Repository navigation
v1.8.0
Added
-
MCP over Streamable HTTP at
/mcpon the REST server — many sessions, one store. (#92)Until now the only MCP transport was stdio, so every Claude Code session spawned its own server, and two sessions on one repo (a main checkout and a worktree) put two processes on one SQLite file, which
docs/concurrency.mdforbids. A hosted instance (Railway, Cloud Run, the Docker image) was reachable by REST only, which no MCP client speaks.fozikio serve --restnow also serves MCP at/mcp(src/mcp/http.ts): stateful sessions keyed by the SDK'smcp-session-id, oneServer+StreamableHTTPServerTransportper client over the oneEngineContext, the same tool list as stdio (the/api/tools/:nameblocklist guards the generic REST endpoint, not an agent's own session). Auth is the REST token, inx-cortex-tokenorAuthorization: Bearer. An unknown session id answers 404 and a non-initialize request with no session 400, as the spec says..mcp.jsonfor a local shared server or a hosted one:{ "type": "http", "url": "…/mcp", "headers": { "x-cortex-token": "${CORTEX_API_TOKEN}" } }.createMcpServer(engine)builds aServerover an existing engine;createServer(config)wraps it as before.startRestServerreturns thehttp.Server(it returnedvoid) so a caller can read the bound port or close it; the start-up log names the/mcpURL. Tests drive the mounted endpoint with the SDK's own client: initialize → tools/list → tools/call, both auth headers and the 401, two clients with distinct sessions over one engine, the 404/400 cases.docs/deploy-railway.md,docker-compose.yml, the README anddocs/concurrency.mdsay how to use it.Observed while proving it against a live store: the first LLM-backed call after ollama loads a 14B model cold took about 80 s, past the SDK client's 60 s default request timeout; warm calls take seconds. A client that may hit a cold model should raise its per-request timeout, or the model should be kept loaded.