Zed Claude Code is a multi-protocol server that enables seamless integration between Claude Code and Zed through the Agent Client Protocol (ACP) and Model Context Protocol (MCP). It functions as an intelligent translation layer that bridges different protocol formats while providing robust, scalable communication between Claude Code capabilities and diverse client applications.
Run the agent directly using NPX or BUNX (no repository cloning required):
# Using NPX
npx zed-claude-code
# Using BUNX
bunx zed-claude-codeConfigure the agent in your Zed settings by adding it to agent_servers. Open your Zed settings and add:
{
"agent_servers": {
"Zed Claude Code": {
"command": "npx",
"args": ["zed-claude-code"],
"env": {}
}
}
}For development or if you prefer bunx:
{
"agent_servers": {
"Zed Claude Code": {
"command": "bunx",
"args": ["zed-claude-code"],
"env": {}
}
}
}π‘ Note: The server will automatically install
@anthropic-ai/claude-codeon first run if not present.
For more information on configuring external agents in Zed, see the Zed External Agents documentation.
βββββββββββββββββββ ACP βββββββββββββββββββ Claude SDK βββββββββββββββββββ
β βββββββββββββΊβ βββββββββββββββββββΊβ β
β Zed β stdin/out β Zed Claude Code β HTTP/MCP β Claude API β
β β β β β β
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β
β MCP Tools
βΌ
βββββββββββββββββββ
β β
β File System β
β Operations β
β β
βββββββββββββββββββ
- Zed initiates ACP connection via stdin/stdout
- Zed Claude Code receives
initializeandnewSessionrequests - Server creates Claude Code SDK query with MCP server configuration
- Internal HTTP server starts for MCP tool communication
- Session is stored in Map for O(1) access performance
- Claude requests tool use via SDK
- Zed Claude Code translates tool request to ACP format
- Zed receives tool call notification with metadata
- User approves/denies tool execution in Zed
- Tool result flows back through MCP β SDK β ACP chain
- Results include location information and diff data
- Session maintains conversation history across messages
- Query object per session enables interruption and streaming
- Context preserved for follow-up messages
- Proper handling of assistant and user message flows
- ACP β Claude SDK: Message format conversion
- Snake_case β CamelCase: External API compatibility with internal code quality
- Tool Metadata: Rich UI information for tool calls
- URL-based URI Parsing: Robust handling of file:// and zed:// protocols with Unicode support
- File Operations: Read, write, edit with diff visualization
- Multi-Edit: Batch file modifications with line tracking
- Permission System: User approval workflow for tool execution
- Caching: Optimized file content caching for performance
- Map-based Storage: O(1) session lookup performance
- Modular Design: Separation of concerns across components
- Type Safety: Full TypeScript implementation with strict checking
- Error Handling: Comprehensive error propagation and logging
- Session Query Management: Per-session query objects with interrupt capability
- Test Coverage: 523 comprehensive unit tests ensuring reliability
π‘ Repository cloning is only required for development. For usage, see the Usage section above.
- Node.js 18+
- Claude Code installed and authenticated
- TypeScript development environment
# Clone repository
git clone https://github.com/suxxes/zed-claude-code.git
cd zed-claude-code
# Install dependencies
npm install
# Build the project
npm run build
# Run in development
npm run dev
# Run tests
npm test
# Linting and formatting
npm run lint
npm run format- TypeScript: Full type coverage required
- Biome: Code formatting and linting with
npm run lintandnpm run format - Testing: Unit tests for new functionality
- Comments: Document complex logic and external APIs
- External APIs: Must maintain snake_case for ACP/MCP compatibility
- Internal Code: Use camelCase for TypeScript best practices
- Tool Names: Follow
mcp__zcc__*naming convention - Error Handling: Provide clear error messages for debugging
mcp__zcc__read_file- Read file contents with optional rangemcp__zcc__edit_file- Edit files with old/new text replacementmcp__zcc__write_file- Write full file contentsmcp__zcc__multi_edit- Batch edit operations
Glob- Pattern-based file matchingGrep- Content search with regex supportLS- Directory listing
Bash- Command execution with output captureTask- Agent delegation for complex operations
TodoWrite- Task management and planningExitPlanMode- Plan completion workflow
WebFetch- HTTP content retrievalWebSearch- Search engine integration
NotebookEdit- Jupyter notebook cell editing
permission_request- User approval workflow- Supports "Always Allow", "Allow Once", "Reject" options
- Tool-specific permission caching
- Rich diff visualization with old/new content
- Location information with file paths and line numbers
- Tool metadata including descriptions and parameters
- Plan integration with TodoWrite tool support
- All file operations respect client capabilities
- Path validation prevents directory traversal
- Error messages avoid information disclosure
- Leverages Claude CLI authentication
- Supports both CLI login and API key methods
- Session isolation prevents cross-session data leaks
- Zod schema validation for all tool parameters
- Type-safe parameter handling throughout codebase
- Comprehensive error handling and logging
Error: Please run /login
Solution: Run claude /login in terminal or configure API key
Error: Session not found: uuid
Solution: Check session lifecycle and cleanup logic
Error: User refused permission to run tool
Solution: User needs to approve tool execution in Zed
Error: EADDRINUSE :::port
Solution: Server automatically selects available ports
Enable debug logging:
npx zed-claude-code --debug
bunx zed-claude-code --debugView detailed logs:
tail -f logs/zed-claude-code.logYou can also access ACP logs in Zed using the "dev: open acp logs" command in the Command Palette.
- Fork the repository
- Create feature branch:
git checkout -b feature/amazing-feature - Make changes with tests
- Ensure build passes:
npm run build - Run linting:
npm run lintandnpm run format - Commit changes:
git commit -m 'Add amazing feature' - Push to branch:
git push origin feature/amazing-feature - Open Pull Request
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
Note: This implementation is based on the original Google Gemini Agent Client Protocol implementation and therefore uses the Apache 2.0 license to maintain compatibility with the original open-source project.
For issues and questions:
- GitHub Issues: Create an issue
- Logs: Enable debug logging for troubleshooting
Built with β€οΈ for seamless Zed and Claude Code integration