Skip to content

feat: support MCP-over-ACP in the Codex adapter - #771

Merged
benbrandt merged 1 commit into
mainfrom
feat/mcp-over-acp
Nov 17, 2026
Merged

benbrandt merged 1 commit into
mainfrom
feat/mcp-over-acp

Conversation

@benbrandt

Copy link
Copy Markdown
Member

Summary

Support MCP-over-ACP on ACP v1 and v2. Clients can declare a type: "acp" server at session setup and serve tools on their existing connection. Codex accepts MCP URLs, not ACP registrations, so the adapter uses the ACP SDK's authenticated loopback HTTP bridge. Its listener and credentials belong to the ACP connection, not an individual session. The adapter redacts the bearer header from its outgoing app-server trace.

Compatibility

  • Advertise the transport only if the running Codex binary lists mcp_2026_07_28. Enable that feature only for threads that actually use a bridged server: the bridge requires modern discovery and does not accept the legacy initialize handshake.
  • Existing stdio and HTTP servers can coexist with ACP registrations. Discovery mode is thread-wide, so legacy HTTP servers may see server/discover before Codex falls back to initialize.
  • Preserve servers from CODEX_CONFIG when adding registrations. Resolve name conflicts before opening endpoints, including when a server URL uses a dotted config key.

Verification

  • npm run typecheck and npm run build
  • npm test — 2,532 passed, 39 skipped
  • npm run test:integration — 21 passed. Real bundled Codex 0.166.0 discovers and calls a client tool in a session with legacy HTTP and stdio servers, on both ACP versions. The tests also check request-scoped progress, MCP errors, bearer authentication, and listener lifetime.
  • npm run bundle:all — all six platform binaries built

No live model or API key is required by the new tests. The separate live-model E2E suite was not run.

@benbrandt
benbrandt merged commit b9503ae into main Nov 17, 2026
6 checks passed
@benbrandt
benbrandt deleted the feat/mcp-over-acp branch November 17, 2026 21:32
nyssance added a commit to nyssance/codex-acp that referenced this pull request Nov 18, 2026
…otocol#769, agentclientprotocol#771)

Adopt upstream's MCP-over-ACP and drop the fork's own endpoint
(AcpMcpEndpoint and the @modelcontextprotocol/server dependency): Codex
now reaches `type: "acp"` servers through the ACP SDK's authenticated
loopback bridge, the transport is advertised only when the Codex binary
implements mcp_2026_07_28, and that feature is enabled for threads that
use a bridged server. The wire contract for clients is unchanged.

Fork-specific parts kept: the session-open wrapper on v2 resume and
fork (now passing the resume signal), the responses routes and provider
catalog in the session config (now built from the expanded overrides),
and the SDK 2.8.0 pin. Parameter properties in upstream code become
plain fields because this repository enables erasableSyntaxOnly.

Snapshots follow upstream's replay boundaries: current state comes after
replay_complete, and announced children end their history with it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
benbrandt pushed a commit that referenced this pull request Nov 19, 2026
🤖 I have created a release *beep* *boop*
---


##
[2.8.0](v2.7.0...v2.8.0)
(2026-11-19)


### Features

* report ACP v2 background work and cancel individual terminals
([#777](#777))
([74dffa0](74dffa0))
* support MCP-over-ACP in the Codex adapter
([#771](#771))
([b9503ae](b9503ae))


### Bug Fixes

* align adapter with ACP SDK 2.7 and current protocol rules
([#769](#769))
([887aab6](887aab6))
* align adapter with ACP SDK 2.8 and current protocol rules
([#775](#775))
([0a17129](0a17129))
* avoid stack overflow when snapshotting deeply nested JSON
([#742](#742))
([06425cc](06425cc))
* put model settings first in session config options
([#778](#778))
([3645fab](3645fab))
* update codex to 0.170.0
([#780](#780))
([77b12a1](77b12a1))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: acp-release-bot[bot] <246668977+acp-release-bot[bot]@users.noreply.github.com>
nyssance added a commit to nyssance/codex-acp that referenced this pull request Nov 19, 2026
…ings first

Upstream since agentclientprotocol#771: ACP SDK 2.8 alignment (agentclientprotocol#775), v2 background work and
terminal cancellation (agentclientprotocol#777), model settings first in config options (agentclientprotocol#778),
the deeply nested JSON snapshot fix (agentclientprotocol#742), Codex 0.170.0 (agentclientprotocol#780).

Kept from this adapter:
- An ordinary v2 prompt during a running turn is still steered into it. A
  keyed prompt takes upstream's derived message ID and shared receipt and is
  steered once; a prompt cannot set both an idempotencyKey and
  _meta.alwith.messageId.
- Child interruption still goes through requestTurnInterrupt and its retry.
  It now reports whether the turn stopped, so a v2 close can require it.
- The generated app-server types (--experimental), the image and audio input
  mapping, the gateway-aware model provider, typed turn failures.

Taken from upstream:
- A v2 session/cancel stops the foreground and leaves children listed as
  background work running until they are cancelled themselves or the session
  closes. The parent-cancellation test follows that rule on v2.
- Upstream's field order in shared test fixtures.

The deep-nesting snapshot test gets a longer timeout: Bun serializes values
about ten times deeper than Node before its stack runs out.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Claude-Session: https://claude.ai/code/session_01RaizxxJBbHnYoG9L4g1u5b
mrmans0n added a commit to mrmans0n/codex-acp that referenced this pull request Nov 19, 2026
Upstream v2.8.0 changed four places next to 904a70d's lines:
- agentclientprotocol#775 rejects a fork at a session cursor at the top of forkSession, where
  the patch maps the ACP v1 _meta.systemPrompt.append alias. The cursor
  check stays first; the alias mapping follows it unchanged.
- agentclientprotocol#778 puts the model options first in session configOptions and notes it
  in the scenario baseline comment and in docs/air-extensions.md, next to
  the patch's notes on the opt-in system prompt append capability. Both
  notes are kept.
- agentclientprotocol#771 (MCP-over-ACP) rewrites the README line after the patch's system
  prompt append line. Both lines are kept.
- agentclientprotocol#742 replaces JsonSnapshot's recursive walk with an explicit container
  stack, so the snapshot walk no longer uses call stack per level. The
  patch's MAX_DEPTH 64 headroom for native JSON.stringify existed only
  because of that recursion. On darwin-arm64 (Node 26), upstream's new
  test (the deepest value JSON.stringify accepts) fails with a
  RangeError on the v2.7.0 recursive walk both at 256 and with the
  downstream 64, and passes on agentclientprotocol#742's walk at 256. The adaptation drops
  that hunk and follows upstream's MAX_DEPTH 256.

Apart from the dropped JsonSnapshot hunk (one removed and three added
lines), the sorted added and removed lines are identical to
904a70d (originally fc0eb68). Upstream
v2.8.0 does not change the systemPrompt conversion that the alias feeds;
newSessionV2, resumeSessionV2 and forkSessionV2 only drop configOptions.
mrmans0n added a commit to mrmans0n/codex-acp that referenced this pull request Nov 19, 2026
Upstream v2.8.0 (agentclientprotocol#771) adds an initialize-v2 test (ACP transport is not
advertised over v1 or v2 when Codex lacks modern MCP) at the position of
c51a9ec's v2 test, and agentclientprotocol#775 renames the following upstream test to "still
routes a v1 initialize to the v1 chain". The adaptation keeps upstream's
test and name and the patch's test after it; its sorted added and removed
lines are identical to c51a9ec
(originally 4ab2596).

Upstream v2.8.0 does not change GitPatch, FileChangeReporter or the diff
patch capability in ClientCapabilities. agentclientprotocol#775 only drops v2 diffs without
any change, so the ACP v1 _meta.diffPatch keeps carrying the Git-relative
patch of a file change.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant