cursor-delegate-mcp 2.0.0 → 2.2.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 +40 -0
- package/README.md +95 -6
- package/package.json +5 -2
- package/src/acp-client.js +32 -7
- package/src/acp-enums.js +4 -3
- package/src/delegate.js +20 -7
- package/src/doctor.js +30 -6
- package/src/server.js +15 -3
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,46 @@ All notable changes to this project are documented here. The format follows
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [2.2.0] - 2026-09-03
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- Registry and protocol icons: `server.json` `icons[]` and the MCP `initialize` payload
|
|
14
|
+
advertise the light and dark logos as HTTPS URLs (SEP-973). Codex `interface.logoDark`.
|
|
15
|
+
|
|
16
|
+
### Changed
|
|
17
|
+
|
|
18
|
+
- README client list checked against vendor docs (3 Sep 2026): OpenCode and Google
|
|
19
|
+
Antigravity added; Kiro, Kilo Code, and Zed no longer share one portable snippet;
|
|
20
|
+
Visual Studio covers 2022 17.14+ and 2026. npm description/keywords and
|
|
21
|
+
`llms-install.md` match that list; OpenCode, Kilo Code, and Zed are called out
|
|
22
|
+
as not using `mcpServers`.
|
|
23
|
+
|
|
24
|
+
## [2.1.1] - 2026-09-03
|
|
25
|
+
|
|
26
|
+
### Fixed
|
|
27
|
+
|
|
28
|
+
- Transitive `fast-uri` and `qs` advisories that failed `npm audit --audit-level=high`.
|
|
29
|
+
- Stderr capture slices an oversized first pipe read so retained memory stays one cap.
|
|
30
|
+
|
|
31
|
+
## [2.1.0] - 2026-09-03
|
|
32
|
+
|
|
33
|
+
### Fixed
|
|
34
|
+
|
|
35
|
+
- `cancel` with `force: true` can be retried after a kill that did not observe an exit. `stop()`
|
|
36
|
+
no longer memoizes that `false`, which had made every later force a no-op.
|
|
37
|
+
- Force-kill unregisters only the handles it actually stopped, so a resume that registers during
|
|
38
|
+
teardown stays cancellable instead of running untracked.
|
|
39
|
+
- Todo `cancelled` is kept and counted in `todoProgress.cancelled` instead of being stripped.
|
|
40
|
+
- `contextFiles` aliases (Win32 case, `realpath`) are sent once.
|
|
41
|
+
- `doctor` reports `agent.error` when `--version` exits non-zero, probes `.mjs`/`.cjs` launchers
|
|
42
|
+
with Node, quotes the resolved command, and includes launcher/timeout env knobs.
|
|
43
|
+
|
|
44
|
+
### Changed
|
|
45
|
+
|
|
46
|
+
- Permission notes in `TECHNICAL.md` match the router: no allow option → `cancelled`, never the
|
|
47
|
+
first offered reject.
|
|
48
|
+
|
|
9
49
|
## [2.0.0] - 2026-08-21
|
|
10
50
|
|
|
11
51
|
One thing changes on upgrade: pass `workspace` on every call, resumes included.
|
package/README.md
CHANGED
|
@@ -20,7 +20,7 @@ Cursor Delegate is the MCP bridge that lets Claude Code, ChatGPT/Codex, Copilot
|
|
|
20
20
|
|
|
21
21
|
<br clear="left">
|
|
22
22
|
|
|
23
|
-

|
|
23
|
+

|
|
24
24
|
|
|
25
25
|
## 🧠 Frontier quality, kept
|
|
26
26
|
|
|
@@ -46,7 +46,7 @@ Composer and Grok run on their **own usage allowance** on every Cursor plan —
|
|
|
46
46
|
- 📋 **Plan first** — `plan` mode: Cursor drafts a plan, you review it, then the same session implements it.
|
|
47
47
|
- 🔍 **Ask anything** — `ask` mode: Q&A over your codebase.
|
|
48
48
|
- 🩺 **Self-diagnosing** — a `doctor` tool that tells you exactly what's missing if setup isn't right.
|
|
49
|
-
- 🔌 **Portable** — plain stdio MCP, so it runs anywhere: VS Code, JetBrains, Windsurf, Visual Studio, and more.
|
|
49
|
+
- 🔌 **Portable** — plain stdio MCP, so it runs anywhere: VS Code, JetBrains, Windsurf, Visual Studio, OpenCode, Antigravity, and more.
|
|
50
50
|
|
|
51
51
|
`plan` and `ask` are instructions to the agent, and `workspace` is its working directory — [Security](SECURITY.md) and the [delegate reference](skills/delegate/reference.md) spell out what the bridge enforces and what it reports back.
|
|
52
52
|
|
|
@@ -145,7 +145,7 @@ Heads-up: Cascade caps you at 100 tools across all servers.
|
|
|
145
145
|
</details>
|
|
146
146
|
|
|
147
147
|
<details>
|
|
148
|
-
<summary><strong>Visual Studio 2022</strong> — <code>%USERPROFILE%\.mcp.json</code></summary>
|
|
148
|
+
<summary><strong>Visual Studio 2022 / 2026</strong> — <code>%USERPROFILE%\.mcp.json</code></summary>
|
|
149
149
|
|
|
150
150
|
```json
|
|
151
151
|
{
|
|
@@ -159,14 +159,103 @@ Heads-up: Cascade caps you at 100 tools across all servers.
|
|
|
159
159
|
}
|
|
160
160
|
```
|
|
161
161
|
|
|
162
|
-
Requires 17.14+. Note the top-level key is `servers`, not `mcpServers`.
|
|
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`.
|
|
163
163
|
|
|
164
164
|
</details>
|
|
165
165
|
|
|
166
166
|
<details>
|
|
167
|
-
<summary><strong>
|
|
167
|
+
<summary><strong>OpenCode</strong> — <code>~/.config/opencode/opencode.json</code> or project <code>opencode.json</code></summary>
|
|
168
168
|
|
|
169
|
-
|
|
169
|
+
OpenCode does **not** use `mcpServers`. Local servers go under `mcp`, with `type: "local"` and `command` as one array:
|
|
170
|
+
|
|
171
|
+
```json
|
|
172
|
+
{
|
|
173
|
+
"$schema": "https://opencode.ai/config.json",
|
|
174
|
+
"mcp": {
|
|
175
|
+
"cursor-delegate": {
|
|
176
|
+
"type": "local",
|
|
177
|
+
"command": ["npx", "-y", "cursor-delegate-mcp"],
|
|
178
|
+
"enabled": true
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
</details>
|
|
185
|
+
|
|
186
|
+
<details>
|
|
187
|
+
<summary><strong>Google Antigravity</strong> — <code>~/.gemini/config/mcp_config.json</code> or workspace <code>.agents/mcp_config.json</code></summary>
|
|
188
|
+
|
|
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.
|
|
201
|
+
|
|
202
|
+
</details>
|
|
203
|
+
|
|
204
|
+
<details>
|
|
205
|
+
<summary><strong>Kiro</strong> — <code>.kiro/settings/mcp.json</code> or <code>~/.kiro/settings/mcp.json</code></summary>
|
|
206
|
+
|
|
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.
|
|
219
|
+
|
|
220
|
+
</details>
|
|
221
|
+
|
|
222
|
+
<details>
|
|
223
|
+
<summary><strong>Kilo Code</strong> — <code>kilo.jsonc</code> (<code>mcp</code> key, not <code>mcpServers</code>)</summary>
|
|
224
|
+
|
|
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`.
|
|
240
|
+
|
|
241
|
+
</details>
|
|
242
|
+
|
|
243
|
+
<details>
|
|
244
|
+
<summary><strong>Zed</strong> — Settings → AI → MCP Servers, or <code>context_servers</code> in Zed settings</summary>
|
|
245
|
+
|
|
246
|
+
```json
|
|
247
|
+
{
|
|
248
|
+
"context_servers": {
|
|
249
|
+
"cursor-delegate": {
|
|
250
|
+
"command": "npx",
|
|
251
|
+
"args": ["-y", "cursor-delegate-mcp"],
|
|
252
|
+
"env": {}
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
Zed's native agent uses this. External ACP agents in Zed read their own MCP config unless you forward Zed's servers.
|
|
170
259
|
|
|
171
260
|
</details>
|
|
172
261
|
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cursor-delegate-mcp",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"mcpName": "io.github.andreilungeanu/cursor-delegate-mcp",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"description": "Delegate multi-file coding work from Claude Code, Codex, or
|
|
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.",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"author": "Andrei Lungeanu <andrei@lungeanu.ro>",
|
|
9
9
|
"repository": {
|
|
@@ -25,6 +25,9 @@
|
|
|
25
25
|
"chatgpt",
|
|
26
26
|
"github-copilot",
|
|
27
27
|
"vscode",
|
|
28
|
+
"opencode",
|
|
29
|
+
"antigravity",
|
|
30
|
+
"windsurf",
|
|
28
31
|
"composer",
|
|
29
32
|
"composer-2.5",
|
|
30
33
|
"delegation",
|
package/src/acp-client.js
CHANGED
|
@@ -62,6 +62,14 @@ export class AcpClient extends EventEmitter {
|
|
|
62
62
|
while (this._stderrChunks.length > 1 && this._stderrLength - this._stderrChunks[0].length >= STDERR_CAP) {
|
|
63
63
|
this._stderrLength -= this._stderrChunks.shift().length;
|
|
64
64
|
}
|
|
65
|
+
// Whole-chunk drops leave a remainder when one pipe read is itself larger than the cap
|
|
66
|
+
// (observed on GitHub Windows runners). Slice that first chunk so retained memory cannot
|
|
67
|
+
// grow with the flood; the public tail is still exactly one cap on read.
|
|
68
|
+
const overflow = this._stderrLength - STDERR_CAP;
|
|
69
|
+
if (overflow > 0) {
|
|
70
|
+
this._stderrChunks[0] = this._stderrChunks[0].slice(overflow);
|
|
71
|
+
this._stderrLength -= overflow;
|
|
72
|
+
}
|
|
65
73
|
}
|
|
66
74
|
});
|
|
67
75
|
this.child.stderr.on("error", () => {});
|
|
@@ -140,12 +148,22 @@ export class AcpClient extends EventEmitter {
|
|
|
140
148
|
|
|
141
149
|
getTranscript(n) { return this.peer ? this.peer.formatLog(n) : ""; }
|
|
142
150
|
|
|
143
|
-
// Idempotent
|
|
144
|
-
//
|
|
145
|
-
//
|
|
146
|
-
// cancel reports the difference rather than calling both "killed".
|
|
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.
|
|
147
154
|
stop({ timeoutMs = STOP_EXIT_TIMEOUT_MS } = {}) {
|
|
148
|
-
if (!this._stopping)
|
|
155
|
+
if (!this._stopping) {
|
|
156
|
+
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
|
+
if (!observed) this._stopping = null;
|
|
161
|
+
return observed;
|
|
162
|
+
}, (err) => {
|
|
163
|
+
this._stopping = null;
|
|
164
|
+
throw err;
|
|
165
|
+
});
|
|
166
|
+
}
|
|
149
167
|
return this._stopping;
|
|
150
168
|
}
|
|
151
169
|
|
|
@@ -171,8 +189,15 @@ export class AcpClient extends EventEmitter {
|
|
|
171
189
|
}));
|
|
172
190
|
const observed = await Promise.race([exited, bounded]);
|
|
173
191
|
clearTimeout(timer);
|
|
174
|
-
//
|
|
175
|
-
//
|
|
192
|
+
// The exit handler rejects in-flight RPCs with stderr. Doing that here on a confirmed
|
|
193
|
+
// exit would race it and the first settlement would drop the forensics. A stop that
|
|
194
|
+
// did not see the child die never gets that handler, so settle those RPCs only when
|
|
195
|
+
// the process is still alive and emitExit has not run.
|
|
196
|
+
if (!observed && !this._exitEmitted && isChildAlive(child)) {
|
|
197
|
+
try {
|
|
198
|
+
this.peer?.rejectAllPending(makeError("agent-exit", "agent process did not exit after stop"));
|
|
199
|
+
} catch {}
|
|
200
|
+
}
|
|
176
201
|
try { this.peer?.close(); } catch {}
|
|
177
202
|
return observed;
|
|
178
203
|
}
|
package/src/acp-enums.js
CHANGED
|
@@ -3,11 +3,12 @@
|
|
|
3
3
|
// schemas in server.js, which advertise them to hosts. A drift between the two would strip a
|
|
4
4
|
// value the tool documents, or document one it strips.
|
|
5
5
|
//
|
|
6
|
-
// Plan status
|
|
7
|
-
//
|
|
6
|
+
// Plan status follows ACP v1 PlanEntryStatus (no cancelled). Todo status follows Cursor's
|
|
7
|
+
// update_todos / create_plan todo arrays, which include cancelled. They stay separate
|
|
8
|
+
// constants so they can diverge.
|
|
8
9
|
|
|
9
10
|
export const PLAN_PRIORITIES = /** @type {const} */ (["high", "medium", "low"]);
|
|
10
11
|
|
|
11
12
|
export const PLAN_STATUSES = /** @type {const} */ (["pending", "in_progress", "completed"]);
|
|
12
13
|
|
|
13
|
-
export const TODO_STATUSES = /** @type {const} */ (["pending", "in_progress", "completed"]);
|
|
14
|
+
export const TODO_STATUSES = /** @type {const} */ (["pending", "in_progress", "completed", "cancelled"]);
|
package/src/delegate.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import process from "node:process";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { pathToFileURL } from "node:url";
|
|
4
|
-
import { statSync } from "node:fs";
|
|
4
|
+
import { statSync, realpathSync } from "node:fs";
|
|
5
5
|
// Async: a sync read on the server's only thread stalls every other in-flight delegation and
|
|
6
6
|
// its progress stream. The statSync calls below stay sync — they are argument validation and
|
|
7
7
|
// run before the spawn.
|
|
@@ -87,14 +87,26 @@ async function buildContextBlocks(contextFiles, workspace, client, warnings) {
|
|
|
87
87
|
// per-entry — they are individually distinct and never arrive in bulk.
|
|
88
88
|
const notFound = [];
|
|
89
89
|
const root = path.resolve(workspace || process.cwd());
|
|
90
|
+
const identKey = (p) => (process.platform === "win32" ? p.toLowerCase() : p);
|
|
90
91
|
for (const entry of contextFiles || []) {
|
|
91
92
|
if (typeof entry !== "string" || !entry.trim()) continue;
|
|
92
93
|
const abs = path.resolve(workspace || process.cwd(), entry);
|
|
93
|
-
|
|
94
|
-
|
|
94
|
+
let canonical;
|
|
95
|
+
try {
|
|
96
|
+
canonical = realpathSync(abs);
|
|
97
|
+
} catch {
|
|
98
|
+
const missKey = identKey(abs);
|
|
99
|
+
if (seen.has(missKey)) continue;
|
|
100
|
+
seen.add(missKey);
|
|
101
|
+
notFound.push(entry);
|
|
102
|
+
continue;
|
|
103
|
+
}
|
|
104
|
+
const key = identKey(canonical);
|
|
105
|
+
if (seen.has(key)) continue;
|
|
106
|
+
seen.add(key);
|
|
95
107
|
let stat;
|
|
96
108
|
try {
|
|
97
|
-
stat = statSync(
|
|
109
|
+
stat = statSync(canonical);
|
|
98
110
|
} catch {
|
|
99
111
|
notFound.push(entry);
|
|
100
112
|
continue;
|
|
@@ -103,7 +115,7 @@ async function buildContextBlocks(contextFiles, workspace, client, warnings) {
|
|
|
103
115
|
warnings.push(`contextFile ${entry} skipped: not a file`);
|
|
104
116
|
continue;
|
|
105
117
|
}
|
|
106
|
-
const mimeType = IMAGE_MIME[path.extname(
|
|
118
|
+
const mimeType = IMAGE_MIME[path.extname(canonical).toLowerCase()];
|
|
107
119
|
if (mimeType) {
|
|
108
120
|
if (!client?.agentCapabilities?.promptCapabilities?.image) {
|
|
109
121
|
warnings.push(`contextFile ${entry} skipped: this agent does not accept image prompts`);
|
|
@@ -113,10 +125,10 @@ async function buildContextBlocks(contextFiles, workspace, client, warnings) {
|
|
|
113
125
|
warnings.push(`contextFile ${entry} skipped: ${Math.round(stat.size / 1024)}KB exceeds the ${MAX_IMAGE_BYTES / 1024 / 1024}MB image limit`);
|
|
114
126
|
continue;
|
|
115
127
|
}
|
|
116
|
-
blocks.push({ type: "image", mimeType, data: (await readFile(
|
|
128
|
+
blocks.push({ type: "image", mimeType, data: (await readFile(canonical)).toString("base64") });
|
|
117
129
|
continue;
|
|
118
130
|
}
|
|
119
|
-
blocks.push({ type: "resource_link", uri: pathToFileURL(
|
|
131
|
+
blocks.push({ type: "resource_link", uri: pathToFileURL(canonical).href, name: path.basename(canonical) });
|
|
120
132
|
}
|
|
121
133
|
if (notFound.length) {
|
|
122
134
|
warnings.push(
|
|
@@ -331,6 +343,7 @@ export async function runDelegate({
|
|
|
331
343
|
completed: count("completed"),
|
|
332
344
|
inProgress: count("in_progress"),
|
|
333
345
|
pending: count("pending"),
|
|
346
|
+
cancelled: count("cancelled"),
|
|
334
347
|
},
|
|
335
348
|
};
|
|
336
349
|
};
|
package/src/doctor.js
CHANGED
|
@@ -11,8 +11,24 @@ const VERSION_PROBE_TIMEOUT_MS = 10_000;
|
|
|
11
11
|
const PROBE_STDOUT_CAP = 64 * 1024;
|
|
12
12
|
const DEFAULT_LOG_SIZE = "2000";
|
|
13
13
|
|
|
14
|
+
function formatArg(value) {
|
|
15
|
+
const s = String(value);
|
|
16
|
+
if (!/[\s"]/.test(s)) return s;
|
|
17
|
+
return `"${s.replace(/"/g, '\\"')}"`;
|
|
18
|
+
}
|
|
19
|
+
|
|
14
20
|
function formatCommand({ command, args }) {
|
|
15
|
-
|
|
21
|
+
const bits = [formatArg(command), ...(args || []).map(formatArg)];
|
|
22
|
+
return args?.length ? bits.join(" ") : formatArg(command);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function isJsLauncher(command) {
|
|
26
|
+
const trimmed = String(command || "").replace(/^["']|["']$/g, "");
|
|
27
|
+
return /\.(?:cjs|mjs|js)$/i.test(trimmed);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function envReport(name, fallback = null) {
|
|
31
|
+
return process.env[name] !== undefined ? process.env[name] : fallback;
|
|
16
32
|
}
|
|
17
33
|
|
|
18
34
|
// Time-boxed because a launcher that accepts --version and then never answers would hang doctor
|
|
@@ -20,9 +36,10 @@ function formatCommand({ command, args }) {
|
|
|
20
36
|
// exactly the case it must survive. Same guard the deep handshake has.
|
|
21
37
|
export function probeAgentVersion(spawnSpec, timeoutMs = VERSION_PROBE_TIMEOUT_MS) {
|
|
22
38
|
const { command, options } = spawnSpec;
|
|
23
|
-
const
|
|
39
|
+
const launcher = String(command || "").replace(/^["']|["']$/g, "");
|
|
40
|
+
const isJsScript = isJsLauncher(launcher);
|
|
24
41
|
const execCommand = isJsScript ? process.execPath : command;
|
|
25
|
-
const execArgs = isJsScript ? [
|
|
42
|
+
const execArgs = isJsScript ? [launcher, "--version"] : ["--version"];
|
|
26
43
|
return new Promise((resolve) => {
|
|
27
44
|
let settled = false;
|
|
28
45
|
let stdout = "";
|
|
@@ -46,9 +63,11 @@ export function probeAgentVersion(spawnSpec, timeoutMs = VERSION_PROBE_TIMEOUT_M
|
|
|
46
63
|
child.stderr?.on("error", () => {});
|
|
47
64
|
child.on("error", () => finish({ found: false, version: null }));
|
|
48
65
|
child.on("close", (code) => {
|
|
66
|
+
const version = code === 0 ? stdout.trim() || null : null;
|
|
49
67
|
finish({
|
|
50
68
|
found: true,
|
|
51
|
-
version
|
|
69
|
+
version,
|
|
70
|
+
...(code !== 0 ? { error: `version probe exited ${code}` } : {}),
|
|
52
71
|
});
|
|
53
72
|
});
|
|
54
73
|
timer = setTimeout(() => {
|
|
@@ -152,8 +171,13 @@ export async function runDoctor({
|
|
|
152
171
|
transport: "stdio",
|
|
153
172
|
},
|
|
154
173
|
env: {
|
|
155
|
-
ACP_LOG_SIZE:
|
|
156
|
-
|
|
174
|
+
ACP_LOG_SIZE: envReport("ACP_LOG_SIZE", DEFAULT_LOG_SIZE),
|
|
175
|
+
ACP_AGENT_COMMAND: envReport("ACP_AGENT_COMMAND"),
|
|
176
|
+
ACP_AGENT_ARGS: envReport("ACP_AGENT_ARGS"),
|
|
177
|
+
CURSOR_DELEGATE_TRANSCRIPT: envReport("CURSOR_DELEGATE_TRANSCRIPT"),
|
|
178
|
+
CURSOR_DELEGATE_HANDSHAKE_MS: envReport("CURSOR_DELEGATE_HANDSHAKE_MS"),
|
|
179
|
+
CURSOR_DELEGATE_HARD_CAP_MS: envReport("CURSOR_DELEGATE_HARD_CAP_MS"),
|
|
180
|
+
CURSOR_DELEGATE_IDLE_MS: envReport("CURSOR_DELEGATE_IDLE_MS"),
|
|
157
181
|
},
|
|
158
182
|
};
|
|
159
183
|
|
package/src/server.js
CHANGED
|
@@ -11,6 +11,13 @@ import { VERSION, readPackageVersion } from "./version.js";
|
|
|
11
11
|
import { DETACHED } from "./proc.js";
|
|
12
12
|
import { PLAN_PRIORITIES, PLAN_STATUSES, TODO_STATUSES } from "./acp-enums.js";
|
|
13
13
|
|
|
14
|
+
const ICON_BASE = `https://raw.githubusercontent.com/andreilungeanu/cursor-delegate-mcp/v${VERSION}/assets`;
|
|
15
|
+
/** @type {Array<{ src: string, mimeType: string, sizes: string[], theme: "light" | "dark" }>} */
|
|
16
|
+
const SERVER_ICONS = [
|
|
17
|
+
{ src: `${ICON_BASE}/logo-light.png`, mimeType: "image/png", sizes: ["1024x1024"], theme: "light" },
|
|
18
|
+
{ src: `${ICON_BASE}/logo-dark.png`, mimeType: "image/png", sizes: ["1024x1024"], theme: "dark" },
|
|
19
|
+
];
|
|
20
|
+
|
|
14
21
|
const nodeMajor = Number(process.versions.node.split(".")[0]);
|
|
15
22
|
if (nodeMajor < 20) {
|
|
16
23
|
console.error(`cursor-delegate-mcp requires Node 20+ (found ${process.versions.node})`);
|
|
@@ -104,6 +111,7 @@ export const delegateOutputShape = {
|
|
|
104
111
|
completed: z.number(),
|
|
105
112
|
inProgress: z.number(),
|
|
106
113
|
pending: z.number(),
|
|
114
|
+
cancelled: z.number(),
|
|
107
115
|
}).optional(),
|
|
108
116
|
};
|
|
109
117
|
|
|
@@ -265,7 +273,7 @@ export function buildServer({ runDelegate: runDelegateInjected, runDoctor: runDo
|
|
|
265
273
|
const runDelegate = runDelegateInjected || runDelegateDefault;
|
|
266
274
|
const runDoctor = runDoctorInjected || runDoctorDefault;
|
|
267
275
|
const server = new McpServer(
|
|
268
|
-
{ name: "cursor-delegate-mcp", version: VERSION },
|
|
276
|
+
{ name: "cursor-delegate-mcp", version: VERSION, icons: SERVER_ICONS },
|
|
269
277
|
{ instructions: SERVER_INSTRUCTIONS }
|
|
270
278
|
);
|
|
271
279
|
|
|
@@ -325,13 +333,17 @@ export function buildServer({ runDelegate: runDelegateInjected, runDoctor: runDo
|
|
|
325
333
|
await new Promise((r) => setTimeout(r, forceGraceMs));
|
|
326
334
|
const stillRunning = inFlight.get(sessionId);
|
|
327
335
|
if (!stillRunning || stillRunning.size === 0) return cancelResult("cancelled", sessionId);
|
|
336
|
+
// Snapshot before awaiting stop. A resume that registers during teardown must not be
|
|
337
|
+
// swept out of the map — it was never killed, and inFlight.delete(sessionId) would
|
|
338
|
+
// hide it from cancel and shutdown.
|
|
339
|
+
const toKill = [...stillRunning];
|
|
328
340
|
const observed = await Promise.all(
|
|
329
|
-
|
|
341
|
+
toKill.map((handle) => Promise.resolve(handle.client.stop()).catch(() => false))
|
|
330
342
|
);
|
|
331
343
|
// "killed" claims the process is gone, so it needs the exit, not just a dispatched signal.
|
|
332
344
|
// When one does not follow, the handles stay registered and force can be tried again.
|
|
333
345
|
if (!observed.every(Boolean)) return cancelResult("cancelled", sessionId);
|
|
334
|
-
inFlight
|
|
346
|
+
for (const handle of toKill) unregisterInFlight(inFlight, sessionId, handle);
|
|
335
347
|
return cancelResult("killed", sessionId);
|
|
336
348
|
}
|
|
337
349
|
);
|