[codex] Add ACP IDE integration with MCP passthrough#380
Open
[codex] Add ACP IDE integration with MCP passthrough#380
Conversation
Contributor
There was a problem hiding this comment.
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 on lines
+1513
to
+1516
| process.env.HYBRIDCLAW_STDIO_PROTOCOL = 'acp'; | ||
| const { runAcpServer } = await import('./acp/server.js'); | ||
| await runAcpServer(); | ||
| break; |
Comment on lines
+188
to
+189
| const chunk = text.trim(); | ||
| if (!chunk) return; |
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) } : {}), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds Agent Client Protocol integration for IDEs by introducing a
hybridclaw acpstdio server and wiring editor-provided MCP servers through the existing gateway and runner paths.What Changed
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 acpwith stdout/stderr split to confirm help text stays on stdout and runtime warnings go to stderrNotes
loadSession/ resume is not implemented yetadditionalDirectorieshandling is not implemented yet