Skip to content

Enable MCP servers for ACP agents #993

@simonrosenberg

Description

@simonrosenberg

Summary

ACP agents (Claude Code / Codex / Gemini CLI / custom) currently cannot use MCP servers. The block is entirely in our own stack — the ACP protocol and all three built-in servers already support MCP. We should let users configure MCP servers for an ACP agent and have them forwarded to the ACP subprocess at session creation.

Why it doesn't work today

The limitation is in software-agent-sdk, not the protocol:

  • ACPAgent.supports_openhands_mcp returns False.
  • ACPAgent.init_state() hard-rejects any config: if self.mcp_config: raise NotImplementedError(...).
  • Session creation passes no servers: new_session(...) omits mcp_servers, and load_session(..., mcp_servers=[]) is hardcoded empty.
  • ACPAgentSettings has no mcp_config field, and the typescript-client ACP_SETTINGS_KEYS allow-list omits it.

What already supports MCP (verified)

  • ACP protocol: new_session/load_session/fork_session all accept mcp_servers: [HttpMcpServer | SseMcpServer | McpServerStdio]; InitializeResponse.agent_capabilities.mcp_capabilities advertises http/sse.
  • claude-agent-acp v0.18 — mcpCapabilities: { http: true, sse: true }; maps the ACP mcpServers array into the Claude Code SDK. stdio + http + sse.
  • codex-acp v0.10 — mcp_capabilities(...http(true)); stdio + http (sse ignored).
  • gemini-cli — supports MCP natively.

Plan (full stack)

Reuse the existing mcp_config ({"mcpServers": {...}}) shape rather than inventing a new field — ACPAgent already inherits mcp_config + its secret-encryption machinery from AgentBase.

  1. software-agent-sdk — drop the NotImplementedError; translate mcp_config → ACP McpServerStdio/HttpMcpServer/SseMcpServer; gate http/sse on mcp_capabilities; pass into new_session and load_session (resume must re-pass). Add mcp_config: MCPConfig | None to ACPAgentSettings + thread through create_agent().
  2. typescript-client — add mcp_config to ACP_SETTINGS_KEYS.
  3. agent-canvas (this repo) — add mcp_config to buildAcpAgentSettingsDiff; render the existing MCPServerList/MCPServerForm editor in the ACP branch of agent-settings.tsx; add a MCPServerConfig[] ⇄ {mcpServers:{...}} adapter (the editor's flat model differs from the SDK field's keyed shape).

Notes / constraints

  • No runtime add — MCP binds at session creation; changing config restarts the (cwd-keyed) session, unlike the live model-switch feature.
  • stdio binaries (npx/uvx) must exist in the runtime image; remote http/sse needs none.
  • Secrets in MCP env/headers are encrypted at rest by the inherited mcp_config machinery and passed inline to the subprocess.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions