@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
package/README.md CHANGED
@@ -18,7 +18,7 @@ The installer is path-agnostic — the three forms below are equivalent. Pick th
18
18
  | Repo clone, from repo root | `node installer/bin/create-meko-setup.mjs [options]` |
19
19
  | Repo clone, from `installer/` | `node bin/create-meko-setup.mjs [options]` |
20
20
 
21
- 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.
21
+ Claude Desktop has two install paths: a one-click `.mcpb` Desktop Extension downloaded from GitHub Releases, and the scripted installer here (run via `npx` or from a clone) — only the latter also installs the agent skill bundle. See [Claude Desktop install](#claude-desktop-install) below for the full comparison.
22
22
 
23
23
  **Interactive (recommended for first-time users):**
24
24
 
@@ -40,19 +40,57 @@ npx @yugabytedb/meko-mcp --local --yes
40
40
  npx @yugabytedb/meko-mcp --client cursor --local --scope project --yes
41
41
  ```
42
42
 
43
- **Claude Desktop install (local, from a repo clone):**
43
+ **Claude Desktop install:**
44
44
 
45
- Claude Desktop supports two install paths — pick one per machine:
45
+ Claude Desktop has two install paths — pick based on whether you want the agent skill (the behavioral guide that teaches the agent *when* to call Meko tools, like proactive `memory_add`):
46
46
 
47
- **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).
47
+ | | Option A: `.mcpb` Desktop Extension | Option B: `create-meko-setup` installer |
48
+ |---|---|---|
49
+ | Installs MCP server | Yes | Yes |
50
+ | Installs the agent skill (behavioral guide) | **No** | **Yes** |
51
+ | Repo clone needed | No | No (works via `npx`); clones also work |
52
+ | Best for | Non-technical users; quickest path to a working MCP connection | Anyone who wants the skill that teaches the agent *when* to call Meko tools |
53
+ | Auto-capture of conversations/memories | No (see [issue #8](https://github.com/amiramm/meko-mcp-server/issues/8)) | Skill-driven only — the agent is prompted to call `memory_add` proactively, but it's not as reliable as Claude Code hooks |
54
+
55
+ You can also combine both: install via `.mcpb` for the MCP wiring, then run Option B to add the skill bundle. If you re-run the Option B installer on top of an `.mcpb` install, it detects the existing entry and prompts before overwriting `mcpServers.meko`.
56
+
57
+ **Option A — Desktop Extension (`.mcpb`), one-click:**
58
+
59
+ 1. Download `meko-<version>.mcpb` from the [GitHub Releases page](https://github.com/yugabyte/meko-mcp-server/releases) (e.g. `meko-1.1.0.mcpb`).
60
+ 2. Open **Claude Desktop > Settings > Extensions > Install from file** and select the file (or drag the file onto that pane).
61
+ 3. When prompted, paste your Meko MCP URL and API key.
62
+ 4. Quit and relaunch Claude Desktop.
63
+ 5. Verify in chat: *"Is Claude configured with an MCP Server for Meko?"*
64
+
65
+ Prerequisite: Node 18+ on `PATH` (the bundle launches `npx mcp-remote` under the hood). See [`mcpb/README.md`](../mcpb/README.md) for what's in the bundle.
48
66
 
49
- **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:
67
+ **Option B — `create-meko-setup` installer:**
68
+
69
+ Run via `npx` (no clone needed) — pick the form that matches the table at the top of this section. From a repo clone:
50
70
 
51
71
  ```bash
52
72
  node installer/bin/create-meko-setup.mjs --client claude-desktop --local --yes
53
73
  ```
54
74
 
55
- 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.
75
+ Or via npm without a clone:
76
+
77
+ ```bash
78
+ npx @yugabytedb/meko-mcp --client claude-desktop --local --yes
79
+ ```
80
+
81
+ This does two things:
82
+
83
+ 1. Merges `mcpServers.meko` into `claude_desktop_config.json` (backed up to `.bak`).
84
+ 2. Builds the `meko-mcp-tools-desktop.skill` bundle and prints its absolute path. The location depends on how you invoked the installer — under the npm package's asset root for `npx`, or under `skills/` in your clone.
85
+
86
+ Then, **once per machine**:
87
+
88
+ 1. Open the path that the installer printed (look for the `Built Meko skill bundle: ...` log line).
89
+ 2. Drag `meko-mcp-tools-desktop.skill` onto the Claude Desktop window — or import it via **Settings > Extensions > Install from file**.
90
+ 3. Quit and relaunch Claude Desktop.
91
+ 4. Verify the skill loaded: ask *"Which Meko skills do you have available?"* — the agent should mention `meko-mcp-tools-desktop`.
92
+
93
+ Re-run the installer to refresh the bundle when skill content updates; you'll need to re-drag the rebuilt `.skill` to pick up changes.
56
94
 
57
95
  **Install on multiple clients at once:**
58
96
 
@@ -112,9 +150,10 @@ The canary used to do a `memory_add` → `memory_get_by_id` → `memory_delete_b
112
150
  - MCP config: `~/.codex/config.toml` (TOML; `[mcp_servers.<name>]` block).
113
151
  - Skills path: `~/.agents/skills/meko-mcp-tools/` (the shared agent-skills convention).
114
152
  - System prompt: `~/.codex/AGENTS.md` (a Meko-managed sentinel block is upserted; user content outside the fence is preserved).
115
- - **Cloud auth**: Codex's TOML stores `bearer_token_env_var = "MEKO_API_KEY"` rather than the key itself. You must export `MEKO_API_KEY` in your shell before launching Codex. The installer offers (interactively, never with `--yes`) to append the export line to your shell rc (`~/.zshrc` / `~/.bashrc` / `~/.config/fish/config.fish`). On macOS, when the desktop app is detected the installer also offers to run `launchctl setenv MEKO_API_KEY ...` since macOS apps launched from Finder/Dock do not inherit shell-rc env vars.
153
+ - **Cloud auth (MCP server)**: Codex's TOML stores `bearer_token_env_var = "MEKO_API_KEY"` rather than the key itself. You must export `MEKO_API_KEY` in your shell before launching Codex. The installer offers (interactively, never with `--yes`) to append the export line to your shell rc (`~/.zshrc` / `~/.bashrc` / `~/.config/fish/config.fish`). On macOS, when the desktop app is detected and an API key is supplied, the installer runs `launchctl setenv MEKO_API_KEY ...` so Codex.app launched from Finder/Dock can authenticate in the current login session.
116
154
  - **No project scope**: Codex has no per-project config. `--scope project --client codex` warns and degrades to user scope.
117
- - **No auto-capture**: Codex does not expose user-installable session lifecycle hooks, so `session-start` / `session-end` capture is not available. Memory persistence still works via the model proactively calling `memory_search` / `memory_add` (the AGENTS.md block prompts this).
155
+ - **Auto-capture hooks**: when Codex hooks are available, the installer writes Meko lifecycle hooks to `~/.codex/hooks.json` and prunes stale Meko hook entries from deleted install paths. Memory persistence still also works via the model proactively calling `memory_search` / `memory_add` (the AGENTS.md block prompts this).
156
+ - **API key storage** (security note): Codex's hooks.json schema rejects a top-level `env` block and provides no per-command env field. The installer writes `MEKO_MCP_URL` and (when supplied) `MEKO_API_KEY` to `~/.codex/meko-env.sh` at mode 0600 (user read/write only); each hook's `command` field sources that file before invoking bash, e.g. `. '/Users/you/.codex/meko-env.sh' && bash '/.../session-start.sh'`. The key never appears in process arguments, so `ps -ef` from another user can't lift it while a hook is running. Trust boundary is the same as `~/.aws/credentials` or `~/.netrc` — file-system permissions on the user's home directory. If your threat model precludes even that, install for the local Meko URL (no API key prompt), or skip hook installation by deleting the Meko entries from `~/.codex/hooks.json` and removing `~/.codex/meko-env.sh` after install.
118
157
  - **Restart Codex.app** after install so it picks up the new MCP server registration.
119
158
 
120
159
  ## CLI Reference
@@ -132,7 +171,7 @@ Usage:
132
171
  | `--local` | Use local Meko at `http://localhost:8000/mcp` (no API key needed) | `false` |
133
172
  | `--scope <scope>` | Config scope: `user` or `project` (`claude-desktop` uses user scope config) | `user` |
134
173
  | `--name <name>` | MCP server name in config | `meko` |
135
- | `--cursor-hook-mode <mode>` | Cursor hook strategy: `native`, `claude-compat`, `hybrid` | `hybrid` |
174
+ | `--cursor-hook-mode <mode>` | Cursor hook strategy: `native` or `claude-compat` | `native` |
136
175
  | `--skip-skills` | Skip plugin marketplace and skills installation (steps 3-4) | `false` |
137
176
  | `--skip-validation` | Skip post-install validation (step 5) | `false` |
138
177
  | `--no-canary` | Skip the canary `datapack_list` call. Basic connectivity + tools/list still run. | `false` |
@@ -297,15 +336,15 @@ memory errs: 0 (failed memory_add calls; re-run with --force to
297
336
  | One-command install | Yes | Yes | Yes | Yes |
298
337
  | MCP server registration | via `claude mcp add` | via `claude_desktop_config.json` merge using `mcp-remote` stdio bridge | via `.cursor/mcp.json` merge | via `codex mcp add` (CLI) or direct TOML write (App-only) |
299
338
  | Backup before config write | `.bak` on `~/.claude/settings.json` | `.bak` on `claude_desktop_config.json` | `.bak` on Cursor config | `.bak` on `~/.codex/config.toml` and `~/.codex/AGENTS.md` |
300
- | Automatic conversation capture | Yes (hooks) | **No** — see [issue #8](https://github.com/amiramm/meko-mcp-server/issues/8) | Yes (hybrid hook mode) | **No** — Codex has no user-installable hooks; AGENTS.md prompts proactive memory tool calls instead |
301
- | Automatic memory persistence | Yes (hooks + skill) | Skill only (proactive `memory_add`) | Yes (hooks + skill) | Skill + AGENTS.md (proactive `memory_add`) |
339
+ | Automatic conversation capture | Yes (hooks) | **No** — see [issue #8](https://github.com/amiramm/meko-mcp-server/issues/8) | Yes (native hooks) | Yes (hooks via `~/.codex/hooks.json`) |
340
+ | Automatic memory persistence | Yes (hooks + skill) | Skill only (proactive `memory_add`) | Yes (hooks + skill) | Yes (hooks + skill + AGENTS.md) |
302
341
  | Skill install | Plugin marketplace (automatic) | `.skill` bundle auto-built, user drags into app | Copy into `.cursor/skills` | Copy into `~/.agents/skills/meko-mcp-tools/` |
303
342
  | Uninstall | Full automatic | MCP entry removed; skill must be removed manually from app | MCP + hooks + skills cleaned up | MCP entry, skill dir, and AGENTS.md block all cleaned up |
304
- | `agent_id` used by skill | `claude_code:<repo>` per project (via SessionStart hook); cross-project facts go to `meko_agent` | `claude_desktop` | `cursor:<repo>` per project (via Cursor hook); cross-project facts go to `meko_agent` | Whatever the agent derives by following the meko-mcp-tools skill (no hook injects an agent_id; the AGENTS.md block defers to the skill) |
343
+ | `agent_id` used by skill | `claude_code:<repo>` per project (via SessionStart hook); cross-project facts go to `meko_agent` | `claude_desktop` | `cursor:<repo>` per project (via Cursor hook); cross-project facts go to `meko_agent` | `claude_code:<repo>` per project (capture.js still classifies non-cursor hooks as the `claude_code` client; native `codex:<repo>` derivation is a follow-up); cross-project facts go to `meko_agent` |
305
344
  | Transport | HTTP only | HTTP (or stdio via hand-edited config) | HTTP only | HTTP (Codex's `bearer_token_env_var` model) |
306
- | Auth model | inline `Authorization: Bearer ...` header | inline header via `mcp-remote` | inline header | env-var name reference (`MEKO_API_KEY` exported in shell or via `launchctl setenv`) |
345
+ | Auth model | inline `Authorization: Bearer ...` header | inline header via `mcp-remote` | inline header | MCP server: env-var name reference (`MEKO_API_KEY` exported in shell or via `launchctl setenv`). Hooks: key written to `~/.codex/meko-env.sh` at mode 0600; each hook command sources the file before bash (no env block in Codex's hooks schema; see [Security](#security)). |
307
346
  | Project scope | Yes (`--scope project`) | No | Yes (`--scope project`) | No (warns and degrades to user scope) |
308
- | Deferred to a follow-up | — | `.mcpb` Desktop Extension packaging — see [issue #7](https://github.com/amiramm/meko-mcp-server/issues/7) | — | Auto-capture (blocked on upstream Codex exposing user-installable hooks) |
347
+ | Deferred to a follow-up | — | `.mcpb` Desktop Extension packaging — see [issue #7](https://github.com/amiramm/meko-mcp-server/issues/7) | — | Native `codex:<repo>` agent_id classification in capture.js |
309
348
 
310
349
  ## Cloud vs Local
311
350
 
@@ -323,10 +362,19 @@ The installer auto-detects cloud vs local based on the URL: any URL containing `
323
362
 
324
363
  ## Security
325
364
 
326
- **Where credentials are stored:**
365
+ **Where credentials are stored** (per client; all files inherit standard user-only filesystem permissions):
327
366
 
328
- - **API key header** -- stored in `~/.claude.json` (MCP server config, managed by `claude mcp add`). Readable only by the current user.
329
- - **`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.
367
+ - **Claude Code**
368
+ - API key header — stored in `~/.claude.json` (MCP server config, managed by `claude mcp add`).
369
+ - `MEKO_API_KEY` env var — written to `~/.claude/settings.json` under `env` so lifecycle hooks can authenticate with the MCP server.
370
+ - **Claude Desktop**
371
+ - `MEKO_API_KEY` env var — written to `claude_desktop_config.json` under `mcpServers.<name>.env`. The header itself uses `${MEKO_API_KEY}` interpolation in `args`, so the key value lives only in the `env` block.
372
+ - **Cursor**
373
+ - API key header — stored in `~/.cursor/mcp.json` (or `.cursor/mcp.json` for project scope) under `mcpServers.<name>.headers.Authorization`.
374
+ - `MEKO_API_KEY` env var — written to `~/.cursor/hooks.json` (native hook mode) and/or `~/.claude/settings.json` (claude-compat hook mode) under `env` so lifecycle hooks can authenticate.
375
+ - **OpenAI Codex (CLI + Desktop App)**
376
+ - MCP-server bearer reference — `~/.codex/config.toml` stores `bearer_token_env_var = "MEKO_API_KEY"`, **not** the key itself. The runtime env (shell rc or `launchctl setenv`) supplies the value.
377
+ - Hook commands — Codex's `~/.codex/hooks.json` schema rejects a top-level `env` block and provides no per-command env field, so the installer writes `MEKO_API_KEY` to `~/.codex/meko-env.sh` at **mode 0600** (user read/write only). Each Meko hook's `command` field sources that file before invoking bash, so the key never appears in process arguments — `ps -ef` from another user can't lift it while the hook runs. Same trust boundary as `~/.aws/credentials` or `~/.netrc` (file-system permissions on the user's home directory). To opt out: install for the local Meko URL (no key prompt), or skip Codex hook installation by deleting the Meko entries from `~/.codex/hooks.json` and removing `~/.codex/meko-env.sh` after install.
330
378
 
331
379
  **How credentials are protected:**
332
380
 
@@ -334,11 +382,12 @@ The installer auto-detects cloud vs local based on the URL: any URL containing `
334
382
  - `--dry-run` mode redacts the key in displayed commands (shown as `<set>`).
335
383
  - The API key is never logged to stdout or stderr during normal operation.
336
384
  - Interactive mode uses masked input (echoes `*` characters) when prompting for the API key.
337
- - 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.
385
+ - 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.
386
+ - During Codex installs, the installer emits a `warn`-level log line confirming where the API key has been written.
338
387
 
339
388
  **Backups:**
340
389
 
341
- 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.
390
+ Before modifying any config file the installer touches, it creates a `.bak` copy alongside the original (e.g. `~/.claude/settings.json.bak`, `~/.codex/config.toml.bak`, `~/.codex/AGENTS.md.bak`). The merge is additive: existing keys are preserved unless explicitly overridden.
342
391
 
343
392
  ## Upgrading
344
393
 
@@ -0,0 +1,44 @@
1
+ #!/usr/bin/env bash
2
+
3
+ # Cursor native beforeSubmitPrompt hook. It only reads local cache populated by
4
+ # cursor-session-start.sh; it never performs Meko network calls.
5
+
6
+ SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
7
+
8
+ load_cursor_hook_env() {
9
+ if [ -n "${MEKO_MCP_URL:-}" ]; then
10
+ return
11
+ fi
12
+ eval "$(node -e '
13
+ const fs = require("fs");
14
+ const path = require("path");
15
+ function shellQuote(value) {
16
+ return "'"'"'" + String(value).replace(/'"'"'/g, "'"'"'\\'"'"''"'"'") + "'"'"'";
17
+ }
18
+ const candidates = [
19
+ path.join(process.cwd(), ".cursor", "hooks.json"),
20
+ path.join(process.env.HOME || "", ".cursor", "hooks.json"),
21
+ ];
22
+ for (const file of candidates) {
23
+ try {
24
+ const cfg = JSON.parse(fs.readFileSync(file, "utf8"));
25
+ const env = cfg && cfg.env && typeof cfg.env === "object" ? cfg.env : {};
26
+ const out = [];
27
+ for (const key of ["MEKO_MCP_URL", "MEKO_API_KEY"]) {
28
+ if (typeof env[key] === "string" && env[key]) {
29
+ out.push(`export ${key}=${shellQuote(env[key])}`);
30
+ }
31
+ }
32
+ if (out.length) {
33
+ process.stdout.write(out.join("\n"));
34
+ break;
35
+ }
36
+ } catch {}
37
+ }
38
+ ')"
39
+ }
40
+
41
+ load_cursor_hook_env
42
+ HOOK_INPUT="$(cat)"
43
+
44
+ printf '%s' "$HOOK_INPUT" | MEKO_HOOK_CLIENT=cursor node "$SCRIPT_DIR/lib/capture.js" before-submit-prompt
@@ -0,0 +1,42 @@
1
+ #!/usr/bin/env bash
2
+
3
+ # Cursor native SessionStart hook. Cursor only documents context injection from
4
+ # SessionStart, so this wrapper returns the Meko context synchronously.
5
+
6
+ SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
7
+
8
+ load_cursor_hook_env() {
9
+ if [ -n "${MEKO_MCP_URL:-}" ]; then
10
+ return
11
+ fi
12
+ eval "$(node -e '
13
+ const fs = require("fs");
14
+ const path = require("path");
15
+ function shellQuote(value) {
16
+ return "'"'"'" + String(value).replace(/'"'"'/g, "'"'"'\\'"'"''"'"'") + "'"'"'";
17
+ }
18
+ const candidates = [
19
+ path.join(process.cwd(), ".cursor", "hooks.json"),
20
+ path.join(process.env.HOME || "", ".cursor", "hooks.json"),
21
+ ];
22
+ for (const file of candidates) {
23
+ try {
24
+ const cfg = JSON.parse(fs.readFileSync(file, "utf8"));
25
+ const env = cfg && cfg.env && typeof cfg.env === "object" ? cfg.env : {};
26
+ const out = [];
27
+ for (const key of ["MEKO_MCP_URL", "MEKO_API_KEY"]) {
28
+ if (typeof env[key] === "string" && env[key]) {
29
+ out.push(`export ${key}=${shellQuote(env[key])}`);
30
+ }
31
+ }
32
+ if (out.length) {
33
+ process.stdout.write(out.join("\n"));
34
+ break;
35
+ }
36
+ } catch {}
37
+ }
38
+ ')"
39
+ }
40
+
41
+ load_cursor_hook_env
42
+ MEKO_HOOK_CLIENT=cursor node "$SCRIPT_DIR/lib/capture.js" session-start