Skip to content

MCP Adapter

ctxctl mcp is an optional adapter that serves the same five commands as MCP tools over stdio. The CLI remains the canonical interface; nothing about it changes when the adapter runs.

Tool Wraps
ctxctl_outline outline <file>
ctxctl_symbol symbol <file> --name <s>
ctxctl_read read <file> --lines N-M
ctxctl_deps deps <file>
ctxctl_exec exec <cmd> [--keep <pat>]

Results come back as plain text with the same saved% metrics as the CLI, wrapped as { content: [{ type: "text", text }] }. Failures (missing file, unknown symbol, bad arguments) surface as isError: true results, never protocol errors. A ctxctl_exec call whose wrapped command exits non-zero prefixes the text with exit code N.

Add ctxctl to any MCP client that launches stdio servers:

{
"mcpServers": {
"ctxctl": {
"command": "ctxctl",
"args": ["mcp"]
}
}
}

This shape works in opencode, Cursor, Claude Desktop, and other MCP-native clients.

  • Newline-delimited JSON-RPC 2.0 over stdio.
  • initialize responds with protocolVersion: "2025-03-26", tool capabilities, and server info (name: "ctxctl").
  • Notifications (messages without an id) produce no response.
  • Malformed JSON gets JSON-RPC error -32700; an id-carrying message without a method gets -32600 (invalid request); unknown methods get -32601.
  • Config resolution is identical to the CLI, including --config.
  • The server exits 0 on clean stdin EOF.