cursor-delegate-mcp 2.2.0 → 2.3.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/CHANGELOG.md CHANGED
@@ -6,6 +6,41 @@ All notable changes to this project are documented here. The format follows
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [2.3.0] - 2026-09-06
10
+
11
+ ### Fixed
12
+
13
+ - JSON that is not an object is ignored on the ACP stream. `null` threw in the frame
14
+ reader — an uncaught exception that took down the server — and arrays or primitives
15
+ counted as activity, holding the idle guard open the way a launcher banner used to.
16
+ - Malformed tool `content` blocks are dropped and reported once in `protocolWarnings`.
17
+ A null block, a block with no string `type`, or a `diff` whose `path` is missing or
18
+ not a string threw in the update handler or recorded a non-path in `touchedFiles`.
19
+ - `cursor/update_todos` sent as a JSON-RPC notification is merged and not answered. A
20
+ reply to a notification is invalid JSON-RPC and aborted the turn.
21
+ - An image `contextFile` that cannot be read is skipped with a warning. A permission
22
+ error or a locked file used to fail the whole delegation after the other attachments
23
+ were already accepted.
24
+ - The Codex plugin `interface` drops `supportURL`. Codex's validator rejects unknown
25
+ keys, so a listing that kept that field would not validate.
26
+
27
+ ### Changed
28
+
29
+ - README usage copy names the Cursor Models pool and links Cursor's usage-limits help
30
+ instead of calling the allowance generous enough that most people never hit it.
31
+
32
+ ### Internal
33
+
34
+ - The production `npm audit` CI step retries three times with a five-minute timeout, so
35
+ a registry blip no longer fails the whole test workflow.
36
+
37
+ ## [2.2.1] - 2026-09-04
38
+
39
+ ### Changed
40
+
41
+ - README client snippets that shared a config shape now point at one example.
42
+ - Skill defaults table dropped duplicated field notes; security wording tightened.
43
+
9
44
  ## [2.2.0] - 2026-09-03
10
45
 
11
46
  ### Added
package/README.md CHANGED
@@ -32,7 +32,7 @@ Composer 2.5 is built for throughput on multi-file edits. The whole delegation i
32
32
 
33
33
  ## 🔋 Your limits stop being the bottleneck
34
34
 
35
- Composer and Grok run on their **own usage allowance** on every Cursor plan — separate from the API-priced main quota, and generous enough that most people never reach the ceiling. Your Claude or Codex subscription spends tokens only on the brief and the review, so the 5-hour window and weekly limits go a lot further. Paying per token on API? That grind moves onto Cursor capacity you already have.
35
+ Composer and Grok draw from the **Cursor Models usage pool**, separate from third-party model usage on [supported Cursor plans](https://cursor.com/help/models-and-usage/usage-limits). Your Claude or Codex subscription handles the brief and review while Cursor runs the implementation. If you pay per token on API, implementation moves onto the Cursor capacity you already have.
36
36
 
37
37
  ![You and your agent plan and review; the MCP delegate tool hands the brief to cursor-agent (Composer 2.5), which implements and edits your workspace; a clean result comes back with what changed, which files, and the plan, for your agent to review](assets/flow.png)
38
38
 
@@ -129,37 +129,14 @@ Under **Settings → Tools → AI Assistant → Model Context Protocol (MCP)**,
129
129
  <details>
130
130
  <summary><strong>Windsurf</strong> — <code>~/.codeium/windsurf/mcp_config.json</code></summary>
131
131
 
132
- ```json
133
- {
134
- "mcpServers": {
135
- "cursor-delegate": {
136
- "command": "npx",
137
- "args": ["-y", "cursor-delegate-mcp"]
138
- }
139
- }
140
- }
141
- ```
142
-
143
- Heads-up: Cascade caps you at 100 tools across all servers.
132
+ Same `mcpServers` block as the generic snippet above. Cascade caps you at 100 tools across all servers.
144
133
 
145
134
  </details>
146
135
 
147
136
  <details>
148
137
  <summary><strong>Visual Studio 2022 / 2026</strong> — <code>%USERPROFILE%\.mcp.json</code></summary>
149
138
 
150
- ```json
151
- {
152
- "servers": {
153
- "cursor-delegate": {
154
- "type": "stdio",
155
- "command": "npx",
156
- "args": ["-y", "cursor-delegate-mcp"]
157
- }
158
- }
159
- }
160
- ```
161
-
162
- Requires Visual Studio 2026, or 2022 17.14+. Note the top-level key is `servers`, not `mcpServers`. Visual Studio also discovers `.mcp.json` next to the solution, plus `.vscode/mcp.json`.
139
+ Same `servers` + `type: "stdio"` shape as VS Code. Requires Visual Studio 2026, or 2022 17.14+. Note the top-level key is `servers`, not `mcpServers`. Visual Studio also discovers `.mcp.json` next to the solution, plus `.vscode/mcp.json`.
163
140
 
164
141
  </details>
165
142
 
@@ -186,57 +163,21 @@ OpenCode does **not** use `mcpServers`. Local servers go under `mcp`, with `type
186
163
  <details>
187
164
  <summary><strong>Google Antigravity</strong> — <code>~/.gemini/config/mcp_config.json</code> or workspace <code>.agents/mcp_config.json</code></summary>
188
165
 
189
- ```json
190
- {
191
- "mcpServers": {
192
- "cursor-delegate": {
193
- "command": "npx",
194
- "args": ["-y", "cursor-delegate-mcp"]
195
- }
196
- }
197
- }
198
- ```
199
-
200
- In the IDE: **…** on the agent panel → **MCP Servers** → **Manage MCP Servers** → **View raw config**. Antigravity 2.0, IDE, and CLI share the Gemini config file. You may need to approve the server's tools on first run.
166
+ Same `mcpServers` block as the generic snippet above. In the IDE: **…** on the agent panel → **MCP Servers** → **Manage MCP Servers** → **View raw config**. Antigravity 2.0, IDE, and CLI share the Gemini config file. You may need to approve the server's tools on first run.
201
167
 
202
168
  </details>
203
169
 
204
170
  <details>
205
171
  <summary><strong>Kiro</strong> — <code>.kiro/settings/mcp.json</code> or <code>~/.kiro/settings/mcp.json</code></summary>
206
172
 
207
- ```json
208
- {
209
- "mcpServers": {
210
- "cursor-delegate": {
211
- "command": "npx",
212
- "args": ["-y", "cursor-delegate-mcp"]
213
- }
214
- }
215
- }
216
- ```
217
-
218
- Workspace file wins when both exist.
173
+ Same `mcpServers` block as the generic snippet above. Workspace file wins when both exist.
219
174
 
220
175
  </details>
221
176
 
222
177
  <details>
223
178
  <summary><strong>Kilo Code</strong> — <code>kilo.jsonc</code> (<code>mcp</code> key, not <code>mcpServers</code>)</summary>
224
179
 
225
- Same shape as OpenCode: `type: "local"` and `command` as one array.
226
-
227
- ```json
228
- {
229
- "mcp": {
230
- "cursor-delegate": {
231
- "type": "local",
232
- "command": ["npx", "-y", "cursor-delegate-mcp"],
233
- "enabled": true
234
- }
235
- }
236
- }
237
- ```
238
-
239
- In the VS Code extension: **Settings → MCP → Add Server → Local (stdio)**. On Windows, if `npx` is not found, use command `cmd` with arguments `/c`, `npx`, `-y`, `cursor-delegate-mcp`.
180
+ Same shape as OpenCode: `type: "local"` and `command` as one array. In the VS Code extension: **Settings → MCP → Add Server → Local (stdio)**. On Windows, if `npx` is not found, use command `cmd` with arguments `/c`, `npx`, `-y`, `cursor-delegate-mcp`.
240
181
 
241
182
  </details>
242
183
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cursor-delegate-mcp",
3
- "version": "2.2.0",
3
+ "version": "2.3.0",
4
4
  "mcpName": "io.github.andreilungeanu/cursor-delegate-mcp",
5
5
  "type": "module",
6
6
  "description": "Delegate multi-file coding work from Claude Code, Codex, Copilot, or any MCP client to Cursor's CLI agent — structured results, plan mode, and changed files.",
package/src/acp-client.js CHANGED
@@ -95,9 +95,14 @@ export class AcpClient extends EventEmitter {
95
95
  };
96
96
  this.child.once("exit", emitExit);
97
97
  this.child.once("close", emitExit);
98
- this.router = null; // set before first stdout line
98
+ this.router = null;
99
99
  this.peer = new JsonRpcPeer(this.child.stdout, this.child.stdin, {
100
- onNotification: (method, params) => { if (method === "session/update") this.emit("update", params); },
100
+ onNotification: (method, params) => {
101
+ if (method === "session/update") this.emit("update", params);
102
+ else if (method === "cursor/update_todos") {
103
+ Promise.resolve(this.router?.(undefined, method, params)).catch(() => {});
104
+ }
105
+ },
101
106
  // The router is async and its result discarded, so a throw from its own catch would reject
102
107
  // unobserved and exit the process. Promise.resolve covers a sync router in tests.
103
108
  onRequest: (id, method, params) => {
@@ -148,15 +153,11 @@ export class AcpClient extends EventEmitter {
148
153
 
149
154
  getTranscript(n) { return this.peer ? this.peer.formatLog(n) : ""; }
150
155
 
151
- // Idempotent while a teardown is in flight and after a confirmed exit, so a force-cancel
152
- // racing the delegation's own finally tears down once. A missed exit is not the same
153
- // fact as the process being gone: that result is not memoized, and force can retry.
156
+ // Idempotent while teardown is in flight and after a confirmed exit. A missed exit is not
157
+ // memoized — force retries with a new treeKill. A confirmed exit stays so later callers join.
154
158
  stop({ timeoutMs = STOP_EXIT_TIMEOUT_MS } = {}) {
155
159
  if (!this._stopping) {
156
160
  this._stopping = this._teardown(timeoutMs).then((observed) => {
157
- // A missed exit must not poison later force-kills: the documented retry is a new
158
- // treeKill, not the same false. A confirmed exit stays memoized so concurrent and
159
- // later callers still join one teardown.
160
161
  if (!observed) this._stopping = null;
161
162
  return observed;
162
163
  }, (err) => {
package/src/delegate.js CHANGED
@@ -125,7 +125,11 @@ async function buildContextBlocks(contextFiles, workspace, client, warnings) {
125
125
  warnings.push(`contextFile ${entry} skipped: ${Math.round(stat.size / 1024)}KB exceeds the ${MAX_IMAGE_BYTES / 1024 / 1024}MB image limit`);
126
126
  continue;
127
127
  }
128
- blocks.push({ type: "image", mimeType, data: (await readFile(canonical)).toString("base64") });
128
+ try {
129
+ blocks.push({ type: "image", mimeType, data: (await readFile(canonical)).toString("base64") });
130
+ } catch (err) {
131
+ warnings.push(`contextFile ${entry} skipped: could not read image (${err?.code || "read failed"})`);
132
+ }
129
133
  continue;
130
134
  }
131
135
  blocks.push({ type: "resource_link", uri: pathToFileURL(canonical).href, name: path.basename(canonical) });
@@ -434,7 +438,13 @@ export async function runDelegate({
434
438
  // is an uncaught exception — the whole server, not this one turn — and it also stops the
435
439
  // reply on the next line from being read, so the turn hangs to its cap.
436
440
  for (const c of Array.isArray(up.content) ? up.content : []) {
437
- if (c.type === "diff" && c.path) {
441
+ if (!c || typeof c !== "object" || Array.isArray(c) || typeof c.type !== "string"
442
+ || (c.type === "diff" && (typeof c.path !== "string" || !c.path))) {
443
+ const warning = "malformed tool content dropped: expected content blocks with string diff paths";
444
+ if (!frameWarnings.includes(warning)) frameWarnings.push(warning);
445
+ continue;
446
+ }
447
+ if (c.type === "diff") {
438
448
  state.touched.add(c.path);
439
449
  try { onProgress?.("editing " + c.path); } catch {}
440
450
  }
package/src/doctor.js CHANGED
@@ -100,7 +100,6 @@ async function runDeepHandshake({ spawnSpec, clientFactory, workspace, timeoutMs
100
100
  // session/new already returned these. currentModel only — any other model needs a set_model
101
101
  // first, which this handshake does not send.
102
102
  details.currentModelOptions = (client.configOptions ?? [])
103
- // model and mode are already reported as their own fields.
104
103
  .filter((o) => typeof o?.id === "string" && o.id !== "model" && o.id !== "mode")
105
104
  .map((o) => ({ id: o.id, values: allowedValues(o) }));
106
105
  })();
package/src/jsonrpc.js CHANGED
@@ -88,6 +88,7 @@ export class JsonRpcPeer {
88
88
  if (!line.trim()) return;
89
89
  let msg;
90
90
  try { msg = JSON.parse(line); } catch { return; }
91
+ if (msg === null || typeof msg !== "object" || Array.isArray(msg)) return;
91
92
  // Only a parsed frame counts. A blank line, a launcher banner or anything else the agent
92
93
  // prints is not the protocol advancing, and treating it as such is what let a chatty
93
94
  // launcher hold the idle guard open and made "Last ACP frame Ns ago" report a stderr byte.
@@ -41,6 +41,7 @@ export function createRequestRouter({ respond, respondError, onCreatePlan, onTod
41
41
  if (method === "cursor/update_todos") {
42
42
  onTodos?.({ todos: params?.todos, merge: params?.merge, toolCallId: params?.toolCallId });
43
43
  log({ method, params });
44
+ if (id == null) return;
44
45
  // The documented response is {outcome:{outcome:"accepted", todos}}; the bare {} we
45
46
  // have always sent is accepted by cursor-agent, so it stays until that changes.
46
47
  return respond(id, {});
@@ -53,7 +54,7 @@ export function createRequestRouter({ respond, respondError, onCreatePlan, onTod
53
54
  } catch (err) {
54
55
  // -32603, not -32000: ACP assigns -32000 to auth_required, and a bug on this side
55
56
  // reported as "authenticate" sends the agent down a recovery path that cannot work.
56
- return respondError(id, -32603, `Router error: ${err?.message || err}`);
57
+ if (id != null) return respondError(id, -32603, `Router error: ${err?.message || err}`);
57
58
  }
58
59
  };
59
60
  }
package/src/server.js CHANGED
@@ -77,15 +77,10 @@ const planEntrySchema = z.object({
77
77
  status: z.enum(PLAN_STATUSES).optional(),
78
78
  }).passthrough();
79
79
 
80
- // No tool declares an outputSchema: declaring one obliges the server to also return
81
- // structuredContent, and a host that reads both it and the text block — Codex does — puts the
82
- // payload in the model's context twice. Every tool returns one compact JSON text block instead.
83
- // So this is an in-repo contract, enforced by the .strict() copy in delegate.test.js, which
84
- // fails when a field added in delegate.js is forgotten here. cancel's status vocabulary is
85
- // published in its tool description, which is now its only schema.
86
- //
87
- // Types only. What each field means, and what its absence means, is documented once in
88
- // skills/delegate/reference.md.
80
+ // No outputSchema: that also requires structuredContent, and a host that reads both (Codex)
81
+ // puts the payload in context twice. One JSON text block; the .strict() copy is in
82
+ // delegate.test.js. Field meanings: skills/delegate/reference.md. cancel status lives on
83
+ // its tool description.
89
84
  export const delegateOutputShape = {
90
85
  result: z.string(),
91
86
  resultSource: z.enum(["pre-tool-fallback", "none"]).optional(),
@@ -115,16 +110,9 @@ export const delegateOutputShape = {
115
110
  }).optional(),
116
111
  };
117
112
 
118
- // What doctor reports about the launcher — the same in-repo contract as delegateOutputShape.
119
- //
120
- // Fields this bridge computes are typed; fields relayed verbatim from the agent are left unknown
121
- // on purpose. doctor runs when the agent is already misbehaving, so a schema tight enough to
122
- // reject a weird protocolVersion would fail on the agent's output rather than on ours.
123
- // doctor.test.js parses every result against a strict copy of this shape.
124
- //
125
- // Types only; what the fields mean is documented once, in TECHNICAL.md.
126
- // Split out so the drift guard can make it strict on its own: a .strict() on agent does not look
127
- // inside handshake, which is the level this schema has drifted at twice.
113
+ // Same in-repo contract as delegateOutputShape. Relayed agent fields stay unknown so a
114
+ // weird protocolVersion is a diagnostic, not a failed call. doctor.test.js holds the
115
+ // strict copy. Handshake is its own shape: a .strict() on agent does not look inside it.
128
116
  export const doctorHandshakeShape = {
129
117
  ok: z.boolean(),
130
118
  error: z.string().optional(),
@@ -145,9 +133,7 @@ export const doctorAgentShape = {
145
133
  handshake: z.object(doctorHandshakeShape).passthrough().optional(),
146
134
  };
147
135
 
148
- // Exported as a shape for the same reason as delegateOutputShape, and with agent split out
149
- // because a top-level .strict() does not look inside a nested object — which is exactly where
150
- // this schema drifted.
136
+ // agent is split out because a top-level .strict() does not look inside a nested object.
151
137
  export const doctorOutputShape = {
152
138
  plugin: z.object({ version: z.string() }).passthrough(),
153
139
  client: z.object({
@@ -428,10 +414,8 @@ export function installSignalCleanup(map, {
428
414
  Promise.all(stops).then(leave, leave);
429
415
  };
430
416
  // Each agent runs in its own process group on POSIX, so a signal aimed at this process no
431
- // longer reaches it the way it did when the two shared a group. Installing a handler replaces
432
- // Node's default, and a server that swallows Ctrl-C would be a worse bug than the agent it
433
- // leaks. Delegations still inside their handshake are reached through `pending`, so this
434
- // covers the agent from the moment it is spawned, not from the moment its session opens.
417
+ // longer reaches it. Installing a handler replaces Node's default; swallowing Ctrl-C would
418
+ // leak the agent. shutdown() already walks pending, so this covers spawn through session/new.
435
419
  if (DETACHED) {
436
420
  const signals = /** @type {[NodeJS.Signals, number][]} */ ([["SIGINT", 130], ["SIGTERM", 143]]);
437
421
  for (const [signal, code] of signals) process.on(signal, () => shutdown(code));
package/src/turn-state.js CHANGED
@@ -87,7 +87,6 @@ export function makeTurnState({ onProgress, progressThrottleMs = 2000 } = {}) {
87
87
  state.messages.reset();
88
88
  },
89
89
 
90
- // The result text as it stands.
91
90
  text() {
92
91
  return state.resultChunks.join("");
93
92
  },