@yugabytedb/meko-mcp 1.0.8 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +242 -44
- package/assets/hooks-handlers/before-submit-prompt.sh +44 -0
- package/assets/hooks-handlers/cursor-session-start.sh +42 -0
- package/assets/hooks-handlers/lib/capture.js +457 -107
- package/assets/hooks-handlers/lib/package.json +1 -0
- package/assets/hooks-handlers/test_single_conversation.sh +1 -1
- package/assets/scripts/package-desktop-skill.sh +36 -0
- package/assets/skills/meko-mcp-tools/SKILL.md +167 -53
- package/assets/skills/meko-mcp-tools/references/_sections.md +1 -1
- package/assets/skills/meko-mcp-tools/references/tools-agent-id-conventions.md +84 -22
- package/assets/skills/meko-mcp-tools/references/tools-cookbook.md +89 -56
- package/assets/skills/meko-mcp-tools/references/tools-datapack-workflow.md +15 -7
- package/assets/skills/meko-mcp-tools/references/tools-known-limitations.md +17 -9
- package/assets/skills/meko-mcp-tools/references/tools-memory-vs-conversation.md +94 -5
- package/assets/skills/meko-mcp-tools/references/tools-overview.md +52 -37
- package/assets/skills/meko-mcp-tools/references/tools-rag-workflow.md +108 -37
- package/assets/skills/meko-mcp-tools/references/tools-scope-permissions.md +6 -10
- package/assets/skills/meko-mcp-tools/references/tools-troubleshooting.md +30 -18
- package/assets/skills/meko-mcp-tools/references/tools-user-id-conventions.md +55 -69
- package/assets/skills/meko-mcp-tools-desktop/SKILL.md +251 -0
- package/assets/skills/meko-mcp-tools-desktop/desktop/README.md +150 -0
- package/assets/skills/meko-mcp-tools-desktop/references/_sections.md +24 -0
- package/assets/skills/meko-mcp-tools-desktop/references/tools-agent-id-conventions.md +99 -0
- package/assets/skills/meko-mcp-tools-desktop/references/tools-cookbook.md +406 -0
- package/assets/skills/meko-mcp-tools-desktop/references/tools-known-limitations.md +69 -0
- package/assets/skills/meko-mcp-tools-desktop/references/tools-memory-vs-conversation.md +217 -0
- package/assets/skills/meko-mcp-tools-desktop/references/tools-overview.md +112 -0
- package/assets/skills/meko-mcp-tools-desktop/references/tools-rag-workflow.md +134 -0
- package/assets/skills/meko-mcp-tools-desktop/references/tools-scope-permissions.md +75 -0
- package/assets/skills/meko-mcp-tools-desktop/references/tools-troubleshooting.md +155 -0
- package/bin/create-meko-setup.mjs +151 -22
- package/lib/clients/claude-code.mjs +378 -68
- package/lib/clients/claude-desktop.mjs +45 -8
- package/lib/clients/codex.mjs +1209 -0
- package/lib/clients/common.mjs +223 -1
- package/lib/clients/cursor.mjs +118 -13
- package/lib/clients/index.mjs +2 -0
- package/lib/config.mjs +56 -0
- package/lib/detect.mjs +52 -44
- package/lib/installer.mjs +11 -4
- package/lib/mcp-transport.mjs +61 -2
- package/lib/migrate/adapters/memory-md.mjs +13 -6
- package/lib/migrate/datapack.mjs +167 -0
- package/lib/migrate/id.mjs +127 -9
- package/lib/migrate/orchestrator.mjs +68 -10
- package/lib/migrate.mjs +346 -3
- package/lib/prompt.mjs +22 -4
- package/lib/validate.mjs +313 -9
- package/lib/version-check.mjs +178 -0
- package/package.json +2 -1
- package/scripts/bundle-assets.mjs +8 -0
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
# Complete Tool Catalog and Decision Tree
|
|
2
2
|
|
|
3
|
+
**26 tools on cloud Meko** (verified against `https://mcp.mekodata.ai/mcp` on 2026-05-07). Earlier counts of 25 or 31 in other docs are stale. Grouped: Memory (8), Conversation (6), Knowledge Base (4), Datapack (5), Database (3).
|
|
4
|
+
|
|
5
|
+
## Cloud Free-Tier gating at a glance
|
|
6
|
+
|
|
7
|
+
Some tools return `{"error": "not_available", "detail": "..."}` on cloud Free Tier. This is a server-side tier block — don't retry.
|
|
8
|
+
|
|
9
|
+
- **Gated on Free Tier**: `db_summarize_database`, `db_run_read_only_query`, `db_run_write_query`, `knowledgebase_trigger_index_creation`, `knowledgebase_add_source_to_index`, `knowledgebase_check_index_status`
|
|
10
|
+
- **Works on Free Tier**: all memory tools, all conversation tools, `knowledgebase_search`, all datapack tools, `flush_pending_memory_candidates`
|
|
11
|
+
|
|
3
12
|
## Quick health check before using tools
|
|
4
13
|
|
|
5
14
|
Before starting a session, verify that the Meko MCP tools are working:
|
|
6
15
|
|
|
7
|
-
1. `
|
|
8
|
-
2. `
|
|
9
|
-
3. `
|
|
10
|
-
|
|
11
|
-
If memory tools fail but DB tools work, you can read memory data directly:
|
|
12
|
-
```
|
|
13
|
-
db_run_read_only_query(scope="read", query="SELECT id, payload FROM default_mem0_collection LIMIT 20")
|
|
14
|
-
```
|
|
16
|
+
1. `memory_search(scope="read", query="test", agent_id="<your-session-agent-id>", conversation_id="<session-conversation-id>")` — Confirms memory subsystem is up. Use the `agent_id` and `conversation_id` from the SessionStart `additionalContext`. May fail with "connection already closed" — see `tools-troubleshooting.md`.
|
|
17
|
+
2. `datapack_list(scope="read")` — Confirms Meko API connectivity
|
|
18
|
+
3. `db_summarize_database(scope="read")` — *Optional, paid-tier only.* On free-tier datapacks this returns `{"error": "not_available"}`. The old "use this for `agent_id` discovery" protocol is retired — use the session-injected `agent_id` for project-scoped calls, or `meko_agent` for the common bucket.
|
|
15
19
|
|
|
16
20
|
## Decision tree: which tool do I need?
|
|
17
21
|
|
|
@@ -21,21 +25,22 @@ User wants to...
|
|
|
21
25
|
│ ├── See what tables exist? ---------> db_summarize_database (read)
|
|
22
26
|
│ ├── Run a SELECT / read query? -----> db_run_read_only_query (read)
|
|
23
27
|
│ └── INSERT / UPDATE / DELETE? -------> db_run_write_query (write)
|
|
24
|
-
├──
|
|
25
|
-
│ ├──
|
|
26
|
-
│ ├──
|
|
27
|
-
│
|
|
28
|
+
├── Query or build a knowledge base (RAG)?
|
|
29
|
+
│ ├── Search chunks in an existing KB? -> knowledgebase_search (read) — WORKS on cloud today
|
|
30
|
+
│ ├── Create a new index from sources? -> knowledgebase_trigger_index_creation (write) — Free-Tier gated, self-hosted only
|
|
31
|
+
│ ├── Add source to existing index? ---> knowledgebase_add_source_to_index (write) — Free-Tier gated
|
|
32
|
+
│ └── Check build progress? -----------> knowledgebase_check_index_status (read) — Free-Tier gated
|
|
28
33
|
├── Store or recall information?
|
|
29
34
|
│ ├── Store a fact/preference/entity? -----------> memory_add (write)
|
|
30
35
|
│ ├── Store a full conversation (multi-turn)? ---> conversation_create + conversation_add_message (write)
|
|
31
36
|
│ ├── Search past knowledge? --------------------> memory_search (read)
|
|
32
37
|
│ └── Retrieve a past conversation? -------------> conversation_get (read)
|
|
33
38
|
└── Manage datapacks?
|
|
34
|
-
|
|
35
|
-
├── Manage agents? -> datapack_create_agent/list_agents/delete_agent
|
|
36
|
-
└── Manage KB sources? -> datapack_add_knowledge_base/list/delete_knowledge_base
|
|
39
|
+
└── CRUD datapack? -> datapack_create/list/describe/update/delete
|
|
37
40
|
```
|
|
38
41
|
|
|
42
|
+
Agent / knowledge-base lifecycle is managed **outside** the MCP surface — typically in the Meko control-plane UI — and is not exposed as tools here.
|
|
43
|
+
|
|
39
44
|
## Database Tools (3)
|
|
40
45
|
|
|
41
46
|
| Tool | Scope | Purpose |
|
|
@@ -44,39 +49,40 @@ User wants to...
|
|
|
44
49
|
| `db_run_read_only_query(scope, query, datapack_id=None)` | read | Run SELECT, returns JSON. Uses `BEGIN READ ONLY` + `ROLLBACK` |
|
|
45
50
|
| `db_run_write_query(scope, query, datapack_id=None)` | write | Execute INSERT/UPDATE/DELETE/CREATE TABLE. Guardrail-validated. Auto-committed |
|
|
46
51
|
|
|
47
|
-
## RAG / Knowledge Base Tools (
|
|
52
|
+
## RAG / Knowledge Base Tools (4)
|
|
48
53
|
|
|
49
54
|
| Tool | Scope | Purpose |
|
|
50
55
|
|------|-------|---------|
|
|
51
|
-
| `
|
|
52
|
-
| `
|
|
53
|
-
| `
|
|
56
|
+
| `knowledgebase_search(scope, query, agent_id, conversation_id, datapack_id, limit=10)` | read | Semantic search across KB chunks. `datapack_id` is REQUIRED (no default). Works on cloud today. |
|
|
57
|
+
| `knowledgebase_trigger_index_creation(scope, conversation_id, source_uris, index_name, ai_provider="OPENAI", embedding_model="text-embedding-3-large", embedding_dimensions=1536, chunk_size=1024, chunk_overlap=256, datapack_id=None)` | write | Register sources + init vector index + trigger build. **S3-only worker + no user creds; Free-Tier gated on cloud.** See `tools-rag-workflow.md`. |
|
|
58
|
+
| `knowledgebase_add_source_to_index(scope, conversation_id, index_name, source_uri, chunk_size=1024, chunk_overlap=256, datapack_id=None)` | write | Add a new source (URI, not id) to an existing index. Free-Tier gated on cloud. |
|
|
59
|
+
| `knowledgebase_check_index_status(scope, conversation_id, index_name, datapack_id=None)` | read | Check build progress via `dist_rag.vector_index_pipeline_details`. Free-Tier gated on cloud. |
|
|
54
60
|
|
|
55
|
-
## Memory Tools (
|
|
61
|
+
## Memory Tools (8)
|
|
56
62
|
|
|
57
63
|
| Tool | Scope | Purpose |
|
|
58
64
|
|------|-------|---------|
|
|
59
|
-
| `memory_add(scope, text, agent_id, user_id=None, app_id=None, run_id=None, metadata=None, messages=None, datapack_id=None)` | write | Store fact/preference/entity as long-term memory |
|
|
60
|
-
| `memory_search(scope, query, agent_id, user_id=None, limit=10, datapack_id=None)` | read | Semantic search across memories + graph relations |
|
|
61
|
-
| `memory_get_by_id(scope, memory_id, agent_id, datapack_id=None)` | read |
|
|
62
|
-
| `memory_get_all(scope, agent_id, user_id=None, app_id=None, run_id=None, datapack_id=None)` | read | List all memories for agent |
|
|
63
|
-
| `memory_update(scope, memory_id, text, agent_id, datapack_id=None)` | write | Overwrite memory text |
|
|
64
|
-
| `memory_delete_by_id(scope, memory_id, agent_id, datapack_id=None)` | write | Delete a single memory |
|
|
65
|
-
| `memory_delete_all(scope, agent_id, user_id=None, app_id=None, run_id=None, datapack_id=None)` | admin | Delete all memories for agent (destructive) |
|
|
65
|
+
| `memory_add(scope, text, agent_id, conversation_id, user_id=None, app_id=None, run_id=None, metadata=None, messages=None, datapack_id=None)` | write | Store fact/preference/entity as long-term memory |
|
|
66
|
+
| `memory_search(scope, query, agent_id, conversation_id="", user_id=None, limit=10, datapack_id=None)` | read | Semantic search across memories + graph relations. `conversation_id` optional (omit or pass `""` for cross-conversation discovery). |
|
|
67
|
+
| `memory_get_by_id(scope, memory_id, agent_id, conversation_id, datapack_id=None)` | read | Direct pgvector row lookup by UUID. Preferred over `memory_search` for exact-id verification. |
|
|
68
|
+
| `memory_get_all(scope, agent_id, conversation_id, user_id=None, app_id=None, run_id=None, datapack_id=None)` | read | List all memories for agent |
|
|
69
|
+
| `memory_update(scope, memory_id, text, agent_id, conversation_id, datapack_id=None)` | write | Overwrite memory text |
|
|
70
|
+
| `memory_delete_by_id(scope, memory_id, agent_id, conversation_id, datapack_id=None)` | write | Delete a single memory |
|
|
71
|
+
| `memory_delete_all(scope, agent_id, conversation_id, user_id=None, app_id=None, run_id=None, datapack_id=None)` | admin | Delete all memories for agent (destructive) |
|
|
72
|
+
| `flush_pending_memory_candidates(scope, agent_id)` | read | Desktop-skill helper: returns an instruction payload telling the agent to scan recent user turns and `memory_add` unsaved facts. No server-side DB write. |
|
|
66
73
|
|
|
67
|
-
## Conversation Tools (
|
|
74
|
+
## Conversation Tools (6)
|
|
68
75
|
|
|
69
76
|
| Tool | Scope | Purpose |
|
|
70
77
|
|------|-------|---------|
|
|
71
78
|
| `conversation_create(scope, agent_id, user_id=None, app_id=None, run_id=None, title=None, metadata=None, session_id="")` | write | Create conversation container (Langfuse session) |
|
|
72
79
|
| `conversation_add_message(scope, conversation_id, agent_id, input, output=None, reasoning=None, metadata=None, seed=None, trace_id="")` | write | Add a message turn (Langfuse trace) |
|
|
73
80
|
| `conversation_get(scope, conversation_id, agent_id, include_messages=False, limit=100, offset=0)` | read | Retrieve conversation, optionally with messages |
|
|
74
|
-
| `conversation_list(scope, agent_id, user_id=None, limit=20, offset=0)` | read | List conversations for agent |
|
|
81
|
+
| `conversation_list(scope, agent_id, conversation_id="", user_id=None, limit=20, offset=0)` | read | List conversations for agent. `conversation_id` optional (omit for browse). |
|
|
75
82
|
| `conversation_update(scope, conversation_id, agent_id, title=None, metadata=None)` | write | Update title or metadata |
|
|
76
|
-
| `conversation_delete_message(scope, conversation_id, agent_id, trace_id)` | write | Delete a single message |
|
|
77
83
|
| `conversation_delete(scope, conversation_id, agent_id)` | admin | Delete entire conversation (destructive) |
|
|
78
84
|
|
|
79
|
-
## Datapack Management Tools (
|
|
85
|
+
## Datapack Management Tools (5)
|
|
80
86
|
|
|
81
87
|
| Tool | Scope | Purpose |
|
|
82
88
|
|------|-------|---------|
|
|
@@ -85,12 +91,21 @@ User wants to...
|
|
|
85
91
|
| `datapack_describe(scope, name, include_status=False)` | read | Describe datapack |
|
|
86
92
|
| `datapack_update(scope, name, connection_string)` | write | Update connection string |
|
|
87
93
|
| `datapack_delete(scope, name)` | admin | Delete datapack (irreversible) |
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
|
94
|
+
|
|
95
|
+
## Platform capabilities NOT exposed via MCP
|
|
96
|
+
|
|
97
|
+
Some things the Meko platform can do are not wired into the MCP tool surface today. If a user asks about them, do not invent MCP tool calls — point them at the appropriate control plane instead. Agents attempting these as MCP tools will hit "tool not found".
|
|
98
|
+
|
|
99
|
+
| Capability | Where it lives | How to reach it |
|
|
100
|
+
|---|---|---|
|
|
101
|
+
| Create / list / delete **agents** within a datapack | `yugabyte/meko` API server | REST: `POST/GET/DELETE /datapacks/:name/agents` (`POST/GET/DELETE /agents/:agent` for targeted deletes), or the Meko control-plane UI |
|
|
102
|
+
| Add / list / delete **knowledge-base sources** on a datapack | `yugabyte/meko` API server | REST: `POST/GET/DELETE /datapacks/:name/knowledge-bases`, plus `upload-url`, `upload-complete`, `create`, `status` subroutes. Also available in the Meko UI. |
|
|
103
|
+
| Langfuse project-key generation | `yugabyte/meko` API server | REST: `POST /datapacks/:name/langfuse/project-keys` |
|
|
104
|
+
| Account / billing / tier management | Meko UI only | Not available via MCP or public REST |
|
|
105
|
+
|
|
106
|
+
The MCP-exposed `datapack_create` / `datapack_list` / `datapack_describe` / `datapack_update` / `datapack_delete` tools above are a deliberate subset — the common CRUD that an agent reasonably needs mid-conversation. Anything involving agent or KB lifecycle is control-plane territory.
|
|
107
|
+
|
|
108
|
+
For knowledge-base content on cloud today, the canonical path is **UI upload**: Datapack → Actions → **Add Knowledge** (PDF/TXT/MD/JSON/MP4, 5MB each, 10/batch). `knowledgebase_search` queries the resulting index from MCP. The MCP ingestion tools (`knowledgebase_trigger_index_creation`, `knowledgebase_add_source_to_index`, `knowledgebase_check_index_status`) exist but are Free-Tier gated and rely on an S3-only worker with no user-supplied credentials — see `tools-rag-workflow.md` for the full picture. Tracked upstream as [#89](https://github.com/yugabyte/meko-mcp-server/issues/89) / MEKO-96.
|
|
94
109
|
|
|
95
110
|
## Common Parameter Patterns
|
|
96
111
|
|
|
@@ -1,63 +1,134 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Knowledge Base / RAG workflow
|
|
2
2
|
|
|
3
|
-
**
|
|
3
|
+
As of 2026-05-07, **knowledge-base ingestion on cloud Meko is a UI-only activity**. The MCP ingestion tools exist but are gated off on cloud and rely on an S3-only worker that has no mechanism to read user-supplied buckets. `knowledgebase_search` is the only KB tool agents can rely on today.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
This page tells you which tool to reach for, what's usable where, and where the current gaps are tracked.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
## Decision table
|
|
8
|
+
|
|
9
|
+
| Situation | Use this | Why |
|
|
10
|
+
|---|---|---|
|
|
11
|
+
| Search an existing KB | `knowledgebase_search` | The one KB tool that works on cloud Free Tier and prod today |
|
|
12
|
+
| Add documents to a KB on cloud | **Meko UI** — Datapack → Actions menu → **Add Knowledge** | File-upload dialog (PDF/TXT/MD/JSON/MP4, 5MB each, 10/batch). The MCP ingestion path is not usable on cloud |
|
|
13
|
+
| Create a new vector index (self-hosted / paid) | `knowledgebase_trigger_index_creation` | Only works when the ingestion worker has IAM access to the S3 bucket you pass |
|
|
14
|
+
| Add a source to an existing index (self-hosted / paid) | `knowledgebase_add_source_to_index` | Same caveat as above |
|
|
15
|
+
| Poll a build (self-hosted / paid) | `knowledgebase_check_index_status` | Gated on cloud Free Tier |
|
|
16
|
+
| Anything that needs KB lifecycle management (list, delete, rename) | **UI** | No MCP tools for KB lifecycle |
|
|
17
|
+
|
|
18
|
+
## knowledgebase_search — the one you'll actually call
|
|
8
19
|
|
|
9
20
|
```
|
|
10
|
-
|
|
11
|
-
scope="
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
21
|
+
knowledgebase_search(
|
|
22
|
+
scope="read",
|
|
23
|
+
query="natural-language question",
|
|
24
|
+
agent_id="<your agent_id>",
|
|
25
|
+
conversation_id="<uuid from conversation_create>",
|
|
26
|
+
datapack_id="<datapack UUID — REQUIRED on this tool>",
|
|
27
|
+
limit=10)
|
|
16
28
|
```
|
|
17
29
|
|
|
18
|
-
|
|
30
|
+
Required: `scope`, `query`, `agent_id`, `conversation_id`, `datapack_id`. Unlike the memory tools, `datapack_id` has no default here — you must pass it explicitly. `agent_id` is **ignored for filtering** on this tool (KB results are team-shared on the datapack), but you still pass it — your session's value is fine.
|
|
19
31
|
|
|
32
|
+
Response shape (verified 2026-05-07 against prod):
|
|
20
33
|
```
|
|
21
|
-
|
|
34
|
+
{"results": [], "count": 0}
|
|
22
35
|
```
|
|
23
36
|
|
|
24
|
-
|
|
37
|
+
On a populated KB each result carries chunk content and similarity scores. On an empty or nonexistent KB you get an empty array and `count: 0` — not an error.
|
|
25
38
|
|
|
26
|
-
##
|
|
39
|
+
## MCP ingestion tools — what actually happens when you call them
|
|
27
40
|
|
|
28
|
-
|
|
41
|
+
This applies to `knowledgebase_trigger_index_creation` and `knowledgebase_add_source_to_index`. Understanding the two-layer architecture is the only way to predict whether a call will succeed.
|
|
29
42
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
43
|
+
**MCP layer (`src/tools.py`):** takes `source_uris`, splits on `,`, passes each string to `dist_rag.create_source(<uri>)` with **zero validation**. No scheme check, no reachability probe. Returns `"build_triggered"` immediately.
|
|
44
|
+
|
|
45
|
+
**Worker layer (`yugabyte-db/python/ai/rag_agent/rag_pipeline/aws_source_processor.py`):** only handles `s3://` URIs. Any other scheme raises `ValueError("Invalid source URI")` inside the worker — **async, never surfaced to the MCP caller**. The S3 crawler is instantiated with no credentials; it relies on boto3's default chain (env vars, IAM role, `~/.aws/credentials` on the worker host). So the worker can only read buckets its own AWS identity has access to.
|
|
46
|
+
|
|
47
|
+
**Implication:** pointing the MCP tool at a user-owned S3 bucket from cloud will return `"build_triggered"` and silently stall at INIT forever. There is no way for the user to supply AWS credentials through the MCP tool.
|
|
48
|
+
|
|
49
|
+
## Free-Tier cloud gating (verified 2026-05-07 against `https://mcp.mekodata.ai/mcp`)
|
|
50
|
+
|
|
51
|
+
| Tool | Verbatim response |
|
|
52
|
+
|---|---|
|
|
53
|
+
| `knowledgebase_trigger_index_creation` | `{"error": "not_available", "detail": "Vector index creation is not available on the free tier."}` |
|
|
54
|
+
| `knowledgebase_add_source_to_index` | Same as above |
|
|
55
|
+
| `knowledgebase_check_index_status` | `{"error": "not_available", "detail": "Index status check is not available on the free tier."}` |
|
|
56
|
+
| `knowledgebase_search` | Works: `{"results": [], "count": 0}` |
|
|
57
|
+
|
|
58
|
+
`{"error": "not_available"}` is a server-side tier block. Don't retry.
|
|
59
|
+
|
|
60
|
+
## UI ingestion (cloud Meko) — what the user sees
|
|
61
|
+
|
|
62
|
+
From `cloud.mekodata.ai`:
|
|
63
|
+
|
|
64
|
+
1. Open a datapack (`/datapacks/<name>`).
|
|
65
|
+
2. Click **Actions** → **Add Knowledge**.
|
|
66
|
+
3. Drag-and-drop or browse for files. Supported: PDF, TXT, MD, JSON, MP4. Per-file limit 5 MB. Up to 10 files per batch.
|
|
67
|
+
4. The UI handles upload, storage, and index build. The user does not pick a bucket or provide credentials.
|
|
68
|
+
5. Search results from `knowledgebase_search` become available once indexing completes.
|
|
33
69
|
|
|
34
|
-
|
|
70
|
+
If a user asks you "how do I add a document to my knowledge base?", point them at this flow. Do not suggest `knowledgebase_trigger_index_creation` with an S3 URI — on cloud that path does not work.
|
|
35
71
|
|
|
36
|
-
|
|
37
|
-
|-----------|------|
|
|
38
|
-
| First time creating a RAG index | `knowledgebase_trigger_index_creation` |
|
|
39
|
-
| Adding a source to an existing index | `knowledgebase_add_source_to_index` |
|
|
40
|
-
| Checking if build is complete | `knowledgebase_check_index_status` |
|
|
72
|
+
## Tracked gaps
|
|
41
73
|
|
|
42
|
-
|
|
74
|
+
- **Upstream GitHub**: [yugabyte/meko-mcp-server#89](https://github.com/yugabyte/meko-mcp-server/issues/89) — disable or gate KB ingestion tools on cloud until the S3 path works end-to-end; return a clearer error than "not_available"; validate schemes at MCP-call time.
|
|
75
|
+
- **Upstream Jira**: MEKO-96 (same issue, cross-linked).
|
|
43
76
|
|
|
44
|
-
|
|
77
|
+
When either lands, the free-tier-gate responses above will change and this page should be revisited.
|
|
45
78
|
|
|
46
|
-
|
|
79
|
+
## Response-shape reference (for agents that need to parse)
|
|
80
|
+
|
|
81
|
+
### knowledgebase_search
|
|
82
|
+
|
|
83
|
+
Populated KB:
|
|
84
|
+
```
|
|
85
|
+
{
|
|
86
|
+
"results": [
|
|
87
|
+
{
|
|
88
|
+
"content": "<chunk text>",
|
|
89
|
+
"similarity": 0.87,
|
|
90
|
+
"source_uri": "<original source URI>",
|
|
91
|
+
"document_name": "<file key>",
|
|
92
|
+
...
|
|
93
|
+
},
|
|
94
|
+
...
|
|
95
|
+
],
|
|
96
|
+
"count": <int>
|
|
97
|
+
}
|
|
47
98
|
```
|
|
48
|
-
|
|
49
|
-
|
|
99
|
+
|
|
100
|
+
Empty or nonexistent KB: `{"results": [], "count": 0}` (no error).
|
|
101
|
+
|
|
102
|
+
### knowledgebase_trigger_index_creation (when not gated)
|
|
103
|
+
|
|
104
|
+
Success shape:
|
|
50
105
|
```
|
|
106
|
+
{
|
|
107
|
+
"source_ids": ["<uuid>", ...],
|
|
108
|
+
"index_id": "<uuid>",
|
|
109
|
+
"index_name": "<name>",
|
|
110
|
+
"status": "build_triggered",
|
|
111
|
+
"message": "N source(s) registered, index '...' initialised, and build triggered."
|
|
112
|
+
}
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Do NOT retry this on failure. Each call creates a new index.
|
|
116
|
+
|
|
117
|
+
### knowledgebase_add_source_to_index (when not gated)
|
|
118
|
+
|
|
119
|
+
The historical `r_index_name` vs `r_index_id` parameter-mismatch bug is fixed on main (`src/tools.py` resolves `index_name → index_id` via `SELECT id FROM dist_rag.vector_indexes WHERE index_name = %s` before calling the dist_rag function). If `index_name` doesn't exist you get `{"error": "index_not_found", "detail": "No vector index found with name '...'"}`.
|
|
120
|
+
|
|
121
|
+
Param is `source_uri` (URI string like `s3://bucket/path/`), **not** `source_id` as older docs may claim.
|
|
51
122
|
|
|
52
|
-
|
|
123
|
+
### knowledgebase_check_index_status (when not gated)
|
|
53
124
|
|
|
54
|
-
|
|
125
|
+
Returns `pipeline_details` (per-document status) and `pipeline_stats` (aggregated). Check `completion_rate_percent` in `pipeline_stats` and `document_status` in `pipeline_details`.
|
|
55
126
|
|
|
56
|
-
-
|
|
57
|
-
- There is **no MCP tool to query** a built index — use `db_run_read_only_query` with `dist_rag` SQL functions directly.
|
|
58
|
-
- `knowledgebase_add_source_to_index` has a **known parameter mismatch bug**. Prefer `knowledgebase_trigger_index_creation` with all sources at once.
|
|
59
|
-
- Each `knowledgebase_trigger_index_creation` call creates a new index. **Do not retry on failure** — you'll create duplicates.
|
|
127
|
+
Stuck at INIT for >5 minutes under self-hosted usually means the worker couldn't reach the bucket — check AWS credentials on the worker host, not the MCP server.
|
|
60
128
|
|
|
61
|
-
##
|
|
129
|
+
## Prerequisites (self-hosted)
|
|
62
130
|
|
|
63
|
-
|
|
131
|
+
- `dist_rag` PostgreSQL extension enabled on the target YugabyteDB database
|
|
132
|
+
- Ingestion workers running (`yugabyte-db/python/ai/rag_agent/`)
|
|
133
|
+
- AWS credentials on the worker host for any S3 bucket you intend to ingest from
|
|
134
|
+
- `datapack_id` passed on every call when targeting a non-default datapack
|
|
@@ -17,7 +17,7 @@ Higher scopes include lower scopes. An unrecognized scope string always fails.
|
|
|
17
17
|
|
|
18
18
|
## Per-Tool Requirements
|
|
19
19
|
|
|
20
|
-
### read scope (
|
|
20
|
+
### read scope (11 tools)
|
|
21
21
|
|
|
22
22
|
| Tool | Group |
|
|
23
23
|
|------|-------|
|
|
@@ -27,14 +27,13 @@ Higher scopes include lower scopes. An unrecognized scope string always fails.
|
|
|
27
27
|
| `memory_search` | Memory |
|
|
28
28
|
| `memory_get_by_id` | Memory |
|
|
29
29
|
| `memory_get_all` | Memory |
|
|
30
|
+
| `flush_pending_memory_candidates` | Memory |
|
|
30
31
|
| `conversation_get` | Conversation |
|
|
31
32
|
| `conversation_list` | Conversation |
|
|
32
33
|
| `datapack_list` | Datapack |
|
|
33
34
|
| `datapack_describe` | Datapack |
|
|
34
|
-
| `datapack_list_agents` | Datapack |
|
|
35
|
-
| `datapack_list_knowledge_bases` | Datapack |
|
|
36
35
|
|
|
37
|
-
### write scope (
|
|
36
|
+
### write scope (11 tools)
|
|
38
37
|
|
|
39
38
|
| Tool | Group |
|
|
40
39
|
|------|-------|
|
|
@@ -47,21 +46,18 @@ Higher scopes include lower scopes. An unrecognized scope string always fails.
|
|
|
47
46
|
| `conversation_create` | Conversation |
|
|
48
47
|
| `conversation_add_message` | Conversation |
|
|
49
48
|
| `conversation_update` | Conversation |
|
|
50
|
-
| `conversation_delete_message` | Conversation |
|
|
51
49
|
| `datapack_create` | Datapack |
|
|
52
50
|
| `datapack_update` | Datapack |
|
|
53
|
-
| `datapack_create_agent` | Datapack |
|
|
54
|
-
| `datapack_add_knowledge_base` | Datapack |
|
|
55
51
|
|
|
56
|
-
### admin scope (
|
|
52
|
+
### admin scope (3 tools — destructive, irreversible)
|
|
57
53
|
|
|
58
54
|
| Tool | Group |
|
|
59
55
|
|------|-------|
|
|
60
56
|
| `memory_delete_all` | Memory |
|
|
61
57
|
| `conversation_delete` | Conversation |
|
|
62
58
|
| `datapack_delete` | Datapack |
|
|
63
|
-
|
|
64
|
-
|
|
59
|
+
|
|
60
|
+
Agent and knowledge-base lifecycle tools are not MCP-exposed — see "Platform capabilities NOT exposed via MCP" in `tools-overview.md`.
|
|
65
61
|
|
|
66
62
|
## Best Practices
|
|
67
63
|
|
|
@@ -7,7 +7,7 @@ These patterns are extracted from real agent sessions. Follow them to avoid wast
|
|
|
7
7
|
1. **Never retry the identical failed call more than once.** If it fails twice with the same error, it's not transient — diagnose the cause.
|
|
8
8
|
2. **Distinguish transient vs persistent failures.** "Connection already closed" is transient (retry once). "Permission denied" is persistent (stop, don't retry).
|
|
9
9
|
3. **Don't guess parameters sequentially.** If a tool fails with one parameter format, don't try 4 variations. Check this skill's docs for the correct format first.
|
|
10
|
-
4. **
|
|
10
|
+
4. **Use your session's `agent_id` consistently.** Pass the value the SessionStart hook injected (e.g. `claude_code:<repo-basename>` for Claude Code; `claude_desktop` for Claude Desktop) on every write and every personal read. Use `agent_id="meko_agent"` deliberately on `memory_search`/`memory_get_all` only when you want the cross-project common bucket — empty string also resolves to `meko_agent`, not a cross-agent fan-out. Don't switch between forms mid-session.
|
|
11
11
|
|
|
12
12
|
---
|
|
13
13
|
|
|
@@ -19,14 +19,9 @@ These patterns are extracted from real agent sessions. Follow them to avoid wast
|
|
|
19
19
|
|
|
20
20
|
**What to do:**
|
|
21
21
|
|
|
22
|
-
1. Retry the same call **once
|
|
23
|
-
2. If it fails again, the memory subsystem is unhealthy for this session
|
|
24
|
-
3.
|
|
25
|
-
```
|
|
26
|
-
db_run_read_only_query(scope="read",
|
|
27
|
-
query="SELECT id, payload FROM default_mem0_collection LIMIT 20")
|
|
28
|
-
```
|
|
29
|
-
Replace `default` with your `agent_id` prefix if using a custom agent.
|
|
22
|
+
1. Retry the same call **once**.
|
|
23
|
+
2. If it fails again, the memory subsystem is unhealthy for this session — stop trying memory calls and tell the user. Do not waste tokens re-sending the same payload.
|
|
24
|
+
3. Direct-SQL fallback **does not apply** on cloud Free Tier (`db_run_read_only_query` returns `{"error": "not_available", "detail": "Free Tier: DB Tools access is not enabled. coming soon."}`). On self-hosted / paid deployments where DB tools are available, inspect memory rows via the multi-tenant schema — tables are namespaced by datapack, not by agent_id. The old `{agent_id}_mem0_collection` per-agent-table layout is gone.
|
|
30
25
|
|
|
31
26
|
**Anti-pattern from real sessions:** Agent called `memory_add` with 500+ tokens of text, got "connection already closed", retried the identical call 3 more times (each 500+ tokens). Wasted ~2000 tokens on guaranteed failures.
|
|
32
27
|
|
|
@@ -77,12 +72,19 @@ Look for tasks stuck `IN_PROGRESS` with expired leases — these indicate crashe
|
|
|
77
72
|
|
|
78
73
|
## knowledgebase_add_source_to_index failure
|
|
79
74
|
|
|
80
|
-
**Error:**
|
|
75
|
+
**Error shape:** `{"error": "not_available", "detail": "Vector index creation is not available on the free tier."}`
|
|
81
76
|
|
|
82
|
-
**
|
|
77
|
+
You're on cloud Free Tier; the ingestion tools are gated off. There is no retry that will succeed. Point the user at the Meko UI's **Add Knowledge** file-upload flow (Datapack → Actions → Add Knowledge) instead.
|
|
78
|
+
|
|
79
|
+
**Error shape:** `{"error": "index_not_found", "detail": "No vector index found with name '...'"}`
|
|
80
|
+
|
|
81
|
+
The `index_name` doesn't exist in this datapack's `dist_rag.vector_indexes` table. Either you're targeting the wrong datapack (check `datapack_id`), or the index hasn't been created yet — call `knowledgebase_trigger_index_creation` first.
|
|
83
82
|
|
|
84
|
-
|
|
85
|
-
|
|
83
|
+
**Error shape:** tool returns `"build_triggered"` but `knowledgebase_check_index_status` shows documents stuck at `INIT` for >5 minutes.
|
|
84
|
+
|
|
85
|
+
Most common cause on self-hosted deployments: the worker can't reach the S3 bucket. `S3BucketCrawler()` uses boto3's default credential chain — check `AWS_ACCESS_KEY_ID` / `AWS_SECRET_ACCESS_KEY` / IAM role / `~/.aws/credentials` on the worker host, not on the MCP server. Second cause: the URI isn't `s3://`-prefixed (`aws_source_processor.py` rejects other schemes with `ValueError("Invalid source URI")` async).
|
|
86
|
+
|
|
87
|
+
**Historical note:** the old `r_index_name` vs `r_index_id` parameter-mismatch bug is fixed on main — the MCP tool now resolves `index_name → index_id` internally via a `SELECT id FROM dist_rag.vector_indexes WHERE index_name = %s` step. Older docs referencing this bug are stale.
|
|
86
88
|
|
|
87
89
|
---
|
|
88
90
|
|
|
@@ -102,13 +104,23 @@ The only valid scope values are: `"read"`, `"write"`, `"admin"`.
|
|
|
102
104
|
|
|
103
105
|
## agent_id errors
|
|
104
106
|
|
|
105
|
-
|
|
107
|
+
On the Cloud multi-tenant schema, `agent_id` is a TEXT column value — not a PostgreSQL identifier — so arbitrary strings are accepted.
|
|
108
|
+
|
|
109
|
+
`agent_id` is **not a constant**. Cloud Meko supports multiple agents on one datapack, and the Cloud UI renders every `agent_id` as a badge on each row regardless of value. The canonical shape for new writes is `<client>:<repo-basename>` for coding agents (e.g. `claude_code:meko-mcp-server`), a bare client name for non-coding clients (e.g. `claude_desktop`), or `meko_agent` for the cross-project common bucket — see `tools-agent-id-conventions.md`.
|
|
110
|
+
|
|
111
|
+
### "My writes are landing in `meko_agent` instead of my agent's bucket"
|
|
112
|
+
|
|
113
|
+
If you call `memory_add` with empty / None / whitespace `agent_id`, the server does NOT reject the write. It silently resolves the value to `meko_agent` (the cross-project common bucket) and the row lands there. The Cloud UI then shows a `meko_agent` badge instead of your client's badge.
|
|
114
|
+
|
|
115
|
+
Fix: always pass a concrete non-empty `agent_id`. Fetch the value the SessionStart hook injected into `additionalContext` and pass it verbatim. Use `agent_id="meko_agent"` only when you genuinely want a fact in the cross-project pool (user identity, global preferences).
|
|
116
|
+
|
|
117
|
+
### "My reads return fewer results than I expected"
|
|
118
|
+
|
|
119
|
+
`memory_search` and `memory_get_all` filter strictly on your passed `agent_id`. A memory written by `claude-code:<slug-A>` is invisible to a search with `agent_id="cursor:<slug-B>"`. If you need a broader view, call repeatedly across the agent_ids you want to cover, or point the user at the UI's Memory Summary page (which shows every row regardless of agent_id).
|
|
106
120
|
|
|
107
|
-
|
|
121
|
+
### "I'm seeing rows tagged with legacy agent_id values"
|
|
108
122
|
|
|
109
|
-
|
|
110
|
-
- Good: `"claude_code"`, `"support_bot"`, `"agent_001"`
|
|
111
|
-
- Bad: `"claude-code"`, `"my agent"`, `"agent.one"`
|
|
123
|
+
Pre-existing data may be tagged `"agent"`, `"claude_code"`, `"cursor:<slug>"`, or similar ad-hoc values. All remain readable. New writes should follow the canonical `<client>:<project-slug>` form; don't try to retag old rows.
|
|
112
124
|
|
|
113
125
|
---
|
|
114
126
|
|