cursor-agent-mcp
README.md
# π Cursor MCP Server
<!--
PROJECT DESCRIPTION:
This is an MCP (Model Context Protocol) server that acts as a bridge between LLMs (like Claude, ChatGPT, etc.)
and Cursor's Background Agents API. It enables AI assistants to programmatically create, manage, and interact
with Cursor's autonomous coding agents that can work on GitHub repositories in the background.
Key capabilities:
- Create background agents that can autonomously work on code repositories
- Manage agent lifecycle (create, monitor, cancel, delete)
- Access agent conversation history and status
- List accessible repositories and available AI models
- Supports both HTTP/MCP protocol and SSE (Server-Sent Events) transports
- Can be self-hosted for integration with OpenAI Platform and ChatGPT
- Provides 13 comprehensive tools for full agent management
Use cases:
- Let AI assistants delegate complex coding tasks to Cursor agents
- Automate code reviews, bug fixes, feature development, and documentation
- Enable LLMs to work with codebases through Cursor's powerful agent system
-->
A **MCP (Model Context Protocol) server** that seamlessly integrates with **Cursor's Background Agents API**. This server enables LLMs to programmatically create, manage, and interact with Cursor's powerful background agents for autonomous code development.
## β¨ Features
π€ **Agent Management**
- Create and manage background agents
- Monitor agent status and progress
- Add followup instructions to running agents
- Delete agents when no longer needed
π **Repository & Model Access**
- List accessible GitHub repositories
- Get available AI models for agents
- Retrieve API key information
π¬ **Communication & History**
- Access agent conversation history
- Real-time status updates
- Comprehensive error handling
π‘οΈ **Quality & Security**
- Automated CI/CD with GitHub Actions
- Branch protection rules for main branch
- Pre-push hooks for local safety
- ESLint code quality checks
- Security vulnerability scanning
### Quick Install via npm
```bash
# Install globally
npm install -g cursor-agent-mcp
# Or use npx (no installation required)
npx cursor-agent-mcp
```
### MCP Client Configuration
Add this to your MCP client configuration (e.g., Claude Desktop's `claude_desktop_config.json`):
```json
{
"mcpServers": {
"cursor-background-agents": {
"command": "npx",
"args": ["cursor-agent-mcp@latest"],
"env": {
"CURSOR_API_KEY": "your_cursor_api_key_here",
"CURSOR_API_URL": "https://api.cursor.com"
}
}
}
}
```
### Development Installation
1. Clone the repository
2. Install dependencies:
```bash
npm install
```
### π‘οΈ Branch Protection & Development Workflow
This repository uses **branch protection rules** to ensure code quality and prevent direct pushes to the main branch.
#### Required Workflow:
1. **Create a feature branch**:
```bash
git checkout -b feature/your-feature-name
```
2. **Make your changes and commit**:
```bash
git add .
git commit -m "Add your feature description"
```
3. **Push your feature branch**:
```bash
git push origin feature/your-feature-name
```
4. **Create a Pull Request** on GitHub
#### Automated Checks:
- β
**Tests**: All tests must pass
- β
**Linting**: Code must pass ESLint checks
- β
**Security**: Vulnerability scanning
- β
**Integration**: MCP client tests
#### Local Safety:
A pre-push hook prevents accidental pushes to main and runs tests before any push.
#### Bypassing (Not Recommended):
```bash
git push --no-verify # Bypasses hooks (use with extreme caution)
```
## π§ Configuring MCP Server in Cursor
To integrate this MCP server with Cursor's Background Agents, follow these steps:
### 1. π Get Your Cursor API Key
1. Open Cursor IDE
2. Go to **Settings** β **Features** β **Background Agents**
3. Generate or copy your API key from the Background Agents section
4. Keep this key secure - it provides full access to your Cursor account
### 2. π οΈ MCP Client Configuration (npm install)
Add this server to your MCP client configuration:
```json
{
"mcpServers": {
"cursor-background-agents": {
"command": "npx",
"args": ["cursor-agent-mcp@latest"],
"env": {
"CURSOR_API_KEY": "your_cursor_api_key_here",
"CURSOR_API_URL": "https://api.cursor.com"
}
}
}
}
```
### 3. π― Claude Desktop Integration
For Claude Desktop, add to your `claude_desktop_config.json`:
```json
{
"mcpServers": {
"cursor-background-agents": {
"command": "npx",
"args": ["cursor-agent-mcp@latest"],
"env": {
"CURSOR_API_KEY": "your_cursor_api_key_here",
"CURSOR_API_URL": "https://api.cursor.com"
}
}
}
}
```
### 4. π§ Codex CLI Configuration
For Codex CLI, add to your `~/.codex/config.toml`:
```toml
# IMPORTANT: the top-level key is `mcp_servers` rather than `mcpServers`.
[mcp_servers.cursor-background-agents]
command = "npx"
args = ["cursor-agent-mcp@latest"]
env = { "CURSOR_API_KEY" = "your_cursor_api_key_here", "CURSOR_API_URL" = "https://api.cursor.com" }
```
**Note**: Codex CLI uses TOML format instead of JSON, and the configuration key is `mcp_servers` (with underscore) rather than `mcpServers` (camelCase).
## π Self-Hosting for OpenAI Platform & ChatGPT
### π Quick Self-Hosting Setup
For **OpenAI Platform** and **ChatGPT** integration, you can self-host this MCP server and make it accessible via the internet.
#### Prerequisites
- Node.js 18+
- Your Cursor API key
- ngrok (for quick public access) or cloud hosting
#### πββοΈ Quick Start with ngrok
1. **Clone and setup**:
```bash
git clone https://github.com/griffinwork40/cursor-agent-mcp.git
cd cursor-agent-mcp
npm install
```
2. **Configure your API key**:
```bash
# Create .env file
echo "CURSOR_API_KEY=your_cursor_api_key_here" > .env
echo "PORT=3000" >> .env
```
3. **Start the server**:
```bash
npm start
```
4. **Make it public with ngrok**:
```bash
# In a new terminal
ngrok http 3000
```
5. **Get your public URL** (e.g., `https://abc123.ngrok-free.app`)
#### π± ChatGPT Configuration
**In ChatGPT Settings β Connectors:**
- **Name**: `cursor-agent-mcp`
- **Description**: `MCP server for Cursor Background Agents API`
- **MCP Server URL**: `https://your-ngrok-url.ngrok-free.app` (base URL only)
- **Authentication**: **None** (uses global API key from .env)
- **Trust checkbox**: β
Checked
**β
Working Configuration:**
```
β
URL: https://abc123.ngrok-free.app
β
Auth: None
β
Trust: Checked
```
**β Common Mistakes:**
```
β URL: https://abc123.ngrok-free.app/sse?token=... (don't use SSE endpoint)
β Auth: OAuth (OAuth is for advanced setups)
β Missing API key in .env
```
#### ποΈ OpenAI Platform Configuration
**For OpenAI Platform integration:**
1. **Server URL**: `https://your-ngrok-url.ngrok-free.app`
2. **Authentication**: None (server uses global API key)
3. **Available Tools**: 13 Cursor agent management tools
**API Endpoints Available:**
- `POST /` - Main MCP protocol endpoint
- `POST /mcp` - Alternative MCP endpoint
- `GET /sse` - Server-Sent Events for real-time connections
- `GET /health` - Health check
- `GET /.well-known/oauth-authorization-server` - OAuth discovery
#### π§ Advanced Configuration Options
**With API Key Authentication** (if you want per-request keys):
```bash
# ChatGPT can send API key in Authorization header
curl -X POST https://your-server.com/ \
-H "Authorization: Bearer key_your_cursor_api_key" \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"tools/list","id":1}'
```
**With Token-based URLs** (for sharing):
```bash
# Visit your server's /connect endpoint
curl https://your-server.com/connect
# Enter your API key to get a tokenized URL
```
#### π Production Hosting Options
**Railway** (Recommended):
```bash
# Deploy to Railway
railway login
railway init
railway add
railway deploy
```
**Heroku**:
```bash
# Deploy to Heroku
heroku create your-cursor-agent-mcp
heroku config:set CURSOR_API_KEY=your_key_here
git push heroku main
```
**AWS/DigitalOcean/etc.**:
- Deploy as a standard Node.js app
- Set environment variables
- Ensure port 3000 (or your chosen port) is accessible
- Configure HTTPS for production use
#### π Security Considerations
**For Production Deployment:**
1. **Use HTTPS**: Always use HTTPS in production
2. **Secure API Keys**: Use environment variables, never commit keys
3. **Rate Limiting**: Consider adding rate limiting for public endpoints
4. **Access Control**: Optionally add IP whitelisting or authentication
5. **Monitoring**: Set up logging and monitoring for production use
**Optional Security Enhancements**:
```bash
# Add MCP_SERVER_TOKEN for SSE endpoint protection
echo "MCP_SERVER_TOKEN=$(openssl rand -hex 32)" >> .env
```
#### π§ͺ Testing Your Setup
**Test the connection**:
```bash
# Health check
curl https://your-server.com/health
# Test MCP protocol
curl -X POST https://your-server.com/ \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"tools/list","id":1}'
# Should return 13 Cursor agent tools
```
**Verify in ChatGPT**:
1. Add the connector with base URL
2. Look for 13 available tools in the tool picker
3. Test with: "List my cursor agents" or "Create a cursor agent for my repo"
### π οΈ Development/Local Installation Configuration
If you're running from source code, use this configuration instead:
```json
{
"mcpServers": {
"cursor-background-agents": {
"command": "node",
"args": ["/path/to/cursor-agent-mcp/src/index.js"],
"env": {
"CURSOR_API_KEY": "your_cursor_api_key_here",
"CURSOR_API_URL": "https://api.cursor.com"
}
}
}
}
```
### Environment Variables
Create a `.env` file in the project root:
```env
# Required
CURSOR_API_KEY=your_cursor_api_key_here
# Optional
PORT=3000
CURSOR_API_URL=https://api.cursor.com
```
### Development Mode
```bash
# Start with auto-reload
npm run dev
# Run tests
npm test
```
## π Server Endpoints
- **`/mcp`** - MCP protocol endpoint for LLM interaction
- **`/health`** - Health check endpoint with uptime info
## π οΈ Available MCP Tools (13 Tools)
This server provides **13 powerful tools** that enable LLMs to fully manage Cursor's Background Agents:
### π― Auto-Create PR
The `createAgent` tool features **automatic PR creation**:
- **β
Default Enabled**: `autoCreatePr` defaults to `true` for all agents
- **ποΈ Override**: Explicitly set `autoCreatePr: false` to disable PR creation
- **π‘οΈ Safe Defaults**: Ensures pull requests are created by default
This ensures pull requests are automatically created when agents complete their work, providing a consistent workflow for code changes.
### π€ Agent Management Tools
#### 1. `createAgent` - Create Background Agent
#### 1a. `createAgentFromTemplate` - Create Agent from Template
**Purpose**: High-level helper to create an agent using curated templates.
**Templates**: `docAudit`, `typeCleanup`, `bugHunt`
**Example Input**:
```json
{
"template": "docAudit",
"params": { "docPaths": ["docs/**/*.md"], "guidelines": "Be concise." },
"model": "auto",
"source": { "repository": "https://github.com/user/repo", "ref": "main" },
"target": { "autoCreatePr": true, "branchName": "audit-docs" }
}
```
**Behavior**: Validates inputs and composes `createAgent` with a rendered prompt.
**Purpose**: Create a new background agent to work on a repository
**Key Features**:
- π Support for text and image prompts
- π― Custom model selection
- πΏ Branch and PR configuration
- π Webhook notifications
- βοΈ Auto-PR creation (defaults to true)
**Example Input**:
```json
{
"prompt": {
"text": "Fix all TypeScript errors in the project and add proper type definitions"
},
"model": "default",
"source": {
"repository": "https://github.com/user/repo",
"ref": "main"
},
"target": {
"autoCreatePr": true,
"branchName": "fix/typescript-errors"
}
}
```
#### 2. `listAgents` - List All Agents
**Purpose**: Retrieve all background agents for the authenticated user
**Features**:
- π Pagination support (1-100 agents per request)
- π Agent status overview
- π
Creation date sorting
- π Cursor-based navigation
#### 3. `summarizeAgents` - Aggregated Agent Dashboard
**Purpose**: Produce a quick dashboard with totals, recent activity, and in-progress timers
**Highlights**:
- π Counts agents per status after applying filters
- π§ Lists the five most recent matching agents
- β±οΈ Shows elapsed time for creating or running agents when available
- π§© Returns structured JSON in the response for downstream automation
Filters are applied before aggregationβuse `status` or `repository` (substring match) to focus on specific pipelines without skewing totals.
**Example Call**:
```javascript
const summary = await mcp.call('summarizeAgents', {
status: 'RUNNING',
repository: 'example/repo',
limit: 75,
});
console.log(summary.content[0].text);
// Access machine-readable aggregates
const dashboard = summary.content[1].json;
```
#### 4. `getAgent` - Get Agent Details
**Purpose**: Retrieve detailed status and results of a specific agent
**Returns**:
- π Current status with emoji indicators
- π Agent summary and progress
- π Direct links to view results
- πΏ Branch and repository information
- π
Creation and update timestamps
#### 5. `deleteAgent` - Remove Agent
**Purpose**: Permanently delete a background agent
**Features**:
- β οΈ Permanent deletion (cannot be undone)
- π‘οΈ Confirmation response
- ποΈ Cleanup of associated resources
#### 6. `addFollowup` - Add Instructions
**Purpose**: Send additional instructions to a running agent
**Capabilities**:
- π¬ Text instructions
- πΌοΈ Image attachments
- π Real-time agent updates
- π Conversation threading
#### 7. `createAndWait` - Create Agent and Wait for Completion
**Purpose**: Create an agent and internally poll until it reaches a terminal status.
**Returns**: `{ finalStatus, agentId, elapsedMs, agent }`
**Configurable Options**:
- `pollIntervalMs` (default 2000)
- `timeoutMs` (default 600000)
- `jitterRatio` (default 0.1)
**Example Input**:
```json
{
"prompt": { "text": "Refactor utils for readability and add tests" },
"source": { "repository": "https://github.com/user/repo", "ref": "main" },
"model": "auto",
"pollIntervalMs": 1500,
"timeoutMs": 900000
}
```
**Example Output**:
```json
{
"finalStatus": "FINISHED",
"agentId": "bc_abc123",
"elapsedMs": 84217,
"agent": { "id": "bc_abc123", "status": "FINISHED" }
}
```
#### 8. `cancelCreateAndWait` - Cancel Waiting Agent Creation
**Purpose**: Cancel a running `createAndWait` operation using its cancel token.
**Features**:
- π Cooperative cancellation of long-running operations
- π Safe termination without data loss
- β±οΈ Immediate response to cancellation requests
**Example Input**:
```json
{
"cancelToken": "build-123"
}
```
### π Information & Discovery Tools
#### 9. `getAgentConversation` - View Chat History
**Purpose**: Access the complete conversation history of an agent
**Features**:
- π¬ Full message history
- π€ User and assistant message types
- π Message count statistics
- π Recent message preview
#### 10. `getMe` - API Key Info
**Purpose**: Retrieve information about the current API key
**Returns**:
- π API key name and creation date
- π€ Associated user email
- π Account status information
#### 11. `listModels` - Available AI Models
**Purpose**: Get list of recommended models for background agents
**Features**:
- π€ All supported AI models
- π Model recommendations
- π― Optimized for different tasks
#### 12. `listRepositories` - Accessible Repos
**Purpose**: List GitHub repositories accessible to the user
**Returns**:
- π Repository names and owners
- π Full repository URLs
- π Access permissions
- π Direct GitHub links
#### 13. `documentation` - Self-Documenting Usage Helper
**Purpose**: Provide structured usage information for LLMs and clients
**Features**:
- π Returns endpoints, auth methods, and protocol version
- π§° Lists all available tools with input schemas
- π§Ύ Example `tools/list` and `tools/call` payloads
- π§© Supports `format` argument: `markdown` (default) or `json`
**Example Input**:
```json
{ "format": "json" }
```
**Example Output**:
Human-readable markdown plus a second content item containing structured data.
## π Example Usage - Background Agents API
Here are practical examples of how to use the Background Agents API through this MCP server:
### π― Complete Workflow Example
```javascript
// 1. First, check what repositories you have access to
const repos = await mcp.call('listRepositories');
console.log('Available repos:', repos.repositories);
// 2. Check available AI models
const models = await mcp.call('listModels');
console.log('Available models:', models.models);
// 3. Create a new background agent
const newAgent = await mcp.call('createAgent', {
prompt: {
text: `Please review this codebase and:
1. Fix any TypeScript errors
2. Add missing unit tests for core functions
3. Update documentation for new features
4. Optimize performance bottlenecks`
},
model: 'default',
source: {
repository: 'https://github.com/myuser/my-project',
ref: 'main'
},
target: {
autoCreatePr: true,
branchName: 'agent/code-improvements'
}
});
console.log('Created agent:', newAgent.agentId);
// 4. Monitor agent progress
const agentStatus = await mcp.call('getAgent', {
id: newAgent.agentId
});
console.log('Agent status:', agentStatus.status);
// 5. Add followup instructions if needed
if (agentStatus.status === 'RUNNING') {
await mcp.call('addFollowup', {
id: newAgent.agentId,
prompt: {
text: "Also please add ESLint configuration with strict rules"
}
});
}
// 6. View conversation history
const conversation = await mcp.call('getAgentConversation', {
id: newAgent.agentId
});
console.log('Messages:', conversation.messages.length);
```
### π₯ Common Use Cases
#### π Bug Fix Agent
```json
{
"prompt": {
"text": "There's a critical bug in the user authentication flow. Please investigate and fix the login issues reported in GitHub issues #123 and #124."
},
"model": "default",
"source": {
"repository": "https://github.com/company/webapp",
"ref": "main"
},
"target": {
"autoCreatePr": true,
"branchName": "hotfix/auth-login-bug"
}
}
```
#### π Feature Development Agent
```json
{
"prompt": {
"text": "Implement a new dark mode toggle feature with the following requirements:\n- System preference detection\n- Persistent user choice\n- Smooth transitions\n- Accessibility compliance"
},
"model": "default",
"source": {
"repository": "https://github.com/company/frontend",
"ref": "develop"
},
"target": {
"autoCreatePr": true,
"branchName": "feature/dark-mode-toggle"
}
}
```
#### π Documentation Agent
```json
{
"prompt": {
"text": "Update all documentation files:\n- Add comprehensive API documentation\n- Create setup guides for new developers\n- Add code examples for all public methods\n- Update README with latest features"
},
"model": "default",
"source": {
"repository": "https://github.com/company/api-server"
},
"target": {
"autoCreatePr": true,
"branchName": "docs/comprehensive-update"
}
}
```
#### π§ͺ Testing Agent
```json
{
"prompt": {
"text": "Improve test coverage by:\n- Adding unit tests for untested components\n- Creating integration tests for API endpoints\n- Adding E2E tests for critical user flows\n- Setting up test data factories"
},
"model": "default",
"source": {
"repository": "https://github.com/company/app"
},
"target": {
"autoCreatePr": true,
"branchName": "test/improve-coverage"
}
}
```
### π± Agent Management Examples
#### List and Monitor All Agents
```javascript
// Get all your agents
const allAgents = await mcp.call('listAgents', { limit: 50 });
// Check each agent's status
for (const agent of allAgents.agents) {
const details = await mcp.call('getAgent', { id: agent.id });
console.log(`${agent.name}: ${details.status}`);
// Get conversation for running agents
if (details.status === 'RUNNING') {
const conversation = await mcp.call('getAgentConversation', {
id: agent.id
});
console.log(` Messages: ${conversation.messageCount}`);
}
}
```
#### Generate a Dashboard Summary
```javascript
const { content } = await mcp.call('summarizeAgents', {
repository: 'company/app',
status: 'RUNNING',
});
// Human-readable overview in the first block
console.log(content[0].text);
// Structured aggregates for automation in the second block
const dashboard = content[1].json;
console.log(dashboard.statusCounts.RUNNING, 'agents in progress');
```
#### Cleanup Finished Agents
```javascript
const agents = await mcp.call('listAgents');
for (const agent of agents.agents) {
if (agent.status === 'FINISHED' || agent.status === 'ERROR') {
await mcp.call('deleteAgent', { id: agent.id });
console.log(`Deleted agent: ${agent.name}`);
}
}
```
## π‘οΈ Enhanced Error Handling
The server includes **enterprise-grade error handling** with:
### π Error Features
- **π Input Validation**: All inputs validated using Zod schemas
- **π HTTP Status Mapping**: Proper error codes mapped to HTTP status codes
- **π Detailed Messages**: Informative error messages with context
- **ποΈ Structured Responses**: Consistent error response format
- **π Comprehensive Logging**: Full request/response logging for debugging
### π¨ Error Types & Status Codes
| Error Type | Status | Description |
|------------|--------|-------------|
| `ValidationError` | 400 | β Input validation failures |
| `AuthenticationError` | 401 | π Invalid or missing API key |
| `AuthorizationError` | 403 | π« Insufficient permissions |
| `NotFoundError` | 404 | π Resource not found |
| `ConflictError` | 409 | βοΈ Resource conflict |
| `RateLimitError` | 429 | π¦ Rate limit exceeded |
| `ApiError` | 500 | β‘ General API errors |
### π§ͺ Testing Error Handling
```bash
# Run comprehensive error handling tests
node test-error-handling.js
# Test with curl examples
bash test-curl-examples.sh
```
## βοΈ Configuration
Configure the server using environment variables:
| Variable | Default | Required | Description |
|----------|---------|----------|-------------|
| `PORT` | `3000` | β | Server port number |
| `CURSOR_API_KEY` | - | β
| Your Cursor API key |
| `CURSOR_API_URL` | `https://api.cursor.com` | β | Cursor API base URL |
## π¨βπ» Development
### π Available Scripts
```bash
# Production
npm start # π Start the server
# Development
npm run dev # π Start with auto-reload (nodemon)
npm test # π§ͺ Run tests (Jest configured)
# Testing
node test-mcp-client.js # π§ Test MCP client
node test-error-handling.js # π‘οΈ Test error handling
bash test-curl-examples.sh # π Test with curl
```
### π Logging & Monitoring
The server includes **comprehensive observability**:
- π₯ **Request/Response Logging**: Full HTTP request/response details
- π§ **API Call Logging**: Cursor API interaction logging
- π¨ **Error Logging**: Detailed error logs with stack traces
- π **Health Monitoring**: Health check endpoint with uptime info
- π **Performance Metrics**: Request timing and success rates
### π₯ Health Check
Monitor server health:
```bash
curl http://localhost:3000/health
```
Response:
```json
{
"status": "ok",
"timestamp": "2025-01-23T10:30:00.000Z",
"version": "1.0.0",
"uptime": 3600.5
}
```
## π― Production Deployment
### π³ Docker Support
```dockerfile
FROM node:18-alpine
WORKDIR /app
COPY package*.json ./
RUN npm ci --only=production
COPY src/ ./src/
EXPOSE 3000
CMD ["npm", "start"]
```
### π Environment Setup
```bash
# Production environment
export NODE_ENV=production
export PORT=3000
export CURSOR_API_KEY=your_production_key
# Start server
npm start
```
### π Monitoring
- Health checks at `/health`
- Structured logging for observability
- Graceful shutdown handling
- Process management ready
---
## π§ Troubleshooting
### Common Issues
#### Authentication Errors
```bash
# Error: Invalid or missing API key
# Solution: Verify your CURSOR_API_KEY is correct
echo $CURSOR_API_KEY
```
#### Connection Issues
```bash
# Error: Connection refused
# Solution: Check if server is running
curl http://localhost:3000/health
```
#### Tool Not Found
```bash
# Error: Tool 'createAgent' not found
# Solution: Verify MCP client configuration
npx cursor-agent-mcp --help
```
### Debug Mode
```bash
# Enable debug logging
DEBUG=* npm start
# Or with environment variable
NODE_ENV=development npm start
```
### Health Check
```bash
# Check server status
curl http://localhost:3000/health
# Expected response:
{
"status": "ok",
"timestamp": "2025-01-23T10:30:00.000Z",
"version": "1.0.5",
"uptime": 3600.5
}
```
## β Frequently Asked Questions
### Q: How do I get a Cursor API key?
A: Open Cursor IDE β Settings β Features β Background Agents β Generate API Key
### Q: Can I use this with other MCP clients besides Claude Desktop?
A: Yes! This server is compatible with any MCP client that supports HTTP transport.
### Q: What's the difference between `createAgent` and `createAndWait`?
A: `createAgent` returns immediately after creating the agent, while `createAndWait` polls until completion.
### Q: How many agents can I run simultaneously?
A: This depends on your Cursor subscription tier. Check your account limits in the Cursor dashboard.
### Q: Can I cancel a running agent?
A: Yes, use the `deleteAgent` tool to stop and remove a running agent.
### Q: Is my API key secure?
A: The server never logs your API key, but the bundled CLI persists it to `~/.config/cursor-agent-mcp/config.json` by default so it can reuse the credential. Use environment variables if you prefer not to write the key to disk and make sure the config file is stored on a trusted machine with appropriate filesystem permissions.
---
## π Documentation
### π API Reference
Complete API documentation for all MCP tools, including request/response schemas, error codes, and examples:
- **π [API Reference](./docs/api-reference.md)** - Comprehensive tool documentation
- **π§ All 13 MCP Tools** - Detailed parameter specifications
- **π¨ Error Handling** - Complete error code reference
- **π‘ Usage Examples** - Practical implementation examples
- **π [Changelog](./CHANGELOG.md)** - Version history and release notes
### π Security
Security best practices and configuration guidance:
- **π‘οΈ [Security Documentation](./docs/SECURITY.md)** - Comprehensive security guide
- **π Authentication Model** - API key security and rotation
- **π Production Deployment** - Secure configuration examples
- **π¨ Incident Response** - Security monitoring and response procedures
### π Additional Resources
- **π [Contributing Guide](./CONTRIBUTING.md)** - How to contribute to this project
- **π§ͺ [Testing Guide](./TESTING.md)** - Testing procedures and examples
- **π [Changelog](./CHANGELOG.md)** - Version history and updates
- **π [Issues](https://github.com/griffinwork40/cursor-agent-mcp/issues)** - Report bugs or request features
---
## π¨ Troubleshooting
### Common Issues
#### "I don't see any special abilities in Claude"
- Make sure you **restarted Claude Desktop** completely
- Check that your **API key is correct** (no extra spaces or characters)
- Verify you have a **Cursor subscription** (free accounts won't work)
#### "Claude says it can't access Cursor"
- Double-check your **API key** is valid
- Make sure you **saved the config file** properly
- Try **restarting Claude Desktop** again
#### "The config file won't save"
- Make sure the file is named **exactly** `claude_desktop_config.json`
- Check you have **permission** to save files in that folder
- Try using a different text editor
#### "I get an error about npx or node"
- This usually means the system is downloading the required files
- **Wait a few minutes** and try again
- Make sure you have an **internet connection**
#### "Validation Error" messages
- Check that your input data matches the required schema
- Ensure all required fields are provided
- Verify your API key has the necessary permissions
#### "API Error (401): Invalid or missing API key"
- Verify your `CURSOR_API_KEY` is set correctly in your environment
- Check that the API key starts with `key_`
- Ensure the API key hasn't expired
### Getting Help
- **GitHub Issues**: [Report bugs or request features](https://github.com/griffinwork40/cursor-agent-mcp/issues)
- **Documentation**: Check the [API Reference](./docs/api-reference.md) for detailed tool documentation
- **Testing**: Use the [testing guide](./TESTING.md) to verify your setup
## π€ Contributing
We welcome contributions! Please see our [Contributing Guide](./CONTRIBUTING.md) for details on:
- **Development Setup** - How to get started with local development
- **Code Standards** - Coding style and conventions
- **Testing Guidelines** - How to write and run tests
- **Pull Request Process** - How to submit changes
- **Issue Reporting** - How to report bugs and request features
### Quick Start for Contributors
1. **Fork the repository** on GitHub
2. **Clone your fork** locally
3. **Install dependencies**: `npm install`
4. **Create a feature branch**: `git checkout -b feature/your-feature-name`
5. **Make your changes** and test them
6. **Submit a pull request**
For detailed information, see the [Contributing Guide](./CONTRIBUTING.md).
## π Why Choose This MCP Server?
β
**Production Ready** - Comprehensive error handling and validation
β
**Full Feature Coverage** - All 13 Cursor Background Agent API endpoints
β
**Developer Friendly** - Extensive documentation and examples
β
**Type Safe** - Zod schema validation for all inputs
β
**Observable** - Detailed logging and monitoring
β
**Tested** - Comprehensive test suite included
β
**Maintained** - Active development and support
**π Ready to supercharge your development workflow with AI-powered background agents!**
This server cannot be deployed
Maintenance
ActivityInactive
ResponsivenessNo recent community issues