A full-featured Agent Client Protocol (ACP) adapter for Cursor CLI, enabling seamless AI-powered coding assistance in ACP-compliant editors like Zed.
This TypeScript implementation provides a production-ready bridge between the Cursor CLI and editors that support the Agent Client Protocol. It offers feature parity with Zed's built-in Claude and Codex adapters while maintaining high performance and reliability.
- ACP Protocol Core - Initialize, session management, prompt processing
- Session Management - Persistent sessions with metadata and history
- Content Processing - Text, code, and image block handling
- Real-time Streaming - Live response streaming for immediate feedback
- Complete Tool System - Filesystem, terminal, and Cursor-specific tools
- Security Framework - Path validation, command filtering, access controls
- Error Handling & Recovery - Robust error handling with comprehensive validation
- Type Safety - Written in TypeScript with strict type checking
- Test Coverage - 200+ unit and integration tests with security coverage
- Cursor CLI Integration - Complete integration with cursor-agent CLI features
- Advanced Tool Registry - Dynamic provider management and validation
- Cross-Tool Workflows - Seamless filesystem, terminal, and code operations
- High Performance - <100ms average response time optimization
- Memory Efficiency - Zero memory leaks, optimal resource usage
- Cross-platform - Works on macOS, Linux, and Windows
- Node.js 18+ - Required for running the adapter
- Cursor CLI - Must be installed and authenticated
# Install Cursor CLI
curl https://cursor.com/install -fsSL | bash
# Authenticate with your Cursor account
cursor-agent login# Install globally
npm install -g @blowmage/cursor-agent-acp
# Or install locally in your project
npm install @blowmage/cursor-agent-acp# Start the ACP adapter
cursor-agent-acp
# Or run directly with npx
npx cursor-agent-acpAdd this configuration to your Zed settings (~/.config/zed/settings.json):
{
"agent_servers": {
"cursor-agent": {
"command": "cursor-agent-acp",
"args": [],
"env": {}
}
}
}If installed locally:
{
"agent_servers": {
"cursor-agent": {
"command": "npx",
"args": ["@blowmage/cursor-agent-acp"],
"env": {}
}
}
}The adapter works with any ACP-compliant editor. Configure your editor to launch cursor-agent-acp as an agent server using stdio transport.
The adapter supports various configuration options:
# Custom configuration file
cursor-agent-acp --config /path/to/config.json
# Set log level
cursor-agent-acp --log-level debug
# Specify session storage directory
cursor-agent-acp --session-dir ~/.cursor-sessions{
"logLevel": "info",
"sessionDir": "~/.cursor-sessions",
"maxSessions": 100,
"sessionTimeout": 3600000,
"tools": {
"filesystem": {
"enabled": true,
"allowedPaths": ["./"],
"maxFileSize": 10485760,
"allowedExtensions": [".ts", ".js", ".json", ".md"]
},
"terminal": {
"enabled": true,
"maxProcesses": 5,
"forbiddenCommands": ["rm", "sudo", "su"],
"allowedCommands": ["echo", "ls", "cat", "grep", "find"]
},
"cursor": {
"enabled": true,
"enableCodeModification": true,
"enableTestExecution": true,
"maxSearchResults": 50
}
},
"cursor": {
"timeout": 30000,
"retries": 3
}
}# Clone the repository
git clone https://github.com/blowmage/cursor-agent-acp.git
cd cursor-agent-acp
# Install dependencies
npm install
# Build the project
npm run build# Run unit tests
npm test
# Run integration tests
npm run test:integration
# Run all tests with coverage
npm run test:coverage
# Watch mode for development
npm run test:watch# Run in development mode with hot reload
npm run dev
# Build and watch for changes
npm run build:watch┌─────────────────────────────────────────────────────┐
│ ACP Editor (Zed) │
└─────────────────┬───────────────────────────────────┘
│ JSON-RPC over stdio
┌─────────────────▼───────────────────────────────────┐
│ Cursor Agent ACP Adapter │
│ ┌─────────────────────────────────────────────────┐│
│ │ Protocol Layer ││
│ │ • Initialization • Session Management ││
│ │ • Prompt Handling • Content Processing ││
│ │ • Tool Calling • Error Handling ││
│ └─────────────────────────────────────────────────┘│
│ ┌─────────────────────────────────────────────────┐│
│ │ Integration Layer ││
│ │ • CLI Bridge • Authentication ││
│ │ • Session Sync • Response Translation ││
│ └─────────────────────────────────────────────────┘│
└─────────────────┬───────────────────────────────────┘
│ Command execution
┌─────────────────▼───────────────────────────────────┐
│ Cursor CLI │
└─────────────────────────────────────────────────────┘
CursorAgentAdapter- Main adapter class implementing ACP protocolSessionManager- Handles session lifecycle and persistenceCursorCliBridge- Interfaces with cursor-agent CLIToolRegistry- Manages available tools and capabilities
initialize- Initialize the adapter with capabilitiessession/new- Create a new conversation sessionsession/load- Load an existing sessionsession/list- List all available sessionssession/update- Update session metadatasession/delete- Delete a sessionsession/prompt- Send a prompt and receive streaming response
-
File System Tools
read_file- Read file contents with security validationwrite_file- Write file contents with path restrictionslist_directory- List directory contents recursivelycreate_directory- Create directories with parent supportdelete_file- Delete files/directories with safety checksget_file_info- Get detailed file/directory information
-
Terminal Tools
execute_command- Execute shell commands with security filteringstart_shell_session- Start interactive shell sessionssend_to_shell- Send input to active shell sessionsclose_shell_session- Close and cleanup shell sessionslist_processes- List active processes and sessions
-
Cursor-Specific Tools
search_codebase- Advanced code search with pattern matchinganalyze_code- Code structure and quality analysisapply_code_changes- Atomic code modifications with backuprun_tests- Execute tests with framework auto-detectionget_project_info- Project metadata and dependency informationexplain_code- AI-powered code explanations and suggestions
"cursor-agent not found"
# Install Cursor CLI
curl https://cursor.com/install -fsSL | bash
# Verify installation
cursor-agent --version"Authentication required"
# Login to Cursor
cursor-agent login
# Check authentication status
cursor-agent status"Permission denied"
# Make sure the binary is executable
chmod +x ./node_modules/.bin/cursor-agent-acp"Session not found"
- Sessions are stored locally and may expire
- Check session directory permissions
- Verify session storage configuration
Enable debug logging to troubleshoot issues:
cursor-agent-acp --log-level debugCheck logs in:
- macOS/Linux:
~/.cursor-agent-acp/logs/ - Windows:
%APPDATA%\cursor-agent-acp\logs\
We welcome contributions! Please see our Contributing Guidelines for details.
- Fork the repository
- Create a feature branch
- Write tests for your changes
- Implement the feature
- Ensure all tests pass
- Submit a pull request
- TypeScript: Strict mode enabled
- Testing: >95% test coverage required
- Linting: ESLint + Prettier
- Commits: Conventional commit messages
MIT License - see LICENSE file for details.
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Documentation: Full API Docs
- Agent Client Protocol - Official ACP specification
- Cursor CLI - Official Cursor command-line interface
- Zed Editor - High-performance code editor with ACP support