A community-driven registry for Claude, Cursor, Windsurf, Cline & more. Not affiliated with Anthropic.
Are you the author? Sign in to claim
claude-acp-server: ACP bridge for Anthropic Claude Code (stdio/WebSocket, JSON-RPC, streaming) for Zed & VS Code.
Agent Client Protocol (ACP) bridge for Claude Code — run JSON-RPC over stdio (default) or WebSocket, and drive the claude CLI in --print mode with stream-json output mapped to ACP session/update notifications.
This project implements the agent side using the official @agentclientprotocol/sdk, so it tracks the Agent Client Protocol (protocol version 1).
Editors that speak ACP (for example Zed) expect a subprocess or socket that exchanges newline-delimited JSON-RPC messages. This server is that subprocess: it translates ACP methods (initialize, session/new, session/prompt, …) into Claude Code invocations with -p / --resume, streams NDJSON from --output-format stream-json --verbose --include-partial-messages, and forwards text and tool events to the client as session/update notifications.
You need a working Claude Code install and authentication (claude on PATH, or npx @anthropic-ai/claude-code, per your setup).
cd claude-acp-server
npm install
npm run build
npm start
The process reads JSON-RPC from stdin and writes responses to stdout. Log lines go to stderr (ACP requires stdout to contain only protocol messages).
When the package is installed globally or linked from a clone (npm link after npm run build), the same entry is available as the claude-acp-server command (see bin in package.json).
npm run start:ws -- --port 3000 --host 0.0.0.0
The WebSocket transport uses the same newline-delimited JSON-RPC framing as stdio (one JSON object per message). A single connection can handle multiple ACP sessions via session/new and session/load, the same as stdio.
| Flag | Description | Default |
|---|---|---|
--mode | stdio or ws | stdio |
--port | WebSocket port | 3000 |
--host | WebSocket bind address | localhost |
--cwd | Server process working directory (process.chdir before ACP starts) | process.cwd() |
--log-level | debug, info, warn, error | info |
Each session/new still sends its own absolute workspace cwd; that value is what Claude Code uses when spawned, not only this flag.
settings.json)Use the absolute path to the built dist/index.js (or node + path to the repo):
{
"assistant": {
"acp": {
"servers": [
{
"name": "Claude Code",
"command": "node",
"args": ["/absolute/path/to/claude-acp-server/dist/index.js"],
"env": {
"CLAUDE_CODE_ALLOWED_TOOLS": "Read,Grep,Bash"
}
}
]
}
}
}
Install an ACP client extension (for example the ACP Client from the marketplace), then point it at the same node dist/index.js command.
| Variable | Purpose |
|---|---|
CLAUDE_CODE_ALLOWED_TOOLS | Passed to --allowed-tools |
CLAUDE_CODE_DISALLOWED_TOOLS | Passed to --disallowed-tools |
CLAUDE_CODE_PERMISSION_MODE | Passed to --permission-mode |
CLAUDE_CODE_BIN | Executable: npx (default), claude, or a path to a .mjs / .js script (see below) |
CLAUDE_CODE_EXTRA_ARGS | Extra CLI tokens appended after the built-in flags |
ACP_SESSION_DIR | Directory for session metadata and transcripts (default: ~/.claude-acp/sessions) |
ACP_MAX_SESSIONS | Cap on concurrent sessions (default: 10) |
Optional file: ~/.claude-acp/config.json may define allowedTools and disallowedTools (used when the env vars are unset). See .env.example.
If CLAUDE_CODE_BIN is set to a .mjs / .js / .cjs file, the server runs node <that-file> -p … with the same flags as the real CLI. This is useful for tests or custom wrappers.
claude-acp-server/
├── src/
│ ├── index.ts # CLI entry, exports
│ ├── server.ts # ACPServer class
│ ├── config.ts # Env, ~/.claude-acp/config.json, CLI flags
│ ├── claude-agent.ts # ACP Agent → Claude Code
│ ├── session-store.ts # Session metadata + transcripts
│ ├── claude/
│ │ ├── run-claude.ts # Spawn CLI, NDJSON stdout
│ │ ├── stream-json.ts # Claude lines → session/update
│ │ └── prompt-text.ts # Content blocks → prompt string
│ └── transports/
│ ├── stdio.ts
│ └── websocket.ts
├── tests/
├── dist/ # `npm run build` (removed by `npm run clean`)
├── tsconfig.json
├── vitest.config.ts
├── .env.example
├── .gitignore
├── package.json
├── README.md
└── LICENSE
Editor (ACP client)
│ JSON-RPC (NDJSON over stdio or WebSocket)
▼
@agentclientprotocol/sdk → ClaudeAgent → spawn Claude Code (-p, stream-json)
│ │
└──────── session/update notifications ◄────────┘
sessionId is a UUID. The first prompt uses --session-id; later prompts use --resume with the same id.ACP_SESSION_DIR so session/load can replay history via session/update (when supported by the client).| Method | Notes |
|---|---|
initialize | Negotiates protocol version and capabilities (loadSession, prompt content). |
authenticate | No-op success (no auth flow in this bridge). |
session/new | Creates session, persists metadata. |
session/load | Replays stored transcript when present. |
session/prompt | Runs Claude Code; streams chunks; returns stopReason. |
session/cancel | Aborts the in-flight CLI process. |
session/set_mode | Acknowledged (no-op). |
Tool permission prompts are handled inside Claude Code; this bridge does not forward interactive permission UI to the editor unless extended to do so.
import { ACPServer } from "claude-acp-server";
const server = new ACPServer({
mode: "stdio",
cwd: "/path/to/project",
allowedTools: ["Read", "Grep"],
});
await server.start();
ACPServer.start() applies cwd with process.chdir (same as the CLI --cwd flag).
npm test
Full compile + test (recommended before commits or CI):
npm run build && npm test
Tests cover CLI/config parsing, stream-json mapping, prompt text from content blocks, and an end-to-end ACP handshake using a tiny fake Claude script (no API or claude binary required).
Development: npm run clean deletes dist/; npm run dev runs the TypeScript entry with watch. Vitest runs test files sequentially so process.chdir in config tests does not race other suites.
FROM node:22-alpine
RUN npm install -g @anthropic-ai/claude-code
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build
EXPOSE 3000
CMD ["node", "dist/index.js", "--mode", "ws", "--host", "0.0.0.0", "--port", "3000"]
See LICENSE (MIT).
A Claude Code skill by Hao (駱君昊) that learns your Facebook voice and auto-posts to FB / IG / Threads / X with a 14-day c
Human + AI music production workflow for Suno - skills, templates, and tools
1000+ skills curated from Anthropic, Vercel, Stripe, and other engineering teams
Claude Code skill for YouTube creators — channel audits, video SEO, retention scripts, thumbnails, content strategy, Sho