cursor-delegate-mcp 2.3.0 → 2.4.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 +34 -0
- package/package.json +1 -1
- package/src/delegate.js +25 -5
- package/src/doctor.js +4 -5
- package/src/model-options.js +41 -6
- package/src/server.js +8 -1
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,40 @@ All notable changes to this project are documented here. The format follows
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [2.4.0] - 2026-10-05
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- `effectiveEffort` in the delegate result: the current value of each option recognized as
|
|
14
|
+
effort, keyed by option id, as the agent reported it when the prompt went out. It is
|
|
15
|
+
present even when `effort` is omitted, because the model then runs at the level Cursor
|
|
16
|
+
saved for it, and absent when no reply confirmed a value. Read from replies the bridge
|
|
17
|
+
already receives, so it adds no ACP requests.
|
|
18
|
+
- `doctor` with `deep: true` reports each `currentModelOptions` entry's `name`, ACP
|
|
19
|
+
`category` and `currentValue` when the agent sends them as strings. The id and values
|
|
20
|
+
alone could not show that grok-4.7's `reasoning_effort` is its effort setting, or which
|
|
21
|
+
level Cursor had saved for it.
|
|
22
|
+
|
|
23
|
+
### Fixed
|
|
24
|
+
|
|
25
|
+
- `effort` reaches a model that advertises it under an unfamiliar id. An option the agent
|
|
26
|
+
marks with ACP's `thought_level` category counts as effort whatever its id or name, and
|
|
27
|
+
the fallback for agents that send no category also knows `reasoning_effort` and names
|
|
28
|
+
containing "effort". grok-4.7 declares `reasoning_effort` ("Effort"), which was missed, so
|
|
29
|
+
`effort: "high"` failed with `invalid-effort` claiming the model had no effort setting.
|
|
30
|
+
- `invalid-effort` no longer says `Accepted: none` when no option is recognized as effort.
|
|
31
|
+
Missing an option is not proof the model has none, so the error lists the options the
|
|
32
|
+
model advertised, with their names, categories and values.
|
|
33
|
+
|
|
34
|
+
### Security
|
|
35
|
+
|
|
36
|
+
- Lockfile bump of `hono` to 4.13.7, clearing a moderate audit advisory.
|
|
37
|
+
|
|
38
|
+
### Internal
|
|
39
|
+
|
|
40
|
+
- Lockfile bumps of `@modelcontextprotocol/sdk` to 1.30.1 and the dev dependency
|
|
41
|
+
`@types/node` to 26.6.3.
|
|
42
|
+
|
|
9
43
|
## [2.3.0] - 2026-09-06
|
|
10
44
|
|
|
11
45
|
### Fixed
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cursor-delegate-mcp",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.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/delegate.js
CHANGED
|
@@ -12,7 +12,7 @@ import { normalizeAgentReportedFiles } from "./agent-reported-files.js";
|
|
|
12
12
|
import { makeTurnState } from "./turn-state.js";
|
|
13
13
|
import { makeError } from "./errors.js";
|
|
14
14
|
import { PLAN_PRIORITIES, PLAN_STATUSES, TODO_STATUSES } from "./acp-enums.js";
|
|
15
|
-
import { optionsFrom, resolveEffort, unsupportedWarning } from "./model-options.js";
|
|
15
|
+
import { effortSettings, optionsFrom, resolveEffort, unsupportedWarning } from "./model-options.js";
|
|
16
16
|
import { transcriptFrames } from "./jsonrpc.js";
|
|
17
17
|
|
|
18
18
|
export const DEFAULT_MODEL = "composer-2.5";
|
|
@@ -230,11 +230,13 @@ async function applyEffort(client, sessionId, model, value, modelOptions) {
|
|
|
230
230
|
+ " the selected model did not report a usable effort option list."
|
|
231
231
|
);
|
|
232
232
|
}
|
|
233
|
-
if (resolved.status === "
|
|
233
|
+
if (resolved.status === "unrecognized") {
|
|
234
234
|
throw makeError(
|
|
235
235
|
"invalid-effort",
|
|
236
|
-
`Model ${JSON.stringify(model)}
|
|
237
|
-
+ `
|
|
236
|
+
`Model ${JSON.stringify(model)} advertised no option the bridge recognizes as effort.`
|
|
237
|
+
+ ` Advertised: ${JSON.stringify(resolved.advertised)}.`
|
|
238
|
+
+ ` If none of these is an effort setting, omit effort; do not send ${JSON.stringify("none")}.`
|
|
239
|
+
+ " If one is, the bridge failed to recognize it — report that rather than retrying."
|
|
238
240
|
);
|
|
239
241
|
}
|
|
240
242
|
if (resolved.status === "invalid") {
|
|
@@ -456,6 +458,7 @@ export async function runDelegate({
|
|
|
456
458
|
let resumeError;
|
|
457
459
|
const unsupportedOptions = [];
|
|
458
460
|
let servedModel;
|
|
461
|
+
let effectiveEffort;
|
|
459
462
|
const contextWarnings = [];
|
|
460
463
|
try {
|
|
461
464
|
const res = await supervisor.supervise(async () => {
|
|
@@ -473,6 +476,11 @@ export async function runDelegate({
|
|
|
473
476
|
// (same model twice running) hits this.
|
|
474
477
|
const openedOnModel = client.sessionModels?.currentModelId === model;
|
|
475
478
|
if (!openedOnModel) await client.setModel(sessionId, model);
|
|
479
|
+
// The selected model's options as the agent last reported them, read for effectiveEffort.
|
|
480
|
+
// After a switch the opening snapshot describes the model we left, so it is dropped. A set
|
|
481
|
+
// that succeeds replaces the snapshot with its reply, which may carry none, and then nothing
|
|
482
|
+
// is known; a refused set changed nothing, so the snapshot stands.
|
|
483
|
+
let observedOptions = openedOnModel ? client.configOptions : undefined;
|
|
476
484
|
// fast is an instruction, not a probe. Cursor persists the tier, and persists it per model —
|
|
477
485
|
// both measured: one fast:true turn leaves the next fresh session reporting fast=true, and a
|
|
478
486
|
// set_model to another model reports that model's own tier. So the opening snapshot only
|
|
@@ -487,6 +495,7 @@ export async function runDelegate({
|
|
|
487
495
|
const fastResult = await applyConfig(client, sessionId, "fast", fast);
|
|
488
496
|
if (fastResult.unsupported && fast) unsupportedOptions.push({ arg: "fast" });
|
|
489
497
|
else servedModel = servedModelFrom(fastResult.res) ?? servedModel;
|
|
498
|
+
if (!fastResult.unsupported) observedOptions = optionsFrom(fastResult.res);
|
|
490
499
|
modelOptions = optionsFrom(fastResult.res);
|
|
491
500
|
}
|
|
492
501
|
// A model that refuses fast leaves no list. Re-asserting the model just set is inert, and
|
|
@@ -494,18 +503,26 @@ export async function runDelegate({
|
|
|
494
503
|
if (modelOptions === undefined && effort !== undefined) {
|
|
495
504
|
const reasserted = await applyConfig(client, sessionId, "model", model);
|
|
496
505
|
modelOptions = optionsFrom(reasserted.res);
|
|
506
|
+
if (!reasserted.unsupported) observedOptions = modelOptions;
|
|
497
507
|
servedModel = servedModelFrom(reasserted.res) ?? servedModel;
|
|
498
508
|
}
|
|
499
509
|
if (effort !== undefined) {
|
|
500
510
|
const r = await applyEffort(client, sessionId, model, effort, modelOptions);
|
|
511
|
+
observedOptions = optionsFrom(r);
|
|
501
512
|
servedModel = servedModelFrom(r) ?? servedModel;
|
|
502
513
|
}
|
|
503
514
|
if (context !== undefined) {
|
|
504
515
|
const r = await applyConfig(client, sessionId, "context", context);
|
|
505
516
|
if (r.unsupported) unsupportedOptions.push({ arg: "context" });
|
|
506
|
-
else
|
|
517
|
+
else {
|
|
518
|
+
observedOptions = optionsFrom(r.res);
|
|
519
|
+
servedModel = servedModelFrom(r.res) ?? servedModel;
|
|
520
|
+
}
|
|
507
521
|
}
|
|
508
522
|
await client.setMode(sessionId, mode);
|
|
523
|
+
// What the agent reported in force as the prompt goes out — never the requested value
|
|
524
|
+
// standing in for a reply that did not confirm it.
|
|
525
|
+
effectiveEffort = effortSettings(observedOptions);
|
|
509
526
|
// Everything a session/load replay may have written belongs to the previous turn.
|
|
510
527
|
state.reset();
|
|
511
528
|
supervisor.promptStarted();
|
|
@@ -566,6 +583,9 @@ export async function runDelegate({
|
|
|
566
583
|
// Only when the agent served a different model than asked — e.g. "default" routing to a
|
|
567
584
|
// concrete id, or a cross-model resume. Silence means the request was honored.
|
|
568
585
|
if (servedModel !== undefined && servedModel !== model) out.effectiveModel = servedModel;
|
|
586
|
+
// Unlike effectiveModel, present whenever known: an omitted effort runs at whatever Cursor
|
|
587
|
+
// saved for the model, and this is the only place the caller can see what that was.
|
|
588
|
+
if (effectiveEffort !== undefined) out.effectiveEffort = effectiveEffort;
|
|
569
589
|
if (stopReason !== undefined) out.stopReason = stopReason;
|
|
570
590
|
// sessionTitle stays out of the result: it is a live label (progress) and a forensic one
|
|
571
591
|
// (timeout errors), not a fact about the finished turn.
|
package/src/doctor.js
CHANGED
|
@@ -4,7 +4,7 @@ import { AcpClient } from "./acp-client.js";
|
|
|
4
4
|
import { resolveAcpSpawn } from "./spawn.js";
|
|
5
5
|
import { DETACHED, treeKill } from "./proc.js";
|
|
6
6
|
import { readPackageVersion } from "./version.js";
|
|
7
|
-
import {
|
|
7
|
+
import { describeOptions } from "./model-options.js";
|
|
8
8
|
|
|
9
9
|
const HANDSHAKE_TIMEOUT_MS = 15_000;
|
|
10
10
|
const VERSION_PROBE_TIMEOUT_MS = 10_000;
|
|
@@ -98,10 +98,9 @@ async function runDeepHandshake({ spawnSpec, clientFactory, workspace, timeoutMs
|
|
|
98
98
|
details.currentModel = client.sessionModels?.currentModelId ?? null;
|
|
99
99
|
details.modes = (client.sessionModes?.availableModes ?? []).map((m) => m?.id).filter(Boolean);
|
|
100
100
|
// session/new already returned these. currentModel only — any other model needs a set_model
|
|
101
|
-
// first, which this handshake does not send.
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
.map((o) => ({ id: o.id, values: allowedValues(o) }));
|
|
101
|
+
// first, which this handshake does not send. name and category are what tell an effort
|
|
102
|
+
// option apart when its id is unfamiliar; currentValue is the level saved for the model.
|
|
103
|
+
details.currentModelOptions = describeOptions(client.configOptions);
|
|
105
104
|
})();
|
|
106
105
|
const timeout = new Promise((_, reject) => {
|
|
107
106
|
timer = setTimeout(() => {
|
package/src/model-options.js
CHANGED
|
@@ -1,14 +1,21 @@
|
|
|
1
1
|
// Config option ids differ per model, and a model rejects any id it does not declare. The set is
|
|
2
2
|
// knowable only once a model is selected, from the configOptions the agent echoes back.
|
|
3
3
|
|
|
4
|
-
//
|
|
5
|
-
|
|
4
|
+
// ACP marks a thought/reasoning level selector with category "thought_level" — grok-4.7 declares
|
|
5
|
+
// reasoning_effort ("Effort") that way. Categories are optional in ACP, so the ids and names
|
|
6
|
+
// below still classify options from an agent that sends none. A match only nominates an option:
|
|
7
|
+
// the requested value must still appear exactly among the values it advertises.
|
|
8
|
+
const THOUGHT_LEVEL_IDS = new Set(["thinking", "reasoning", "effort", "reasoning_effort", "thought_level"]);
|
|
9
|
+
// Never an effort setting, and doctor reports them as currentModel and modes, so a list of what a
|
|
10
|
+
// model offers leaves them out.
|
|
11
|
+
const SELECTOR_IDS = new Set(["model", "mode"]);
|
|
6
12
|
|
|
7
13
|
export function isThoughtLevel(opt) {
|
|
14
|
+
if (opt?.category === "thought_level") return true;
|
|
8
15
|
const id = typeof opt?.id === "string" ? opt.id.toLowerCase() : "";
|
|
9
16
|
if (THOUGHT_LEVEL_IDS.has(id)) return true;
|
|
10
17
|
const name = typeof opt?.name === "string" ? opt.name.toLowerCase() : "";
|
|
11
|
-
return /thinking|reasoning|thought/.test(name);
|
|
18
|
+
return /thinking|reasoning|thought|effort/.test(name);
|
|
12
19
|
}
|
|
13
20
|
|
|
14
21
|
export function optionsFrom(res) {
|
|
@@ -21,15 +28,43 @@ export function allowedValues(opt) {
|
|
|
21
28
|
.filter((v) => typeof v === "string");
|
|
22
29
|
}
|
|
23
30
|
|
|
31
|
+
// What a model offers besides the model and mode selectors, as doctor reports it and as an
|
|
32
|
+
// unrecognized effort names it. Optional metadata appears only when the agent sent a string.
|
|
33
|
+
export function describeOptions(options) {
|
|
34
|
+
return (Array.isArray(options) ? options : [])
|
|
35
|
+
.filter((o) => typeof o?.id === "string" && !SELECTOR_IDS.has(o.id))
|
|
36
|
+
.map((o) => ({
|
|
37
|
+
id: o.id,
|
|
38
|
+
...(typeof o.name === "string" ? { name: o.name } : {}),
|
|
39
|
+
...(typeof o.category === "string" ? { category: o.category } : {}),
|
|
40
|
+
values: allowedValues(o),
|
|
41
|
+
...(typeof o.currentValue === "string" ? { currentValue: o.currentValue } : {}),
|
|
42
|
+
}));
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// The current value of every recognized effort option, keyed by id. All of them rather than one
|
|
46
|
+
// picked: a model can declare a thinking toggle beside a level, and either alone can mislead.
|
|
47
|
+
// Undefined when no recognized option reports a string value.
|
|
48
|
+
export function effortSettings(options) {
|
|
49
|
+
const settings = {};
|
|
50
|
+
for (const o of Array.isArray(options) ? options : []) {
|
|
51
|
+
if (isThoughtLevel(o) && typeof o?.id === "string" && typeof o.currentValue === "string") {
|
|
52
|
+
settings[o.id] = o.currentValue;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return Object.keys(settings).length > 0 ? settings : undefined;
|
|
56
|
+
}
|
|
57
|
+
|
|
24
58
|
// Resolve only values the selected model advertised. This keeps future vocabularies working
|
|
25
59
|
// without aliases or a ranking table: xhigh, extra-high, max and ultra are just exact tokens.
|
|
26
|
-
//
|
|
27
|
-
//
|
|
60
|
+
// No list, an empty list, or a thought-level option with no usable id/values is unavailable. A
|
|
61
|
+
// list with nothing classified as thought-level is unrecognized — not proof the model has no
|
|
62
|
+
// effort setting: categories are optional and ids get renamed, so the caller is shown the list.
|
|
28
63
|
export function resolveEffort(options, value) {
|
|
29
64
|
if (!Array.isArray(options) || options.length === 0) return { status: "unavailable" };
|
|
30
65
|
|
|
31
66
|
const candidates = options.filter(isThoughtLevel);
|
|
32
|
-
if (candidates.length === 0) return { status: "
|
|
67
|
+
if (candidates.length === 0) return { status: "unrecognized", advertised: describeOptions(options) };
|
|
33
68
|
|
|
34
69
|
const usable = candidates.filter((o) => typeof o?.id === "string");
|
|
35
70
|
const accepted = [...new Set(usable.flatMap(allowedValues))];
|
package/src/server.js
CHANGED
|
@@ -85,6 +85,7 @@ export const delegateOutputShape = {
|
|
|
85
85
|
result: z.string(),
|
|
86
86
|
resultSource: z.enum(["pre-tool-fallback", "none"]).optional(),
|
|
87
87
|
effectiveModel: z.string().optional(),
|
|
88
|
+
effectiveEffort: z.record(z.string()).optional(),
|
|
88
89
|
stopReason: z.string().optional(),
|
|
89
90
|
sessionId: z.string(),
|
|
90
91
|
filesReportedByEditTools: z.array(z.string()).optional(),
|
|
@@ -122,7 +123,13 @@ export const doctorHandshakeShape = {
|
|
|
122
123
|
currentModel: z.unknown().optional(),
|
|
123
124
|
modes: z.array(z.unknown()).optional(),
|
|
124
125
|
// Built here rather than relayed, so it gets a real type where its neighbours get z.unknown().
|
|
125
|
-
currentModelOptions: z.array(z.object({
|
|
126
|
+
currentModelOptions: z.array(z.object({
|
|
127
|
+
id: z.string(),
|
|
128
|
+
name: z.string().optional(),
|
|
129
|
+
category: z.string().optional(),
|
|
130
|
+
values: z.array(z.string()),
|
|
131
|
+
currentValue: z.string().optional(),
|
|
132
|
+
})).optional(),
|
|
126
133
|
};
|
|
127
134
|
|
|
128
135
|
export const doctorAgentShape = {
|