Skip to content

[codex] Add ACP IDE integration with MCP passthrough#380

Open
furukama wants to merge 2 commits intomainfrom
codex/ide-integration-acp
Open

[codex] Add ACP IDE integration with MCP passthrough#380
furukama wants to merge 2 commits intomainfrom
codex/ide-integration-acp

Conversation

@furukama
Copy link
Copy Markdown
Contributor

@furukama furukama commented Apr 20, 2026

Summary

Adds Agent Client Protocol integration for IDEs by introducing a hybridclaw acp stdio server and wiring editor-provided MCP servers through the existing gateway and runner paths.

What Changed

  • add an ACP bridge for VS Code, Zed, and JetBrains with session lifecycle, prompt handling, cancellation, slash command support, and approval passthrough
  • convert ACP prompt content blocks into HybridClaw prompt/media input and stream text/tool progress back as ACP events
  • thread per-session MCP server overrides through gateway, executor, host runner, container runner, and worker signatures
  • move ACP-mode logs and startup warnings off stdout so the stdio protocol stays clean
  • add targeted ACP and worker-signature tests

Validation

  • npm run typecheck
  • ./node_modules/.bin/vitest run --configLoader runner --config vitest.unit.config.ts tests/acp-prompt.test.ts tests/acp-mcp.test.ts tests/gateway-chat-service.acp.test.ts tests/worker-signature.test.ts
  • ./node_modules/.bin/tsx src/cli.ts help acp with stdout/stderr split to confirm help text stays on stdout and runtime warnings go to stderr

Notes

  • ACP loadSession / resume is not implemented yet
  • ACP multi-root additionalDirectories handling is not implemented yet
  • editor MCP config is applied per ACP session and overrides runtime-config MCP servers for that session

@furukama furukama marked this pull request as ready for review April 20, 2026 18:41
Copilot AI review requested due to automatic review settings April 20, 2026 18:41
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds Agent Client Protocol (ACP) support to HybridClaw by introducing an ACP stdio server and plumbing per-session MCP server overrides through the gateway/executor/runner stack, while keeping stdout clean for the protocol stream.

Changes:

  • Introduces hybridclaw acp (CLI + help) and a new ACP stdio server implementation that bridges prompts, streaming text/tool progress, approvals, and slash commands.
  • Threads per-session MCP server overrides through gateway request types, agent/executor interfaces, worker signature computation, and host/container runners.
  • Redirects runtime warnings/log output away from stdout in ACP mode, and adds focused ACP + worker-signature tests.

Reviewed changes

Copilot reviewed 22 out of 23 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tests/worker-signature.test.ts Adds coverage ensuring worker signatures vary with session MCP routing changes.
tests/gateway-chat-service.acp.test.ts Verifies ACP workspace + MCP overrides are forwarded from gateway chat handling into runAgent.
tests/acp-prompt.test.ts Tests ACP prompt block conversion (embedded resources/images) and available command filtering.
tests/acp-mcp.test.ts Tests ACP MCP server conversion + merge overlay behavior for per-session overrides.
src/utils/stdio-warning.ts Adds emitRuntimeWarning() helper to route warnings to stderr in ACP stdio mode.
src/security/runtime-secrets.ts Routes runtime-secrets warnings through emitRuntimeWarning to avoid stdout noise.
src/logger.ts Redirects pretty logger output to stderr when HYBRIDCLAW_STDIO_PROTOCOL=acp.
src/infra/worker-signature.ts Extends worker signature input to include normalized MCP server config.
src/infra/mcp-server-config.ts Adds merge/clone helpers and signature-normalization for MCP server configs.
src/infra/host-runner.ts Applies per-session MCP overrides before launching host executor runs and signature computation.
src/infra/container-runner.ts Applies per-session MCP overrides before launching container executor runs and signature computation.
src/gateway/gateway-types.ts Adds mcpServersOverride to GatewayChatRequest.
src/gateway/gateway-chat-service.ts Forwards mcpServersOverride to runAgent.
src/config/runtime-config.ts Routes watcher/config warnings through emitRuntimeWarning for ACP-safe output.
src/cli/help.ts Adds acp command help + help topic entry.
src/cli.ts Adds acp command entrypoint and sets HYBRIDCLAW_STDIO_PROTOCOL=acp before importing ACP server.
src/agent/executor-types.ts Adds mcpServersOverride to ExecutorRequest.
src/agent/agent.ts Passes mcpServersOverride through to the executor.
src/acp/server.ts New ACP server: session lifecycle, prompt handling, streaming events, approvals, slash command passthrough.
src/acp/prompt.ts Converts ACP prompt content blocks to HybridClaw prompt + media items; publishes slash commands.
src/acp/mcp.ts Converts ACP MCP server descriptors into internal MCP config map.
package.json Adds @agentclientprotocol/sdk@0.19.0 dependency.
package-lock.json Lockfile update for ACP dependency + workspace metadata changes.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/cli.ts
Comment on lines +1513 to +1516
process.env.HYBRIDCLAW_STDIO_PROTOCOL = 'acp';
const { runAcpServer } = await import('./acp/server.js');
await runAcpServer();
break;
Comment thread src/acp/server.ts
Comment on lines +188 to +189
const chunk = text.trim();
if (!chunk) return;
Comment thread src/acp/mcp.ts
Comment on lines +36 to +61
mapped[name] = {
transport: 'http',
url: server.url,
...(headersToRecord(server.headers)
? { headers: headersToRecord(server.headers) }
: {}),
};
continue;
}

if ('type' in server && server.type === 'sse') {
mapped[name] = {
transport: 'sse',
url: server.url,
...(headersToRecord(server.headers)
? { headers: headersToRecord(server.headers) }
: {}),
};
continue;
}

mapped[name] = {
transport: 'stdio',
command: server.command,
args: [...server.args],
...(envToRecord(server.env) ? { env: envToRecord(server.env) } : {}),
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.

2 participants