cursor-delegate-mcp 1.11.0 → 1.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/PRIVACY.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Privacy
2
2
 
3
- Cursor Delegate MCP runs as a local stdio MCP server. The project author does not operate a backend for the plugin and does not receive your code, prompts, workspace contents, session identifiers, diagnostics, or usage telemetry.
3
+ Cursor Delegate runs as a local stdio MCP server. The project author does not operate a backend for the plugin and does not receive your code, prompts, workspace contents, session identifiers, diagnostics, or usage telemetry.
4
4
 
5
5
  Claude Code installs run the server bundled in the plugin cache. On first session, the plugin may run `npm install --omit=dev` inside that cache to fetch its open-source runtime dependencies; it does not install them into your project. Codex, Copilot, VS Code, and standalone MCP configurations start the published package through `npx`, so npm may apply its own registry logging under npm's policies.
6
6
 
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Cursor Delegate MCP
1
+ # Cursor Delegate
2
2
 
3
3
  **Keep the brains. Delegate the build.**
4
4
 
@@ -8,7 +8,7 @@
8
8
  [![license: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
9
9
  [![tests](https://github.com/andreilungeanu/cursor-delegate-mcp/actions/workflows/test.yml/badge.svg)](https://github.com/andreilungeanu/cursor-delegate-mcp/actions/workflows/test.yml)
10
10
 
11
- <img src="assets/logo-light.png" alt="Cursor Delegate MCP logo" width="150" align="left" hspace="15">
11
+ <img src="assets/logo-light.png" alt="Cursor Delegate logo" width="150" align="left" hspace="15">
12
12
 
13
13
  Use your best coding agent where its judgment matters most: understanding the task, shaping the plan, and reviewing the result.
14
14
 
@@ -88,7 +88,7 @@ copilot plugin install andreilungeanu/cursor-delegate-mcp
88
88
  ```json
89
89
  {
90
90
  "servers": {
91
- "cursor-delegate-mcp": {
91
+ "cursor-delegate": {
92
92
  "type": "stdio",
93
93
  "command": "npx",
94
94
  "args": ["-y", "cursor-delegate-mcp"]
@@ -114,7 +114,7 @@ Under **Settings → Tools → AI Assistant → Model Context Protocol (MCP)**,
114
114
  ```json
115
115
  {
116
116
  "mcpServers": {
117
- "cursor-delegate-mcp": {
117
+ "cursor-delegate": {
118
118
  "command": "npx",
119
119
  "args": ["-y", "cursor-delegate-mcp"]
120
120
  }
@@ -132,7 +132,7 @@ Heads-up: Cascade caps you at 100 tools across all servers.
132
132
  ```json
133
133
  {
134
134
  "servers": {
135
- "cursor-delegate-mcp": {
135
+ "cursor-delegate": {
136
136
  "type": "stdio",
137
137
  "command": "npx",
138
138
  "args": ["-y", "cursor-delegate-mcp"]
@@ -152,7 +152,7 @@ Add the following server to the client's MCP config:
152
152
  ```json
153
153
  {
154
154
  "mcpServers": {
155
- "cursor-delegate-mcp": {
155
+ "cursor-delegate": {
156
156
  "command": "npx",
157
157
  "args": ["-y", "cursor-delegate-mcp"]
158
158
  }
package/SECURITY.md CHANGED
@@ -11,7 +11,7 @@ Treat every `delegate` call like handing an engineer write access to that tree.
11
11
  ## Recommendations
12
12
 
13
13
  - Point `workspace` at the smallest directory that contains the task (not `$HOME` or `/`).
14
- - Review `filesReportedByAgent` and the git diff before committing.
14
+ - Review `filesReportedByEditTools` and the git diff before committing.
15
15
  - Use `mode: "plan"` when you only want a plan, not file changes.
16
16
  - Run verification (tests, lint) after delegation — the delegate skill asks Claude to do
17
17
  this, but automated gates in CI are still your backstop.
package/TERMS.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Terms of Use
2
2
 
3
- Cursor Delegate MCP is provided under the MIT License on an "as is" basis, without warranties or guarantees.
3
+ Cursor Delegate is provided under the MIT License on an "as is" basis, without warranties or guarantees.
4
4
 
5
5
  The plugin runs locally and starts `cursor-agent` with access to the workspace selected for a delegation. Delegated agent-mode tasks may create, modify, or delete files. You are responsible for choosing an appropriate workspace, reviewing changes, protecting credentials, and complying with the terms that apply to Cursor, your MCP host, and any model you select.
6
6
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cursor-delegate-mcp",
3
- "version": "1.11.0",
3
+ "version": "1.12.0",
4
4
  "type": "module",
5
5
  "description": "MCP server bridging AI coding hosts to cursor-agent over the Agent Client Protocol (ACP).",
6
6
  "license": "MIT",
package/src/acp-client.js CHANGED
@@ -58,8 +58,13 @@ export class AcpClient extends EventEmitter {
58
58
  log: (e) => this.emit("ack", e),
59
59
  });
60
60
  return new Promise((resolve, reject) => {
61
- this.child.once("error", (e) =>
62
- reject(new Error(`Failed to spawn agent (${command}): ${e.message}. Install Cursor CLI and run 'cursor-agent login'.`)));
61
+ this.child.once("error", (e) => {
62
+ // Tagged like every other failure class so the caller gets
63
+ // "delegate failed [spawn-failed]: ..." instead of the one untagged prose error.
64
+ const err = new Error(`Failed to spawn agent (${command}): ${e.message}. Install Cursor CLI and run 'cursor-agent login'.`);
65
+ err.reason = "spawn-failed";
66
+ reject(err);
67
+ });
63
68
  this.child.once("spawn", () => resolve());
64
69
  });
65
70
  }
package/src/delegate.js CHANGED
@@ -462,9 +462,12 @@ export async function runDelegate({
462
462
  if (up.sessionUpdate === "current_mode_update" && up.currentModeId && up.currentModeId !== mode) {
463
463
  modeChanged = { from: mode, to: up.currentModeId };
464
464
  }
465
- // The agent names the turn a beat after the prompt lands ("File Creator"). Cheap
466
- // label for a caller juggling several delegations.
465
+ // The agent names the turn a beat after the prompt lands ("File Creator"). Useful as an
466
+ // ephemeral label while several delegations run, and in timeout forensics — but not in
467
+ // the result, where it arrives after there is nothing left to tell apart and has been
468
+ // measured contradicting the answer ("No Image Detected" on a turn describing an image).
467
469
  if (up.sessionUpdate === "session_info_update" && typeof up.title === "string" && up.title) {
470
+ if (up.title !== sessionTitle) { try { onProgress?.(`turn titled: ${up.title}`.slice(0, 200)); } catch {} }
468
471
  sessionTitle = up.title;
469
472
  }
470
473
  if (up.sessionUpdate === "agent_thought_chunk" && up.content?.text) {
@@ -570,15 +573,34 @@ export async function runDelegate({
570
573
  ? (sawToolCall ? "post-tool" : "tool-free-stream")
571
574
  : "none";
572
575
  const protocolWarnings = [];
573
- if (!finalMessageAvailable && discardedResult) {
574
- result = discardedResult;
575
- resultSource = "pre-tool-fallback";
576
- protocolWarnings.push(
577
- "the agent ran a tool after its last message and never spoke again, so no final message closed the turn."
578
- + " result carries the last message before that tool call — it may be a preamble rather than the answer."
579
- );
580
- } else if (!finalMessageAvailable) {
581
- protocolWarnings.push("the agent ended the turn without emitting any message; result is empty.");
576
+ // plan.detail is the model restating — into chat's sibling channel — a plan it also filed via
577
+ // create_plan; cursor-agent narrates across the IDE's two surfaces and here they flatten into
578
+ // one ACP payload. The detail is never load-bearing: the plan lives in the agent's own session
579
+ // (which is what a resume-to-implement reads, not this field) and the orchestrator approves
580
+ // from result + plan.entries. So in plan/ask keep the plan in one prose channel — drop the
581
+ // detail as a duplicate when result already is a real plan message, fold it into result when
582
+ // the message is too terse (or a fallback preamble) to be the plan itself. In agent mode the
583
+ // plan was accepted and result is the implementation report, a separate artifact — both stay.
584
+ const PLAN_TERSE_FLOOR = 200;
585
+ let dropPlanDetail = false;
586
+ if (typeof planDetail === "string" && (mode === "plan" || mode === "ask")) {
587
+ dropPlanDetail = true;
588
+ if (!(finalMessageAvailable && result.length >= PLAN_TERSE_FLOOR)) {
589
+ result = planDetail;
590
+ resultSource = "plan-detail";
591
+ }
592
+ }
593
+ if (resultSource !== "plan-detail") {
594
+ if (!finalMessageAvailable && discardedResult) {
595
+ result = discardedResult;
596
+ resultSource = "pre-tool-fallback";
597
+ protocolWarnings.push(
598
+ "the agent ran a tool after its last message and never spoke again, so no final message closed the turn."
599
+ + " result carries the last message before that tool call — it may be a preamble rather than the answer."
600
+ );
601
+ } else if (!finalMessageAvailable) {
602
+ protocolWarnings.push("the agent ended the turn without emitting any message; result is empty.");
603
+ }
582
604
  }
583
605
  // A runaway reply comes back whole and can blow the caller's context (104K chars in one
584
606
  // test). When the caller sets a ceiling, cut the result to it and say so, so the truncation
@@ -604,40 +626,59 @@ export async function runDelegate({
604
626
  }
605
627
  const out = {
606
628
  result,
607
- resultSource,
608
- finalMessageAvailable,
609
629
  sessionId,
610
- filesReportedByAgent: normalizeAgentReportedFiles([...touched], workspace),
611
- resumed: !!resumeSessionId && sessionId === resumeSessionId,
612
630
  };
631
+ // Like every other collection here, absence means "nothing reported": an empty list on
632
+ // every read-only turn read as a claim that nothing changed, which this field cannot make
633
+ // (shell-driven edits leave no diff event).
634
+ const filesReported = normalizeAgentReportedFiles([...touched], workspace);
635
+ if (filesReported.length) out.filesReportedByEditTools = filesReported;
636
+ // resultSource is a caveat, not a fact worth stating on every turn: on the happy path
637
+ // (post-tool / tool-free-stream) result is simply the answer, so say nothing. Surface it only
638
+ // when it warns — pre-tool-fallback, plan-detail, none. finalMessageAvailable is dropped
639
+ // outright: it stated the same thing in a second boolean. resumed is emitted only when a
640
+ // resume actually took; a fresh session or a failed resume (which carries its own warning)
641
+ // leaves it absent.
642
+ if (resultSource !== "post-tool" && resultSource !== "tool-free-stream") out.resultSource = resultSource;
643
+ if (!!resumeSessionId && sessionId === resumeSessionId) out.resumed = true;
613
644
  if (stopReason !== undefined) out.stopReason = stopReason;
614
645
  // Elicitation almost never fires (the agent tends to ask in prose and end the turn), so an
615
646
  // always-empty array is steady noise. Report it only when a question actually came through.
616
647
  if (questionsAsked.length) out.questionsAsked = questionsAsked;
617
- if (sessionTitle) out.sessionTitle = sessionTitle;
648
+ // sessionTitle stays out of the result: it is a live label (progress) and a forensic one
649
+ // (timeout errors), not a fact about the finished turn.
618
650
  if (resumeError) protocolWarnings.push(`resuming ${resumeSessionId} failed, started a fresh session: ${resumeError}`);
619
651
  for (const id of unsupportedOptions) protocolWarnings.push(`model ${model} has no ${id} option; the requested value was ignored`);
620
652
  protocolWarnings.push(...contextWarnings);
621
653
  if (planEntries.length > 0 || planOverview !== undefined || planDetail !== undefined) {
622
654
  out.plan = sanitizePlan(protocolWarnings);
623
- // plan.detail duplicated the prose already in result on every observed plan turn — the
624
- // same plan in two forms, ~2x the context for one answer. Drop it when result is at least
625
- // as long (result is carrying the plan), but keep it when result is too terse to be the
626
- // plan itself, so a plan that lived only in the detail is never lost. entries and overview
627
- // are structured and unique, and always stay.
628
- if (typeof out.plan.detail === "string" && result.length >= out.plan.detail.length) {
629
- delete out.plan.detail;
630
- }
655
+ // In plan/ask the plan is already carried by result (a real message, or folded in per the
656
+ // one-plan contract above), so the detail here is a duplicate — drop it. entries and
657
+ // overview are structured and unique, and always stay.
658
+ if (dropPlanDetail) delete out.plan.detail;
631
659
  }
632
660
  // Most successful turns emit no todos at all, so an empty list would read as "nothing
633
- // done" rather than "not tracked". Report only what the agent actually sent.
634
- if (sawTodoFrame) Object.assign(out, sanitizeTodos(protocolWarnings));
661
+ // done" rather than "not tracked". Report only what the agent actually sent — and of
662
+ // that, the full list only when it says something todoProgress cannot: which items
663
+ // remain. On a fully-completed turn the list restates the counts entry by entry.
664
+ if (sawTodoFrame) {
665
+ const { todos: todoList, todoProgress } = sanitizeTodos(protocolWarnings);
666
+ out.todoProgress = todoProgress;
667
+ if (todoProgress.completed < todoProgress.total) out.todos = todoList;
668
+ }
635
669
  if (writeCapableActivity.length) {
636
670
  out.writeCapableActivity = writeCapableActivity;
671
+ // "the diff for what changed" overclaims when every entry is a pathless execute — live
672
+ // runs drew the same warning for read-only commands (git log, git show, ls -la) as for
673
+ // a real write. Hedge when nothing reported a path.
674
+ const anyPath = writeCapableActivity.some((a) => a.path);
637
675
  protocolWarnings.push(
638
676
  `mode ${mode} asked the agent not to change anything, but it ran ${writeCapableActivity.length}`
639
677
  + ` write-capable tool call${writeCapableActivity.length === 1 ? "" : "s"} — see writeCapableActivity`
640
- + " for what ran, and the diff for what changed."
678
+ + " for what ran"
679
+ + (anyPath
680
+ ? ", and the diff for what changed."
681
+ : "; none reported touching a file, so this may be read-only activity — check the git diff to confirm nothing changed.")
641
682
  );
642
683
  }
643
684
  if (modeChanged) {
@@ -679,9 +720,11 @@ export async function runDelegate({
679
720
  }
680
721
  if (sessionId) err.message += ` Resume with resumeSessionId ${sessionId}.`;
681
722
  if (isTimeout) {
723
+ // Name the knob that actually fired: raising the hard cap does nothing for an
724
+ // idle-timeout, whose ceiling is CURSOR_DELEGATE_IDLE_MS.
725
+ const knob = err.reason === "idle-timeout" ? "CURSOR_DELEGATE_IDLE_MS" : "CURSOR_DELEGATE_HARD_CAP_MS";
682
726
  err.message += " cursor-agent does not stream shell output over ACP, so a long-running command emits"
683
- + " nothing until it exits. Split the command, run it in the background and poll, or raise"
684
- + " CURSOR_DELEGATE_HARD_CAP_MS.";
727
+ + ` nothing until it exits. Split the command, run it in the background and poll, or raise ${knob}.`;
685
728
  }
686
729
  }
687
730
  // Opt-in, because the frames land in the caller's context and nothing there is
package/src/server.js CHANGED
@@ -30,7 +30,7 @@ function rememberSession(set, id) {
30
30
  // Loaded at connect, before any tool schema is, so this carries only pre-call facts: what a
31
31
  // caller needs to decide whether to delegate at all. Call-time facts belong on the parameter
32
32
  // descriptions, read while the call is being written.
33
- export const SERVER_INSTRUCTIONS = `Delegate coding work to Cursor through the delegate tool. Every permission the agent requests is auto-approved, in every mode: mode="plan" and mode="ask" are instructions to the agent, not limits the bridge enforces, and the bridge cannot detect one being ignored. So scope workspace to the smallest relevant directory and review the git diff after every run, not only write-capable ones; filesReportedByAgent lists what the agent reported editing but the diff is authoritative.`;
33
+ export const SERVER_INSTRUCTIONS = `Delegate coding work to Cursor through the delegate tool. Every permission the agent requests is auto-approved, in every mode: mode="plan" and mode="ask" are instructions to the agent, not limits the bridge enforces, and the bridge cannot detect one being ignored. So scope workspace to the smallest relevant directory and review the git diff after every run, not only write-capable ones; filesReportedByEditTools lists what the agent's edit tools reported changing (absent when they reported none) but the diff is authoritative.`;
34
34
 
35
35
  const planEntrySchema = z.object({
36
36
  content: z.string(),
@@ -40,23 +40,21 @@ const planEntrySchema = z.object({
40
40
 
41
41
  const delegateOutputSchema = z.object({
42
42
  result: z.string(),
43
- resultSource: z.enum(["tool-free-stream", "post-tool", "pre-tool-fallback", "none"]).optional().describe(
44
- "Where result came from. pre-tool-fallback means no final message closed the turn and result is the last message before the agent's final tool call — read protocolWarnings before trusting it as the answer."
43
+ resultSource: z.enum(["pre-tool-fallback", "plan-detail", "none"]).optional().describe(
44
+ "Present only as a caveat on result; absent on the happy path, where result is simply the agent's answer. pre-tool-fallback: no final message closed the turn and result is the last message before the agent's final tool call — read protocolWarnings before trusting it. plan-detail (plan/ask only): the agent's chat message was too terse to be the plan, so result carries the plan it filed via create_plan. none: the turn produced no message and result is empty."
45
45
  ),
46
- finalMessageAvailable: z.boolean().optional(),
47
46
  stopReason: z.string().optional().describe(
48
47
  "Present only when it is not the ordinary end_turn — a refusal, a cancel, or an output cap. Absence means the turn ended normally."
49
48
  ),
50
49
  sessionId: z.string(),
51
- filesReportedByAgent: z.array(z.string()).describe(
52
- "Files the agent reported editing via native ACP diff events (may omit shell-driven edits)."
50
+ filesReportedByEditTools: z.array(z.string()).optional().describe(
51
+ "Files the agent's edit tools reported changing, via native ACP diff events. Absent when they reported none — which is not proof nothing changed: shell-driven edits leave no diff event; the git diff is authoritative."
53
52
  ),
54
53
  questionsAsked: z.array(z.string()).optional().describe(
55
54
  "Clarifying questions the agent raised through elicitation. Absent on most turns — the agent usually asks in prose and ends the turn, which this does not capture; read result for that."
56
55
  ),
57
- resumed: z.boolean().optional(),
58
- sessionTitle: z.string().optional().describe(
59
- "Short title the agent gave this turn. Present on most turns; purely a label."
56
+ resumed: z.boolean().optional().describe(
57
+ "Present and true only when a requested resume took (the returned session id matched resumeSessionId). Absent for a fresh session, or when a resume failed — a failed resume is reported in protocolWarnings."
60
58
  ),
61
59
  autoAnswered: z.array(z.object({ prompt: z.string(), chosen: z.string() })).optional(),
62
60
  fallbackAnswers: z.array(z.object({ prompt: z.string(), given: z.string(), chosen: z.string() })).optional(),
@@ -68,19 +66,21 @@ const delegateOutputSchema = z.object({
68
66
  entries: z.array(planEntrySchema),
69
67
  overview: z.string().optional(),
70
68
  detail: z.string().optional(),
71
- }).optional(),
69
+ }).optional().describe(
70
+ "The agent's plan. entries and overview are the structured plan and always present when a plan exists. detail (a prose rendition the agent also filed) is kept only in agent mode; in plan/ask it is dropped because result already carries the plan — as the agent's own message, or folded in (resultSource plan-detail) when that message was too terse. To act on a plan, resume the sessionId rather than forwarding detail: the plan lives in the agent's session."
71
+ ),
72
72
  todos: z.array(z.object({
73
73
  id: z.string(),
74
74
  content: z.string(),
75
75
  status: z.enum(["pending", "in_progress", "completed"]).optional(),
76
76
  })).optional().describe(
77
- "Todo list the agent tracked for this turn. Absent when the agent tracked none, which is common on short tasks and does not imply incompleteness."
77
+ "Todo items the agent left unfinished, present only when todoProgress shows completed < total — read it to see what remains before resuming. Absent both when the agent tracked no todos (common on short tasks) and when everything tracked was completed; todoProgress tells those apart."
78
78
  ),
79
79
  modeChanged: z.object({ from: z.string(), to: z.string() }).optional().describe(
80
80
  "Set when the agent switched itself out of the requested mode mid-session. Absence does not mean the mode was honored — an agent can write while staying in plan."
81
81
  ),
82
82
  writeCapableActivity: z.array(z.object({ kind: z.string(), detail: z.string(), path: z.string().optional() })).optional().describe(
83
- "Write-capable tool calls (edit/delete/move/execute) the agent ran during a plan or ask turn, which are expected to change nothing. Records what ran, not what changed — a shell command is not a change list. Only populated for mode plan and ask."
83
+ "Write-capable tool calls (edit/delete/move/execute) the agent ran during a plan or ask turn, which are expected to change nothing. Records what ran, not what changed — kind is what the tool could do, not proof it wrote: an execute entry may be a read-only command like `ls -la`. Read detail for the evidence and the git diff for the truth. Only populated for mode plan and ask."
84
84
  ),
85
85
  todoProgress: z.object({
86
86
  total: z.number(),
@@ -111,7 +111,7 @@ const doctorOutputSchema = z.object({
111
111
 
112
112
  export const delegateInputSchema = z.object({
113
113
  spec: z.string().trim().min(1, "spec must not be blank").describe("Inline task brief (default): goal, scope, decisions already made (constraints and fixed choices — quote the user's exact values verbatim), acceptance criteria. Point at files to read or mimic rather than pasting code. Optional file path if the user wants a persisted spec."),
114
- mode: z.enum(["agent", "plan", "ask"]).default("agent").describe("Requested agent mode. plan and ask are passed to the agent as instructions, not enforced by the bridge — the agent may write in any of them; modeChanged reports it if it switched."),
114
+ mode: z.enum(["agent", "plan", "ask"]).default("agent").describe("Requested agent mode. plan and ask are passed to the agent as instructions, not enforced by the bridge — the agent may write in any of them; modeChanged reports it if it switched. ask held on every model tested while plan compliance varies by model, so prefer ask when you need the stricter read-only instruction."),
115
115
  resumeSessionId: z.string().optional().describe("Resume an existing ACP session instead of a new one"),
116
116
  workspace: z.string().optional().describe("Working directory for the agent (defaults to cwd). Must be an existing directory; the call fails rather than creating it."),
117
117
  model: z.string().trim().min(1, "model must be a non-empty string").default(DEFAULT_MODEL),