cursor-dispatcher
Click on "Deploy 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-dispatcher have cursor scaffold a fastify server under ./demo."
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-dispatcher
An MCP server + Claude Code plugin that lets Claude spawn Cursor subagents as async, bounded workers.
Claude delegates a task, gets a run_id back immediately, and continues talking to the user. When the subagent finishes, a plugin hook injects the outcome into Claude's next turn — no polling, no blocked chat.
The original design spec lives in
PRD.md.
What it does
Spawn Cursor subagents on demand (
spawn_subagent).Message them mid-run via
--resume=<chat_id>(send_subagent_message).Stream their NDJSON events to disk as they run (readable via
get_subagent_eventsor thesubagent://<run_id>/eventsMCP resource).Synthesize a structured completion payload — status, summary, artifacts (file edits + shell tool calls with stdout/stderr) — via
get_subagent_result.Cancel, list, prune.
Retain run history under
~/.claude-cursor-harness/with tiered compression (7d → gzip, 14d → delete) and an LRU cap.Notify Claude asynchronously via an
UserPromptSubmithook so subagent completions surface without polling.Preflight cursor-agent auth on startup + every spawn; refuses with an actionable error if not logged in.
Related MCP server: cursor-mcp-server
Requirements
Node ≥ 20 (for the MCP server)
cursor-agentinstalled on$PATH, authenticated viacursor-agent loginorCURSOR_API_KEYenv varClaude Code (for the plugin — hooks, skill, slash command)
Install
Public (via GitHub marketplace)
From inside Claude Code:
/plugin marketplace add ppetko98/cursor-dispatcher
/plugin install cursor-dispatcher@cursor-dispatcher
/reload-pluginsThat's it — Claude Code clones the repo, wires up the MCP server, hook, skill, and slash command. You still need cursor-agent installed on $PATH and authenticated (see /cursor-login).
Local (for dev)
git clone https://github.com/ppetko98/cursor-dispatcher.git
cd cursor-dispatcher
npm install
npm run build
# From Claude Code:
/plugin marketplace add /absolute/path/to/cursor-dispatcher
/plugin install cursor-dispatcher@cursor-dispatcher
/reload-pluginsThen verify:
/mcp # cursor-dispatcher should be listed
/hooks # UserPromptSubmit → on-user-prompt.mjs
Skill: cursor-dispatcher:cursor-subagent
Slash: /cursor-loginWithout the plugin (MCP-only)
If you only want the MCP tools without the hook + skill:
claude mcp add cursor-dispatcher -- node /absolute/path/to/cursor-dispatcher/dist/server.jsUsage (from Claude)
Typical delegation flow, driven by the shipped cursor-subagent skill:
You: "have cursor scaffold a fastify server under
./demo."Claude: calls
spawn_subagent({ prompt: "...", cwd: "...", permission: "auto" })→ returnsrun_idinstantly. Tells you it's running and moves on.Subagent runs
cursor-agent -p --output-format stream-json --resume-supportin the background, streaming NDJSON events to~/.claude-cursor-harness/runs/<run_id>/events.ndjson.You send any next message — the
UserPromptSubmithook scans for terminal transitions and prependsSUBAGENT <id> → completed — <summary>to your prompt.Claude sees the update inline in the very next turn and reports back with the outcome (files edited, shell output, etc.).
Follow-ups on the same run use send_subagent_message — it re-invokes cursor-agent --resume=<chat_id> so the subagent picks up where it left off.
Permission model
The harness maps the parent Claude session's own posture to Cursor's approval flags:
| Cursor flags | When to pick |
|
| Parent Claude is in plan / read-only mode. Subagent cannot write files or run shell commands. |
|
| Default. Server-side classifier auto-approves safe tool calls; unsafe ones would prompt (and effectively hang in headless mode). |
|
| Fully autonomous. Use only when the user has explicitly said "let it rip." |
Model must come from an allowlist (default: auto, gpt-5.2, claude-opus-5-thinking-high, claude-opus-4-8-thinking-high, composer-2.5). Working directory must live under a configured root (default ~/workspace).
MCP tools
All tools live under the cursor-dispatcher MCP server.
Tool | Purpose |
| Launch a new subagent. Returns |
| Send a follow-up message to a run (resumes the same Cursor chat). |
| Cheap poll: status + last event id + current turn. |
| Fetch NDJSON events since a given |
| Terminal-run completion payload: |
| Filterable list of runs known to the harness. |
| SIGTERM the child. |
| Manual cleanup: |
Resources are exposed at subagent://<run_id>/status and subagent://<run_id>/events, with notifications/resources/updated fired on each new batch of events.
Configuration
Precedence: env var > ~/.claude-cursor-harness/config.json > built-in defaults.
Example config file:
{
"runtime": { "cursorBin": "cursor-agent" },
"policy": {
"models": ["auto", "gpt-5.2"],
"defaultModel": "auto",
"cwdRoot": "/Users/you/workspace",
"sandbox": "enabled"
},
"retention": {
"compressAfterDays": 7,
"maxAgeDays": 14,
"maxRuns": 200,
"pruneOnStartup": true,
"pruneOnSpawn": true
}
}Env-var overrides:
Env | Config path |
| root data dir (default |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| cursor-agent auth (bypasses login) |
Retention
Each run's data lives under ~/.claude-cursor-harness/runs/<run_id>/:
runs/<run_id>/
├── meta.json # RunMeta (status, model, chat_id, session, summary, retention state)
├── events.ndjson # NDJSON of every parsed cursor-agent event
├── messages.ndjson # Parent ↔ subagent message log
└── artifacts/ # Reserved for future materialized outputsLifecycle:
0–7 days: kept fully.
7–14 days:
events.ndjsonandmessages.ndjsongzipped in place.meta.jsongainsretentionState: "compressed",compressedAt, and a materializedsummaryso it stays self-describing.get_subagent_resultstill works —readEventstransparently gunzips.>14 days: entire run dir deleted.
LRU: if more than
maxRunsterminal survivors remain, the oldest (byendedAt) are deleted regardless of age.Non-terminal runs are never touched.
Triggers: startup (registry.load), after every spawn_subagent, and on-demand via prune_subagents.
The plugin bundle
Under plugin/:
MCP server — same code that ships as
dist/server.js.Skill
cursor-subagent(plugin/skills/cursor-subagent/SKILL.md) — teaches Claude the non-blocking pattern, permission mapping, and follow-up flow.Slash command
/cursor-login(plugin/commands/cursor-login.md) — walks the user through interactive login orCURSOR_API_KEYsetup.Hook
UserPromptSubmit(plugin/hooks/on-user-prompt.mjs) — before each of your prompts, scans for new terminal transitions and injects a summary block. Filters to this Claude Code session where possible; falls back to reporting mismatched-session runs as[unlinked]so nothing is silently missed.
Development
npm install
npm run build # tsc
npm test # vitest (34 tests)
npm run lint # tsc --noEmitRepo layout:
src/
├── server.ts # MCP stdio entrypoint
├── config.ts # Config layer (env + config.json)
├── session.ts # Per-server session id resolver
├── types.ts
├── runtime/
│ ├── runner.ts # Cursor CLI child process
│ ├── registry.ts # In-memory + disk-backed run registry
│ ├── storage.ts # ~/.claude-cursor-harness/ layout + gzip helpers
│ ├── events.ts # NDJSON parser, summary + artifact synthesis
│ ├── cleanup.ts # Retention engine (compress/delete/LRU)
│ ├── auth.ts # cursor-agent status preflight
│ └── notifier.ts # MCP notifications helpers
├── tools/ # One file per MCP tool
└── policy/ # Model allowlist, sandbox, cwd whitelist
plugin/
├── .claude-plugin/plugin.json
├── skills/cursor-subagent/SKILL.md
├── commands/cursor-login.md
└── hooks/on-user-prompt.mjs
tests/Known limitations
Session linking is loose. Claude Code doesn't expose a shared session id to child MCP servers, so runs stamped with the MCP server's random UUID rarely match the session id Claude Code injects into the hook. The hook falls back to reporting these as
[unlinked]so nothing is missed — noisy if you run concurrent Claude sessions.True mid-silence wake-up isn't possible. MCP notifications reach the client but Claude Code doesn't (currently) auto-invoke the model on them. Subagent completions surface on your next prompt, not asynchronously.
spawn_subagentrequires a working cursor-agent + auth. No queueing, no retry. If cursor-agent isn't installed or not authenticated, the tool call fails with a clear message pointing at/cursor-login.
License
PolyForm Noncommercial 1.0.0 — free for personal, research, educational, hobbyist, and other noncommercial use (including noncommercial open-source projects, charities, and government/academic institutions). Commercial use, hosting-as-a-service, and repackaging for resale are not permitted. If you want to use this in a for-profit setting, open an issue to discuss a commercial license.
Note: "noncommercial" here does not meet the OSI's Open Source Definition (which forbids field-of-use restrictions); this is a source-available license.
Available Tools
8 toolscancel_subagentA
Terminate a running subagent (SIGTERM).
Inputs: run_id (required).
get_subagent_eventsA
Fetch NDJSON events emitted by a subagent since a given event id. Use for polling or to catch up after a notifications/resources/updated ping.
Inputs: run_id (required), limit, since_event_id.
get_subagent_resultA
Return the final structured completion payload for a terminated run (status ∈ {completed, failed, cancelled, timed_out}).
Inputs: run_id (required).
get_subagent_statusB
Return the current status of a subagent run.
Inputs: run_id (required).
list_subagentsB
List subagent runs known to this harness.
Inputs: since, status.
prune_subagentsA
Compress / delete old terminal runs. By default follows the retention config (compress after N days, delete after M days, LRU cap). Pass overrides to run a manual cleanup or set dry_run=true to preview what would happen.
Inputs: dry_run, keep_last, max_age_days, compress_after_days.
send_subagent_messageA
Send a follow-up message to a running subagent (resumes the same chat). Errors if a turn is already in flight.
Inputs: run_id (required), message (required).
spawn_subagentA
Launch a Cursor subagent with the given prompt. Returns immediately with a run_id; the subagent runs asynchronously. Model must be in the allowlist. Use get_subagent_events or subscribe to subagent://<run_id>/events to observe progress.
Inputs: prompt (required), cwd, mode, model, +4 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 8 tools
Each tool targets a distinct operation in the subagent lifecycle: spawn, message, status, events, list, cancel, result, and prune. There is no meaningful overlap between any pair; even status vs. result are clearly differentiated by current state vs. final completion payload.
All tool names follow a consistent verb_noun pattern in snake_case (spawn_subagent, send_subagent_message, get_subagent_status, etc.). The verbs are specific and predictable, making the API easy to learn and navigate.
Eight tools is ideal for a subagent dispatcher. Each tool earns its place by covering a distinct part of the lifecycle, and the count is neither thin nor bloated.
The set provides full lifecycle coverage: create (spawn), interact (send message), read (status, events, list), terminate (cancel), retrieve final output (result), and cleanup (prune). There are no obvious gaps that would hinder an agent using this server.
Maintenance
Related MCP Connectors
Shared memory and mail for your AI agents. Verified with Claude Code; other MCP clients in testing.
Hosted X Ads MCP server for Claude, ChatGPT and Cursor, with each action switched per account.
Hosted Web Crawler MCP server for Claude, ChatGPT and Cursor, with each action switched per account.
Real-time chat for AI agents. Claude Code, Cursor, Cline and Codex join channels over MCP.
Related MCP Servers
- AlicenseAqualityDmaintenanceMCP server that spawns autonomous Claude Code agents in GitHub repos, enabling task delegation with persistent state, multi-step workflows, and job monitoring.4776 npm2Apache 2.0
- 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 gradedqualityFmaintenanceAn MCP server that enables Cursor to delegate complex, multi-step tasks to specialized subagents, including general-purpose and explore agents, with automatic discovery of existing Claude subagents.1 npm1MIT
- AlicenseNot gradedqualityCmaintenanceAn MCP server that lets any MCP-capable agent spawn and drive Claude Code sessions — effectively turning Claude Code into an orchestratable sub-agent fleet.71 npmMIT