MCP Server

The MCP server accepts agent connections over HTTP/SSE and dispatches JSON-RPC requests to the appropriate tool handlers.

Endpoints

EndpointMethodDescription
/sseGETSSE stream — agents connect here for JSON-RPC messages
/messagePOSTSend JSON-RPC requests to the server
/healthGETReturns {"status":"ok"} — no auth required

Connection Flow

Agent GET /sse
  -> SSE stream opens
Agent POST /message {"jsonrpc":"2.0","method":"initialize",...}
  -> server creates session, sends initialize response via SSE
Agent POST /message {"jsonrpc":"2.0","method":"tools/list"}
  -> server sends tools/list response via SSE
Agent POST /message {"jsonrpc":"2.0","method":"tools/call",...}
  -> server dispatches to tool handler, sends result via SSE
Agent disconnects
  -> session closed, request_count flushed to DB

Connection Limiting

The server tracks active SSE connections via an atomic counter. When the limit is reached (configurable via mcp.max_connections), new SSE connections receive a 429 Too Many Requests response.