MCP and IDE Integration
- Three ways an editor or agent host reaches Cymatix: the MCP shim
(Claude Code, Codex, Gemini CLI, Antigravity — any MCP host), the
OpenAI-compatible proxy
(Continue, or any client that honors
OPENAI_BASE_URL), and raw HTTP API. - The MCP adapter is a thin shim, not a second engine. It speaks stdio
JSON-RPC to the host and proxies every tool call over HTTP to a running
cymatix-server. It does no retrieval of its own — so the backend must be up, and everything on Configuration applies unchanged. Since 0.12.0 the same tools can also be served over loopback streamable HTTP (cymatix mcp serve --http) for clients that cannot spawn a stdio process; stdio stays the default. See Streamable HTTP transport. - The default tool surface is deliberately lean. Every registered tool's
name, description, and JSON schema is injected into the host's context on
every turn, so the default profile is eleven core tools, hiding the admin,
diagnostic, and legacy surface behind
CYMATIX_MCP_FULL=1. - Canonical
cymatix_document_*names are the ones to call. The legacy biology-named tools still work under the full surface, with a deprecation nudge in their docstrings. Nothing was removed. (The canonical names come from the Tier-2 lexicon pass, #419, which follows the 0.9.1 tag — on a 0.9.1 wheel call the legacy names.) - The consuming agent must carry the prompt fragment. Without it, capable
models paint over
do_not_answer_from_genome: trueand answer from their training prior anyway. See Agent Contract.
Setup
Install the extra, run the backend, then register the shim:
pip install "cymatix-context[mcp]"
cymatix-server # binds 127.0.0.1:11437
For Claude Code, Claude Desktop, Cursor, and Gemini CLI the CLI can write the entry for you:
cymatix mcp install --host claude-code # or claude-desktop, cursor, gemini-cli
cymatix mcp install --host claude-code --dry-run # print the entry, write nothing
It writes the cymatix-context entry (with CYMATIX_MCP_HOST and
CYMATIX_AGENT_KIND set to the host) after backing the target file up; on an
existing entry it keeps your command, args, and env keys and rewrites only
CYMATIX_MCP_URL and the host tags. By hand:
{
"mcpServers": {
"cymatix-context": {
"command": "python",
"args": ["-m", "cymatix_context.mcp_server"],
"cwd": "/absolute/path/to/your/project",
"env": {
"CYMATIX_MCP_URL": "http://127.0.0.1:11437"
}
}
}
}
- Claude Code reads this from a project-level
.mcp.jsonor the user-level~/.claude.json. Gemini CLI (.gemini/settings.json) and Antigravity (~/.gemini/config/mcp_config.json) take the samemcpServersentry; Codex takes the equivalent[mcp_servers.cymatix-context]table in.codex/config.toml(cymatix mcp installdoes not write TOML). The native shapes and the per-hostCYMATIX_MCP_HOSTvalues (codex,gemini-cli,antigravity) are in the guides underdocs/clients/. Direct MCP needs neither the model proxy nor the tray; a healthy headless server is sufficient. - Lanes. If you run extra servers under
[[lanes]](0.11.0),cymatix mcp laneslists each lane's port and entry name, andcymatix mcp install --host ... --lane NAMEadds acymatix-context-<lane>entry beside the primary one, so one host can reach several stores. - The server self-identifies as
cymatixand its tools are namedcymatix_*. Hosts prefix them with the entry name, so Claude Code showsmcp__cymatix-context__cymatix_health. - On Windows, wrap the stdio launcher as
cmd /c python ...whenpythonis not directly resolvable in the host's spawn environment.
Streamable HTTP transport (0.12.0)
cymatix mcp serve --http # 127.0.0.1:11441, lane stable, profile lean
cymatix mcp serve --http --profile remote-read # read tools only
- Stateless streamable HTTP at
/mcp, added in #543. Flags:--port(default11441),--lane(defaultstable; that lane's port becomes the proxied Cymatix URL),--profile lean|full|remote-read(defaultlean, the same tools as stdio). Like stdio, it proxies to a runningcymatix-server. - Loopback only.
--hostother than127.0.0.1exits 2. DNS-rebinding refusal: a request whoseHostorOriginis not loopback is rejected. remote-readexposes only the eight retrieval and document-read tools (cymatix_context,cymatix_context_packet,cymatix_healthand the fivecymatix_document_*tools), with no ingest or session tools. It fails closed: the server refuses to start if the surface cannot be pruned to exactly that set.- Identity per request.
X-Cymatix-Agent,X-Cymatix-UserandX-Cymatix-PartyoverrideCYMATIX_AGENT,CYMATIX_USERandCYMATIX_PARTY_IDfor that request only. Values are trimmed, empty means unset, and a value that does not match^[A-Za-z0-9._:@-]{1,64}$is ignored. Stdio ignores these headers. - The headers are labels, not authentication. To require a credential,
set
CYMATIX_MCP_HTTP_TOKENwhen serving; a request withoutAuthorization: Bearer <token>then gets 401. - No shared working set. Over HTTP a caller's
session_idis ignored and session delivery elision is off (ignore_delivered), so remote clients never share or touch another session's delivered set. - Retrieval-inert: the transport changes how tools are reached, not what they return.
The tool surface
Core set — what ships by default (eleven tools).
| Tool | Does | Backed by |
|---|---|---|
cymatix_document_query |
Build a compressed context window for a query | POST /context |
cymatix_context |
The same operation under its original name | POST /context |
cymatix_context_packet |
Agent-safe bundle: verified / stale_risk items plus the reread plan and a know / miss block |
POST /context/packet |
cymatix_document_get |
Fetch one document by id | GET /genes/{id} |
cymatix_document_preview |
Which documents would be selected — retrieval through candidate selection, no compression. Takes max_docs |
GET /debug/preview |
cymatix_document_fingerprint |
Scores and pointers, no content. Takes max_results, profile |
POST /fingerprint |
cymatix_document_neighbors |
Top-k neighbors for a query. Takes k (default 10) |
GET /debug/neighbors |
cymatix_ingest |
Contribute content to the knowledge store | POST /ingest |
cymatix_health |
Readiness probe — compressor, document count, upstream | GET /health |
cymatix_sessions_list |
Sibling-agent awareness: who else is registered | GET /sessions |
cymatix_announce |
Self-report the agent's model_id (and optionally override the detected IDE) for the dashboard badge. Call once, after cymatix_health |
POST /sessions/{participant}/announce |
cymatix_document_query defaults its session_id to the MCP subprocess's own
session, so repeated calls within one host session elide already-delivered
documents automatically. (Over the HTTP transport, elision is off.)
Canonical and legacy names. The five document_* tools are thin
pass-throughs to existing handlers — identical behavior, better names.
| Canonical (in the core set) | Legacy (full surface only) |
|---|---|
cymatix_document_query |
cymatix_context (also in the core set) |
cymatix_document_get |
cymatix_gene_get |
cymatix_document_preview |
cymatix_splice_preview |
cymatix_document_fingerprint |
cymatix_fingerprint |
cymatix_document_neighbors |
cymatix_neighbors |
CYMATIX_MCP_FULL=1 unhides everything else — 25 tools in total. Set it
in the same env block. What appears:
- Retrieval / store:
cymatix_refresh_targets,cymatix_stats,cymatix_resonance,cymatix_consolidate, plus the legacy names above. - Session registry:
cymatix_session_recent. - HITL events:
cymatix_hitl_emit,cymatix_hitl_recent. - Operational:
cymatix_metrics_tokens,cymatix_bridge_status,cymatix_swap_db.
Accepted truthy values: 1, true, yes, on. Pruning is non-fatal — if the
adapter cannot enumerate or remove a tool it logs a warning and leaves the full
surface exposed. Correctness over token savings.
Identity
The eight identity variables are not optional in spirit. Anything you omit
falls back to a default that erodes attribution: badges read unknown and the
authored_by_* columns fill with mcp-<pid> instead of your handle.
"env": {
"CYMATIX_MCP_URL": "http://127.0.0.1:11437",
"CYMATIX_ORG": "your-org",
"CYMATIX_PARTY_ID": "your-device",
"CYMATIX_DEVICE": "your-device",
"CYMATIX_USER": "you",
"CYMATIX_AGENT": "laude",
"CYMATIX_AGENT_KIND": "claude-code",
"CYMATIX_MCP_HANDLE": "laude",
"CYMATIX_MCP_HOST": "claude-code"
}
| Variable | What it sets |
|---|---|
CYMATIX_MCP_URL |
Backend base URL. Default http://127.0.0.1:11437 |
CYMATIX_MCP_TIMEOUT |
Per-request timeout in seconds. Default 30 |
CYMATIX_MCP_HANDLE |
This session's handle in the registry. Default mcp-<pid> |
CYMATIX_PARTY_ID |
Party this participant belongs to. Falls back to CYMATIX_DEVICE, then CYMATIX_PARTY, then the hostname |
CYMATIX_MCP_HOST |
Which IDE spawned the process — becomes a capability tag. Optional since 2026-05-06: the adapter auto-detects the host from VSCODE_PID / CURSOR_TRACE_ID. Set it only to override the detection |
CYMATIX_AGENT_KIND |
The vendor/family axis (claude-code, gemini-cli, codex) — orthogonal to host |
CYMATIX_ORG / CYMATIX_USER / CYMATIX_AGENT / CYMATIX_DEVICE |
The four attribution layers stamped on ingested content |
CYMATIX_ADMIN_TOKEN |
Sent as Authorization: Bearer <token> on every call (0.11.0). Set it when the server has [server] admin_token, or cymatix_ingest gets a 401 |
CYMATIX_MCP_FULL |
Expose the full tool surface |
CYMATIX_MCP_HTTP_TOKEN |
Server side, HTTP transport only (0.12.0): the bearer cymatix mcp serve --http requires when set |
Per-host conventions:
| Host | CYMATIX_MCP_HOST |
Typical CYMATIX_AGENT |
|---|---|---|
| Claude Code (CLI) | claude-code |
laude |
| Claude Desktop | claude-desktop |
laude |
| Antigravity (Gemini) | antigravity |
raude |
| Cursor | cursor |
taude |
| VS Code Continue | vscode-continue |
laude or per-user |
How a call actually travels
Two hops, always:
Claude Code --stdio JSON-RPC--> cymatix_context.mcp --HTTP--> cymatix-server
(host) (thin adapter) 127.0.0.1:11437
- On subprocess start the adapter registers itself as a participant:
it reads the identity env, posts to
/sessions/register, starts a heartbeat, and attaches capability tags["mcp_tools", "host:<CYMATIX_MCP_HOST>"]. Registration failure is non-fatal — tool calls still proxy, and a warning is logged to the adapter's stderr. - On every tool call the adapter wraps the arguments into an HTTP request, attaches the four identity layers on ingest paths, and forwards the response back over stdio.
- On heartbeat it pings
/sessions/{participant}/heartbeaton a timer. Stop the host process and the participant TTLs out naturally.
Verifying the route. Ask the agent to call cymatix_health, then check the
launcher dashboard (cymatix-launcher, at http://127.0.0.1:11438): the
Parties panel should show your CYMATIX_PARTY_ID, Identities your
CYMATIX_USER workspace, and Agents a participant matching
CYMATIX_MCP_HANDLE with the host:<...> capability tag. Without the
launcher, curl -s http://127.0.0.1:11437/sessions lists the same
participants.
| Symptom | Cause | Fix |
|---|---|---|
| Tool calls return network errors | CYMATIX_MCP_URL unreachable; backend not running |
Start cymatix-server |
cymatix_ingest returns 401 |
The server has [server] admin_token set |
Set CYMATIX_ADMIN_TOKEN in the env block |
cymatix_ingest returns 409 |
The store is frozen | Unfreeze it in the dashboard; see Troubleshooting |
| Calls work but no participant in the dashboard | Registration silently failed | Read the adapter's stderr for the _register_with_registry warning |
Ingested content shows agent=unknown |
CYMATIX_AGENT unset in the MCP env |
Set it in the env block |
Agent appears as mcp-<pid> |
CYMATIX_MCP_HANDLE did not carry |
Set it, or accept the per-process unique default |
| Two panels collide on one handle | Both share CYMATIX_MCP_HANDLE |
Give each a distinct handle, or omit it |
cymatix_sessions_list empty |
The bridge import failed at adapter startup | Check the adapter's startup log — usually a missing dependency in the spawn environment |
| Only eleven tools visible | The lean default profile | Set CYMATIX_MCP_FULL=1 |
The agent-side skill
skills/cymatix-context/SKILL.md
is the contract the agent follows when calling these tools — the identity
contract and the tool-use rules, portable across the four hosts. It is purely
instructional; it runs no code. Install it project-scoped or user-global (the
Claude Code paths are shown; Gemini CLI and Antigravity paths are in their
guides):
mkdir -p .claude/skills/cymatix-context
cp <repo>/skills/cymatix-context/SKILL.md .claude/skills/cymatix-context/SKILL.md
# or once, for every project
mkdir -p ~/.claude/skills/cymatix-context
cp <repo>/skills/cymatix-context/SKILL.md ~/.claude/skills/cymatix-context/SKILL.md
Continue IDE
models:
- name: Cymatix (Local)
provider: openai
model: gemma3:e4b
apiBase: http://127.0.0.1:11437/v1
apiKey: EMPTY
roles: [chat]
defaultCompletionOptions:
contextLength: 128000
maxTokens: 4096
Use Chat mode, not Agent mode. The proxy intercepts messages and injects
context; it does not route tool calls. Agent mode will appear to work and then
fail on the first tool invocation. If you want tool-shaped access from
Continue, add the mcpServers block above instead.
OpenAI-compatible proxy
OPENAI_BASE_URL=http://localhost:11437/v1 your-app
Zero code changes. Cymatix intercepts the messages, runs the retrieval
pipeline, injects the assembled window into the system message, and forwards to
[server] upstream. Details: HTTP API.
Which surface to pick
| Surface | Best for | Trade-off |
|---|---|---|
| MCP | Claude Code, Codex, Gemini CLI, Antigravity — agents that should decide when to retrieve | Costs schema tokens every turn; needs the backend running |
| HTTP proxy | Continue, or any OpenAI-compatible app you cannot modify | Retrieval is automatic and unconditional; no tool routing |
| CLI | Scripts, CI, subprocess-driving agents, cold starts | No daemon at all, but pays process start-up per call. See CLI |
All three run the same pipeline against the same store and return the same JSON shapes, so an integration can move between them without changing its parser.
Tool responses keep legacy field names on the wire by default — gene_id in
a cymatix_document_get or cymatix_document_neighbors result is verbatim,
not a leak from an unconverted page. The tool names and the prose moved to
software terms. Renaming the JSON contract breaks every existing consumer, so
it ships only as the experimental opt-in [budget] wire_format = "canonical"
(0.10.0, #417),
which switches tags, headers, and JSON fields across HTTP, CLI, and MCP; pair
it with full_fragment(wire_format="canonical"). See Lexicon.
Go deeper
docs/clients/cymatix-context.md— the shared cross-host overview, with native guides for Codex, Gemini CLI, and Antigravitydocs/clients/claude-code.md— the routing reference: the two hops, the full identity contract, per-host variants, request lifecycledocs/api/mcp-tools.md— per-tool input schemasskills/cymatix-context/SKILL.md— the agent-side identity contract and tool-use rulesdocs/architecture/SESSION_REGISTRY.md— the server-side presence and attribution modeldocs/agent-sdk-fragment.md— the prompt fragment the consuming agent must carry- Next: Agent Contract · HTTP API · CLI · Getting Started