cursor-delegate-mcp 1.2.0 → 1.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/README.md +66 -86
- package/package.json +3 -3
- package/src/delegate.js +44 -8
- package/src/doctor.js +2 -1
- package/src/server.js +0 -4
- package/src/spawn.js +0 -1
package/README.md
CHANGED
|
@@ -1,74 +1,69 @@
|
|
|
1
1
|
# Cursor Delegate MCP
|
|
2
2
|
|
|
3
|
-
**
|
|
3
|
+
**Let Claude think. Let Cursor build.**
|
|
4
4
|
|
|
5
|
-
](https://www.npmjs.com/package/cursor-delegate-mcp)
|
|
6
|
+
[](https://www.npmjs.com/package/cursor-delegate-mcp)
|
|
7
|
+
[](https://nodejs.org)
|
|
8
|
+
[](LICENSE)
|
|
10
9
|
|
|
11
|
-
|
|
10
|
+
An MCP server that lets Claude Code (or any MCP client) delegate coding tasks to **Cursor's CLI agent** — and get structured results back, not a wall of terminal text.
|
|
12
11
|
|
|
13
|
-
|
|
14
|
-
- **Plan before you build** — Run in plan mode, review the plan, then resume the same session to implement.
|
|
15
|
-
- **Get structured output** — Session id, which files changed, stop reason, and optional plan payload — not just raw terminal text.
|
|
16
|
-
- **Ask questions mid-run** — If Cursor needs a clarification, it comes back through the client's normal prompt.
|
|
17
|
-
- **Check setup** — The `doctor` tool tells you if cursor-agent is missing or misconfigured.
|
|
18
|
-
|
|
19
|
-
> Delegation **auto-approves file writes** in the target workspace.
|
|
20
|
-
|
|
21
|
-
## Requirements
|
|
12
|
+

|
|
22
13
|
|
|
23
|
-
|
|
24
|
-
- [cursor-agent](https://cursor.com/docs/cli/overview) installed and logged in (`cursor-agent login`)
|
|
14
|
+
## Why
|
|
25
15
|
|
|
26
|
-
|
|
16
|
+
Frontier models like **Opus** and **Fable** are brilliant orchestrators — great at understanding intent, planning, and reviewing. Cursor's **Composer** is a fast, cheap workhorse for the actual edits, with its own generous usage pool.
|
|
27
17
|
|
|
28
|
-
|
|
18
|
+
This bridge pairs them: the big brain writes the brief and reviews the diff; Cursor does the typing. Your Claude quota goes to thinking, not boilerplate.
|
|
29
19
|
|
|
30
|
-
|
|
20
|
+
## How it works
|
|
31
21
|
|
|
32
|
-
```
|
|
33
|
-
/
|
|
34
|
-
|
|
22
|
+
```
|
|
23
|
+
You → Claude (Opus / Fable — plans & reviews)
|
|
24
|
+
│ MCP delegate tool
|
|
25
|
+
▼
|
|
26
|
+
cursor-agent (Composer 2.5 — implements)
|
|
27
|
+
│ edits your workspace
|
|
28
|
+
▼
|
|
29
|
+
Structured result: files changed, session id, plan
|
|
35
30
|
```
|
|
36
31
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
### Use it
|
|
40
|
-
|
|
41
|
-
Say what you want in plain language — for example:
|
|
32
|
+
Delegation defaults to Cursor's **Composer 2.5**, which draws from the separate **Auto + Composer** usage pool — so implementation work doesn't eat into your API-model quota. Want a different model? Just say so: *"delegate with Opus"*.
|
|
42
33
|
|
|
43
|
-
|
|
34
|
+
**Three modes:** `agent` (implement, default) · `plan` (draft a plan, review, resume to implement) · `ask` (read-only Q&A).
|
|
44
35
|
|
|
45
|
-
|
|
36
|
+
> **Note:** delegation auto-approves file writes in the target workspace — review the diff afterward, like any teammate's work.
|
|
46
37
|
|
|
47
|
-
|
|
38
|
+
## Features
|
|
48
39
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
40
|
+
- 🤝 **Perfect Claude Code integration** — ships as a plugin with a skill, slash command, and hooks. Just say *"delegate this to Cursor"* and it happens.
|
|
41
|
+
- 💬 **Answers Cursor's questions** — when Cursor needs a clarification mid-run, the question surfaces in your client's normal prompt. No stalled sessions.
|
|
42
|
+
- 📦 **Structured results** — session id, files changed, stop reason, and plan payload. Claude knows exactly what happened and what to review.
|
|
43
|
+
- 📋 **Plan mode** — have Cursor draft a plan first, review it, then resume the same session to implement.
|
|
44
|
+
- 🔍 **Ask mode** — read-only Q&A over the codebase, zero file changes.
|
|
45
|
+
- 🩺 **Built-in diagnostics** — a `doctor` tool that tells you exactly what's missing if setup isn't right.
|
|
46
|
+
- 🔌 **Works everywhere MCP does** — Claude Code, VS Code, Codex CLI, Kiro, Kilo Code, and more.
|
|
52
47
|
|
|
53
|
-
|
|
48
|
+
## Quick start
|
|
54
49
|
|
|
55
|
-
|
|
50
|
+
**Requirements:** [Node.js 22+](https://nodejs.org/) and [cursor-agent](https://cursor.com/docs/cli/overview) logged in (`cursor-agent login`).
|
|
56
51
|
|
|
57
|
-
|
|
52
|
+
### Claude Code (recommended)
|
|
58
53
|
|
|
59
54
|
```shell
|
|
60
|
-
|
|
55
|
+
/plugin marketplace add andreilungeanu/cursor-delegate-mcp
|
|
56
|
+
/plugin install cursor-delegate-mcp@cursor-delegate-mcp
|
|
61
57
|
```
|
|
62
58
|
|
|
63
|
-
|
|
59
|
+
Then just ask:
|
|
64
60
|
|
|
65
|
-
|
|
61
|
+
> Delegate to Cursor: migrate src/api from callbacks to async/await and update the tests, then walk me through what changed.
|
|
66
62
|
|
|
67
|
-
|
|
63
|
+
Claude writes the brief, Cursor grinds through the files, and Claude reviews the diff with you — that's the whole loop.
|
|
68
64
|
|
|
69
|
-
#### Antigravity 2.0
|
|
70
65
|
|
|
71
|
-
|
|
66
|
+
### Any other MCP client
|
|
72
67
|
|
|
73
68
|
```json
|
|
74
69
|
{
|
|
@@ -81,24 +76,8 @@ Clarifying-question prompts are interactive only on elicitation-capable clients
|
|
|
81
76
|
}
|
|
82
77
|
```
|
|
83
78
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
`~/.cursor/mcp.json`:
|
|
87
|
-
|
|
88
|
-
```json
|
|
89
|
-
{
|
|
90
|
-
"mcpServers": {
|
|
91
|
-
"cursor-delegate-mcp": {
|
|
92
|
-
"command": "npx",
|
|
93
|
-
"args": ["-y", "cursor-delegate-mcp"]
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
#### VS Code
|
|
100
|
-
|
|
101
|
-
`.vscode/mcp.json`:
|
|
79
|
+
<details>
|
|
80
|
+
<summary><strong>VS Code</strong> — <code>.vscode/mcp.json</code></summary>
|
|
102
81
|
|
|
103
82
|
```json
|
|
104
83
|
{
|
|
@@ -112,9 +91,10 @@ Clarifying-question prompts are interactive only on elicitation-capable clients
|
|
|
112
91
|
}
|
|
113
92
|
```
|
|
114
93
|
|
|
115
|
-
|
|
94
|
+
</details>
|
|
116
95
|
|
|
117
|
-
|
|
96
|
+
<details>
|
|
97
|
+
<summary><strong>Codex CLI</strong> — <code>~/.codex/config.toml</code></summary>
|
|
118
98
|
|
|
119
99
|
```toml
|
|
120
100
|
[mcp_servers.cursor-delegate-mcp]
|
|
@@ -122,9 +102,10 @@ command = "npx"
|
|
|
122
102
|
args = ["-y", "cursor-delegate-mcp"]
|
|
123
103
|
```
|
|
124
104
|
|
|
125
|
-
|
|
105
|
+
</details>
|
|
126
106
|
|
|
127
|
-
|
|
107
|
+
<details>
|
|
108
|
+
<summary><strong>Kiro</strong> — <code>~/.kiro/settings/mcp.json</code></summary>
|
|
128
109
|
|
|
129
110
|
```json
|
|
130
111
|
{
|
|
@@ -137,9 +118,10 @@ args = ["-y", "cursor-delegate-mcp"]
|
|
|
137
118
|
}
|
|
138
119
|
```
|
|
139
120
|
|
|
140
|
-
|
|
121
|
+
</details>
|
|
141
122
|
|
|
142
|
-
|
|
123
|
+
<details>
|
|
124
|
+
<summary><strong>Kilo Code</strong> — <code>~/.config/kilo/kilo.jsonc</code></summary>
|
|
143
125
|
|
|
144
126
|
```jsonc
|
|
145
127
|
{
|
|
@@ -153,28 +135,26 @@ args = ["-y", "cursor-delegate-mcp"]
|
|
|
153
135
|
}
|
|
154
136
|
```
|
|
155
137
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
## Delegation modes
|
|
159
|
-
|
|
160
|
-
Applies to both the plugin and the MCP server:
|
|
161
|
-
|
|
162
|
-
- **Agent (default)** — Cursor implements in your workspace; you review the diff afterward.
|
|
163
|
-
- **Plan** — Cursor drafts a plan first; review it, then resume and implement.
|
|
164
|
-
- **Ask** — Read-only Q&A over the codebase; no file changes.
|
|
138
|
+
</details>
|
|
165
139
|
|
|
166
|
-
|
|
140
|
+
<details>
|
|
141
|
+
<summary><strong>Antigravity 2.0</strong> — <code>~/.gemini/config/mcp_config.json</code></summary>
|
|
167
142
|
|
|
168
|
-
|
|
143
|
+
```json
|
|
144
|
+
{
|
|
145
|
+
"mcpServers": {
|
|
146
|
+
"cursor-delegate-mcp": {
|
|
147
|
+
"command": "npx",
|
|
148
|
+
"args": ["-y", "cursor-delegate-mcp"]
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
```
|
|
169
153
|
|
|
170
|
-
|
|
154
|
+
</details>
|
|
171
155
|
|
|
172
|
-
|
|
173
|
-
| -------- | ------- | ----------- |
|
|
174
|
-
| `ACP_AGENT_COMMAND` | `agent` | Launcher for the ACP agent process. |
|
|
175
|
-
| `ACP_AGENT_ARGS` | `acp` | Arguments passed to the launcher. Quote arguments that contain spaces: `--config "C:\path with spaces\acp.json"`. |
|
|
176
|
-
| `ACP_LOG_SIZE` | `2000` | ACP frames kept for the error transcript; `0` disables. |
|
|
156
|
+
Call the **`delegate`** tool with your task; run **`doctor`** if anything seems off.
|
|
177
157
|
|
|
178
158
|
## License
|
|
179
159
|
|
|
180
|
-
MIT © Andrei Lungeanu
|
|
160
|
+
MIT © [Andrei Lungeanu](https://github.com/andreilungeanu)
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cursor-delegate-mcp",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "MCP server bridging Claude Code to cursor-agent over the Agent Client Protocol (ACP).",
|
|
6
6
|
"license": "MIT",
|
|
7
|
-
"author": "Andrei Lungeanu <
|
|
7
|
+
"author": "Andrei Lungeanu <andrei@lungeanu.ro>",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
10
|
-
"url": "https://github.com/andreilungeanu/cursor-delegate-mcp.git"
|
|
10
|
+
"url": "git+https://github.com/andreilungeanu/cursor-delegate-mcp.git"
|
|
11
11
|
},
|
|
12
12
|
"bugs": {
|
|
13
13
|
"url": "https://github.com/andreilungeanu/cursor-delegate-mcp/issues"
|
package/src/delegate.js
CHANGED
|
@@ -35,7 +35,7 @@ export async function runDelegate({
|
|
|
35
35
|
spec, mode = "agent", resumeSessionId, workspace,
|
|
36
36
|
model = "composer-2.5", fast = false, clientFactory, onElicit,
|
|
37
37
|
idleMs = 90000, hardCapMs, timeoutMs, cancelGraceMs = 10000, killGraceMs = 5000,
|
|
38
|
-
onSessionReady, onProgress, gitChangedSet = gitChangedSetReal,
|
|
38
|
+
onSessionReady, onProgress, progressThrottleMs = 2000, gitChangedSet = gitChangedSetReal,
|
|
39
39
|
} = {}) {
|
|
40
40
|
const capMs = hardCapMs ?? timeoutMs ?? 3600000;
|
|
41
41
|
const MAX_OUTPUT = 10 * 1024 * 1024;
|
|
@@ -67,19 +67,52 @@ export async function runDelegate({
|
|
|
67
67
|
let textLength = 0;
|
|
68
68
|
let truncated = false;
|
|
69
69
|
const touched = new Set();
|
|
70
|
+
|
|
71
|
+
// Each stream reports its newest complete sentence, at most one per throttle window.
|
|
72
|
+
// Capital-letter boundary: cursor-agent thoughts arrive as sentences with no separator.
|
|
73
|
+
const SENTENCE_END = /[.!?](?=\s|[A-Z])|\n/;
|
|
74
|
+
const MARKDOWN_LINE = /^(?:[|#>`~*_=+-]|\d+[.)]\s)/;
|
|
75
|
+
const progressStream = (prefix) => {
|
|
76
|
+
let buf = "", pending = null, lastEmit = 0;
|
|
77
|
+
const flush = (force) => {
|
|
78
|
+
if (pending === null || (!force && Date.now() - lastEmit < progressThrottleMs)) return;
|
|
79
|
+
lastEmit = Date.now();
|
|
80
|
+
try { onProgress?.(prefix + pending); } catch {}
|
|
81
|
+
pending = null;
|
|
82
|
+
};
|
|
83
|
+
const take = (s) => {
|
|
84
|
+
const line = s.replace(/\s+/g, " ").trim().slice(0, 200);
|
|
85
|
+
if (line.length > 3 && !MARKDOWN_LINE.test(line)) pending = line;
|
|
86
|
+
flush(false);
|
|
87
|
+
};
|
|
88
|
+
return {
|
|
89
|
+
push(text) {
|
|
90
|
+
buf += text;
|
|
91
|
+
for (let m; (m = SENTENCE_END.exec(buf)); buf = buf.slice(m.index + 1)) {
|
|
92
|
+
take(buf.slice(0, m.index + 1));
|
|
93
|
+
}
|
|
94
|
+
if (buf.length > 300) { take(buf); buf = ""; }
|
|
95
|
+
},
|
|
96
|
+
end() { take(buf); buf = ""; flush(true); },
|
|
97
|
+
reset() { buf = ""; pending = null; },
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
const thoughtProgress = progressStream("thinking: ");
|
|
101
|
+
const messageProgress = progressStream("Cursor: ");
|
|
102
|
+
|
|
70
103
|
client.on("update", (u) => {
|
|
71
104
|
const up = u?.update || {};
|
|
72
105
|
if (up.sessionUpdate === "plan") {
|
|
73
106
|
planEntries = up.entries || [];
|
|
74
107
|
}
|
|
75
108
|
if (up.sessionUpdate === "agent_thought_chunk" && up.content?.text) {
|
|
76
|
-
|
|
77
|
-
const tail = text.length > 200 ? text.slice(-200) : text;
|
|
78
|
-
try { onProgress?.("thinking: " + (tail.trim() || text.slice(0, 200))); } catch {}
|
|
109
|
+
thoughtProgress.push(up.content.text);
|
|
79
110
|
}
|
|
80
111
|
if (up.sessionUpdate === "tool_call") {
|
|
81
112
|
const label = up.title || up.kind || "tool";
|
|
82
|
-
|
|
113
|
+
const path = up.locations?.[0]?.path;
|
|
114
|
+
const line = "running: " + String(label) + (path ? " — " + path : "");
|
|
115
|
+
try { onProgress?.(line.slice(0, 200)); } catch {}
|
|
83
116
|
}
|
|
84
117
|
if (up.sessionUpdate === "agent_message_chunk" && up.content?.text) {
|
|
85
118
|
const text = up.content.text;
|
|
@@ -96,8 +129,7 @@ export async function runDelegate({
|
|
|
96
129
|
truncated = true;
|
|
97
130
|
}
|
|
98
131
|
}
|
|
99
|
-
|
|
100
|
-
try { onProgress?.(tail.trim() || text.slice(0, 200)); } catch {}
|
|
132
|
+
messageProgress.push(text);
|
|
101
133
|
}
|
|
102
134
|
if (up.sessionUpdate === "tool_call_update") {
|
|
103
135
|
for (const c of up.content || []) {
|
|
@@ -111,7 +143,7 @@ export async function runDelegate({
|
|
|
111
143
|
|
|
112
144
|
try {
|
|
113
145
|
let sessionId;
|
|
114
|
-
const gitBefore = gitChangedSet(workspace);
|
|
146
|
+
const gitBefore = gitChangedSet(workspace);
|
|
115
147
|
const res = await supervisor.supervise(async () => {
|
|
116
148
|
await client.start();
|
|
117
149
|
await client.initialize();
|
|
@@ -125,12 +157,16 @@ export async function runDelegate({
|
|
|
125
157
|
textChunks.length = 0;
|
|
126
158
|
textLength = 0;
|
|
127
159
|
truncated = false;
|
|
160
|
+
thoughtProgress.reset();
|
|
161
|
+
messageProgress.reset();
|
|
128
162
|
planEntries = [];
|
|
129
163
|
planOverview = undefined;
|
|
130
164
|
planDetail = undefined;
|
|
131
165
|
touched.clear();
|
|
132
166
|
return client.prompt(sessionId, resolveSpec(spec));
|
|
133
167
|
});
|
|
168
|
+
thoughtProgress.end();
|
|
169
|
+
messageProgress.end();
|
|
134
170
|
let result = textChunks.join("");
|
|
135
171
|
if (truncated) result += TRUNCATION_MARKER;
|
|
136
172
|
const gitAfter = gitChangedSet(workspace);
|
package/src/doctor.js
CHANGED
|
@@ -68,6 +68,7 @@ export async function runDoctor({
|
|
|
68
68
|
spawnSpec = resolveAcpSpawn(),
|
|
69
69
|
clientFactory = (opts) => new AcpClient(opts),
|
|
70
70
|
workspace,
|
|
71
|
+
handshakeTimeoutMs = HANDSHAKE_TIMEOUT_MS,
|
|
71
72
|
} = {}) {
|
|
72
73
|
const { capabilities, version } = getClientInfo();
|
|
73
74
|
const agentProbe = await probeAgentVersion(spawnSpec);
|
|
@@ -95,7 +96,7 @@ export async function runDoctor({
|
|
|
95
96
|
spawnSpec,
|
|
96
97
|
clientFactory,
|
|
97
98
|
workspace,
|
|
98
|
-
timeoutMs:
|
|
99
|
+
timeoutMs: handshakeTimeoutMs,
|
|
99
100
|
});
|
|
100
101
|
}
|
|
101
102
|
|
package/src/server.js
CHANGED
|
@@ -24,11 +24,7 @@ export async function runDelegateTool({ args, extra, server, runDelegate, inFlig
|
|
|
24
24
|
let onProgress = () => {};
|
|
25
25
|
if (progressToken != null) {
|
|
26
26
|
let progress = 0;
|
|
27
|
-
let lastSent = 0;
|
|
28
27
|
onProgress = (message) => {
|
|
29
|
-
const now = Date.now();
|
|
30
|
-
if (progress > 0 && now - lastSent < 100) return;
|
|
31
|
-
lastSent = now;
|
|
32
28
|
try {
|
|
33
29
|
extra.sendNotification({
|
|
34
30
|
method: "notifications/progress",
|