Expand description
Model Context Protocol (MCP) server for grr.
Hand-rolled JSON-RPC 2.0 over stdio — no SDK crate: a tool-only server needs five methods. Newline-delimited requests in, one response line per request out, logs to stderr ONLY (stdout is the MCP stream, the same discipline as the rest of grr).
initialize— protocol-version negotiation + capabilitiesnotifications/initialized— a notification; never answeredtools/list— every method in the Discovery index as a tooltools/call— one method invocation through the shared call pathping— an empty result
Tool names are the dotted method ids grr api call takes
(gmail.users.messages.list), so an agent reaches every method Google
publishes through the same resolution the CLI uses. Errors never kill
the server: a tool failure is an isError result (MCP’s tool-error
contract), a protocol failure a JSON-RPC error object.
{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-11-25"}}
{"jsonrpc":"2.0","method":"notifications/initialized"}
{"jsonrpc":"2.0","id":2,"method":"tools/list"}
{"jsonrpc":"2.0","id":3,"method":"tools/call",
"params":{"name":"gmail.users.messages.list","arguments":{"userId":"me","dry_run":true}}}Structs§
- McpServer
- One server instance: one credential, one safety profile, every tool.
The stdio loop is single-tasked, so no
Arcis needed.
Functions§
- serve
- The stdio loop: newline-delimited JSON-RPC in, one response line per request out. Generic over the reader/writer so tests can run the whole handshake in-process. EOF on stdin (the client closed the session) is a clean shutdown.