Skip to content

ctx mcp

ctx mcp serve runs a Model Context Protocol server over stdio. Compatible MCP clients (Claude Code, Cursor, opencode, MCP Inspector) can connect and call ctx pipelines as tools.

Terminal window
ctx mcp serve # long-running stdio server
ctx mcp tools # list exposed tools (debug)
ToolWrapsUse case
ctx_execpipelines::exec::run_proxy_captureRun a shell command with compression
ctx_searchpipelines::catalog::searchSemantic search in a catalog
ctx_mappipelines::map::runGenerate a repo map
ctx_listpipelines::catalog::list_collectionsList indexed catalogs
ctx_graph_indexpipelines::graph::indexIndex the symbol graph
ctx_callerspipelines::graph::callersWho calls symbol X?
ctx_calleespipelines::graph::calleesWhat does symbol X call?
ctx_tracepipelines::graph::traceCaller chain up to depth
ctx_impactpipelines::graph::impactWhat breaks on change?
ctx_nodepipelines::graph::nodeWhere is X defined?

ctx install --agent claude-code writes this into ~/.claude/settings.json:

{
"mcpServers": {
"ctx": {
"command": "ctx",
"args": ["mcp", "serve"],
"_installer": "ctx"
}
}
}

The _installer: "ctx" marker lets ctx uninstall remove only our entries without touching MCP servers added by other tools.

Terminal window
# Send initialize + tools/list to a running ctx mcp serve
(
echo '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"test","version":"0.1"}}}'
echo '{"jsonrpc":"2.0","method":"notifications/initialized"}'
echo '{"jsonrpc":"2.0","id":2,"method":"tools/list","params":{}}'
sleep 1
) | ctx mcp serve

Built on top of rmcp 1.7 with schemars 1.0 for automatic JSON schema generation. Each tool is an async fn annotated with #[tool(...)] and the schema is derived from the input struct.

See src/integrations/mcp/server.rs for the full implementation (~250 lines for all 10 tools).