Implements the [MCP-over-ACP RFD](https://agentclientprotocol.com/rfds/mcp-over-acp) for ACP v1 and v2. A client can declare an MCP server with `"type": "acp"` in a session setup request, and the agent sends that server's MCP requests to the client as `mcp/message` over the ACP connection it already has. ## What changes for a client - `initialize` advertises the transport: `agentCapabilities.mcpCapabilities.acp: true` on v1, and `capabilities.session.mcp.acp: {}` on v2. - `session/new`, `session/load`, `session/resume` and `session/fork` take `acp` servers in `mcpServers`. v2 used to reject them with `-32602`. - Claude Code discovers the server, lists its tools and calls them. Each request reaches the client as an `mcp/message` request, and the client's request-scoped `mcp/message` notifications (such as progress) reach Claude Code. ## How it works Claude Code's MCP client connects to a command or a URL, so it cannot send `mcp/message` itself. The adapter uses the ACP SDK's helpers for this case: `McpOverAcpCaller` and `McpOverAcpHttpBridge`. Each `acp` server gets an MCP 2026-07-28 HTTP endpoint on `127.0.0.1` that forwards every MCP request over the ACP connection. The `acp` servers of a connection share one listener, which closes with the connection, and a request needs the bearer token of its server. - The new `McpOverAcp` class in `src/mcp-servers.ts` owns the caller and the bridge. `sdkMcpServers` is now async and maps an `acp` server to the SDK's `http` config through it. Both cores use it: v1 through `AcpClient.mcpServerOverAcp`, v2 through `V2Agent.sdkMcpServers`. - Both agent apps register `McpOverAcp.handleNotification` for `mcp/message` notifications. - A server gets the same config for as long as the connection lives. A session that restarts, or a v2 resume of an active session with the same servers, does not reconnect it. ## Notes for review - **Depends on Claude Code's MCP negotiation.** The endpoint speaks MCP 2026-07-28 only and takes no `initialize`. Claude Code 2.1.325 sends `server/discover` to an HTTP server first by default. With `MCP_PROTOCOL_NEGOTIATION=legacy`, or with its `tengu_mcp_protocol_negotiation_http` flag off, it sends `initialize` instead. Then the server is listed as failed in `/mcp`, and the client gets the existing "failed to start" notice. The adapter does not force `MCP_PROTOCOL_NEGOTIATION=auto`: that would also change the handshake of the user's other servers. - **A listener that cannot open fails the setup request** with `-32603` and a message that names the server, instead of starting the session without it. - **Golden files.** The 42 scenario snapshots change only in the `initialize` line. `compare.ts` documents the new capability as an allowed difference from the origin/main baseline. ## Testing - `src/tests/mcp-servers.test.ts`: the transport mapping, a request and its progress through a real in-memory ACP connection, one config and one listener per connection, and the requests the endpoint refuses (another server's token, `initialize`). - `src/tests/v2/acp-v2.test.ts`: a tool call of a v1 session and of a v2 session through the protocol router, also after a v2 resume of the active session. Both fail when the `mcp/message` notification handler is not registered. - `src/tests/v2/v2-integration.test.ts`: the bundled Claude Code CLI lists the tools of an `acp` server. It sends no prompt, so it costs no API usage. - Run by hand against the built adapter with a real ACP client that serves a tool: on v1 and on v2, Claude Code 2.1.325 sent `server/discover`, `subscriptions/listen`, `tools/list` and `tools/call` as `mcp/message`, and answered with the tool's result.
ACP adapter for the Claude Agent SDK
Use Claude Agent SDK from ACP-compatible clients!
This tool implements an ACP agent by using the official Claude Agent SDK, supporting:
- Context @-mentions
- Images
- Tool calls (with permission requests)
- Compact file changes through the negotiated AIR diff patch extension
- Following
- Edit review
- TODO lists
- Nested subagent transcripts
- Interactive (and background) terminals
- Custom Slash commands
- Client MCP servers, including the ones that the client serves over the ACP connection (MCP-over-ACP,
"type": "acp") - An Ultracode session config option, which turns on Claude Code's dynamic workflows for every task. It appears when dynamic workflows are enabled and the model supports ultracode (any model with
xhigheffort) /mcpin the chat: the MCP server status as a list. The adapter runs/mcp reconnect,/mcp enable, and/mcp disablethrough the SDK control API, because Claude Code refuses them in SDK mode. A reconnect of an ACP server that needs authentication starts MCP OAuth through URL elicitation- Session-scoped long-running goals for AIR through the goal extension under
_meta.jetbrains.air.goal - Structured errors, recovery, and warnings through the opt-in session failure extension
- Concrete model and effort defaults through the opt-in recommended config value extension
- Tool permission presentation, editable choices, and durable effects through the permission extension
- One fact per field in every tool call report, as the ACP tool call contract defines
- All AIR extensions, capabilities, and
_metakeys: AIR extensions
Learn more about the Agent Client Protocol.
To try changes that have landed on main but are not released yet, install from the
preview channel — every push to main publishes one. See
docs/RELEASES.md.
npm install @agentclientprotocol/claude-agent-acp@preview
Standalone executables
Each release attaches archives for Linux (glibc and musl), macOS and Windows, on
x64 and arm64, to its GitHub release.
They need no Node.js install. Each holds two files: claude-agent-acp, and the
Claude CLI (claude) it runs. Keep them in the same directory; a symlink to
claude-agent-acp elsewhere works. To use a Claude CLI you already have
instead, set CLAUDE_CODE_EXECUTABLE. On Alpine, install libgcc and
libstdc++ first.
To build one for your machine (needs Bun) and check it:
npm run build:binary
npm run smoke:binary # add `-- --full` to drive a real session; needs a Claude login
Experimental ACP v2
The adapter also serves the draft ACP v2:
a client that asks for protocol version 2 or later in initialize gets v2, and every other client
gets v1. The draft can still change, and this surface changes with it.
CLAUDE_AGENT_ACP_PROTOCOL limits the adapter to one version. With v1, a client that asks
for v2 is negotiated down to v1. With v2, the adapter rejects the initialize of a v1 client.
auto, the default, serves both.
On v2 the adapter serves the session baseline (session/new, session/list, session/resume
with replay, which replay_complete ends, session/close, session/prompt, session/cancel), session/delete,
session/fork, session/status, session/options (with initial configOptions on session/new,
session/resume and session/fork), session/set_title, additional directories, config options (the mode is one), plans, notices,
compaction, display terminals for commands, permission requests, elicitation, providers, auth, and
subagents. Steering is v1 only for now.
v2 is served by the v2 agent in src/v2/, which runs straight on Claude
Code instead of translating to v1. A v2 client that declares JetBrains AIR
(_meta.jetbrains.air) also gets the AIR extensions that ACP v2 does not cover.
Contribution Policy
This project does not require a Contributor License Agreement (CLA). Instead, contributions are accepted under the following terms:
By contributing to this project, you agree that your contributions will be licensed under the Apache License, Version 2.0. You affirm that you have the legal right to submit your work, that you are not including code you do not have rights to, and that you understand contributions are made without requiring a Contributor License Agreement (CLA).