Skip to main content

Module server

Module server 

Source
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§

AprMcpServer
MCP server exposing the apr CLI as tools.
CancelHandle
Per-request cancellation record held in AprMcpServer::in_flight.

Type Aliases§

NotificationSink
Callback used by tools to emit notifications/progress messages back to the MCP client while a long-running tools/call is still in flight.