Skip to main content

Module mcp_dispatch

Module mcp_dispatch 

Source
Expand description

v0.10.2 — transport-agnostic MCP JSON-RPC dispatcher.

Until v0.10.1 the MCP server logic lived behind rmcp’s stdio transport (crate::mcp::serve_stdio); the only way an MCP client could reach Solo’s tools was by spawning solo mcp-stdio as a subprocess. v0.10.2 adds an HTTP transport on /mcp so a single solo daemon --http-port process can serve BOTH /v1/graph/* (REST, for solo-web) and /mcp (JSON-RPC, for solo-jarvis) without the writer-lock dance.

The dispatcher is the request -> response funnel that both transports call into identically. It carries no transport-specific state — it holds an Arc<SoloMcpServer> and routes JSON-RPC method names to the existing direct-dispatch entry points (SoloMcpServer::dispatch_list_tools + SoloMcpServer::dispatch_tool). Today the stdio loop continues to use rmcp’s ServerHandler impl (which handles MCP framing for us); the HTTP route uses this dispatcher directly to avoid hand-rolling framing for one-shot request/response.

§Supported methods

  • initialize — returns the same ServerInfo shape rmcp emits over stdio. v0.10.2 returns the static info; the sampling-capability gating that lives in [crate::mcp::SoloMcpServer::initialize] is stdio-only because there’s no Peer<RoleServer> over HTTP. HTTP clients that try to drive mcp_sampling-mode tenants will see sampling errors at tool-call time instead. Documented in the dev log for v0.10.2.
  • tools/list — returns SoloMcpServer::dispatch_list_tools.
  • tools/call — returns SoloMcpServer::dispatch_tool.
  • ping — returns an empty object. Useful for HTTP-client liveness probes without paying the cost of tools/list.
  • Anything else returns MethodNotFound per JSON-RPC 2.0.

§Notifications

JSON-RPC notifications carry no id field; per spec the server MUST NOT respond. dispatch_notification accepts these (e.g. notifications/initialized) and returns ().

§Out of scope (deferred to v0.10.3+)

  • Mcp-Session-Id session affinity
  • Resumable streams with Last-Event-ID
  • Server-initiated requests over the GET SSE stream
  • Per-tool streaming (progress events during long tool calls)

Structs§

JsonRpcErrorBody
JsonRpcErrorResponse
JSON-RPC 2.0 error response envelope. id is Value::Null when the server could not read the request id (parse error / unreadable envelope); otherwise it echoes the request id back so the client can correlate.
JsonRpcRequest
JSON-RPC 2.0 request envelope used by the HTTP transport.
JsonRpcSuccess
JSON-RPC 2.0 successful response envelope.
McpDispatcher
Transport-agnostic MCP dispatcher used by the v0.10.2 HTTP /mcp route. Holds the per-tenant SoloMcpServer needed to answer tools/list and tools/call.

Enums§

JsonRpcResponse
Either a success or error response, serialised as a single JSON-RPC 2.0 message on the wire. serde(untagged) so both shapes share the {jsonrpc, id, ...} prefix and are distinguished by the presence of result vs. error.