cursor-sdk-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-sdk-mcprun a cursor agent to add error handling to src/api.ts"
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-sdk-mcp
An MCP (Model Context Protocol) server that lets MCP clients such as Claude Code invoke the Cursor SDK and use Cursor Agent capabilities as tools for local and cloud coding workflows.
What it does
The server speaks MCP over stdio and exposes these tools:
Tool | Description |
| Verify the configured Cursor API key and return the authenticated identity. |
| List the Cursor models available to the account. |
| Compatibility alias for a local Cursor Agent run against one |
| Run a local Cursor Agent against one or more working directories with optional Cursor MCP settings, inline MCP servers, subagents, sandboxing, and auto-review. |
| Run a Cursor Cloud Agent in a Cursor-hosted or self-hosted environment, optionally cloning repos and creating PRs. |
| Continue a previous agent conversation by |
| Fetch agent metadata. |
| List runs for an agent. |
| Fetch one run by |
| Cancel one run by |
| List artifacts produced by an agent. |
| Download an artifact as base64 content. |
Under the hood it uses @cursor/sdk's local and cloud runtimes. Local agents read/write files on
disk from this Node process. Cloud agents run in Cursor-hosted or self-hosted environments and can
use Cursor account/team MCP configuration from cursor.com/agents.
Related MCP server: cursor-mcp-server
Requirements
Node.js >= 22.13 (required by
@cursor/sdk).A Cursor API key. Create one at the Cursor Dashboard → API Keys (user key) or Team settings (service account key).
Install & build
npm install
npm run buildConfigure
Set your API key (see .env.example):
export CURSOR_API_KEY="your-cursor-api-key"
# Optional: default model id used when a tool call omits one (default: "auto")
export CURSOR_MCP_DEFAULT_MODEL="auto"Use with Claude Code
Register the server with Claude Code (stdio):
claude mcp add cursor-sdk -- node /absolute/path/to/cursor-sdk-mcp/dist/index.jsOr add it to your MCP client config manually:
{
"mcpServers": {
"cursor-sdk": {
"command": "node",
"args": ["/absolute/path/to/cursor-sdk-mcp/dist/index.js"],
"env": { "CURSOR_API_KEY": "your-cursor-api-key" }
}
}
}Then ask Claude Code to, for example, "use the cursor agent to refactor src/auth.ts", and it will
call cursor_run_local_agent or the compatibility cursor_run_agent.
Local agent usage
Use cursor_run_local_agent when the agent should work in local directories:
{
"prompt": "Refactor src/server.ts to split schemas into src/schemas.ts and run tests.",
"cwd": "/absolute/path/to/repo",
"model": "auto",
"mode": "agent",
"settingSources": ["project", "user", "plugins"],
"autoReview": true
}settingSources controls which Cursor MCP/settings layers the local runtime loads from disk. You can
also pass inline mcpServers, agents, and sandboxOptions for one-off tool wiring and safety.
For local cursor_follow_up, lifecycle, and artifact calls, pass the same cwd used to create the
agent so the SDK can find persisted local agent state.
Live progress and cancellation
cursor_run_agent, cursor_run_local_agent, cursor_run_cloud_agent, and cursor_follow_up run to
completion in a single tool call. Because a real coding run can take minutes, the server keeps the
call responsive:
Progress streaming. When the MCP client sends a
progressTokenwith the request (most clients do this automatically when you register a progress callback), the server streams each agent step — assistant text, tool calls, status changes — back asnotifications/progress. Clients that reset their request timeout on progress (setresetTimeoutOnProgress) won't time out on long runs, and the user sees what the agent is doing instead of a silent wait.Cancellation. If the client cancels the tool call (its
AbortSignalfires), the server cancels the underlying Cursor run, so you stop paying for work you no longer need.
Progress streaming is best-effort: if a client doesn't request progress, or the runtime doesn't support streaming, the tool still returns the same final result.
Cloud agent usage
Use cursor_run_cloud_agent when the agent should run in Cursor Cloud:
{
"prompt": "Add tests for the auth middleware and open a PR.",
"repos": [{ "url": "https://github.com/your-org/your-repo", "startingRef": "main" }],
"model": "auto",
"autoCreatePR": true
}repos can be omitted for an empty workspace or a named cloud environment. Cloud agents can use
inline MCP plus Cursor account/team MCP configured at cursor.com/agents. Use the lifecycle tools to
inspect runs, cancel work, and fetch artifacts.
Cursor MCP and skills strategy
Local agents use inline MCP unless
settingSourcesincludes project, user, or plugin settings.Local stdio MCP servers may include
cwd; cloud stdio MCP servers must not includecwd.Cloud agents use inline MCP plus user/team MCP from
cursor.com/agents.OAuth MCP must already be authorized in Cursor before local reuse.
Cursor skills can live in
.cursor/skills/,.agents/skills/,~/.cursor/skills/, or~/.agents/skills/.Claude Code skills are separate from this integration and are not loaded by Cursor Agent through this MCP server.
Development
npm run dev # run from source with hot reload (tsx)
npm run typecheck # type-check only
npm run lint # eslint
npm test # integration tests (fake Cursor backend, no network)
npm run demo # spawn the built server over stdio and call its tools
RUN_AGENT=1 npm run demo # additionally run a real Cursor Agent (needs CURSOR_API_KEY)How it's structured
src/cursor.ts—CursorServiceinterface +CursorSdkService(the@cursor/sdkwrapper).src/server.ts— builds theMcpServerand registers the tools. Decoupled from the SDK viaCursorServiceso tests can inject a fake backend.src/index.ts— entry point; wires the real service to aStdioServerTransport.tests/server.test.ts— connects an in-memory MCP client to the server and exercises every tool.examples/demo-client.ts— end-to-end demo over a real stdio transport.
License
MIT
Available Tools
4 toolscursor_follow_upCursor: follow upADestructive
Continue an existing Cursor Agent conversation by agentId with a new prompt. Conversation context from previous runs is loaded automatically.
| Name | Required | Description | Default |
|---|---|---|---|
| agentId | Yes | The agentId returned by a previous cursor_run_agent call. | |
| prompt | Yes | Follow-up instruction for the agent. | |
| model | No | Optional per-run model override. |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already provide destructiveHint=true; description adds automatic context loading. Additional behavioral details like mutation effects are omitted.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Two concise sentences with zero waste, front-loading the core purpose.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
No output schema provided and description lacks return value details. Adequate for simple follow-up but incomplete for understanding full tool behavior.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema covers 100% of parameters with descriptions. Description adds no further meaning beyond restating schema.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
Description clearly states it continues an existing conversation via agentId with a new prompt, distinguishing it from sibling cursor_run_agent which starts new conversations.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Implies use after cursor_run_agent by requiring agentId. Provides context but no explicit when-not-to-use alternatives.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
cursor_list_modelsCursor: list modelsARead-only
List the Cursor models available to the configured account. Use the returned ids as the model argument for cursor_run_agent / cursor_follow_up.
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already provide readOnlyHint and openWorldHint, so the description's main addition is the usage of returned ids. It confirms the read-only nature but does not disclose further behavioral traits like pagination or result format. Adequate given annotations.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Two sentences, front-loaded with the core purpose, and every word adds value. No wasted text.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a zero-parameter list tool with strong annotations, the description is complete. It explains the output's purpose (model ids for sibling tools) and the scope (available to account). No gaps.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The input schema has zero parameters with 100% coverage, so the description does not need to add parameter details. The description provides no param info, which is appropriate.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool lists Cursor models available to the configured account, with a specific verb ('List') and resource ('Cursor models'). It distinguishes from siblings by explaining how the returned ids are used with cursor_run_agent and cursor_follow_up.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description explicitly tells the agent to use returned model ids as the `model` argument for two sibling tools, providing clear context. It does not include when-not-to-use or alternative tools, but the guidance is strong.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
cursor_run_agentCursor: run agentADestructive
Run a Cursor Agent (local runtime) against a working directory and return the final result. The agent can read, edit, and write files and run shell commands in cwd. Returns an agentId you can pass to cursor_follow_up to continue the same conversation.
| Name | Required | Description | Default |
|---|---|---|---|
| prompt | Yes | Instruction for the Cursor Agent. | |
| cwd | Yes | Absolute path to the working directory the agent operates in. | |
| model | No | Model id (e.g. "composer-2.5"). Defaults to the server default ("auto"). | |
| mode | No | "agent" implements changes directly; "plan" explores and plans first. |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Description aligns with annotations: confirms destructive hint via file write/shell commands, open-world hint via flexibility. Adds agentId follow-up detail. No contradictions.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Two sentences: first sentence states purpose, second adds capabilities and follow-up. No extraneous words, efficient structure.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Description covers what the agent does and follow-up reference. No output schema, so mention of agentId is helpful. Could elaborate on return format, but sufficient for selection.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100%, so description does not need to add param details. Description provides operational context but does not enhance individual parameter meaning beyond schema.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
Clearly states verb 'run', resource 'Cursor Agent', and scope 'against a working directory'. Distinguishes from sibling tools by mentioning cursor_follow_up for continuation.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Provides some context by listing agent capabilities (read, edit, write files, run commands) but does not explicitly state when to use this tool versus alternatives or when not to use it.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
cursor_whoamiCursor: who am IARead-only
Verify the configured Cursor API key and return the authenticated account identity. Use this first to confirm authentication works before running an agent.
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already indicate readOnlyHint=true and openWorldHint=true, so the description does not need to disclose destructive behavior. It adds value by clarifying that the tool verifies the key and returns identity, which is consistent with the annotations. No contradiction.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is two sentences long, directly to the point, and front-loaded with the purpose. No extraneous words.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a simple authentication check tool with no parameters and no output schema, the description is fully complete. It explains what it does and when to use it, covering all needed context.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The tool has no parameters, and schema coverage is 100%. Baseline is 4 for 0 parameters. The description adds context about the return value (account identity), which is helpful beyond the empty schema.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description explicitly states the tool verifies the Cursor API key and returns the authenticated account identity, which is a specific verb-resource pair. It distinguishes itself from sibling tools like cursor_run_agent and cursor_list_models by focusing on authentication verification.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description directly advises to use this tool 'first to confirm authentication works before running an agent', providing explicit guidance on when to use it and implying not to use it for other purposes.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.
4 tool updates
v0.1.0- First observed
cursor_follow_up - First observed
cursor_list_models - First observed
cursor_run_agent - First observed
cursor_whoami
TDQS
Each tool serves a distinct purpose: authentication, model listing, starting an agent, and continuing a conversation. No overlap.
All tools use snake_case with a consistent 'cursor_' prefix and action-oriented verbs, forming a predictable pattern.
With 4 tools, the set covers the essential interactions (auth, model list, run, follow-up) without bloat or gaps.
The domain is well-covered for basic usage; missing an optional stop/status tool, but core workflows are complete.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
Discover and call AI agents via MCP. Supports A2A agents and platform agents with async tasks.
Real-time chat hub for AI agents — Claude Code, Cursor, Cline, Codex over MCP or REST.
Real-time chat for AI agents. Claude Code, Cursor, Cline and Codex join channels over MCP.
Remote data science agents for Snowflake, Databricks & BigQuery in Claude/Cursor via MCP
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceEnables programmatic control of Cursor's cloud-based AI agents for automated code generation and repository management via standardized MCP tools.256MIT
- FlicenseNot gradedqualityDmaintenanceAn MCP server wrapping the Cursor CLI agent, enabling Claude Code and other MCP clients to delegate tasks to Cursor's AI agent for file writing, bash commands, and codebase queries.-
- AlicenseNot gradedqualityBmaintenanceEnables MCP clients like Claude Code to delegate coding tasks to the local Cursor Agent CLI, with persistent per-workspace sessions that resume across calls.12MIT
- FlicenseNot gradedqualityBmaintenanceBridges MCP to Cursor Agent via ACP, allowing Codex to delegate file edits and shell commands to Cursor for repository modifications, with security defaults.-
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/newxun/cursor-sdk-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server