add user index
This commit is contained in:
@@ -12,11 +12,8 @@ description: |
|
||||
# Mattermost Search (MCP)
|
||||
|
||||
Search local Mattermost JSON exports produced by `mattermost-dl.py`. **Always use MCP
|
||||
tools** (`mm_search`, `mm_search_index_status`) as the default path.
|
||||
|
||||
**Ежедневные планы и отчёты (#plan / #report):** [everyday.md](everyday.md)
|
||||
|
||||
Username: `sergey.marinkevich`
|
||||
tools** (`mm_search`, `mm_resolve_user`, `mm_search_users`, `mm_user_directory_refresh`,
|
||||
`mm_search_index_status`) as the default path.
|
||||
|
||||
## Mandatory rules
|
||||
|
||||
@@ -24,6 +21,11 @@ Username: `sergey.marinkevich`
|
||||
|
||||
Не делать самостоятельно, пока пользователь явно не попросил:
|
||||
|
||||
Всё про ежедневные планы или отчёты смотри: [everyday.md](everyday.md). Там и формат описан, и каналы.
|
||||
|
||||
My username: `sergey.marinkevich`. Resolve others via `mm_resolve_user(ref="Цисык")` →
|
||||
`vladislav.tsisyk` (needs user directory — see below).
|
||||
|
||||
| Обход | Примеры |
|
||||
|---|---|
|
||||
| Индекс | `no_index=true`, `regex=true` (сканирует JSON), прямое чтение/grep по `results/` |
|
||||
@@ -49,10 +51,11 @@ Server env (set in `mcp.json` `cwd` / `env`):
|
||||
|---|---|
|
||||
| `MM_SEARCH_ROOT` | `results` |
|
||||
| `MM_SEARCH_DB` | `mattermost_index.sqlite` |
|
||||
| `MM_CONFIG_PATH` | `config.json` (for `mm_user_directory_refresh(from_api=true)`) |
|
||||
|
||||
## Quick start
|
||||
|
||||
1. `mm_search_index_status()` — confirm `db_exists`, `root_exists`, `json_files`.
|
||||
1. `mm_search_index_status()` without paramters — confirm `db_exists`, `root_exists`, `json_files`.
|
||||
2. Pick **search_mode** (see table below).
|
||||
3. `mm_search(query=…, …)` with filters; keep `limit` small (10–50) unless the user needs all hits.
|
||||
4. Read `matches[].post.message`; for attachments also `matches[].attachment`.
|
||||
@@ -62,7 +65,14 @@ Server env (set in `mcp.json` `cwd` / `env`):
|
||||
| Need | Tool |
|
||||
|---|---|
|
||||
| Search messages / attachments | `mm_search(query, …)` |
|
||||
| Check index & export layout | `mm_search_index_status(db?, root?)` |
|
||||
| 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)` |
|
||||
| Check index & export layout | `mm_search_index_status(db, root)` |
|
||||
|
||||
User directory is stored in the sqlite DB (`users` table). Sources: `users.json` in export
|
||||
root (written by `mattermost-dl.py`), Mattermost API (`from_api=true`), and distinct
|
||||
usernames from indexed posts.
|
||||
|
||||
## Choose search_mode
|
||||
|
||||
@@ -136,6 +146,20 @@ mm_search(query="deploy rollback", user="alice", after="2026-01-01", limit=20)
|
||||
mm_search(query="incident", channel="alerts", limit=30)
|
||||
```
|
||||
|
||||
**Resolve user, then search their posts**
|
||||
|
||||
```
|
||||
mm_user_directory_refresh(from_api=true)
|
||||
mm_resolve_user(ref="Цисык")
|
||||
mm_search(query="#report", user="vladislav.tsisyk", channel="System/HW", limit=30)
|
||||
```
|
||||
|
||||
**Check somebody report** (when username is known)
|
||||
|
||||
```
|
||||
mm_search(query="#report", user="ivan.pavlov", channel="System/HW", limit=30)
|
||||
```
|
||||
|
||||
**Find attachment by name**
|
||||
|
||||
```
|
||||
@@ -158,7 +182,10 @@ mm_search(query="standup", output="human", show_file=true, limit=15)
|
||||
|
||||
- `file_name` / `file_content` + `regex=true` → error.
|
||||
- Attachment search without index → error; run `mm_index.py` first.
|
||||
- `channel` / `user` / `team` are **exact** matches, not substring.
|
||||
- `channel` / `user` / `team` are **exact** matches, not substring — resolve display names
|
||||
with `mm_resolve_user` first.
|
||||
- User directory empty → run `mm_user_directory_refresh(from_api=true)` or re-export with
|
||||
`mattermost-dl.py` (writes `users.json`).
|
||||
- Token budget: prefer `limit`, narrow `after`/`before`, then widen if empty.
|
||||
- If `count=0` with index: broaden `query`, drop filters, suggest `mm_index.py` — **не**
|
||||
переключаться на `no_index` / `regex` / CLI без явного разрешения.
|
||||
|
||||
Reference in New Issue
Block a user