$npx -y skills add AgamiAI/agami-core --skill agami-serveWires the local agami MCP server (python -m mcp_harness) into the Claude Desktop app in one step, so you can ask your database questions from Claude Desktop — not just inside Claude Code. Auto-detects the right Python interpreter (the one with your DB driver), installs the agami-
| 1 | # agami serve — wire the local MCP server into Claude Desktop |
| 2 | |
| 3 | You are setting up the local agami **MCP server** so the user can query their |
| 4 | database from the **Claude Desktop app** (or any client that reads a |
| 5 | `claude_desktop_config.json`-style file). This is the local mirror of the hosted |
| 6 | "Ask Agami" connector: same tool surface (`list_datasources`, |
| 7 | `get_datasource_schema`, `get_prompt_examples`, `execute_sql`), |
| 8 | but backed by the user's local model + local execution. Everything stays on the |
| 9 | machine; the server is stdio-only, has no auth, and makes no network call. |
| 10 | |
| 11 | The heavy lifting is done by a deterministic helper — |
| 12 | [`scripts/setup_desktop_mcp.py`](../../scripts/setup_desktop_mcp.py). This skill's |
| 13 | job is to run it, read its output, and handle the two things that need a human: |
| 14 | a missing DB driver, and the app restart. |
| 15 | |
| 16 | ## Conversation style |
| 17 | |
| 18 | - **Tight.** This is a one-shot setup tool, not a tutorial. Run the helper, report what it did, give the restart line. |
| 19 | - **Honest about surfaces.** Claude Desktop is the target here; if the user is already in Claude Code, remind them the skills already work there — the MCP server is for *other* clients. |
| 20 | |
| 21 | --- |
| 22 | |
| 23 | ## Phase −1: Plan-mode preflight |
| 24 | |
| 25 | Run the detection + ask logic from [`shared/plan-mode-check.md`](../../shared/plan-mode-check.md). This skill needs Bash (to run the helper, which writes files). If plan mode is active, refuse with: *"I can't wire up Claude Desktop in plan mode — it installs the agami-core package and writes your desktop config. Switch to **Auto** or **Edit Automatically** mode (Shift+Tab to cycle) and re-invoke me."* **DO NOT write a plan file. DO NOT call `ExitPlanMode`.** |
| 26 | |
| 27 | ## Phase 0: Preflight |
| 28 | |
| 29 | 1. **Credentials present** — `<artifacts_dir>/local/credentials` must exist for the active profile. If missing, invoke `/agami-connect` first; the server needs a connection to execute against. |
| 30 | 2. **Model present** — `<artifacts_dir>/<profile>/org.yaml` must exist (so the server has a semantic model to serve). If not, invoke `/agami-connect`. |
| 31 | 3. **Profile** — default to the active profile. If `$ARGUMENTS` names a profile, pass it through as `--profile <name>`. |
| 32 | |
| 33 | ## Phase 1: Run the setup helper |
| 34 | |
| 35 | Show the plan first with `--dry-run`, then do it for real: |
| 36 | |
| 37 | ```bash |
| 38 | # 1. Preview (writes nothing) |
| 39 | python3 "$AGAMI_PLUGIN_ROOT/scripts/setup_desktop_mcp.py" --dry-run |
| 40 | |
| 41 | # 2. Apply |
| 42 | python3 "$AGAMI_PLUGIN_ROOT/scripts/setup_desktop_mcp.py" |
| 43 | ``` |
| 44 | |
| 45 | Pass `--profile <name>` if the user named one. (Installation goes through `sm install`, |
| 46 | which does an editable install automatically when run from a dev checkout — no flag needed.) |
| 47 | |
| 48 | ## Phase 2: Handle the two human cases |
| 49 | |
| 50 | - **Driver missing (exit code 3).** The helper couldn't find a Python that can |
| 51 | import the DB driver. Relay its suggested `pip install ...` line, offer to run |
| 52 | it, then re-run the helper. Example: `python3 -m pip install psycopg2-binary`. |
| 53 | - **Wrote successfully.** Tell the user, in one or two lines: |
| 54 | 1. **Fully quit** the Claude Desktop app (Cmd+Q on macOS — not just close the window), then reopen it. |
| 55 | 2. In Claude Desktop, ask *"What datasources does agami see?"* — it should call `list_datasources` and return their profiles. |
| 56 | 3. If it doesn't appear, the log is at `~/Library/Logs/Claude/mcp-server-agami.log`. |
| 57 | |
| 58 | ## Phase 3: Orient them (one short paragraph) |
| 59 | |
| 60 | Close with: this is the same toolset their business end-users would use through |
| 61 | the hosted Agami connector — the only difference is the backend (their local |
| 62 | files vs a shared, governed, always-on cloud). So what they just felt in Claude |
| 63 | Desktop *is* the end-user experience. If they want it for a team (one shared |
| 64 | model, evals, governance, reachable from web/mobile/Cowork), that's the hosted |
| 65 | product — see `docs/open-vs-hosted.md` in the repo |
| 66 | (https://github.com/AgamiAI/agami-core/blob/main/docs/open-vs-hosted.md). |
| 67 | |
| 68 | ## Notes |
| 69 | |
| 70 | - The setup is **idempotent** — re-running updates the `agami |