Skip to content

ASNT-98: Serve the agent bridge as an MCP server #110

Closed

Description

@devnull03

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/initialized handshake removed, Mcp-Session-Id and 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 — _meta carries io.modelcontextprotocol/clientInfo (name + version) per request. A real replacement for the X-Agent header the Agent panel uses; keep X-Agent for raw HTTP callers, prefer clientInfo when present.
  • Tool schemas — tools/list stops an agent guessing at parameter shapes. Biggest single win.
  • Cacheable lists — ttlMs / cacheScope on list responses.
  • Routing headers — Mcp-Method / Mcp-Name on tools/list and tools/call.
  • server/discover for 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::agent types.
  • Stdio JSON-RPC as the transport an agent runtime registers.
  • No new dependency: serde_json is already in the tree and the repo hand-rolls its HTTP; hand-roll the MCP subset rather than pull an SDK in for tools/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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions