cursor-mcp-bridge
This server bridges an MCP host to a headless Cursor CLI agent, enabling cheap and fast delegation of coding tasks and exploration while keeping large file contents out of your own context.
delegate: Run arbitrary tasks (implementation, edits, shell commands) with full tool access (read, edit, shell) via a cheap Cursor agent in a specified working directory.explore: Read-only codebase exploration — omitfilesto get a general project map (layout, modules, entry points, conventions), or pass specific files to ask focused questions without loading code into context.read_slice: Surgically read only the lines relevant to a query from specified files, keeping context small.run_filtered: Execute a shell command and return only the lines matching a semantic filter.web_lookup: Perform web or docs searches using the Cursor agent's web access.follow_up: Continue a prior session bysession_id, preserving context on Cursor's side without resending it.bridge_stats: Report usage statistics (call count, characters returned) per tool when logging is enabled.
All tools accept optional cwd, model (default: auto for cheapest), and effort parameters, and return a session_id for continuation.
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-mcp-bridgeexplore the project structure in ./src"
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-mcp-bridge
MCP server that lets any agent or MCP host delegate to headless Codex, Grok, and Claude Code CLIs, with Cursor available as an opt-in fallback. Use the fleet for implementation, planning, and project exploration without burning the caller's context on raw worker output.
Worker tools take optional model and effort overrides, return a session_id, and support
follow_up. Difficulty levels select a distinct default model across the three active
subscriptions.
Tools
The server exposes ten tools:
Tool | Purpose |
| Run a task with full read/edit/shell access in |
| Read-only exploration on Codex with |
| Surgical read-only read: returns ONLY the code relevant to |
| Run a shell |
| Web/docs lookup through Codex/Luna with real web search enabled and a read-only filesystem. |
| Generate or edit an image through Codex's built-in image tool and save it inside |
| Phase 1: read the codebase and return an implementation plan without editing. Defaults to level 4 (Codex Sol, hard read-only); level 5 Claude is read-only by prompt only. |
| Phase 2: implement an approved plan with full access. Defaults to level 1 (Codex Luna) and optionally accepts an |
| Continue a prior session by |
| Report calls and chars returned to context per tool (needs |
Worker tools accept cwd, model, and effort where applicable. delegate requires a level
(1-5); plan and build default to levels 4 and 1 respectively. Explicit model/effort
values override the selected tier.
Related MCP server: cursor-mcp-server
Requirements
Node ≥ 18
Codex installed and authenticated for read tools and levels 1/3/4; Grok for level 2; Claude Code for level 5.
Optional Cursor fallback: install
cursor-agentand setCURSOR_BRIDGE_ENABLE_CURSOR=1.
Install
Installing via an AI agent? Point it at
INSTALL.md— an agent-facing, copy-paste guide that detects the host and registers the bridge in Claude Code, Cursor, Codex, Grok, or any generic MCP host.
git clone https://github.com/JaimeJunr/cursor-mcp-bridge.git
cd cursor-mcp-bridge
npm install
npm run buildRegister in an MCP host
Claude Code:
claude mcp add cursor-bridge -s user -- node /abs/path/to/cursor-mcp-bridge/dist/index.jsAny host — add to its mcp.json:
{
"mcpServers": {
"cursor-bridge": {
"command": "node",
"args": ["/abs/path/to/cursor-mcp-bridge/dist/index.js"]
}
}
}Permissions (Claude Code): claude mcp add registers the server but does not grant
tool permission — without an allowlist every bridge call prompts for approval. After
registering, add either "mcp__cursor-bridge__*" (full; also auto-approves mutating tools
delegate/build/run_filtered/follow_up) or a read-only subset
(explore/read_slice/web_lookup/plan/bridge_stats) under
permissions.allow in settings.json. Full options and trade-offs:
INSTALL.md §3. Cursor/Codex/other hosts
have their own approval settings — consult the host.
Configuration (env)
Var | Default | Meaning |
|
| Path to the optional Cursor CLI fallback. |
|
| Path to the Grok CLI. |
|
| Path to the Codex CLI. |
|
| Path to the Claude Code CLI. |
| (off) | Set to |
|
| Default model for the optional Cursor path. |
|
| Codex model for |
| (off) | Additional |
|
| Isolates every engine in a bubblewrap sandbox with an empty |
| (off) | If |
|
| Per-call safety-net timeout (not a work budget). Execution tools ( |
| (off) | Path to a JSONL file; when set, every call logs |
|
| Hook behavior: |
|
| Line threshold above which the optional hook (below) redirects/nudges whole-file Read toward |
Security:
delegate,build, andrun_filteredhave full access and auto-approve their work.explore,read_slice, andweb_lookupuse Codex's read-only sandbox.planis hard read-only on Codex; level 5 Claude enforces read-only through its prompt. Named agents are resolved on the host, reject path traversal, and are injected without mounting agent directories.
Make the agent actually use it
Registering the tools is not enough. Two structural forces push the agent back to
native tools: (1) the host rule "prefer the dedicated file/search tools", and (2) MCP
tools used to be deferred — the agent had to run a tool-search to load their schemas,
so always-loaded Read/Grep/WebSearch won by default. The server now publishes
startup instructions (routing boundary) and marks the five core tools with
_meta: { "anthropic/alwaysLoad": true } (Claude Code ≥2.1.121) so their schemas load
eagerly; secondary tools stay deferred. Four fixes, strongest first:
1. Call-time hook (recommended). A PreToolUse hook that steers the agent toward
the bridge at the moment it reaches for a native tool — text in a config file loses under
pressure, a call-time reminder does not. This repo ships one at
hooks/prefer-cursor-bridge.mjs: it runs on node
(already required) and only fires where it pays. Default mode is redirect
(CURSOR_BRIDGE_HOOK_MODE=redirect): for the two safe-to-block cases it returns
permissionDecision: "deny" once and names the bridge tool; other cases stay non-blocking
nudges. Wire it into your host's settings (Claude Code settings.json):
{
"hooks": {
"PreToolUse": [
{
"matcher": "Read|Grep|Glob|WebSearch|WebFetch|Bash|Edit|Write|MultiEdit",
"hooks": [
{ "type": "command", "command": "node /abs/path/to/cursor-mcp-bridge/hooks/prefer-cursor-bridge.mjs", "timeout": 5 }
]
}
]
}
}What it emits, and when — each fires at most once per session (deduplicated in a tmp
file keyed by session_id), because a repeated fire is worse than none: the agent learns
to ignore it and every fire costs tokens. Dedup keys are saved before emitting so
redirect is one-shot and fail-open (a second identical call is allowed through).
Readwhole-file (no offset/limit) overCURSOR_BRIDGE_HOOK_MIN_LINESlines → redirect (default) or nudge towardread_slice(once per file). Partial reads are left alone.
WebSearch/WebFetch→ redirect (default) or nudge towardweb_lookup(once).
Grep/Glob→ emits the one-time preload reminder to run theToolSearchfor any still-deferred bridge tools (nudge only — never redirected). The dedup collapses them to a single fire.
Bashwhose command writes an artifact (git commit/push,git worktree add,gh pr create,gh issue create,bkt pr create) → suggests offloading that grunt-work todelegate(once, nudge only). Read-only Bash (status/diff/log/checkout) is left alone — the orchestrator needs that state, and a mechanical filter (e.g. rtk) already trims the noise.
Edit/Write/MultiEdit→ once per session, reminds that a self-contained task (feature, bugfix, mechanical multi-file change, build fix) can go whole todelegate(prompt, level)— the selected worker edits with full access — instead of the orchestrator implementing it on expensive tokens. It never blocks the edit (nudge only); the once-per-session dedup means the orchestrator still edits inline freely (the nudge repositions execution, it doesn't police every edit).The first qualifying fire of the session (whichever tool triggers it) also carries that preload reminder, so secondary schemas get loaded even in a Read-only or web-only session.
Redirect deny reasons end with a fail-open suffix: if the bridge tool isn't loaded yet, run ToolSearch first; if the native tool is genuinely needed, call it again and it will be allowed (critical under headless
-pso the agent never hard-stalls).
Set CURSOR_BRIDGE_HOOK_MODE=nudge for the old non-blocking behavior, or off to disable.
To reset the dedup and see the fires again, start a new session (or delete
cursor-bridge-nudged-<session_id>.json from your OS temp dir — os.tmpdir(),
e.g. /tmp on Linux, not necessarily $TMPDIR).
Preloading at session start (SessionStart)
The PreToolUse preload above only fires when the agent uses the Grep/Read tool. But
under pressure agents often reach for Bash grep instead, which matches no PreToolUse
matcher — so the preload reminder never arrives. Wire the same hook for SessionStart to
close that hole: the preload reminder then lands in context before the first tool decision,
regardless of how the agent searches.
{
"hooks": {
"SessionStart": [
{ "hooks": [{ "type": "command", "command": "node /abs/path/to/cursor-mcp-bridge/hooks/prefer-cursor-bridge.mjs", "timeout": 5 }] }
]
}
}On SessionStart the hook emits the ToolSearch preload as additionalContext and pre-marks
preload as seen in the session's dedup file, so the PreToolUse piggyback never repeats it.
Reaching subagents too (SubagentStart)
The nudges above only steer the main loop. Spawned subagents never see them,
so wire the same hook for SubagentStart as well:
{
"hooks": {
"SubagentStart": [
{
"hooks": [
{ "type": "command", "command": "node /abs/path/to/cursor-mcp-bridge/hooks/prefer-cursor-bridge.mjs" }
]
}
]
}
}On SubagentStart the hook injects a compact cursor-bridge preference into every
spawned subagent via additionalContext (subagentStartContext(agent_type)).
When agent_type is Explore it appends an extra line: that Explore run was spawned on the
orchestrator's expensive model (Explore inherits the session model, capped at Opus), so it should
route all reading through explore/read_slice (which run on Codex Luna) and
keep the expensive shell to orchestration only.
Coexisting with context-mode. The bridge and context-mode use separate channels (context-mode may still do its own thing; this hook only emits
additionalContext), so they coexist cleanly — noupdatedInputrace, no delay, no import of context-mode's routing.
2. Preload any still-deferred tools. The five core tools are already alwaysLoad on
Claude Code ≥2.1.121. For secondary tools (or older hosts), tell the agent to load schemas
once per session. Add to your CLAUDE.md/AGENTS.md:
At the start of any session involving code reading/exploration, run tool-search once for
`read_slice, explore, run_filtered, web_lookup` (and any secondary bridge tools you need) so
their schemas are loaded if the host still defers them.3. Reconcile the conflict in CLAUDE.md. State the precedence explicitly:
The host rule "prefer dedicated file/search tools" applies to the EDIT path (Edit needs the
file content → native Read). For PURE reading/locating/web (no edit), cursor-bridge takes
precedence over native Read/Grep/Glob/WebSearch/WebFetch. Read a large file whole with native
Read ONLY when you are about to edit it.4. Delegate execution, not just exploration. The bridge is not only for reading — delegate
runs implementation work with full read/edit/shell access, so the orchestrator shouldn't burn its
own tokens on self-contained tasks. State this in CLAUDE.md so the agent routes doing, not just
finding, to the cheap worker:
You are the ORCHESTRATOR. delegate(prompt, level) is the DEFAULT for BOTH execution AND judgment.
`level` picks a distinct tier: 1=GPT-5.6 Luna (codex), 2=Grok 4.5 medium, 3=GPT-5.6 Terra medium
(codex), 4=GPT-5.6 Sol medium (codex), 5=Opus (claude). The worker has full read/edit/shell access
in cwd when you delegate. The constant win is context economy: the worker's raw output never enters
your context. Delegate it, then review the result; edit inline only for a quick one-off you're
already positioned for. Use plan(task) then build(plan) when you want a strong read-only planning
phase followed by a cheaper executor. Pass agent:"name" or agent:{prompt:"..."} when the worker
needs a specialized persona.Develop
npm test # vitest — unit tests for model resolution / arg building
npm run dev # run from source via tsxLicense
MIT
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
- Alicense-qualityCmaintenanceMCP server for task management, project knowledge, workspace trust, runner sandboxes, extension registry, and workflow prompts, enabling AI agents to manage tasks and collaborate locally.Last updated2,827Apache 2.0
- Flicense-qualityDmaintenanceAn 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.Last updated
- AlicenseAqualityCmaintenanceMCP server that lets any agent or MCP host delegate tasks to Claude Code running headless, with tools for review, validation, analysis, and autonomous work.Last updated4992MIT
- AlicenseAqualityBmaintenanceLocal MCP server that exposes delegation tools for Codex, Claude, and Antigravity CLI, enabling an orchestrator agent to assign tasks to these sub-agents via non-interactive CLI commands.Last updated3MIT
Related MCP Connectors
Personal assistant MCP server with search, execute, packages, jobs, secrets, and integrations.
Real-time chat hub for AI agents — Claude Code, Cursor, Cline, Codex over MCP or REST.
Real-time chat hub for AI agents — Claude Code, Cursor, Cline, Codex over MCP or REST.
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/JaimeJunr/cursor-mcp-bridge'
If you have feedback or need assistance with the MCP directory API, please join our Discord server