cursor-delegate-mcp 1.18.1 → 1.19.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/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # Cursor Delegate
2
2
 
3
- **Stop burning your frontier agent's limits on boilerplate.** Delegate edits to Cursor's CLI agent — your agent writes the brief and reviews the diff.
3
+ **Stop burning your frontier agent's limits on boilerplate.**
4
+
5
+ Delegate edits to Cursor's CLI agent — your agent writes the brief and reviews the diff.
4
6
 
5
7
  [![npm version](https://img.shields.io/npm/v/cursor-delegate-mcp)](https://www.npmjs.com/package/cursor-delegate-mcp)
6
8
  [![npm downloads](https://img.shields.io/npm/dt/cursor-delegate-mcp)](https://www.npmjs.com/package/cursor-delegate-mcp)
@@ -30,17 +32,9 @@ Composer 2.5 is built for throughput on multi-file edits. The whole delegation i
30
32
 
31
33
  ## 🔋 Your limits stop being the bottleneck
32
34
 
33
- 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 ([Cursor's own wording](https://cursor.com/pricing)). 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 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.
34
36
 
35
- ```
36
- You → your agent (plans & reviews)
37
- │ MCP delegate tool
38
- ▼
39
- cursor-agent (Composer 2.5 — implements)
40
- │ edits your workspace
41
- ▼
42
- Clean result: what changed, which files, the plan
43
- ```
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)
44
38
 
45
39
  ![Delegate result payload](assets/result-json.png)
46
40
 
@@ -96,7 +90,7 @@ copilot plugin install andreilungeanu/cursor-delegate-mcp
96
90
  }
97
91
  }
98
92
  ```
99
-
93
+
100
94
  ### Client-specific config locations
101
95
 
102
96
  <details>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cursor-delegate-mcp",
3
- "version": "1.18.1",
3
+ "version": "1.19.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, or Copilot to Cursor's CLI agent — structured results, plan mode, and changed files.",
package/src/delegate.js CHANGED
@@ -12,6 +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, resolveEffortId, unsupportedWarning } from "./model-options.js";
15
16
 
16
17
  export const DEFAULT_MODEL = "composer-2.5";
17
18
  export const DEFAULT_HANDSHAKE_MS = 60000;
@@ -184,16 +185,25 @@ async function applyConfig(client, sessionId, configId, value) {
184
185
  // The resolved model appears only in a set_config_option reply's configOptions (set_model
185
186
  // returns nothing). Absent for models that reject every option sent — the field then stays off.
186
187
  function servedModelFrom(res) {
187
- const opts = res?.configOptions;
188
- if (!Array.isArray(opts)) return undefined;
188
+ const opts = optionsFrom(res);
189
+ if (opts === undefined) return undefined;
189
190
  const m = opts.find((o) => o?.id === "model");
190
191
  return typeof m?.currentValue === "string" ? m.currentValue : undefined;
191
192
  }
192
193
 
194
+ // Sent under whichever id the model declares. A model that refuses fast leaves no option list;
195
+ // only then are the candidate ids tried in turn.
196
+ async function applyEffort(client, sessionId, value, modelOptions) {
197
+ const id = resolveEffortId(modelOptions, value);
198
+ if (id === undefined) return { applied: false };
199
+ const r = await applyConfig(client, sessionId, id, value);
200
+ return r.unsupported ? { applied: false } : { applied: true, res: r.res };
201
+ }
202
+
193
203
  /**
194
204
  * @param {{
195
205
  * spec?: string, mode?: string, resumeSessionId?: string, workspace?: string,
196
- * model?: string, fast?: boolean, reasoning?: string, context?: string,
206
+ * model?: string, fast?: boolean, effort?: string, context?: string,
197
207
  * contextFiles?: string[], clientFactory?: (opts: any) => any,
198
208
  * idleMs?: number, handshakeMs?: number, hardCapMs?: number, timeoutMs?: number,
199
209
  * onSessionReady?: (sessionId: string, client: any) => void,
@@ -203,7 +213,7 @@ function servedModelFrom(res) {
203
213
  */
204
214
  export async function runDelegate({
205
215
  spec, mode = "agent", resumeSessionId, workspace,
206
- model = DEFAULT_MODEL, fast = false, reasoning, context, contextFiles, clientFactory,
216
+ model = DEFAULT_MODEL, fast = false, effort, context, contextFiles, clientFactory,
207
217
  idleMs, handshakeMs, hardCapMs, timeoutMs,
208
218
  onSessionReady, onProgress, progressThrottleMs = 2000,
209
219
  heartbeatMs = DEFAULT_HEARTBEAT_MS,
@@ -365,15 +375,28 @@ export async function runDelegate({
365
375
  assertKnownModel(client, model);
366
376
  await client.setModel(sessionId, model);
367
377
  // fast is always sent — a resumed session may already have it on, so false is a real
368
- // instruction. reasoning and context go only when the caller named one. Each reply reports
369
- // the now-current model; the last one seen wins.
378
+ // instruction. Its reply carries this model's configOptions, which is where the effort id
379
+ // comes from. effort and context go only when the caller named one. Each reply reports the
380
+ // now-current model; the last one seen wins.
370
381
  const fastResult = await applyConfig(client, sessionId, "fast", fast);
371
- if (fastResult.unsupported && fast) unsupportedOptions.push("fast");
382
+ if (fastResult.unsupported && fast) unsupportedOptions.push({ arg: "fast" });
372
383
  else servedModel = servedModelFrom(fastResult.res) ?? servedModel;
373
- for (const [id, value] of [["reasoning", reasoning], ["context", context]]) {
374
- if (value === undefined) continue;
375
- const r = await applyConfig(client, sessionId, id, value);
376
- if (r.unsupported) unsupportedOptions.push(id);
384
+ let modelOptions = optionsFrom(fastResult.res);
385
+ // A model that refuses fast leaves no list. Re-asserting the model just set is inert, and
386
+ // its reply carries the full list — measured on claude-haiku-4-5, which refuses fast.
387
+ if (modelOptions === undefined && effort !== undefined) {
388
+ const reasserted = await applyConfig(client, sessionId, "model", model);
389
+ modelOptions = optionsFrom(reasserted.res);
390
+ servedModel = servedModelFrom(reasserted.res) ?? servedModel;
391
+ }
392
+ if (effort !== undefined) {
393
+ const applied = await applyEffort(client, sessionId, effort, modelOptions);
394
+ if (!applied.applied) unsupportedOptions.push({ arg: "effort", modelOptions });
395
+ else servedModel = servedModelFrom(applied.res) ?? servedModel;
396
+ }
397
+ if (context !== undefined) {
398
+ const r = await applyConfig(client, sessionId, "context", context);
399
+ if (r.unsupported) unsupportedOptions.push({ arg: "context" });
377
400
  else servedModel = servedModelFrom(r.res) ?? servedModel;
378
401
  }
379
402
  await client.setMode(sessionId, mode);
@@ -441,7 +464,7 @@ export async function runDelegate({
441
464
  // sessionTitle stays out of the result: it is a live label (progress) and a forensic one
442
465
  // (timeout errors), not a fact about the finished turn.
443
466
  if (resumeError) protocolWarnings.push(`resuming ${resumeSessionId} failed, started a fresh session: ${resumeError}`);
444
- for (const id of unsupportedOptions) protocolWarnings.push(`model ${model} has no ${id} option; the requested value was ignored`);
467
+ for (const u of unsupportedOptions) protocolWarnings.push(unsupportedWarning(model, u));
445
468
  protocolWarnings.push(...contextWarnings);
446
469
  if (state.planEntries.length > 0 || state.planOverview !== undefined || state.planDetail !== undefined) {
447
470
  // Sanitize even when the plan is discarded: the warnings it raises report malformed ACP
package/src/doctor.js CHANGED
@@ -4,6 +4,7 @@ import { AcpClient } from "./acp-client.js";
4
4
  import { resolveAcpSpawn } from "./spawn.js";
5
5
  import { treeKill } from "./proc.js";
6
6
  import { readPackageVersion } from "./version.js";
7
+ import { allowedValues } from "./model-options.js";
7
8
 
8
9
  const HANDSHAKE_TIMEOUT_MS = 15_000;
9
10
  const VERSION_PROBE_TIMEOUT_MS = 10_000;
@@ -67,6 +68,12 @@ async function runDeepHandshake({ spawnSpec, clientFactory, workspace, timeoutMs
67
68
  details.models = (client.sessionModels?.availableModels ?? []).map((m) => m?.modelId).filter(Boolean);
68
69
  details.currentModel = client.sessionModels?.currentModelId ?? null;
69
70
  details.modes = (client.sessionModes?.availableModes ?? []).map((m) => m?.id).filter(Boolean);
71
+ // session/new already returned these. currentModel only — any other model needs a set_model
72
+ // first, which this handshake does not send.
73
+ details.currentModelOptions = (client.configOptions ?? [])
74
+ // model and mode are already reported as their own fields.
75
+ .filter((o) => typeof o?.id === "string" && o.id !== "model" && o.id !== "mode")
76
+ .map((o) => ({ id: o.id, values: allowedValues(o) }));
70
77
  })();
71
78
  const timeout = new Promise((_, reject) => {
72
79
  timer = setTimeout(() => {
@@ -0,0 +1,52 @@
1
+ // Config option ids differ per model, and a model rejects any id it does not declare. The set is
2
+ // knowable only once a model is selected, from the configOptions the agent echoes back.
3
+
4
+ // Mirrors cursor-agent's own classifier.
5
+ const THOUGHT_LEVEL_IDS = new Set(["thinking", "reasoning", "effort", "thought_level"]);
6
+
7
+ export function isThoughtLevel(opt) {
8
+ const id = typeof opt?.id === "string" ? opt.id.toLowerCase() : "";
9
+ if (THOUGHT_LEVEL_IDS.has(id)) return true;
10
+ const name = typeof opt?.name === "string" ? opt.name.toLowerCase() : "";
11
+ return /thinking|reasoning|thought/.test(name);
12
+ }
13
+
14
+ export function optionsFrom(res) {
15
+ return Array.isArray(res?.configOptions) ? res.configOptions : undefined;
16
+ }
17
+
18
+ export function allowedValues(opt) {
19
+ return (Array.isArray(opt?.options) ? opt.options : [])
20
+ .map((o) => o?.value)
21
+ .filter((v) => typeof v === "string");
22
+ }
23
+
24
+ function isBoolean(opt) {
25
+ const v = allowedValues(opt).slice().sort();
26
+ return v.length === 2 && v[0] === "false" && v[1] === "true";
27
+ }
28
+
29
+ // Claude declares thinking (true|false) and effort (low|medium|high) together, so the value picks
30
+ // the id. With no match, a non-boolean candidate still goes: the agent's own "Invalid value for X"
31
+ // names the allowed set. A boolean-only model (claude-haiku-4-5 declares just thinking) gets
32
+ // nothing — sending a level there is a guaranteed invalid value, which would fail the run.
33
+ export function resolveEffortId(options, value) {
34
+ const candidates = (Array.isArray(options) ? options : []).filter(isThoughtLevel);
35
+ if (candidates.length === 0) return undefined;
36
+ const pick = candidates.find((o) => allowedValues(o).includes(value))
37
+ ?? candidates.find((o) => !isBoolean(o));
38
+ return typeof pick?.id === "string" ? pick.id : undefined;
39
+ }
40
+
41
+ // effort's id varies per model, so name the ids the model declares. fast and context are sent
42
+ // under their own names.
43
+ export function unsupportedWarning(model, { arg, modelOptions }) {
44
+ if (arg !== "effort") return `model ${model} has no ${arg} option; the requested value was ignored`;
45
+ // No reply carried a list, so claiming the model declares nothing would assert a capability
46
+ // never observed.
47
+ if (modelOptions === undefined) return `effort ignored: ${model} did not report its option list`;
48
+ const ids = modelOptions.filter(isThoughtLevel).map((o) => o?.id).filter(Boolean);
49
+ return ids.length
50
+ ? `effort ignored: ${model} declares ${ids.join(", ")}, which did not take the requested value`
51
+ : `effort ignored: ${model} declares no thinking or reasoning option`;
52
+ }
package/src/server.js CHANGED
@@ -145,11 +145,16 @@ export const delegateInputSchema = z.object({
145
145
  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, so review the git diff after every run. ask held on every model tested while plan compliance varies by model, so prefer ask when you need the stricter read-only instruction."),
146
146
  resumeSessionId: z.string().optional().describe("Resume an existing ACP session instead of a new one"),
147
147
  workspace: z.string().optional().describe("Working directory for the agent. Optional; defaults to the server process cwd. Must already exist — never create one for the call."),
148
- model: z.string().trim().min(1, "model must be a non-empty string").default(DEFAULT_MODEL),
148
+ model: z.string().trim().min(1, "model must be a non-empty string").default(DEFAULT_MODEL).describe("Bare ACP family id, version included: composer-2.5, grok-4.5, claude-opus-5, gpt-5.6-sol. doctor deep:true lists every id."),
149
149
  fast: z.boolean().default(false).describe("Fast speed tier — higher cost; enable only when the user asks"),
150
150
  // Which options a model offers, and their valid values, are only knowable by asking the
151
151
  // agent, so these stay open strings and the agent rejects what it does not accept.
152
- reasoning: z.string().trim().min(1).optional().describe("Reasoning effort. Not offered by every model; gpt-5.x accepts none, low, medium, high, extra-high."),
152
+ effort: z.string().trim().min(1).optional().describe("Thinking effort. Not offered by every model, and the values differ; gpt-5.x accepts none, low, medium, high, extra-high. doctor deep:true lists the current model's options."),
153
+ // Declared only to be rejected: an undeclared key is stripped silently, which would lose the
154
+ // requested effort without a word. Rejection costs a retry and no spawn.
155
+ reasoning: z.string().trim().min(1).optional()
156
+ .refine((v) => v === undefined, { message: "reasoning was renamed to effort; pass effort instead" })
157
+ .describe("Removed — use effort."),
153
158
  context: z.string().trim().min(1).optional().describe("Context window size. Not offered by every model; gpt-5.x accepts 272k and 1m."),
154
159
  contextFiles: z.array(z.string()).optional().describe("Paths to attach instead of pasting file contents into spec. Text files are passed as references the agent may open; images (png, jpg, gif, webp, under 5MB) are sent inline. Relative paths resolve against workspace, and paths outside it are allowed — attach only files the agent should read. Anything skipped is reported in protocolWarnings, never fatal."),
155
160
  });
@@ -164,7 +169,7 @@ export const delegateInputSchema = z.object({
164
169
  * @returns {Promise<import("@modelcontextprotocol/sdk/types.js").CallToolResult>}
165
170
  */
166
171
  export async function runDelegateTool({ args, extra, runDelegate, inFlight, seenSessions = new Set() }) {
167
- const { spec, mode, resumeSessionId, workspace, model, fast, reasoning, context, contextFiles } = args;
172
+ const { spec, mode, resumeSessionId, workspace, model, fast, effort, context, contextFiles } = args;
168
173
 
169
174
  const progressToken = extra?._meta?.progressToken;
170
175
  /** @type {(message: string) => void} */
@@ -191,7 +196,7 @@ export async function runDelegateTool({ args, extra, runDelegate, inFlight, seen
191
196
  workspace: workspace || process.cwd(),
192
197
  model,
193
198
  fast,
194
- reasoning,
199
+ effort,
195
200
  context,
196
201
  contextFiles,
197
202
  onProgress,