Skip to content

Session-scoped stdio MCP server from session/new.mcpServers never reaches the model — no tools/list, not even listed as a known-but-unconnected server #883

Description

@mrmans0n

Summary

An ACP host (Alas, https://github.com/mrmans0n/alas) injects a per-session, dynamically-configured stdio MCP server into session/new's mcpServers array (fresh command/env per session — the server binary, socket path, and session id are all generated at session-creation time). The server itself is verified working: running it directly and sending initialize + tools/list over stdio returns a valid tool list.

Inside the resulting Claude Code session, the agent has no visibility into this server at all:

  • It doesn't show up as an available/deferred tool.
  • ToolSearch (deferred-tool lookup) returns no match for its name or its tool names.
  • It doesn't even appear as a "known but not yet connected/authenticated" server, unlike statically-configured MCP connectors (e.g. Atlassian, Slack), which do show up in that state when unauthenticated.

Meanwhile the ACP host has no way to detect this from its side: it only knows that it sent the server in mcpServers — ACP defines no confirmation signal for "the agent successfully connected to server X and exposed its tools." So the host UI shows the server as attached/requested while the model-facing session behaves as if it was never mentioned.

Versions

  • @agentclientprotocol/claude-agent-acp: 0.59.0
  • Bundled @anthropic-ai/claude-agent-sdk: 0.3.207
  • @agentclientprotocol/sdk: 1.2.1
  • Platform: macOS (darwin), Node (current)

Repro

  1. Have an ACP client send session/new with an mcpServers entry of the plain stdio shape (no type field, i.e. the default/stdio variant per the ACP schema):
    {
      "name": "myserver",
      "command": "/path/to/binary",
      "args": ["mcp"],
      "env": [{"name": "SOME_RUNTIME_VAR", "value": "generated-per-session"}]
    }
    where the command/env are freshly generated for this specific session (not a static entry present in ~/.claude.json or any project .mcp.json ahead of time).
  2. Confirm the binary works standalone: pipe initialize then tools/list JSON-RPC lines to it directly — it returns a normal tool list.
  3. Start a prompt in the resulting session and ask the model what MCP servers/tools it has. It reports none, and ToolSearch for the server's tool names returns nothing.

Expected

Either:

  • The server is connected and its tools appear (directly or via ToolSearch) like any other MCP server, or
  • If it fails to connect, that failure is visible to the model (as "known but unavailable", matching the treatment of unauthenticated static connectors) and/or surfaced back to the ACP host via session/update so the host doesn't report it as successfully requested.

Additional context

Happens consistently across fresh sessions, not tied to a specific worktree/session id. The server config is otherwise schema-valid per the ACP McpServer stdio variant (bare name/command/args/env, no type key).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions