Cursor Agent MCP
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Cursor Agent MCPsearch the codebase for references to the User model"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
π±οΈ Cursor Agent MCP
A fast, hardened Model Context Protocol server that lets any MCP host (Claude Code, Claude Desktop, and others) drive the Cursor Agent CLI.
Offload heavy, repoβaware "thinking" β search, analysis, planning, edits β from your host model to cursor-agent, keeping the host's context small and your token bill low.
Why this exists
Large hosts like Claude Code burn tokens when they read big codebases directly. This server exposes a set of focused, verb-centric tools (chat, edit, analyze, search, plan, raw) that delegate the heavy lifting to the Cursor Agent CLI with tight scopes and concise outputs β so the host stays cheap and fast.
It also fixes a very real papercut: on Linux, cursor-agent -p can take 60β90 seconds just to start because it loads your desktop's MCP servers and syncs marketplace plugins before answering. This server ships a bare_config mode that runs the CLI against an isolated config directory, cutting cold starts to ~15 seconds β without touching your real ~/.cursor setup.
flowchart LR
A[Claude / MCP host] -- stdio --> B[Cursor Agent MCP]
B -- spawn --> C[cursor-agent CLI]
C -- isolated CURSOR_CONFIG_DIR --> D[(no user MCPs/plugins<br/>fast startup)]
C --> E[Model: auto / gpt-5 / composer-2]Related MCP server: cursor-mcp-server
Highlights
β‘
bare_configfast mode β isolatedCURSOR_CONFIG_DIRskips user MCPs/plugins (~90s β ~15s on Linux).π§° 10 tools β chat, edit, analyze, search, plan, raw, legacy run, plus async start/check/cancel for long jobs.
π First-class auth & model β pass
api_keyandmodelper call or via env; API keys are redacted in debug logs.π§΅ Async jobs β fire long tasks in the background and poll them without hitting tool-call timeouts.
π‘οΈ Hardened spawning β
shell: false(no injection), Zod-validated inputs, robust timeouts and optional idle-kill.π Host-agnostic β works with Claude Code, Claude Desktop, or any stdio MCP client.
Requirements
Node.js 18+ (tested through Node 22)
Cursor Agent CLI on your
PATHasagentorcursor-agent(or point to it withCURSOR_AGENT_PATH)A Cursor API key (
crsr_β¦) if you usebare_config(an isolated config can't reuse the desktop login)
# verify the CLI is available
agent --versionInstall the CLI from the Cursor CLI docs if it's missing.
Installation
git clone https://github.com/lipey1/cursor-agent-mcp.git
cd cursor-agent-mcp
npm install # or: npm ciRun it directly (stdio):
node ./server.jsMost of the time you won't run it by hand β your MCP host launches it for you (see below).
Configure your MCP host
Add an entry pointing at server.js. Recommended fast defaults:
{
"mcpServers": {
"cursor-agent": {
"command": "node",
"args": ["/absolute/path/to/cursor-agent-mcp/server.js"],
"env": {
"CURSOR_AGENT_PATH": "/home/you/.local/bin/agent",
"CURSOR_API_KEY": "crsr_your_key_here",
"CURSOR_AGENT_MODEL": "auto",
"CURSOR_AGENT_FORCE": "1",
"CURSOR_AGENT_TRUST": "1",
"CURSOR_AGENT_BARE_CONFIG": "1",
"CURSOR_AGENT_TIMEOUT_MS": "0",
"CURSOR_AGENT_ASYNC_MAX_MS": "0"
}
}
}
}Never commit your real key. Put it in the host's MCP env (or your shell environment), not in a tracked file.
Claude Code: add the block to your project's
.mcp.json.Claude Desktop: add it under
mcpServersinclaude_desktop_config.json.
The bare_config fast path
On Linux, the Cursor Agent CLI loads ~/.cursor/mcp.json and syncs marketplace plugins (Prisma, Figma, Notion, β¦) before it answers β often 60β90 seconds of pure startup, even for a one-line question.
Setting CURSOR_AGENT_BARE_CONFIG=1 (or bare_config: true per call) points the CLI at an isolated CURSOR_CONFIG_DIR (~/.cursor-agent-mcp by default). It skips your desktop MCPs and plugins entirely.
Configuration | Cold start | Notes |
Default (loads | ~60β90s | Your real desktop MCPs + marketplace plugins |
| ~15β20s | Isolated config; your |
+ telemetry disabled (default) | ~15β20s | Child gets |
OpenTelemetry fan-out alone can add ~15β50s per call (CDN contacts on every spawn). This server disables it in the child process by default.
Because the isolated config has no saved login, provide an API key when using this mode.
Tools
All tools share a COMMON set of arguments:
Arg | Type | Description |
|
| Response format (default |
|
| CLI model id ( |
|
| Cursor API key; prefer setting it via env |
|
| Pass |
|
| Pass |
|
| Use the isolated fast config |
|
| Explicit |
|
| Working directory for the CLI |
|
| Explicit path to the CLI binary |
|
| Extra argv passed through |
|
| Prepend the effective prompt to the result |
Tool | Purpose |
| One-shot chat with a prompt |
| Prompt-based file edit (diff or apply) |
| Analyze one or more paths |
| Code search with include/exclude globs |
| Produce a numbered plan for a goal |
| Escape hatch: pass raw argv to the CLI |
| Legacy single-shot chat (kept for compatibility) |
| Start a long task in the background β |
| Poll a background |
| Kill a background job |
Examples
Chat (fast mode, explicit model):
{
"name": "cursor_agent_chat",
"arguments": {
"prompt": "Who created React?",
"model": "auto",
"bare_config": true
}
}Scoped code search:
{
"name": "cursor_agent_search_repo",
"arguments": {
"query": "fetch(",
"include": ["src/**/*.ts", "app/**/*.tsx"],
"exclude": ["node_modules/**", "dist/**"],
"output_format": "markdown"
}
}Long task without timeouts:
// 1) start
{ "name": "cursor_agent_start", "arguments": { "prompt": "Refactor the auth module and add tests", "label": "auth-refactor" } }
// β returns { "job_id": "job_1_..." }
// 2) poll until status is completed/failed
{ "name": "cursor_agent_check", "arguments": { "job_id": "job_1_...", "full": true } }Environment variables
Variable | Meaning |
| Absolute path to |
| API key passed as |
| Default model ( |
|
|
|
|
|
|
| Where the bare config lives (default |
| Always use this |
| Hard runtime ceiling per call (default |
| Max lifetime for async jobs (default |
| Idle-kill threshold; |
|
|
|
|
|
|
Quick smoke test
A tiny stdio client is included:
# list tools and call chat
node ./test_client.mjs "Hello from smoke test"
# fast mode + explicit key
CURSOR_AGENT_BARE_CONFIG=1 \
CURSOR_API_KEY="crsr_your_key" \
node ./test_client.mjs "Say only OK"
# call the raw tool with --help (no implicit --print)
TEST_TOOL=cursor_agent_raw TEST_ARGV='["--help"]' node ./test_client.mjsTroubleshooting
Symptom | Fix |
| Set |
~60β90s before the first token | Enable |
Auth error / 401 | Set |
Cut off mid-answer | Raise |
Empty output | Verify the model id and credentials; try |
Security notes
Child processes are spawned with
shell: falseβ no shell injection or quoting pitfalls.All tool inputs are validated with Zod.
API keys passed via argv are redacted in debug logs; prefer env over per-call
api_key.bare_configisolates only the CLI's config directory β it never modifies your real~/.cursor..gitignoreexcludes.env, keys, and the bare config dir so secrets don't get committed.
Project layout
cursor-agent-mcp/
βββ server.js # MCP server: tools, spawning, async jobs
βββ test_client.mjs # stdio smoke-test client
βββ package.json
βββ misc/ # Host/agent instruction docs (cost-aware usage)
βββ LICENSE
βββ README.mdCredits
This project builds on the original sailay1996/cursor-agent-mcp.
Enhancements in this fork β model/API-key options, bare_config fast startup, --trust handling, async job hardening, and this documentation β by Felipe Estrela.
License
MIT β see the license file for details.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/lipey1/cursor-agent-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server