@yugabytedb/meko-mcp 1.0.3
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 +505 -0
- package/assets/hooks-handlers/lib/capture.js +863 -0
- package/assets/hooks-handlers/lib/checkpoint-timer.js +72 -0
- package/assets/hooks-handlers/pre-compact.sh +3 -0
- package/assets/hooks-handlers/session-end.sh +27 -0
- package/assets/hooks-handlers/session-start.sh +24 -0
- package/assets/hooks-handlers/test_single_conversation.sh +169 -0
- package/assets/skills/meko-mcp-tools/SKILL.md +192 -0
- package/assets/skills/meko-mcp-tools/references/_sections.md +31 -0
- package/assets/skills/meko-mcp-tools/references/tools-agent-id-conventions.md +39 -0
- package/assets/skills/meko-mcp-tools/references/tools-conversation-dedup.md +49 -0
- package/assets/skills/meko-mcp-tools/references/tools-cookbook.md +373 -0
- package/assets/skills/meko-mcp-tools/references/tools-datapack-workflow.md +56 -0
- package/assets/skills/meko-mcp-tools/references/tools-db-query-patterns.md +38 -0
- package/assets/skills/meko-mcp-tools/references/tools-known-limitations.md +61 -0
- package/assets/skills/meko-mcp-tools/references/tools-memory-vs-conversation.md +128 -0
- package/assets/skills/meko-mcp-tools/references/tools-overview.md +97 -0
- package/assets/skills/meko-mcp-tools/references/tools-rag-workflow.md +63 -0
- package/assets/skills/meko-mcp-tools/references/tools-scope-permissions.md +79 -0
- package/assets/skills/meko-mcp-tools/references/tools-troubleshooting.md +143 -0
- package/assets/skills/meko-mcp-tools/references/tools-user-id-conventions.md +93 -0
- package/assets/skills/meko-mcp-tools/references/tools-write-guardrails.md +30 -0
- package/bin/create-meko-setup.mjs +499 -0
- package/lib/claude-code.mjs +14 -0
- package/lib/clients/claude-code.mjs +265 -0
- package/lib/clients/claude-desktop.mjs +256 -0
- package/lib/clients/common.mjs +107 -0
- package/lib/clients/cursor.mjs +332 -0
- package/lib/clients/index.mjs +14 -0
- package/lib/config.mjs +369 -0
- package/lib/detect.mjs +125 -0
- package/lib/installer.mjs +255 -0
- package/lib/logger.mjs +97 -0
- package/lib/mcp-transport.mjs +204 -0
- package/lib/migrate/adapters/claude-code.mjs +165 -0
- package/lib/migrate/adapters/cursor.mjs +221 -0
- package/lib/migrate/adapters/memory-md.mjs +230 -0
- package/lib/migrate/claude-parser.mjs +306 -0
- package/lib/migrate/daemon.mjs +67 -0
- package/lib/migrate/id.mjs +83 -0
- package/lib/migrate/lockfile.mjs +121 -0
- package/lib/migrate/logger.mjs +79 -0
- package/lib/migrate/mcp-client.mjs +224 -0
- package/lib/migrate/orchestrator.mjs +443 -0
- package/lib/migrate/progress.mjs +76 -0
- package/lib/migrate/state.mjs +177 -0
- package/lib/migrate.mjs +328 -0
- package/lib/prompt.mjs +212 -0
- package/lib/validate.mjs +259 -0
- package/package.json +49 -0
- package/scripts/bundle-assets.mjs +49 -0
package/README.md
ADDED
|
@@ -0,0 +1,505 @@
|
|
|
1
|
+
# Meko Setup Installer
|
|
2
|
+
|
|
3
|
+
A zero-dependency Node.js CLI that configures [Meko MCP Server](https://mekodata.netlify.app/) for Claude Code, Claude Desktop, and Cursor in one command. It registers MCP server settings, configures hook/runtime environment where supported, installs skills support, and validates the setup.
|
|
4
|
+
|
|
5
|
+
Reduces manual setup to a single command.
|
|
6
|
+
|
|
7
|
+
## Quick Start
|
|
8
|
+
|
|
9
|
+
The installer is path-agnostic — the three forms below are equivalent. Pick the one that matches how you obtained the code:
|
|
10
|
+
|
|
11
|
+
| Source | Command |
|
|
12
|
+
|---|---|
|
|
13
|
+
| npm (no repo clone needed) | `npx @yugabytedb/meko-mcp [options]` |
|
|
14
|
+
| Repo clone, from repo root | `node installer/bin/create-meko-setup.mjs [options]` |
|
|
15
|
+
| Repo clone, from `installer/` | `node bin/create-meko-setup.mjs [options]` |
|
|
16
|
+
|
|
17
|
+
Claude Desktop install (issue [#7](https://github.com/amiramm/meko-mcp-server/issues/7)) still requires a repo clone — the `.skill` packaging script isn't bundled. All other clients work from the npm tarball without a checkout.
|
|
18
|
+
|
|
19
|
+
**Interactive (recommended for first-time users):**
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npx @yugabytedb/meko-mcp
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
The installer walks you through connection type, URL, API key, and skills installation with guided prompts.
|
|
26
|
+
|
|
27
|
+
**Local one-liner (docker-compose stack already running):**
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
npx @yugabytedb/meko-mcp --local --yes
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
**Cursor project install (local):**
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
npx @yugabytedb/meko-mcp --client cursor --local --scope project --yes
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
**Claude Desktop install (local, from a repo clone):**
|
|
40
|
+
|
|
41
|
+
Claude Desktop supports two install paths — pick one per machine:
|
|
42
|
+
|
|
43
|
+
**Option A — Desktop Extension (`.mcpb`), one-click.** Download `meko-<version>.mcpb` from the [GitHub Releases page](https://github.com/amiramm/meko-mcp-server/releases) and drag it onto **Claude Desktop > Settings > Extensions > Install from file**. You'll be prompted for your Meko MCP URL and API key in the Settings UI, and that's it. Best for non-technical users. See [`mcpb/README.md`](../mcpb/README.md) for what's in the bundle. Prerequisite: Node 18+ on PATH (the bundle launches `npx mcp-remote` under the hood).
|
|
44
|
+
|
|
45
|
+
**Option B — `create-meko-setup` installer.** Use this when you want a scripted / repeatable install, or when you need the `.skill` bundle built at the same time:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
node installer/bin/create-meko-setup.mjs --client claude-desktop --local --yes
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Builds a `.skill` bundle at `skills/meko-mcp-tools-desktop.skill`. Drag it onto Claude Desktop (or import via Settings > Extensions) once and restart the app. The installer also merges `mcpServers.meko` into `claude_desktop_config.json`. If it detects that Meko was previously installed via the `.mcpb` path (Option A), it flags the entry and prompts before overwriting so you don't end up with two conflicting configs.
|
|
52
|
+
|
|
53
|
+
**Install on multiple clients at once:**
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
# Target two clients in one run:
|
|
57
|
+
npx @yugabytedb/meko-mcp --client claude-code,claude-desktop --local --yes
|
|
58
|
+
|
|
59
|
+
# Target every supported client (claude-code, claude-desktop, cursor):
|
|
60
|
+
npx @yugabytedb/meko-mcp --client all --local --yes
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Each client is installed sequentially. A failure on one does not abort the others — the command exits with status 2 on partial success, 1 on total failure.
|
|
64
|
+
|
|
65
|
+
**CI / non-interactive (Cloud Meko):**
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
npx @yugabytedb/meko-mcp \
|
|
69
|
+
--url https://your-mcp.mekodev.com/mcp \
|
|
70
|
+
--api-key "$MEKO_API_KEY" \
|
|
71
|
+
--yes
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## What It Does
|
|
75
|
+
|
|
76
|
+
The installer performs up to 5 steps (some are skippable via flags):
|
|
77
|
+
|
|
78
|
+
| Step | Action | Command / File Modified |
|
|
79
|
+
|------|--------|------------------------|
|
|
80
|
+
| 1 | Register MCP server | `claude mcp add meko <url> --transport http --scope user` (with `-H "API_KEY: <key>"` for cloud) |
|
|
81
|
+
| 2 | Set hook environment vars | Writes `MEKO_MCP_URL` and `MEKO_API_KEY` into `~/.claude/settings.json` under the `env` key |
|
|
82
|
+
| 3 | Register plugin marketplace | `claude plugin marketplace add yugabyte/meko-mcp-server --sparse skills --scope user` |
|
|
83
|
+
| 4 | Install skills plugin | `claude plugin install meko-agent-skills --scope user` |
|
|
84
|
+
| 5 | Validate setup | Config check via `claude mcp list`, MCP `initialize` handshake, `tools/list` verification |
|
|
85
|
+
|
|
86
|
+
**Files modified (depends on `--client`):**
|
|
87
|
+
|
|
88
|
+
- **Claude Code**
|
|
89
|
+
- `~/.claude/settings.json` -- env vars (`MEKO_MCP_URL`, `MEKO_API_KEY`) that lifecycle hooks read at runtime.
|
|
90
|
+
- Claude Code internal config (`~/.claude.json`) -- MCP registration and plugin state (managed by `claude` CLI).
|
|
91
|
+
- **Claude Desktop**
|
|
92
|
+
- macOS: `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
93
|
+
- Linux: `~/.config/Claude/claude_desktop_config.json`
|
|
94
|
+
- Windows: `%USERPROFILE%/AppData/Roaming/Claude/claude_desktop_config.json`
|
|
95
|
+
- **Cursor**
|
|
96
|
+
- MCP config: `~/.cursor/mcp.json` or `.cursor/mcp.json`
|
|
97
|
+
- Hooks config: `~/.cursor/hooks.json` or `.cursor/hooks.json` (native mode)
|
|
98
|
+
- Skills path: `~/.cursor/skills` or `.cursor/skills`
|
|
99
|
+
|
|
100
|
+
## CLI Reference
|
|
101
|
+
|
|
102
|
+
```
|
|
103
|
+
Usage:
|
|
104
|
+
create-meko-setup [options]
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
| Flag | Description | Default |
|
|
108
|
+
|------|-------------|---------|
|
|
109
|
+
| `--client <list>` | Target client(s): one or more of `claude-code`, `claude-desktop`, `cursor`. Comma-separated, or `all` | `claude-code` |
|
|
110
|
+
| `--url <url>` | MCP server URL (from app.mekodev.com > Datapacks > Connect) | _(interactive prompt)_ |
|
|
111
|
+
| `--api-key <key>` | API key for Cloud Meko authentication | _(interactive prompt or `$MEKO_API_KEY` env)_ |
|
|
112
|
+
| `--local` | Use local Meko at `http://localhost:8000/mcp` (no API key needed) | `false` |
|
|
113
|
+
| `--scope <scope>` | Config scope: `user` or `project` (`claude-desktop` uses user scope config) | `user` |
|
|
114
|
+
| `--name <name>` | MCP server name in config | `meko` |
|
|
115
|
+
| `--cursor-hook-mode <mode>` | Cursor hook strategy: `native`, `claude-compat`, `hybrid` | `hybrid` |
|
|
116
|
+
| `--skip-skills` | Skip plugin marketplace and skills installation (steps 3-4) | `false` |
|
|
117
|
+
| `--skip-validation` | Skip post-install validation (step 5) | `false` |
|
|
118
|
+
| `--dry-run` | Show what would be done without making changes | `false` |
|
|
119
|
+
| `--uninstall` | Remove Meko MCP server, skills, env vars, and marketplace entry | `false` |
|
|
120
|
+
| `--verbose` | Show detailed output (API keys are always redacted) | `false` |
|
|
121
|
+
| `--yes` | Accept all defaults, run non-interactively | `false` |
|
|
122
|
+
| `-h`, `--help` | Show help message | |
|
|
123
|
+
| `-v`, `--version` | Show version | |
|
|
124
|
+
|
|
125
|
+
Migrate subcommand flags (see [Migrate Existing Data](#migrate-existing-data) below for details):
|
|
126
|
+
|
|
127
|
+
| Flag | Description | Default |
|
|
128
|
+
|------|-------------|---------|
|
|
129
|
+
| `--migrate` | Start a detached migration of existing Claude Code + Cursor conversations and `CLAUDE.md` memories into Meko. | `false` |
|
|
130
|
+
| `--with-migrate` | With `--yes`, kick off `--migrate` at the end of a successful install without prompting. CI-friendly. | `false` |
|
|
131
|
+
| `--migrate-status` | Print the status of the latest (or `--run-id`-specified) migration run. | `false` |
|
|
132
|
+
| `--migrate-stop` | Stop the running migration (SIGTERM, then SIGKILL after 2s). | `false` |
|
|
133
|
+
| `--no-extract` | Skip `memory_add(messages=...)` (the Mem0 extractor call). Replay via `conversation_create` + `conversation_add_message` only; standalone `memory_add(text=...)` for CLAUDE.md / memory files still runs. | `false` |
|
|
134
|
+
| `--rate <n>` | Max concurrent MCP calls during migration. | `4` |
|
|
135
|
+
| `--force` | Ignore a live lockfile or re-ingest already-processed items. | `false` |
|
|
136
|
+
| `--run-id <id>` | Target a specific run-id for `--migrate-status`. | _(latest run)_ |
|
|
137
|
+
|
|
138
|
+
## Migrate Existing Data
|
|
139
|
+
|
|
140
|
+
After installing Meko, `--migrate` seeds your new datapack with the conversations and memories already on your machine so the first session isn't an empty slate.
|
|
141
|
+
|
|
142
|
+
### What the migrator reads
|
|
143
|
+
|
|
144
|
+
| Source | Location | Becomes |
|
|
145
|
+
|---|---|---|
|
|
146
|
+
| Claude Code transcripts | `~/.claude/projects/<slug>/<uuid>.jsonl` | One Meko conversation (one Langfuse trace) per session; one paired user↔assistant turn per message pair. |
|
|
147
|
+
| Cursor transcripts | `~/.cursor/projects/<name>/agent-transcripts/<uuid>/*.jsonl` | Same — one conversation per session, one paired turn per user↔assistant round. |
|
|
148
|
+
| User-scope CLAUDE.md | `~/.claude/CLAUDE.md` | One memory per top-level `# ` section (agent = `claude-code:user`). |
|
|
149
|
+
| Project-scope CLAUDE.md | `<projectCwd>/.claude/CLAUDE.md` | One memory per top-level `# ` section (agent = `claude-code:<slug>`). |
|
|
150
|
+
| Indexed project memories | `~/.claude/projects/<slug>/memory/*.md` | One memory per file; YAML frontmatter (`name`, `description`, `type`) is preserved in metadata. |
|
|
151
|
+
|
|
152
|
+
Project `cwd` is derived by reading the `cwd` field from a real session file in each slug directory — never by reverse-slugging the directory name, which loses `.` and `-` in component names.
|
|
153
|
+
|
|
154
|
+
### What the migrator writes (MCP calls)
|
|
155
|
+
|
|
156
|
+
Per migrated Claude Code / Cursor session:
|
|
157
|
+
|
|
158
|
+
1. **`conversation_create`** — once per session. Captures `cwd`, `gitBranch`, `startedAt`, and source agent (`claude-code` or `cursor`) in metadata. Returns the `conversation_id` used for subsequent calls.
|
|
159
|
+
2. **`conversation_add_message`** — once per paired user↔assistant turn. Carries `input`, `output`, and `reasoning` (thinking blocks + tool-use/tool-result summaries), plus a deterministic `seed` for server-side dedup. Fire-and-forget; Meko batches to Langfuse.
|
|
160
|
+
3. **`memory_add(messages=[{role,content},...])`** — once per paired turn. This invokes Meko's server-side Mem0 extractor (the same pipeline the demo chatbot uses at `chatbot.py:177-178`) so the migrator seeds structured memories, not just raw transcripts. Skipped entirely under `--no-extract`.
|
|
161
|
+
|
|
162
|
+
Per CLAUDE.md / memory directory discovered:
|
|
163
|
+
|
|
164
|
+
4. **`conversation_create`** — one umbrella "memory-migration" conversation per agent (reused for all MD items under that agent, to satisfy Meko's `memory_add` requirement that memories be associated with a conversation).
|
|
165
|
+
5. **`memory_add(text=...)`** — once per CLAUDE.md section or `memory/*.md` file. Uses the `text=` form (not `messages=`) because the file is already curated memory; no LLM extraction needed.
|
|
166
|
+
|
|
167
|
+
So a real run exercises **both** the Langfuse observability surface (1 + 2) and the Mem0 memory surface (3 + 5). `--dry-run` prints the exact breakdown before you commit:
|
|
168
|
+
|
|
169
|
+
```
|
|
170
|
+
Dry run:
|
|
171
|
+
Claude Code sessions: 94
|
|
172
|
+
Cursor sessions: 10
|
|
173
|
+
Paired user↔asst turns: 887
|
|
174
|
+
Memory items (MD): 14
|
|
175
|
+
Planned MCP calls:
|
|
176
|
+
conversation_create: 105 ← one per session + one umbrella per memory agent
|
|
177
|
+
conversation_add_message: 887 ← one per paired turn (Langfuse)
|
|
178
|
+
memory_add (messages=): 887 ← one per paired turn (Mem0 extractor)
|
|
179
|
+
memory_add (text=): 14 ← one per CLAUDE.md section / memory file
|
|
180
|
+
total: 1893
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
### Why the migrator drives memory extraction
|
|
184
|
+
|
|
185
|
+
The Meko MCP server does **not** currently auto-extract memories on `conversation_add_message` (that call only writes to Langfuse). See [yugabyte/meko#120](https://github.com/yugabyte/meko/issues/120) — auto-extraction on the live write path was deferred because of LLM cost, but batch extraction for *previously-existing* conversations was explicitly endorsed. Until #120 lands, the migrator closes that gap itself by calling `memory_add(messages=...)` once per paired turn.
|
|
186
|
+
|
|
187
|
+
`--no-extract` skips step 3 above, turning migration into conversation-only replay. Use it when you're re-running for any reason other than seeding memories, when extraction cost is a concern, or if / when #120 lands (the migrator will be updated to default to `--no-extract` then).
|
|
188
|
+
|
|
189
|
+
### Scope
|
|
190
|
+
|
|
191
|
+
- `--scope user` (default) — every Claude Code and Cursor project on the machine, plus `~/.claude/CLAUDE.md`, plus every per-project `.claude/CLAUDE.md` and indexed `memory/*.md` directory.
|
|
192
|
+
- `--scope project` — only sessions whose `cwd` equals `process.cwd()`, plus that one project's `.claude/CLAUDE.md` and memory directory.
|
|
193
|
+
|
|
194
|
+
### Running
|
|
195
|
+
|
|
196
|
+
```bash
|
|
197
|
+
# Plan-only (no HTTP, no fork). Works without --url / --api-key — prints
|
|
198
|
+
# session counts, paired-turn counts, and per-tool planned-call totals so
|
|
199
|
+
# you can estimate LLM extraction cost before firing a real run.
|
|
200
|
+
create-meko-setup --migrate --dry-run --scope user
|
|
201
|
+
|
|
202
|
+
# Start a real migration; returns immediately with a run-id.
|
|
203
|
+
create-meko-setup --migrate --scope user --url https://... --api-key "$MEKO_API_KEY"
|
|
204
|
+
|
|
205
|
+
# Install + migrate in one command (CI-friendly).
|
|
206
|
+
create-meko-setup --url https://... --api-key "$MEKO_API_KEY" --yes --with-migrate
|
|
207
|
+
|
|
208
|
+
# Watch progress (or pass --run-id <id>).
|
|
209
|
+
create-meko-setup --migrate-status
|
|
210
|
+
|
|
211
|
+
# Stop a long-running migration (SIGTERM, then SIGKILL after 2s).
|
|
212
|
+
create-meko-setup --migrate-stop
|
|
213
|
+
|
|
214
|
+
# Conversation replay only; do not invoke the Mem0 extractor.
|
|
215
|
+
create-meko-setup --migrate --scope user --no-extract
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
### Behavior around install
|
|
219
|
+
|
|
220
|
+
- **Interactive install** (no `--yes`): after a successful install, the installer dry-runs the enumerator, prints how much local data would be migrated, and asks `Y/n`. Declining prints a reminder to run `--migrate` later.
|
|
221
|
+
- **`--yes` without `--with-migrate`**: install succeeds silently and prints a one-line tip pointing at `create-meko-setup --migrate`. No migration is started.
|
|
222
|
+
- **`--yes --with-migrate`**: install succeeds, then the detached migration is started automatically. Progress via `--migrate-status`.
|
|
223
|
+
|
|
224
|
+
### Idempotency, resume, and state
|
|
225
|
+
|
|
226
|
+
- Per-run logs: `~/.meko/migrate/<run-id>/log.ndjson` (one JSON object per line). `tail -f | jq .` is a reasonable debug loop.
|
|
227
|
+
- Per-run progress snapshot: `~/.meko/migrate/<run-id>/progress.json` (what `--migrate-status` reads).
|
|
228
|
+
- Durable state: `~/.meko/migrate/state.json` tracks per-session checkpoints (`conversationId`, `messagesSent`, `lastUuid`, `status`) and per-memory content hashes. A re-run skips sessions marked `done` and memories whose body hash is unchanged. A partial session resumes from `lastUuid + 1`.
|
|
229
|
+
- Server-side dedup: `conversation_add_message` gets a deterministic `seed = sha256(agentId + ":" + sessionUuid + ":" + messageUuid)` so partial-run overlap doesn't create duplicate messages.
|
|
230
|
+
- `--force` wipes resume state and re-issues every MCP call (useful for testing or after a server-side wipe).
|
|
231
|
+
|
|
232
|
+
### What does NOT get migrated (v1)
|
|
233
|
+
|
|
234
|
+
- Slash-command skills, hooks, and `.claude/settings.json` — those remain in Claude Code's own config; Meko has no equivalent tool.
|
|
235
|
+
- Knowledge-base documents — would need an S3 upload path and `knowledgebase_trigger_index_creation` wiring.
|
|
236
|
+
- Transcripts from other coding agents (Aider, Continue.dev, Windsurf, Codex CLI). Claude Code + Cursor only.
|
|
237
|
+
- `user_id` is left null on every call (the server fills it from the API key). Multi-user routing is a follow-up.
|
|
238
|
+
|
|
239
|
+
## Client Compatibility Matrix
|
|
240
|
+
|
|
241
|
+
| Capability | Claude Code | Claude Desktop | Cursor |
|
|
242
|
+
|---|---|---|---|
|
|
243
|
+
| One-command install | Yes | Yes | Yes |
|
|
244
|
+
| MCP server registration | via `claude mcp add` | via `claude_desktop_config.json` merge using `mcp-remote` stdio bridge | via `.cursor/mcp.json` merge |
|
|
245
|
+
| Backup before config write | `.bak` on `~/.claude/settings.json` | `.bak` on `claude_desktop_config.json` | `.bak` on Cursor config |
|
|
246
|
+
| Automatic conversation capture | Yes (hooks) | **No** — see [issue #8](https://github.com/amiramm/meko-mcp-server/issues/8) | Yes (hybrid hook mode) |
|
|
247
|
+
| Automatic memory persistence | Yes (hooks + skill) | Skill only (proactive `memory_add`) | Yes (hooks + skill) |
|
|
248
|
+
| Skill install | Plugin marketplace (automatic) | `.skill` bundle auto-built, user drags into app | Copy into `.cursor/skills` |
|
|
249
|
+
| Uninstall | Full automatic | MCP entry removed; skill must be removed manually from app | MCP + hooks + skills cleaned up |
|
|
250
|
+
| `agent_id` used by skill | `claude_code` | `claude_desktop` | `claude_code` |
|
|
251
|
+
| Transport | HTTP only | HTTP (or stdio via hand-edited config) | HTTP only |
|
|
252
|
+
| Deferred to a follow-up | — | `.mcpb` Desktop Extension packaging — see [issue #7](https://github.com/amiramm/meko-mcp-server/issues/7) | — |
|
|
253
|
+
|
|
254
|
+
## Cloud vs Local
|
|
255
|
+
|
|
256
|
+
| | Cloud Meko | Local Meko |
|
|
257
|
+
|---|-----------|-----------|
|
|
258
|
+
| **URL** | Provided by app.mekodev.com > Datapacks > Connect | `http://localhost:8000/mcp` |
|
|
259
|
+
| **Authentication** | Requires `--api-key` or `$MEKO_API_KEY` env var | None |
|
|
260
|
+
| **MCP registration** | Includes `-H "API_KEY: <key>"` header | No auth header |
|
|
261
|
+
| **Hook env vars** | Both `MEKO_MCP_URL` and `MEKO_API_KEY` written to settings | Only `MEKO_MCP_URL` written |
|
|
262
|
+
| **Infrastructure** | Hosted, no local setup needed | Requires `docker compose up -d` running the Meko stack |
|
|
263
|
+
| **Use case** | Production, team collaboration | Development, testing |
|
|
264
|
+
| **Flag** | `--url <url> --api-key <key>` | `--local` |
|
|
265
|
+
|
|
266
|
+
The installer auto-detects cloud vs local based on the URL: any URL containing `localhost` or `127.0.0.1` is treated as local (no API key required). All other URLs are cloud and require authentication.
|
|
267
|
+
|
|
268
|
+
## Security
|
|
269
|
+
|
|
270
|
+
**Where credentials are stored:**
|
|
271
|
+
|
|
272
|
+
- **API key header** -- stored in `~/.claude.json` (MCP server config, managed by `claude mcp add`). Readable only by the current user.
|
|
273
|
+
- **`MEKO_API_KEY` env var** -- written to `~/.claude/settings.json` so lifecycle hooks can authenticate with the MCP server. This file has standard user-only filesystem permissions.
|
|
274
|
+
|
|
275
|
+
**How credentials are protected:**
|
|
276
|
+
|
|
277
|
+
- The `--verbose` flag never prints the actual API key. It always appears as `<set>` or `<not set>`.
|
|
278
|
+
- `--dry-run` mode redacts the key in displayed commands (shown as `<set>`).
|
|
279
|
+
- The API key is never logged to stdout or stderr during normal operation.
|
|
280
|
+
- Interactive mode uses masked input (echoes `*` characters) when prompting for the API key.
|
|
281
|
+
- The `MEKO_API_KEY` env var fallback means the key does not need to appear in shell history -- set it in your shell profile or CI secrets.
|
|
282
|
+
|
|
283
|
+
**Backups:**
|
|
284
|
+
|
|
285
|
+
Before modifying `~/.claude/settings.json`, the installer creates a `.bak` copy at `~/.claude/settings.json.bak`. The merge is additive: existing keys are preserved unless explicitly overridden.
|
|
286
|
+
|
|
287
|
+
## Troubleshooting
|
|
288
|
+
|
|
289
|
+
### Claude Code CLI not found
|
|
290
|
+
|
|
291
|
+
```
|
|
292
|
+
Claude Code CLI not found.
|
|
293
|
+
Install it first: https://docs.anthropic.com/en/docs/claude-code/getting-started
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
The `claude` binary is not installed or not on your PATH. After installing, verify:
|
|
297
|
+
|
|
298
|
+
```bash
|
|
299
|
+
which claude
|
|
300
|
+
claude --version
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
### Connection refused
|
|
304
|
+
|
|
305
|
+
```
|
|
306
|
+
Connection refused. Is the MCP server running?
|
|
307
|
+
For local Meko, ensure `docker compose up -d` has started the stack.
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
For local setups, confirm the stack is running and the MCP endpoint is accessible:
|
|
311
|
+
|
|
312
|
+
```bash
|
|
313
|
+
curl -s http://localhost:8000/mcp -X POST \
|
|
314
|
+
-H "Content-Type: application/json" \
|
|
315
|
+
-d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-03-26","capabilities":{},"clientInfo":{"name":"test","version":"1.0.0"}}}'
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
### Authentication failure (401 / 403)
|
|
319
|
+
|
|
320
|
+
```
|
|
321
|
+
Server returned 401. Verify your API key is correct and has not expired.
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
- Confirm the API key at app.mekodev.com > Datapacks > Connect.
|
|
325
|
+
- If using `$MEKO_API_KEY` env var, ensure it is exported in the current shell.
|
|
326
|
+
- Re-run the installer interactively to re-enter the key.
|
|
327
|
+
|
|
328
|
+
### Plugin marketplace already registered
|
|
329
|
+
|
|
330
|
+
This is non-fatal. The installer logs a warning and continues. If you need to force a re-registration, uninstall first (`--uninstall`) then install again.
|
|
331
|
+
|
|
332
|
+
### Skills plugin already installed
|
|
333
|
+
|
|
334
|
+
Same as above -- non-fatal. The existing plugin is kept. Use `--uninstall` followed by a fresh install if you need to update.
|
|
335
|
+
|
|
336
|
+
### Invalid JSON in settings.json
|
|
337
|
+
|
|
338
|
+
```
|
|
339
|
+
Invalid JSON in ~/.claude/settings.json: ...
|
|
340
|
+
Fix the file manually or delete it and re-run the installer.
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
The settings file has been corrupted or hand-edited incorrectly. Restore from the `.bak` backup:
|
|
344
|
+
|
|
345
|
+
```bash
|
|
346
|
+
cp ~/.claude/settings.json.bak ~/.claude/settings.json
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
### Missing core tools
|
|
350
|
+
|
|
351
|
+
```
|
|
352
|
+
Missing core tools: memory_search, conversation_create. Found 0 tool(s) total.
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
The MCP server responded but does not expose the expected tools (`memory_search`, `conversation_create`, `db_summarize_database`). This usually means a server version mismatch. Update the MCP server or check which datapack is connected.
|
|
356
|
+
|
|
357
|
+
### DNS lookup failed
|
|
358
|
+
|
|
359
|
+
```
|
|
360
|
+
DNS lookup failed for host. Check the URL is correct.
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
Verify the MCP URL is spelled correctly and your network can resolve it.
|
|
364
|
+
|
|
365
|
+
### Request timed out
|
|
366
|
+
|
|
367
|
+
```
|
|
368
|
+
Request timed out after 10s. Is the server running and reachable?
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
The server did not respond within 10 seconds. Check network connectivity, firewall rules, or server health.
|
|
372
|
+
|
|
373
|
+
### Claude Desktop doesn't see the new MCP server
|
|
374
|
+
|
|
375
|
+
After the installer writes `claude_desktop_config.json`, **quit and relaunch** Claude Desktop — it only reads the config on startup. If Desktop shows *"Some MCP servers could not be loaded"* or the server still doesn't appear:
|
|
376
|
+
|
|
377
|
+
1. **Check the `meko` entry is the stdio shape.** Claude Desktop rejects the HTTP `{ "url": ... }` shape with a silent warning. The installer writes the stdio form that wraps the URL with the `mcp-remote` bridge:
|
|
378
|
+
```json
|
|
379
|
+
"meko": {
|
|
380
|
+
"command": "npx",
|
|
381
|
+
"args": ["-y", "mcp-remote", "<url>", "--transport", "http-only"]
|
|
382
|
+
}
|
|
383
|
+
```
|
|
384
|
+
If you see a `"url"` field at the top level instead, re-run the installer to rewrite it.
|
|
385
|
+
2. Validate the config is well-formed JSON: `python3 -m json.tool ~/Library/Application\ Support/Claude/claude_desktop_config.json`
|
|
386
|
+
3. Verify `npx` is on PATH (the bridge is launched via `npx -y mcp-remote`): `which npx`
|
|
387
|
+
4. Check the Desktop logs at `~/Library/Logs/Claude/mcp.log` (macOS) or `%APPDATA%\Claude\logs\` (Windows) for load errors.
|
|
388
|
+
5. Restore the `.bak` backup if needed: `cp ~/Library/Application\ Support/Claude/claude_desktop_config.json.bak ~/Library/Application\ Support/Claude/claude_desktop_config.json`
|
|
389
|
+
|
|
390
|
+
### Claude Desktop skill bundle didn't build
|
|
391
|
+
|
|
392
|
+
The installer runs `skills/scripts/package-desktop-skill.sh` via `bash`. If packaging fails:
|
|
393
|
+
|
|
394
|
+
- Run the script directly to see the error: `bash skills/scripts/package-desktop-skill.sh`
|
|
395
|
+
- Verify `zip` is on your PATH (`which zip`)
|
|
396
|
+
- The output file `skills/meko-mcp-tools-desktop.skill` is gitignored — safe to regenerate
|
|
397
|
+
|
|
398
|
+
### Claude Desktop capture doesn't happen automatically
|
|
399
|
+
|
|
400
|
+
Expected: Claude Desktop has no SessionStart / PreCompact / SessionEnd hook API, so automatic transcript capture is not yet implemented. The skill tells the agent to proactively call `memory_add` and `conversation_create`, but this relies on agent behavior. See [issue #8](https://github.com/amiramm/meko-mcp-server/issues/8) for the planned automatic-capture work.
|
|
401
|
+
|
|
402
|
+
## Uninstalling
|
|
403
|
+
|
|
404
|
+
Remove Meko configuration for the selected client:
|
|
405
|
+
|
|
406
|
+
```bash
|
|
407
|
+
node installer/bin/create-meko-setup.mjs --client cursor --scope project --uninstall
|
|
408
|
+
```
|
|
409
|
+
|
|
410
|
+
This reverses installer-managed changes for the selected client:
|
|
411
|
+
|
|
412
|
+
1. Removes MCP registration/config entries
|
|
413
|
+
2. Removes installer-managed hook/runtime config
|
|
414
|
+
3. Removes installer-managed skills wiring where applicable
|
|
415
|
+
|
|
416
|
+
Each step is safe if the component was already removed -- the uninstaller logs a warning and continues.
|
|
417
|
+
|
|
418
|
+
Use `--verbose` for detailed output during uninstall:
|
|
419
|
+
|
|
420
|
+
```bash
|
|
421
|
+
node installer/bin/create-meko-setup.mjs --uninstall --verbose
|
|
422
|
+
```
|
|
423
|
+
|
|
424
|
+
## Manual Test Plan
|
|
425
|
+
|
|
426
|
+
| # | Scenario | Steps | Expected Result |
|
|
427
|
+
|---|----------|-------|-----------------|
|
|
428
|
+
| M1 | Fresh local install | `node installer/bin/create-meko-setup.mjs --local --yes` with docker stack running | All 5 steps pass, validation shows 3 green checks |
|
|
429
|
+
| M2 | Fresh cloud install | Run interactively, provide Cloud Meko URL + API key | MCP registered with API_KEY header, env vars set, validation passes |
|
|
430
|
+
| M3 | Existing config | Run installer when `meko` MCP is already registered | Prompts to overwrite; answering No keeps existing config |
|
|
431
|
+
| M4 | No claude CLI | Run on a machine without `claude` in PATH | Exits with error message and install link |
|
|
432
|
+
| M5 | Server unreachable | Install with `--skip-validation`, then re-run without it | Install succeeds; validation warns about connectivity |
|
|
433
|
+
| M6 | Uninstall | Run `--uninstall` after a successful install | MCP removed, env vars removed, plugin removed, marketplace entry removed |
|
|
434
|
+
| M7 | Dry run | `--local --dry-run --verbose` | Shows all planned commands with redacted keys, no files changed on disk |
|
|
435
|
+
| M8 | Cloud hooks capture | After cloud install, start a new Claude Code session | SessionStart hook creates conversation via cloud MCP (check watermark in `~/.claude/meko-capture/`) |
|
|
436
|
+
| M9 | API key redaction | Run with `--verbose` using a cloud URL and API key | API key appears only as `<set>`, never as the actual value |
|
|
437
|
+
| M10 | Idempotent re-install | Run installer twice with `--local --yes` | Second run detects existing config, overwrites cleanly, all checks pass |
|
|
438
|
+
| M11 | Invoke from repo root | `cd <repo> && node installer/bin/create-meko-setup.mjs --client cursor --local --scope user --dry-run --yes` | Dry-run succeeds; no path-resolution errors |
|
|
439
|
+
| M12 | Invoke from `installer/` | `cd <repo>/installer && node bin/create-meko-setup.mjs --client cursor --local --scope user --dry-run --yes` | Dry-run succeeds (note: `--scope project` gives different `.cursor/...` paths because project scope uses cwd — pick a fixed cwd or `--scope user` to compare byte-for-byte) |
|
|
440
|
+
| M13 | Clone-free via npm pack | `cd installer && npm pack` → `npm install -g ./yugabytedb-meko-mcp-*.tgz` → from a directory with **no repo clone**, run `create-meko-setup --client cursor --local --scope project --dry-run` | Succeeds; asset paths resolve under the globally-installed `node_modules/@yugabytedb/meko-mcp/assets/...` |
|
|
441
|
+
|
|
442
|
+
## Development
|
|
443
|
+
|
|
444
|
+
### Prerequisites
|
|
445
|
+
|
|
446
|
+
- Node.js >= 18.0.0 (required for `util.parseArgs` and `node:test`)
|
|
447
|
+
- No `npm install` needed -- zero external dependencies
|
|
448
|
+
|
|
449
|
+
### Project Structure
|
|
450
|
+
|
|
451
|
+
```
|
|
452
|
+
installer/
|
|
453
|
+
package.json # @yugabytedb/meko-mcp
|
|
454
|
+
bin/
|
|
455
|
+
create-meko-setup.mjs # CLI entry point (arg parsing, orchestration)
|
|
456
|
+
lib/
|
|
457
|
+
installer.mjs # Shared multi-client orchestration
|
|
458
|
+
clients/ # Per-client adapters (claude-code/desktop/cursor)
|
|
459
|
+
claude-code.mjs # Backward-compatible Claude wrapper
|
|
460
|
+
config.mjs # Safe JSON read/merge/write + path helpers
|
|
461
|
+
detect.mjs # Claude CLI and existing config detection
|
|
462
|
+
logger.mjs # ANSI-colored console output (respects NO_COLOR)
|
|
463
|
+
prompt.mjs # Interactive readline prompts (choice, text, secret, yes/no)
|
|
464
|
+
validate.mjs # Post-install validation (config, connectivity, tools)
|
|
465
|
+
test/
|
|
466
|
+
config.test.mjs # Unit tests for JSON merge/read/write
|
|
467
|
+
clients.test.mjs # Unit tests for cursor adapter behavior
|
|
468
|
+
validate.test.mjs # Unit tests for validation logic
|
|
469
|
+
installer.test.mjs # Integration tests for full install flow
|
|
470
|
+
fixtures/ # Mock settings files for tests
|
|
471
|
+
```
|
|
472
|
+
|
|
473
|
+
### Running Tests
|
|
474
|
+
|
|
475
|
+
```bash
|
|
476
|
+
cd installer
|
|
477
|
+
|
|
478
|
+
# All tests
|
|
479
|
+
node --test test/
|
|
480
|
+
|
|
481
|
+
# Unit tests only
|
|
482
|
+
npm run test:unit
|
|
483
|
+
|
|
484
|
+
# Integration tests (opt-in; can mutate local config)
|
|
485
|
+
npm run test:integration
|
|
486
|
+
|
|
487
|
+
# Cloud round-trip tests (opt-in; regression coverage for MEKO-20).
|
|
488
|
+
# Requires credentials in the shell:
|
|
489
|
+
export MEKO_TEST_CLOUD_URL=https://<your-mcp>.mekodev.com/mcp
|
|
490
|
+
export MEKO_TEST_API_KEY=<your-cloud-api-key>
|
|
491
|
+
npm run test:integration:cloud
|
|
492
|
+
```
|
|
493
|
+
|
|
494
|
+
The cloud round-trip tests point the installer at a throw-away `$HOME` via
|
|
495
|
+
`spawnSync`, so the developer's real `~/.claude/settings.json` is never
|
|
496
|
+
modified. They skip cleanly when either env var is unset.
|
|
497
|
+
|
|
498
|
+
### Design Principles
|
|
499
|
+
|
|
500
|
+
- **Zero external dependencies** -- Node.js built-ins only (`fs`, `path`, `readline`, `child_process`, `url`, `http`, `https`, `os`, `node:test`, `node:assert`), matching the pattern of `capture.js`.
|
|
501
|
+
- **Non-destructive** -- Creates `.bak` backups before modifying settings.
|
|
502
|
+
- **Additive merges** -- New env vars are added without overwriting existing unrelated keys.
|
|
503
|
+
- **Graceful failures** -- Non-critical errors (plugin already exists) warn and continue; only missing prerequisites cause hard failures.
|
|
504
|
+
- **API key safety** -- Never logged, always redacted in output.
|
|
505
|
+
- **NO_COLOR support** -- Respects the `NO_COLOR` env var to suppress ANSI color codes.
|