Run mattermost-search MCP over shared HTTP and fix FTS hangs.
Avoid per-agent stdio contention on the sqlite index, sort FTS by rank with created tie-break, and add mm_search_tag for dated #plan/#report substring search. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -12,8 +12,8 @@ description: |
|
||||
# Mattermost Search (MCP)
|
||||
|
||||
Search local Mattermost JSON exports produced by `mattermost-dl.py`. **Always use MCP
|
||||
tools** (`mm_search`, `mm_resolve_user`, `mm_search_users`, `mm_user_directory_refresh`,
|
||||
`mm_search_index_status`) as the default path.
|
||||
tools** (`mm_search`, `mm_search_tag`, `mm_resolve_user`, `mm_search_users`,
|
||||
`mm_user_directory_refresh`, `mm_search_index_status`) as the default path.
|
||||
|
||||
## Mandatory rules
|
||||
|
||||
@@ -45,13 +45,22 @@ My username: `sergey.marinkevich`. Resolve others via `mm_resolve_user(ref="Ци
|
||||
- SQLite index `mattermost_index.sqlite` (or `MM_SEARCH_DB`) for fast search and
|
||||
**required** for attachment search. Build/update: `python mm_index.py`.
|
||||
|
||||
Server env (set in `mcp.json` `cwd` / `env`):
|
||||
Prefer **one shared HTTP instance** (not stdio per agent). User systemd unit:
|
||||
`mm-search-mcp.service` → `http://127.0.0.1:8766/mcp`. In `~/.cursor/mcp.json`:
|
||||
|
||||
```json
|
||||
"mattermost-search": { "url": "http://127.0.0.1:8766/mcp" }
|
||||
```
|
||||
|
||||
Server env (HTTP service / stdio `env`):
|
||||
|
||||
| Variable | Default |
|
||||
|---|---|
|
||||
| `MM_SEARCH_ROOT` | `results` |
|
||||
| `MM_SEARCH_DB` | `mattermost_index.sqlite` |
|
||||
| `MM_CONFIG_PATH` | `config.json` (for `mm_user_directory_refresh(from_api=true)`) |
|
||||
| `MM_MCP_TRANSPORT` | `stdio` (`http` for shared server) |
|
||||
| `MM_MCP_HOST` / `MM_MCP_PORT` | `127.0.0.1` / `8766` |
|
||||
|
||||
## Quick start
|
||||
|
||||
@@ -65,6 +74,7 @@ Server env (set in `mcp.json` `cwd` / `env`):
|
||||
| Need | Tool |
|
||||
|---|---|
|
||||
| Search messages / attachments | `mm_search(query, …)` |
|
||||
| `#plan` / `#report` in a date range | `mm_search_tag(keyword, after, before, …)` |
|
||||
| Resolve display name → username | `mm_resolve_user(ref)` |
|
||||
| Search users by name | `mm_search_users(query)` |
|
||||
| Refresh user directory | `mm_user_directory_refresh(from_api=true)` |
|
||||
@@ -82,6 +92,7 @@ usernames from indexed posts.
|
||||
| Attachment filename | `file_name` | Index **required**; no `regex` |
|
||||
| Text inside attachment | `file_content` | Index **required**; UTF-8 text files only |
|
||||
| Regex in message | `message` + `regex=true` | **User permission required** — scans JSON, skips index |
|
||||
| Tag `#plan` / `#report` by date | use `mm_search_tag` | Required `after`/`before`; substring `#keyword`; newest first |
|
||||
|
||||
## mm_search parameters
|
||||
|
||||
|
||||
Reference in New Issue
Block a user