cursor-relay-mcp
This server lets MCP clients delegate bounded tasks to a selected Cursor model and manage durable, restart-safe, explicitly authorized local workspace runs.
Run diagnostics with
doctorto check config, authentication, and persistence without calling Cursor models.Discover available models, aliases, and parameters with
list_modelsbefore starting a run.Issue short-lived, one-time, read-only workspace authorization tokens via
authorize_workspacewhen the user explicitly approves a workspace in the conversation.Start persistent Cursor Agent runs with
start_run, requiring workspace, task, model, and idempotency key; default permission is read-only, with guardedworkspace-writeanddanger-full-accessoptions.Continue a finished agent session under the same agentId with
reply_run.Inspect or recover runs after restart with
get_run, poll withwait_run(max 30s, call again when not terminal), and cancel withcancel_run.List persisted relay runs with
list_runsand page through streamed events withread_events, including truncation metadata for large event data.Enforce security defaults: static workspace allowlist for unattended runs, bounded permissions, sandbox on supported non-Windows hosts, idempotent/recoverable operations, and no secret persistence (optional
CURSOR_API_KEYfor automation).
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-relay-mcpstart a run to review the recent code changes and suggest improvements"
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-relay-mcp
A local MCP server built on the official @cursor/sdk. It lets MCP clients delegate a bounded task to an explicitly selected Cursor model while keeping durable, restart-safe run state.
@cursor/sdk is public beta. This package pins exactly 1.0.28 and includes an SDK export contract test. See README.zh-CN.md for the full guide.
For a tested Codex Desktop installation workflow on Windows, including personal marketplace layout, CLI fallback, sandbox compatibility, cache refresh, and a Grok 4.6 smoke test, see CODEX_INSTALL.zh-CN.md.
Codex built-in MCP contract
The Codex plugin manifest references the packaged MCP declaration with
"mcpServers": "./.mcp.json". The packaged .mcp.json must start
node ./dist/index.js with cwd: ".". Codex resolves that working directory
against the installed plugin version root. Do not hard-code a development checkout
or a versioned Codex cache path, duplicate the same server in user config.toml, or
put CURSOR_API_KEY in the MCP declaration.
After installing or reinstalling the plugin, create a new Codex task. Codex loads
the bundled Skill and starts the built-in MCP automatically. It sends only the
workspace path, task, model, permission, and idempotency data; the Cursor Agent
reads the authorized workspace itself, so callers should not embed source files in
MCP arguments. An explicit request for Cursor to review a current or named
workspace authorizes in-scope reading, not secrets, unrelated paths, or edits. An
explicit request to modify or fix must map to workspace-write, not be silently
downgraded to analysis. Outside the static allowlist, authorize_workspace
issues a reusable capability bound to the current Codex conversation and exact
workspace; it supports both read-only and workspace-write.
Related MCP server: mcp-job-queue
Quick start
Requirements: Git, Node.js >=22.13, and a Cursor account. The recommended
authentication method is the official Cursor.auth.login() stored login.
git clone https://github.com/tonytanglab/cursor-relay-mcp.git
cd cursor-relay-mcp
npm install
# Opens the system default browser and stores an official SDK login for this OS user.
node --input-type=module --eval 'import { Cursor } from "@cursor/sdk"; await Cursor.auth.login({ apiKeyName: "cursor-relay-mcp" })'
npm run build
$env:CURSOR_RELAY_WORKSPACE_ROOTS = "D:\app\git"
node .\dist\index.jsRun the login once on each computer and OS user account that starts the MCP server. The official SDK opens the system default browser, mints a named, expiring and revocable API key, and stores it in its official credential store; the relay never reads or returns the key value. Check the login without exposing credentials:
node --input-type=module --eval 'import { Cursor } from "@cursor/sdk"; console.log((await Cursor.auth.status()).status)'logged-in means the MCP process can use stored login. CURSOR_API_KEY remains
an optional alternative for automation, but do not put it in .mcp.json, shell
history, logs, or the repository. When using stored login, omit
CURSOR_API_KEY entirely instead of setting it to an empty string.
The normal tool flow is doctor → list_models → start_run → repeated wait_run calls until terminal=true. Runs are idempotent, persisted, bounded by a total timeout, and recoverable after process restart.
Security defaults are fail-closed: unattended runs require the static workspace
allowlist. When a user explicitly authorizes Cursor Relay for a workspace in the
current conversation, authorize_workspace can issue a reusable read-only or
workspace-write capability. The token is never persisted and is bound to the
real path, granted permission ceiling, and MCP task/session when available. A
workspace-write capability can also run read-only tasks; a read-only capability
cannot be elevated. It expires when that conversation scope or MCP process ends.
Permissions otherwise default to read-only, the Cursor sandbox is enabled by
default on supported non-Windows hosts, and only project settings are loaded.
Windows defaults the SDK sandbox off because the current local runtime reports
it as unsupported; the read-only tool allowlist remains enforced.
danger-full-access still requires the static allowlist plus both
CURSOR_RELAY_ENABLE_DANGER_FULL_ACCESS=true at server startup and
confirmedDangerousPermission=true on the request. Leave the server switch off
for normal use.
CURSOR_RELAY_READ_ONLY_SANDBOX_ENABLED can explicitly disable the sandbox on
supported non-Windows hosts. Windows always clamps this setting off because the
current Cursor SDK local runtime does not support that sandbox path. This switch
applies only to the read-only preset; its public tool allowlist remains
restricted to read, grep, glob, and ls.
The workspace-write sandbox follows the same platform compatibility rule: it is
enabled by default on supported non-Windows hosts and clamped off on Windows,
while the exact workspace authorization and disallowed-tool list remain enforced.
CURSOR_RELAY_SETTING_SOURCES is an optional comma-separated list restricted
to the public project, team, and mdm setting layers. It defaults to
project; user, plugins, and all are deliberately rejected to avoid
ambient or recursive MCP behavior.
Run summaries omit streamed events and report eventCount; use read_events
for event pages. Event data larger than 8 KiB is replaced with explicit
truncation metadata. Redaction is based on sensitive field names and is not a
general secret scanner, so use a private state directory and avoid secrets in
prompts.
The relay uses only public exports from the pinned SDK: model discovery,
Agent.create/resume/listRuns/getRun, Run.stream/wait/cancel, and
official authentication status. It does not inspect Cursor IDE state or private
endpoints. Restarting the Cursor IDE is not required for local SDK runs.
Verification
npm run format:check
npm run lint
npm run typecheck
npm test
npm run build
npm run test:mcp
npm run check:package
npm run test:sdk-contractThe default tests do not call the real Cursor API or modify a real workspace.
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 Servers
- FlicenseAqualityBmaintenanceEnables MCP clients to invoke Cursor SDK's agent runtime, run coding agents, list models, and continue conversations.4
- AlicenseAqualityCmaintenanceEnables MCP clients to submit long-running jobs that are executed safely in isolated child processes with a durable SQLite queue, configurable timeouts, retries with backoff, and backpressure.5MIT
- AlicenseNot gradedqualityCmaintenanceEnables running and managing automated tasks with retry loops and machine-checkable success criteria via MCP tools.5MIT
- AlicenseDqualityCmaintenanceProvides MCP tools and hooks for agent coordination within Cursor workspaces, enabling claim-based scope management, compliance auditing, and production readiness checks.4MIT
Related MCP Connectors
Reliable async execution for agent tool calls: schema gating, retries, idempotency, audit trail.
Control plane for autonomous software labor. Agents claim objectives over MCP with audit trail.
Remote MCP for A2A failure replay MCP, structured receipts, audit logs, and reviewer-ready evidence.
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/tonytanglab/cursor-relay-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server