Skip to content

feat(mcp): The stdio shim must dial the running app, so hermes gets the live roster #501

Closed

Description

@omesser

The half of #470 that #491 does not close, and the reason a speak from hermes still moves nothing.

What #491 shipped, and what it left

The app now serves MCP on loopback HTTP, and a Harness that advertises the HTTP capability gets the live roster, so a real speak reaches the buddy's bubble. That is recorded in ADR-0018.

hermes advertises no HTTP capability. It falls back to the published ai-buddy-mcp binary, which builds its dispatch context from stubs: no window sensing, an empty roster, no expression. So a speak there returns success and nothing happens on screen, which is the original complaint in #470 for every stdio-only Harness.

What it needs

The second of #166's two options, which #491 did not need and this does: the published binary becomes a thin shim that holds no state and forwards to the running app over a local socket, a named pipe, or loopback. The endpoint it dials is the one #491 already built, so this is a client rather than a second server.

Two details that matter:

  • Discovery and authorisation. The shim has to find the running app's port and token without either reaching a log or a world-readable file. fix(mcp): Serve MCP from the app on loopback HTTP so a Harness's speak lands on screen (#470) #491's token lives only in memory and in the session's own headers, so the shim needs a deliberate answer here, not an inherited one. ADR-0010's rules about credentials apply.
  • A shim with no app to dial must fail visibly rather than returning success, which is the whole lesson of the stub. See the sibling issue about dispatch reporting success when nothing changed.

Acceptance

  • With hermes attached, a speak from hermes puts the line in the buddy's bubble.
  • crates/mcp-server no longer builds a stub context on the shipped path.
  • The shim with no running app reports a failure the Harness can see.
  • No token or port reaches a log or a file other users can read.

Related: #470, #491, #166, ADR-0018, ADR-0010.

— Claude Code, on @omesser's behalf.

Activity

  1. added this to the V1 milestone on Sep 7, 2026
  2. omesser commented on Sep 7, 2026

    @omesser
    OwnerAuthor

    Implemented on branch feat/501-mcp-stdio-shim (not pushed, no PR yet) — blocked on #491.

    The published ai-buddy-mcp binary is now a stateless shim: rmcp, tokio, serde and ai-buddy-core are gone, the stub DispatchContext and StubWindowSource with them, and every line is relayed to the app over the loopback endpoint #491 builds. Discovery and authorisation travel in AI_BUDDY_MCP_URL / AI_BUDDY_MCP_TOKEN on the MCP-server entry the app already hands the Harness, so the token never touches disk. Recorded as ADR-0024. Every failure — unset variable, refused connection, rejected token, an empty answer to a request — is JSON-RPC -32603 plus stderr, never a success.

    Why it holds rather than opening a PR

    src-tauri/src/mcp_http.rs does not exist on main, so nothing sets the two variables and every call on the shipped path would answer -32603. On main alone this branch trades the stub's silent success for a guaranteed failure with no working replacement. It rebases onto #491 once that merges.

    #491 does not close the gap by itself. Its acp_wire::open builds the entry as McpServerStdio::new("ai-buddy", path).args(...) with no env field, and harness.rs asserts the Harness child gets none of ours. The hand-off ADR-0024 describes is implemented by neither branch. What it takes, on top of #491: an env field on McpLaunch, filled in harness::mcp_server() from mcp_http::endpoint() (needs an accessor handing back both values so the token stays inside the type), passed through acp_wire::open's servers() closure as McpServerStdio::env(…), and kept out of McpLaunch::line(), which harness.rs:818 writes to the Action Log. That is its own change with its own tests, and it belongs on #491 or a follow-up.

    Acceptance

    • crates/mcp-server no longer builds a stub context on the shipped path.
    • The shim with no running app reports a failure the Harness can see.
    • No token or port reaches a log or a file other users can read — nothing is written, Endpoint derives neither Debug nor Serialize, and the connect failure names no authority. The shim also refuses any non-loopback URL, so the bearer token cannot be sent off-host.
    • hermes speak puts the line in the buddy's bubble — unreachable until fix(mcp): Serve MCP from the app on loopback HTTP so a Harness's speak lands on screen (#470) #491 lands and the env hand-off exists.

    Note on ADR numbering

    0023 is claimed by two open PRs — #491 and #512. This branch takes 0024, which no open PR claims, but one of #491 or #512 has to renumber before all three land.

    — Claude Code, on @omesser's behalf.

  3. moved this from Todo to In Progress in Fidgeton Sep 8, 2026
  4. added
    p0Drop everything: broken for users, or blocking
    on Sep 9, 2026
  5. moved this from 🏗 In Progress to 🏁 Done in Fidgeton Sep 9, 2026
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

    enhancementNew feature or requestp0Drop everything: broken for users, or blocking

    Projects

    • Status
      Done

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions