Repository navigation
ASNT-98: Serve the agent bridge as an MCP server #110
Description
Overview
An agent using the loopback bridge today spends every call on a shell round-trip: read the endpoint file, sed the token out, hand-quote JSON. stage_findings is the worst of it, and hand-quoting is what produced the malformed_request seen in live testing.
The seven methods are already granular and chainable. Adding more, smaller ones would mean more shell round-trips, not fewer. Fix the invocation, not the granularity.
Do not rewrite the transport. crates/app/src/agent_bridge.rs and the ai::agent contract stay as they are — tested, and documented in AGENTS.md as the language-neutral route any runtime can use. Add a thin MCP adapter in front that forwards to the loopback HTTP already running.
Scope
Target the 2026-07-28 MCP spec (current as of 2026-08-15; previous was 2025-11-25). That revision works in qrate's favour:
- Stateless core —
initialize/initializedhandshake removed,Mcp-Session-Idand protocol-level sessions removed. Every request is self-describing, which matches the bridge's existing one-request → one-answer → closed-socket shape. No session machinery to build. - Client identity —
_metacarriesio.modelcontextprotocol/clientInfo(name + version) per request. A real replacement for theX-Agentheader the Agent panel uses; keepX-Agentfor raw HTTP callers, preferclientInfowhen present. - Tool schemas —
tools/liststops an agent guessing at parameter shapes. Biggest single win. - Cacheable lists —
ttlMs/cacheScopeon list responses. - Routing headers —
Mcp-Method/Mcp-Nameontools/listandtools/call. server/discoverfor optional capability discovery.
Do not implement: Roots, Sampling and Logging (deprecated); legacy HTTP+SSE transport (deprecated, 12-month offramp); MRTR elicitation/sampling (qrate needs none). Extensions (MCP Apps, Tasks) are out of scope — qrate's calls are fast and synchronous.
Task Details
- One MCP tool per existing method, schemas generated from the
ai::agenttypes. - Stdio JSON-RPC as the transport an agent runtime registers.
- No new dependency:
serde_jsonis already in the tree and the repo hand-rolls its HTTP; hand-roll the MCP subset rather than pull an SDK in fortools/list+tools/call. - A feature-lifecycle policy now guarantees ≥12 months between deprecation and removal, so pinning to 2026-07-28 is safe.
Definition of Done
An agent registers one MCP server, then reviews an open project and stages findings without invoking a shell, and every call still appears in the Agent panel with a real client name.
Estimate
Medium
Type
Feature request
Blocks #? (ASNT-92, Pi agent harness and terminal UX) — with MCP in place the terminal stops being how an agent talks to qrate and becomes only how you watch one run.
Notion: https://app.notion.com/p/3bd21d32b13b81bb8a09fd0e4449d7de
Activity