Expand description
AprMcpServer — JSON-RPC 2.0 dispatcher for aprender MCP tools.
§Cancellation model (FALSIFY-MCP-006)
tools/call requests that target apr.run are dispatched on a worker
thread so the main stdio loop can continue reading and honour
notifications/cancelled. Each in-flight call registers a CancelHandle
in AprMcpServer::in_flight, keyed by request id. A matching
notifications/cancelled signals the worker’s cancel channel; the worker
then SIGTERMs the spawned apr subprocess, waits
crate::tools::subprocess::CANCEL_GRACE_MS, and SIGKILLs if still alive.
Non-cancellable tool calls still run on a worker (so future concurrent
calls don’t block notifications/cancelled routing) but their cancel
channels are never signalled. initialize, tools/list, and other
fast synchronous methods dispatch inline on the main thread.
Structs§
- AprMcp
Server - MCP server exposing the
aprCLI as tools. - Cancel
Handle - Per-request cancellation record held in
AprMcpServer::in_flight.
Type Aliases§
- Notification
Sink - Callback used by tools to emit
notifications/progressmessages back to the MCP client while a long-runningtools/callis still in flight.