@yugabytedb/meko-mcp 1.1.0 → 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.
Files changed (26) hide show
  1. package/README.md +68 -19
  2. package/assets/hooks-handlers/before-submit-prompt.sh +44 -0
  3. package/assets/hooks-handlers/cursor-session-start.sh +42 -0
  4. package/assets/hooks-handlers/lib/capture.js +291 -40
  5. package/assets/scripts/package-desktop-skill.sh +36 -0
  6. package/assets/skills/meko-mcp-tools/references/tools-overview.md +1 -1
  7. package/assets/skills/meko-mcp-tools-desktop/SKILL.md +251 -0
  8. package/assets/skills/meko-mcp-tools-desktop/desktop/README.md +150 -0
  9. package/assets/skills/meko-mcp-tools-desktop/references/_sections.md +24 -0
  10. package/assets/skills/meko-mcp-tools-desktop/references/tools-agent-id-conventions.md +99 -0
  11. package/assets/skills/meko-mcp-tools-desktop/references/tools-cookbook.md +406 -0
  12. package/assets/skills/meko-mcp-tools-desktop/references/tools-known-limitations.md +69 -0
  13. package/assets/skills/meko-mcp-tools-desktop/references/tools-memory-vs-conversation.md +217 -0
  14. package/assets/skills/meko-mcp-tools-desktop/references/tools-overview.md +112 -0
  15. package/assets/skills/meko-mcp-tools-desktop/references/tools-rag-workflow.md +134 -0
  16. package/assets/skills/meko-mcp-tools-desktop/references/tools-scope-permissions.md +75 -0
  17. package/assets/skills/meko-mcp-tools-desktop/references/tools-troubleshooting.md +155 -0
  18. package/bin/create-meko-setup.mjs +4 -4
  19. package/lib/clients/claude-desktop.mjs +11 -8
  20. package/lib/clients/codex.mjs +236 -4
  21. package/lib/clients/common.mjs +81 -0
  22. package/lib/clients/cursor.mjs +47 -10
  23. package/lib/config.mjs +26 -0
  24. package/lib/installer.mjs +2 -2
  25. package/package.json +1 -1
  26. package/scripts/bundle-assets.mjs +8 -0
@@ -0,0 +1,251 @@
1
+ ---
2
+ name: meko-mcp-tools-desktop
3
+ description: >-
4
+ Behavioral guide for AI agents using Meko MCP tools on the desktop Claude
5
+ app. Triggers when calling MCP tools, storing memories, persisting
6
+ knowledge, managing datapacks, or working with YugabyteDB databases
7
+ through Meko. Use this skill whenever the user mentions memory, Meko,
8
+ datapacks, YugabyteDB, knowledge base, conversations, or interacts with
9
+ meko MCP tools in any way. Also trigger when the user shares personal
10
+ information, preferences, role details, or organizational conventions
11
+ that should be persisted across sessions.
12
+ license: MIT
13
+ metadata:
14
+ author: Meko
15
+ version: "1.3.0"
16
+ tags: mcp, yugabytedb, tools, datapack, memory, conversation, rag, meko, desktop
17
+ ---
18
+
19
+ # Meko MCP Tools — Agent Behavioral Guide (Desktop)
20
+
21
+ Meko is agent-native data infrastructure that enables continuous learning from context windows through collective memory and shared knowledge. This skill teaches you how to use Meko's 26 MCP tools — and more importantly, **when to use them proactively** without waiting to be asked.
22
+
23
+ ## First turn of every session
24
+
25
+ Claude Desktop has no SessionStart hook. You are responsible for bootstrapping memory yourself.
26
+
27
+ On the first user turn in any session, before answering substantive questions:
28
+
29
+ 1. **Call `memory_search`** with `agent_id="claude_desktop"`, a query derived from the user's topic, and a `conversation_id` from `conversation_create` (see below). Also call it once with `agent_id="meko_agent"` to surface cross-project facts (user identity, global preferences) that any Meko client may have stored.
30
+ 2. Incorporate the recalled facts into your reply. Don't re-ask things you've been told before.
31
+
32
+ You do **not** need the user's permission to do any of this. Silent recall is the correct behavior.
33
+
34
+ ## `agent_id` — multi-agent identity
35
+
36
+ `agent_id` identifies **which agent wrote a memory or conversation**. It is not a constant. Different agents (Claude Code, Cursor, this Claude Desktop client) each use their own `agent_id`, and the Cloud UI renders the value as a badge on every row.
37
+
38
+ **For Claude Desktop, use `agent_id="claude_desktop"` by default.** Desktop has no per-project concept, so a stable client name is the right granularity (it's a "loose" client in contract terms). Coding agents like Claude Code and Cursor use `<client>:<repo-basename>` (e.g. `claude_code:meko-mcp-server`). For genuinely cross-project facts that any agent should see — user identity, global preferences — use the common bucket `agent_id="meko_agent"`.
39
+
40
+ **Read scoping:**
41
+ - `memory_search` / `memory_get_all` / `conversation_list` / `conversation_get` — scoped to `(datapack_id, user_id, agent_id)`, strictly matched. To read across multiple agents (e.g. memories you wrote from Claude Code in different repos), call once per agent_id. Empty/missing `agent_id` is rewritten to `meko_agent` server-side, so it returns the common bucket only — not a fan-out.
42
+ - `knowledgebase_search` — scoped to `datapack_id` only. `agent_id` on the request is ignored. Returns the team's Shared Knowledge — uploaded documents plus memories the user promoted via the UI.
43
+
44
+ Some pre-existing rows use the older constant `agent_id="agent"` or ad-hoc shapes (e.g. `claude-desktop` with a hyphen). They remain readable — query them with the literal value. See `tools-agent-id-conventions.md` for the full model.
45
+
46
+ ## The only acceptable default
47
+
48
+ When the user tells you **anything declarative** about themselves, their team, their tools, their environment, or their preferences — **including casual drops in passing** like "btw I use helix" or "I'm evaluating pnpm" — **call `memory_add` in the same turn** with the right bucket: `agent_id="meko_agent"` for cross-project facts (user identity, global preferences), or `agent_id="claude_desktop"` for desktop-specific context. No "would you like me to remember this?" — just store it and continue. Ask permission only if the information is sensitive (credentials, legal, medical).
49
+
50
+ There is no "substantive enough" threshold. Short casual drops are exactly the memories that matter most over time, because they accumulate into a profile of who the user is and how they work. Treat every declarative statement about the user as a save candidate by default.
51
+
52
+ The failure mode to avoid: listening to the user, answering their question, and moving on without persisting anything. A turn later you have no record that the exchange happened. That is the single most common failure of this skill in practice — do not repeat it. Explicitly override your default "just answer and move on" reflex on open-ended prompts: if the user shared a declarative fact along the way, the save happens first, then the answer.
53
+
54
+ ### Deterministic memory flush (new in v1.2.0)
55
+
56
+ Claude Desktop has no SessionStart / PreCompact / SessionEnd hooks — in practice the save-on-every-declarative rule above still gets missed on open-ended prompts. To compress the failure surface, call the server-side `flush_pending_memory_candidates` tool periodically:
57
+
58
+ 1. **At session start**, call:
59
+ ```
60
+ flush_pending_memory_candidates(scope="read", agent_id="claude_desktop")
61
+ ```
62
+ 2. **After every ~5 assistant turns**, call it again.
63
+ 3. The tool returns a directive telling you to scan recent user turns for unsaved facts and issue `memory_add` calls. **Follow the directive immediately** — that's the whole point. The server dedups on its side, so repeat calls are safe.
64
+
65
+ This turns "remember to save" into "act on the checklist the server just handed you." The tool result is always read by the model, so this is a deterministic floor on memory capture even if the proactive rule misses the signal.
66
+
67
+ ## What Meko enables
68
+
69
+ Meko turns your volatile context window into persistent, shareable knowledge:
70
+
71
+ - **Personal memory** — Store who the user is, their preferences, role, and working style. Survives across sessions. Private to you (scoped per-user and per-agent).
72
+ - **Team-shared knowledge** — Memories the user promotes from the Learnings tab in the Cloud UI become visible to every member of the datapack. Uploaded documents land in the same place. Both are queryable via `knowledgebase_search`.
73
+ - **Conversation history** — Preserve full dialog exchanges with reasoning traces for audit, replay, and learning transfer.
74
+ - **Decision traces** — Capture how and why decisions were made, enabling debugging and continuous improvement.
75
+
76
+ ## When to use this skill
77
+
78
+ - You are calling tools on a Meko MCP server
79
+ - You need to decide what to store, where, and how (personal memory vs. team-shared knowledge)
80
+ - You want to search the team's shared knowledge base (`knowledgebase_search`)
81
+ - You are managing datapacks
82
+ - You want to understand scope/permission requirements, `agent_id` conventions, or `datapack_id` routing
83
+
84
+ ## Critical: Use Meko tools, not local storage
85
+
86
+ **When Meko MCP tools are available, ALWAYS use them instead of local/built-in storage mechanisms.** Do not write to local memory files, markdown notes, or any file-based memory system. Meko's memory is persistent across all agents, sessions, and team members — local files are not.
87
+
88
+ - User shares personal info → call `memory_add` on the MCP server, NOT write to a local file
89
+ - User asks what you know → call `memory_search` on the MCP server, NOT read local files
90
+ - Conversation worth preserving → call `conversation_create`, NOT save to a local log
91
+
92
+ If a Meko tool call fails, you may fall back to local storage and tell the user — but Meko is always the first choice.
93
+
94
+ ## Core principle: Be Meko's persistent brain
95
+
96
+ **Do not wait for the user to say "save this to memory."** Proactively store context that would be valuable in future sessions. Think of Meko as your long-term memory that persists across conversations.
97
+
98
+ Rules of thumb:
99
+
100
+ - **Save-first, not save-later.** If a fact is worth remembering, store it in the same turn it appeared. Do not promise to remember it — actually call `memory_add`.
101
+ - **One `memory_add` per distinct fact.** Don't batch five unrelated facts into a single long text field; Mem0 extracts atomic facts and batching hurts recall.
102
+ - **Call it silently.** Don't interrupt the conversation with "I've saved that to memory." Just save and continue. A short acknowledgment is fine if the user explicitly asked you to remember something.
103
+ - **Never log to local files as a memory substitute.** If `memory_add` fails, retry once; if it still fails, tell the user the call failed rather than writing a markdown note.
104
+
105
+ ### Proactive behavior rules
106
+
107
+ | Signal in conversation | What to do | Tool to use |
108
+ |---|---|---|
109
+ | User shares personal info ("I'm Amiram", "I'm a VP of Product") | Store as personal memory immediately | `memory_add` |
110
+ | User states a preference ("I prefer dark mode", "always use Python") | Store as personal preference | `memory_add` |
111
+ | User shares org convention ("we write in Go", "our standard is X") | Store as organizational memory | `memory_add` |
112
+ | User teaches domain knowledge ("Meko traces are decision traces") | Store as memory AND consider KB ingestion | `memory_add` |
113
+ | User corrects your behavior ("don't do X, do Y instead") | Store the correction as a learning | `memory_add` |
114
+ | User asks "what do you know about X?" | Three-call sweep: desktop memories, then the cross-project common bucket, then team-shared knowledge | `memory_search(agent_id="claude_desktop")` → `memory_search(agent_id="meko_agent")` → `knowledgebase_search(datapack_id=<X>)` |
115
+ | User asks "what do we (as a team) know about X?" or about uploaded documents | Query the team's Shared Knowledge directly | `knowledgebase_search` (returns uploaded docs + promoted memories) |
116
+ | Session produced a valuable multi-turn exchange | Preserve the full conversation | `conversation_create` + `conversation_add_message` |
117
+ | Significant learnings accumulated during session | Offer to persist key takeaways; remind the user they can promote important ones to Shared Knowledge from the Cloud UI | Summarize and propose `memory_add` calls |
118
+ | User provides structured/tabular data (CSV, data dictionary) | Not natively supported via MCP on Cloud today — `db_run_write_query` returns `{"error": "not_available"}`. Store the key facts as a narrative memory, or point the user at the UI's knowledge-base upload for file form | `memory_add` for facts, UI "Add Knowledge" for files |
119
+ | User wants to add documents to the team's knowledge base | Point them at the Cloud UI flow — Datapack → Actions → **Add Knowledge** (PDF/TXT/MD/JSON/MP4, 5MB each, 10/batch). The MCP ingestion tools are not available on Cloud. | UI only |
120
+
121
+ ### Information classification
122
+
123
+ When the user shares information, classify it before storing:
124
+
125
+ ```
126
+ User says something → Classify:
127
+ ├── About themselves (name, role, preferences)
128
+ │ → memory_add — personal profile
129
+ ├── About how their team/org works (conventions, standards, policies)
130
+ │ → memory_add — personal memory; the user can promote it to Shared
131
+ │ Knowledge from the UI's Learnings tab so teammates see it too
132
+ ├── Domain knowledge (facts, definitions, specs, research)
133
+ │ → memory_add for quick recall; for bulk documents, the user uploads
134
+ │ files via the UI's Datapack → Actions → Add Knowledge flow
135
+ ├── A correction or learning ("don't do X", "always do Y")
136
+ │ → memory_add — behavioral feedback
137
+ ├── Full conversation worth preserving (multi-turn, reasoning traces)
138
+ │ → conversation_create + conversation_add_message — verbatim
139
+ └── Structured/tabular data (CSV rows, schemas, data dictionaries)
140
+ → Not MCP-supported on Cloud today (db_run_write_query returns
141
+ {"error": "not_available"}). Extract key facts to memory_add
142
+ or tell the user this isn't a Cloud feature yet.
143
+ ```
144
+
145
+ ## Conversation capture
146
+
147
+ Claude Desktop does not have automatic capture hooks. Preserve valuable sessions manually.
148
+
149
+ ### When to create a conversation
150
+
151
+ Create a conversation container when starting substantive work — not for quick questions, but for sessions with multi-turn reasoning worth replaying or sharing. **Call `conversation_create` early so you have a real `conversation_id`** — memory writes require one (nil-UUID orphans the trace in Langfuse):
152
+
153
+ ```
154
+ conversation_create(scope="write", agent_id="claude_desktop",
155
+ title="<descriptive topic>")
156
+ ```
157
+
158
+ Save the returned `conversation_id` — use it for all subsequent calls in that session.
159
+
160
+ ### When to add messages
161
+
162
+ After significant exchanges (3+ turns), save key exchanges:
163
+
164
+ ```
165
+ conversation_add_message(scope="write", conversation_id="<id>",
166
+ agent_id="claude_desktop",
167
+ input="<exact user prompt>",
168
+ output="<exact assistant response>",
169
+ reasoning="<tool calls and reasoning, if any>")
170
+ ```
171
+
172
+ ### Capture rules
173
+
174
+ - **Verbatim content only** — never summarize, rephrase, or condense any field
175
+ - **Include tool calls** in the `reasoning` field — these are essential for session replay
176
+ - **Extract key facts** with `memory_add` alongside conversation capture — memory is searchable, conversations are not
177
+ - **Use seeds** for dedup: `seed="<conversation_id>:claude-desktop:<sequential_number>"`
178
+
179
+ ## Calling tools correctly on the first attempt
180
+
181
+ **Use only the required parameters. Do not guess optional parameters.**
182
+
183
+ ### memory_add — correct call pattern
184
+ ```
185
+ memory_add(scope="write",
186
+ text="User is VP of Product at YugabyteDB",
187
+ agent_id="claude_desktop",
188
+ conversation_id="<id from conversation_create>")
189
+ ```
190
+ Required parameters: `scope`, `text`, `agent_id`, `conversation_id`. On **writes**, `conversation_id` must be a real UUID from `conversation_create` — writes attached to a nil/empty conversation are orphaned in Langfuse traces. Empty / missing `agent_id` is NOT rejected — the server quietly falls back to the `meko_agent` common bucket. Pass `agent_id="claude_desktop"` explicitly so this client's writes stay in the right bucket and don't pollute the cross-project pool.
191
+
192
+ ### memory_search — correct call pattern
193
+ ```
194
+ memory_search(scope="read",
195
+ query="user role",
196
+ agent_id="claude_desktop",
197
+ conversation_id="<id from conversation_create>")
198
+ ```
199
+ Required parameters: `scope`, `query`, `agent_id`, `conversation_id`. On **`memory_search`** specifically, `conversation_id` is used only for Langfuse trace nesting — it does NOT filter results. Pass the session's UUID so the search span appears under the active conversation; passing `""` is accepted and means "don't nest under any trace." For conversation-scoped filtering use the separate `run_id` parameter.
200
+
201
+ For cross-project common-bucket search (facts written under `agent_id="meko_agent"`, including everything written with empty/missing `agent_id`), pass it explicitly:
202
+ ```
203
+ memory_search(scope="read", query="user role",
204
+ agent_id="meko_agent", conversation_id="<id>")
205
+ ```
206
+
207
+ Empty string also resolves to `meko_agent` server-side. To search across other clients' specific buckets (e.g. `claude_code:some-repo`), call `memory_search` once per known agent_id — there's no single-call fan-out.
208
+
209
+ ### knowledgebase_search — correct call pattern
210
+ ```
211
+ knowledgebase_search(scope="read",
212
+ query="...",
213
+ agent_id="<anything — ignored>",
214
+ conversation_id="<id>",
215
+ datapack_id="<datapack UUID>",
216
+ limit=10)
217
+ ```
218
+ Required parameters: `scope`, `query`, `agent_id`, `conversation_id`, `datapack_id`. `datapack_id` has no default here. `agent_id` is ignored for filtering — results are the team's shared knowledge on the datapack regardless of what you pass.
219
+
220
+ ### Critical parameter rules
221
+
222
+ - **agent_id**: `"claude_desktop"` for this client's project-less personal writes/reads. Use `"meko_agent"` for the cross-project common bucket (genuinely global facts like user identity). Empty/missing routes to `meko_agent` server-side; that's not a cross-agent fan-out. Ignored on `knowledgebase_search`. See `tools-agent-id-conventions.md`.
223
+ - **conversation_id**: Behavior varies by tool. On write tools (`memory_add`, `conversation_add_message`) pass a real UUID from `conversation_create` — a nil/empty value orphans the Langfuse trace. On `memory_search` it's used only for trace nesting (not for filtering), and empty-string is accepted; on `memory_get_all` and most read tools, still pass the session UUID when you have one. Never pass `"current"` or other non-UUID junk — only a real UUID or an intentionally empty string where the tool allows it.
224
+ - **scope**: Only `"read"`, `"write"`, or `"admin"`. Nothing else.
225
+ - **When in doubt about optional parameters, omit them.** The server has sensible defaults.
226
+
227
+ ## Key concepts
228
+
229
+ 1. **26 tools in 5 groups**: Memory (8, including `flush_pending_memory_candidates` — the Desktop deterministic-capture helper described above), Conversation (6), Knowledge Base (4), Datapack (5), Database (3). On Cloud Meko today, all DB tools and the three KB ingestion tools return `{"error": "not_available"}` — only `knowledgebase_search` works in the KB group. See `tools-overview.md`.
230
+ 2. **Scope hierarchy**: `read < write < admin` — every tool validates scope at entry. Only three valid values: `"read"`, `"write"`, `"admin"`. Using anything else (e.g., `"all"`) will fail. Tool docstrings sometimes say `"Pass 'admin'"` but the code only requires `"read"` or `"write"` — use the minimum the code actually enforces.
231
+ 3. **datapack_id routing**: DB, RAG, and memory tools accept optional `datapack_id` (default datapack if omitted). `knowledgebase_search` is the exception: `datapack_id` is **required** there.
232
+ 4. **agent_id is multi-agent**: For Claude Desktop, use `agent_id="claude_desktop"` for desktop-personal writes and `agent_id="meko_agent"` for cross-project common facts. Writes are scoped to `(datapack_id, user_id, agent_id)`. Personal reads filter strictly on this tuple — to span agent_ids, call once per known value (the empty-string shortcut is not a fan-out; the server rewrites empty to `meko_agent`). `knowledgebase_search` ignores `agent_id` entirely. See `tools-agent-id-conventions.md`.
233
+ 5. **Personal memory vs. team-shared knowledge**: Un-promoted memories are scoped per-user and per-agent — only you see them. The user can promote important memories to Shared Knowledge via the Cloud UI's Learnings tab, which makes them visible to every team member on the datapack. `knowledgebase_search` is the MCP read path for both Shared Knowledge and uploaded documents.
234
+ 6. **conversation_id IS the Langfuse trace ID**: every MCP tool call inside a conversation becomes a span under that trace. Observable in the Meko UI's Observe hub. See `tools-memory-vs-conversation.md`.
235
+ 7. **Adding documents to the team knowledge base is UI-only on Cloud today**: user uploads files via Datapack → Actions → **Add Knowledge** (PDF/TXT/MD/JSON/MP4, 5MB each). The MCP ingestion tools are not available on Cloud. See `tools-rag-workflow.md`.
236
+ 8. **Manual conversation capture**: Claude Desktop does not have automatic capture hooks. Create and save conversations explicitly when sessions are valuable.
237
+ 9. **Memory latencies are not cheap**: observed on prod 2026-05-07 — `memory_add` 12-21s/call (calls OpenAI), `memory_search` 2-6s/call. Budget accordingly.
238
+ 10. **Known limitations**: see `tools-known-limitations.md` before attempting write operations on tools that appear in the catalog but aren't available on Cloud.
239
+ 11. **Error recovery**: Connection errors are common with memory tools — see `tools-troubleshooting.md` for retry strategies and fallbacks.
240
+
241
+ ## Reference sections
242
+
243
+ | File | What it covers |
244
+ |------|---------------|
245
+ | `tools-overview.md` | Complete catalog of all 26 tools with decision tree + cloud Free-Tier gating map |
246
+ | `tools-cookbook.md` | Per-tool examples with correct parameters, responses, and error cases |
247
+ | `tools-memory-vs-conversation.md` | When to use memory tools vs conversation tools |
248
+ | `tools-rag-workflow.md` | End-to-end RAG pipeline flow |
249
+ | `tools-scope-permissions.md` | read/write/admin permission hierarchy |
250
+ | `tools-troubleshooting.md` | Error recovery, retry strategies, stuck pipeline diagnosis |
251
+ | `tools-known-limitations.md` | Broken tools, missing capabilities, permission gaps |
@@ -0,0 +1,150 @@
1
+ # Meko MCP Tools — Claude Desktop Setup
2
+
3
+ Use the Meko MCP tools skill natively in Claude Desktop. The skill teaches Claude to proactively store memories, classify information, use all 25 Meko MCP tools correctly, and handle errors gracefully.
4
+
5
+ ## Setup
6
+
7
+ ### Step 1: Install the skill
8
+
9
+ **Option A — Plugin marketplace** (recommended):
10
+
11
+ In Claude Desktop: Customize > Personal plugins > Browse plugin marketplace. Search for `meko-agent-skills-claude-desktop` and install.
12
+
13
+ **Option B — .skill file:**
14
+
15
+ Download `meko-mcp-tools-desktop.skill` from the [releases page](https://github.com/yugabyte/meko-mcp-server/releases) and drag it into Claude Desktop (or use Customize > Skills > Import).
16
+
17
+ **Option C — Manual install:**
18
+
19
+ ```bash
20
+ git clone https://github.com/yugabyte/meko-mcp-server.git
21
+ ```
22
+
23
+ Copy `skills/skills/meko-mcp-tools-desktop/` into Claude Desktop's skill directory. The exact path depends on your Desktop version — check Customize > Skills for the install location.
24
+
25
+ ### Step 2: Configure the MCP server
26
+
27
+ Add the Meko MCP server to your Claude Desktop configuration. Go to Claude > Settings > Developer > Edit Config and add a `mcpServers` entry.
28
+
29
+ **Local HTTP** (for [meko-test](https://github.com/yugabyte/meko-test) docker-compose users):
30
+
31
+ ```json
32
+ {
33
+ "mcpServers": {
34
+ "meko": {
35
+ "url": "http://localhost:8000/mcp"
36
+ }
37
+ }
38
+ }
39
+ ```
40
+
41
+ **Local stdio** (running the server directly via uv):
42
+
43
+ ```json
44
+ {
45
+ "mcpServers": {
46
+ "meko": {
47
+ "command": "uv",
48
+ "args": [
49
+ "--directory",
50
+ "/path/to/meko-mcp-server",
51
+ "run",
52
+ "src/server.py"
53
+ ],
54
+ "env": {
55
+ "YUGABYTEDB_URL": "dbname=yugabyte host=localhost port=5433 user=yugabyte password=yugabyte",
56
+ "OPENAI_API_KEY": "your-openai-api-key",
57
+ "OPENAI_MODEL": "gpt-4.1-nano-2025-04-14",
58
+ "OPENAI_EMBEDDING_MODEL": "text-embedding-3-small"
59
+ }
60
+ }
61
+ }
62
+ }
63
+ ```
64
+
65
+ Replace `/path/to/meko-mcp-server` with your cloned repo path and set the correct database URL and API keys.
66
+
67
+ **Managed instance:**
68
+
69
+ ```json
70
+ {
71
+ "mcpServers": {
72
+ "meko": {
73
+ "url": "https://<your-instance>.mcp.mekodev.com/mcp"
74
+ }
75
+ }
76
+ }
77
+ ```
78
+
79
+ Get the URL from your team.
80
+
81
+ Restart Claude Desktop after editing the configuration.
82
+
83
+ ### Step 3: Verify
84
+
85
+ Start a new conversation and say:
86
+
87
+ > Show me the tables in my database.
88
+
89
+ Claude should call `db_summarize_database` and return the table schemas. If it works, the MCP server and skill are both connected.
90
+
91
+ ## Usage
92
+
93
+ The skill triggers automatically based on context — just talk to Claude naturally:
94
+
95
+ ### Store personal info (triggers memory_add proactively)
96
+ > I'm a backend engineer. We use Go and YugabyteDB for everything.
97
+
98
+ ### Recall memories (triggers memory_search)
99
+ > What do you know about me?
100
+
101
+ ### Query the database (triggers db_summarize_database / db_run_read_only_query)
102
+ > Show me the first 10 rows from the customers table.
103
+
104
+ ### Save conversations (triggers conversation_create + conversation_add_message)
105
+ > Save this conversation.
106
+
107
+ ### Store structured data (triggers db_run_write_query)
108
+ > Here's a CSV of our products: [paste CSV data]
109
+
110
+ ### Manage datapacks (triggers datapack_list / datapack_create)
111
+ > List all datapacks.
112
+
113
+ ## Differences from Claude Code
114
+
115
+ | Feature | Claude Code | Claude Desktop |
116
+ |---------|-------------|----------------|
117
+ | Skill name | `meko-mcp-tools` | `meko-mcp-tools-desktop` |
118
+ | Installation | `claude plugin install meko-agent-skills` | Plugin marketplace / .skill file / manual |
119
+ | MCP connection | `claude mcp add --transport http meko <url>` | `claude_desktop_config.json` |
120
+ | Automatic capture | Hooks (SessionStart, PreCompact, SessionEnd) | Manual — ask to save conversations |
121
+ | Periodic checkpoints | CronCreate (every 10 min) | Not available |
122
+ | agent_id | `agent` | `agent` |
123
+
124
+ ## Troubleshooting
125
+
126
+ ### "Tools aren't available"
127
+
128
+ 1. Check that `claude_desktop_config.json` has valid JSON syntax
129
+ 2. Restart Claude Desktop after editing the config
130
+ 3. Check logs at `~/Library/Logs/Claude` (macOS) or `%APPDATA%\Claude\Logs` (Windows)
131
+
132
+ ### "Connection refused"
133
+
134
+ Ensure the MCP server is running:
135
+ - For docker-compose: `docker compose ps` — the `meko-mcp` service should be healthy
136
+ - For stdio: the server starts automatically when Claude Desktop launches
137
+
138
+ ### "memory_add fails with SQL syntax error"
139
+
140
+ On Cloud Meko, `agent_id` is a row-level column value — any string works, it never becomes a PostgreSQL identifier. Use `agent_id="claude_desktop"` for this client (or the value the skill tells you to use). Empty / missing `agent_id` is NOT rejected — the server resolves it to `meko_agent` (the cross-project common bucket). That's rarely what you want for Desktop, so always pass `agent_id="claude_desktop"` explicitly to keep this client's writes in the right bucket.
141
+
142
+ ### "Conversation tools don't work"
143
+
144
+ Conversation tools require Langfuse credentials (`LANGFUSE_PUBLIC_KEY`, `LANGFUSE_SECRET_KEY`). The other 19 tools work without Langfuse. If you don't need conversation persistence, you can skip this.
145
+
146
+ ### "Skill doesn't trigger"
147
+
148
+ The skill activates when Claude detects relevant context (MCP tools, memory operations, database queries, etc.). If it doesn't trigger:
149
+ 1. Verify the skill appears in Customize > Skills and is enabled
150
+ 2. Try a more explicit prompt: "Use the Meko tools to store this in memory: I prefer Python."
@@ -0,0 +1,24 @@
1
+ ---
2
+ title: Section Index
3
+ description: Maps reference files to their topics for the meko-mcp-tools-desktop skill
4
+ ---
5
+
6
+ # Reference Sections
7
+
8
+ ## Tool Selection & Catalog
9
+ - [tools-overview.md](tools-overview.md) — Complete catalog of all 26 tools with a decision tree and cloud Free-Tier gating map
10
+
11
+ ## Tool-Specific Guidance
12
+ - [tools-agent-id-conventions.md](tools-agent-id-conventions.md) — Multi-agent model: the three buckets (project `<client>:<repo-basename>`, common `meko_agent`, loose client name), personal vs. team-shared read surfaces
13
+ - [tools-memory-vs-conversation.md](tools-memory-vs-conversation.md) — Decision framework: memory_add vs conversation_create/conversation_add_message, plus Desktop capture guidance
14
+ - [tools-rag-workflow.md](tools-rag-workflow.md) — End-to-end RAG pipeline: source registration, index creation, status polling
15
+
16
+ ## Safety & Permissions
17
+ - [tools-scope-permissions.md](tools-scope-permissions.md) — read/write/admin permission hierarchy and per-tool requirements
18
+
19
+ ## Practical Usage
20
+ - [tools-cookbook.md](tools-cookbook.md) — Per-tool examples with correct parameters, expected responses, and common errors
21
+
22
+ ## Troubleshooting & Limitations
23
+ - [tools-troubleshooting.md](tools-troubleshooting.md) — Error recovery, retry strategies, stuck pipeline diagnosis
24
+ - [tools-known-limitations.md](tools-known-limitations.md) — Broken tools, missing capabilities, permission gaps
@@ -0,0 +1,99 @@
1
+ # agent_id — multi-agent identity on Cloud Meko
2
+
3
+ `agent_id` identifies **which agent wrote a memory or created a conversation**. It is not a constant. Pick a value that represents the specific agent + project you're acting for, use it consistently for writes within this session, and use it to scope your own reads.
4
+
5
+ The Cloud UI (`cloud.mekodata.ai`) renders `agent_id` as a badge on every memory and conversation row — so the value you pick is user-visible. Multiple different agents with different `agent_id` values can write into the same datapack; each one's personal view is scoped to itself, and the UI shows the full cross-agent picture.
6
+
7
+ ## The three buckets
8
+
9
+ Memories segregate strictly by `agent_id`. Pick the right bucket up front:
10
+
11
+ | Pattern | When to use | Example |
12
+ |---|---|---|
13
+ | Loose client name | Claude Desktop and other non-coding clients — there's no per-project concept, so the bare client name is the right granularity. | `claude_desktop` |
14
+ | `<client>:<repo-basename>` | Coding agents (Claude Code, Cursor) writing project-scoped facts. **Not used by Claude Desktop**, but you'll see these values on rows written by other clients in the same datapack. | `claude_code:meko-mcp-server` |
15
+ | `meko_agent` | Cross-project common bucket — facts any agent should see regardless of project (user identity, global preferences). The server stores empty/missing `agent_id` here automatically. | `meko_agent` |
16
+
17
+ **For Claude Desktop, the practical default is `claude_desktop` for personal context and `meko_agent` for genuinely cross-client facts.** When the user's information is project-agnostic ("the user is named Amiram", "the user prefers vim"), prefer `meko_agent` so other clients (Claude Code, Cursor) can see it too.
18
+
19
+ ## Valid characters
20
+
21
+ The server stores `agent_id` as a row-level column value — it never becomes a PostgreSQL identifier on Cloud. Any printable string works: colons, hyphens, dots, underscores, spaces. Stay within what's readable in the UI badge.
22
+
23
+ Pre-existing data in real datapacks includes a mix of legacy shapes — `agent`, `claude-code`, `claude_code`, `cursor:<slug>`, `claude-code:-Users-...`, `claude-desktop` (hyphenated). None of them cause errors. To query those rows, pass the literal legacy value as `agent_id`. New writes should follow the table above.
24
+
25
+ ## How agent_id filters reads and writes
26
+
27
+ ### Writes — `memory_add`, `conversation_create`, `conversation_add_message`
28
+
29
+ - The row stores `(meko_datapack_id, meko_user_id, meko_agent_id)` — the user_id comes from your cognito account; the datapack_id defaults or is explicit; the agent_id is what you pass.
30
+ - If you pass an empty or whitespace-only `agent_id`, the server stores `meko_agent`. That's the common bucket — fine for cross-client facts; not what you want for desktop-personal writes.
31
+
32
+ ### Personal reads — `memory_search`, `memory_get_all`, `conversation_list`, `conversation_get`
33
+
34
+ Filter tuple: `(datapack_id, user_id, agent_id)`.
35
+
36
+ - `user_id` is **always enforced**: you can only see memories and conversations you wrote (or that other team members shared with you via promotion — see below). One user cannot read another team member's un-promoted memories directly from MCP.
37
+ - `agent_id` is **strictly matched**: a search with `agent_id="claude_desktop"` returns only rows whose stored value is exactly that. Memories written from `agent_id="claude_code:foo"` are invisible to it.
38
+ - An empty `agent_id` is rewritten to `meko_agent` server-side, so a "broad" read with empty string returns only common-bucket rows — **not** a cross-client fan-out. To search across multiple agent_ids, call once per known value.
39
+
40
+ Empirically verified 2026-05-19 on Cloud prod (free-tier multitenant mode, segregation via row-level filter).
41
+
42
+ ### Team-shared reads — `knowledgebase_search`
43
+
44
+ Filter tuple: `(datapack_id)` only. **`agent_id` on the request is ignored.** Whatever value you pass, `knowledgebase_search` returns every row on the datapack.
45
+
46
+ This is the multi-user, multi-agent read path. Content in `knowledgebase_search` is shared across:
47
+ - All agents on the datapack (any `agent_id` value)
48
+ - All users with access to the datapack (`user_id` is not a column on the shared table)
49
+
50
+ The originating `agent_id` is preserved in each result's `metadata_filters.agent_id` for provenance, but it does not affect which rows come back.
51
+
52
+ ## What lives where
53
+
54
+ ```
55
+ memory_add(agent_id=X, text=...)
56
+ │
57
+ ▼
58
+ mem0_collection ── personal memories, scoped (datapack, user, agent)
59
+ │
60
+ │ UI "Promote to Knowledge" (Learnings tab)
61
+ │ ─────────────────────────────────────────
62
+ │ Strips user_id, keeps agent_id as metadata,
63
+ │ copies into team-shared table
64
+ ▼
65
+ knowledge_base ── team-shared, scoped (datapack) only
66
+ │
67
+ ▼
68
+ knowledgebase_search(agent_id=anything, query=...)
69
+ ```
70
+
71
+ - **Personal memories** are what you get from `memory_search` / `memory_get_all`. Private to you.
72
+ - **Shared Knowledge** is what you get from `knowledgebase_search`. Visible to every user and every agent on the datapack.
73
+ - **Promotion is UI-only.** There is no MCP tool for promoting a memory to Shared Knowledge — the user triggers it from the datapack's Learnings tab in the Cloud UI.
74
+
75
+ ## When to use what — broad-query guidance
76
+
77
+ If the user asks "what do you know about X?" and you want to maximize recall:
78
+
79
+ 1. **First call**: `memory_search(agent_id="claude_desktop", query="X")` — returns your desktop-personal memories.
80
+ 2. **Second call**: `memory_search(agent_id="meko_agent", query="X")` — returns the common cross-project bucket: anything written with `agent_id="meko_agent"` from any client, plus rows the server stored under that name when called with empty `agent_id`.
81
+ 3. **Third call**: `knowledgebase_search(agent_id="<anything>", datapack_id="<datapack>", query="X")` — returns team-shared knowledge. Useful when the answer may have been promoted by the user or a teammate.
82
+
83
+ For a true cross-agent fan-out (e.g. you also want to see what was written from `claude_code:some-repo` or `cursor:foo`), call `memory_search` once per known agent_id — the empty-string shortcut does not bypass the filter; the server rewrites empty to `meko_agent`.
84
+
85
+ Always tell the user what scope you searched, so they understand why the answer is or isn't there. Example wording: "I found this in your desktop personal memories" vs. "I found this in your common cross-project bucket" vs. "I found this in your team's shared knowledge."
86
+
87
+ ## Sub-scoping within an agent
88
+
89
+ Optional parameters narrow further within the same `agent_id`:
90
+ - `user_id` — explicitly scope writes/reads to a specific end-user if your agent serves multiple (rare in Claude Desktop; more common in API products)
91
+ - `run_id` — per-execution run
92
+
93
+ Available on `memory_add`, `memory_search`, `memory_get_all`, `memory_delete_all`, `conversation_create`, `conversation_list`.
94
+
95
+ ## Things I checked and found in-data on real Cloud datapacks
96
+
97
+ - `agent_id="agent"` appears on many legacy rows — it was the previous canonical constant. New writes should use the schema in the table above; query legacy rows with `agent_id="agent"` explicitly.
98
+ - Memory Summary UI (`/datapacks/<name>/memory-summary`) is agent-id-agnostic — shows every row in the datapack, renders the stored `agent_id` as a badge. The filtering is MCP-side only.
99
+ - Subagents spawned via the `Agent` tool in Claude Code do not automatically inherit the parent's `agent_id`. The parent must inject it into the spawn prompt. See the SKILL.md "When spawning subagents" section in the coding-agent skill.