Expand description
MCP ServerHandler implementation.
Tool surface, top to bottom:
- Always registered:
ping; the source tools (read_source,grep,list_source) gated on an active source-roots provider;repo_management(no-ops outside--workspacemode). - Conditionally registered at boot (dynamic):
github_issuesandgithub_api— only whenGITHUB_TOKENis reachable. This is “honest tool listing”: agents see the tools only when they can succeed. Decision is boot-time; restart the server to pick up a token that appears later.set_root_dir— only when the bound workspace is local-flavoured (workspace.kind: local); swaps the active root at runtime.- Manifest-declared
python:tools andcypher:tools — added by downstream binaries throughapply_python_extensions.
The source-roots provider is dynamic — workspace mode swaps it as
the active repo changes; source-root and watch modes wire it to a
fixed root; local-workspace mode rebinds it on set_root_dir. An
empty list signals “no active source” and the tools return a
friendly error rather than failing the call.
Per-server state held on McpServer (cloned per request via Arc):
a ServerOptions struct (providers + workspace handle + manifest
builtins) and the rmcp ToolRouter. The github_issues closure
additionally captures an Arc<Mutex<ElementCache>> so FETCH calls
can cache collapsed elements (cb_N, patch_N, comment_N,
overflow) for the agent to drill into via element_id on
subsequent calls — no re-fetching.
Structs§
- Github
ApiArgs - Github
Issues Args - Grep
Args - List
Source Args - McpServer
- MCP server backed by the rmcp framework.
- Ping
Args - Read
Source Args - Repo
Management Args - Server
Options - Per-server runtime state shared by every tool dispatch.
- SetRoot
DirArgs
Type Aliases§
- Repo
Provider - Provider returning the active GitHub repo (e.g.
"pydata/xarray") orNonewhen nothing is bound. Workspace mode wires this to the active workspace repo; single-graph mode can pin a fixed value.