mcp-copilot-worker 1.0.2 → 1.0.3
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 +180 -110
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,51 +1,137 @@
|
|
|
1
1
|
# mcp-copilot-worker
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
`mcp-copilot-worker` is a stdio mcp server that turns your github copilot oauth session into resumable background workers.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
it keeps task state on disk, exposes a very small tool surface, and gives you a clean way to launch work, resume it, cancel it, or answer follow-up questions without building extra glue around the copilot sdk yourself.
|
|
6
6
|
|
|
7
|
-
##
|
|
7
|
+
## what you need
|
|
8
8
|
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
- Supports cancellation and full task clearing with `cancel-agent`.
|
|
14
|
-
- Persists task state under `~/.super-agents/<workspace-md5>.json`.
|
|
15
|
-
- Writes live task output to `.super-agents/<task-id>.output` inside the target workspace.
|
|
16
|
-
- Supports `shared` or `isolated` execution workspaces.
|
|
17
|
-
- Exposes both human-readable resources and MCP task handlers.
|
|
9
|
+
- node 22+
|
|
10
|
+
- github copilot cli installed
|
|
11
|
+
- a working copilot oauth login
|
|
12
|
+
- optional but recommended: `mcpc` for local testing
|
|
18
13
|
|
|
19
|
-
##
|
|
14
|
+
## login first
|
|
20
15
|
|
|
21
|
-
|
|
16
|
+
if copilot is not already logged in, do this:
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
copilot login
|
|
20
|
+
copilot -p "reply with exactly ok."
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
if the second command prints `ok`, you are good to go.
|
|
24
|
+
|
|
25
|
+
if you want profile failover across multiple copilot accounts, log in each profile separately and then export them:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
copilot login --config-dir "$HOME/.copilot"
|
|
29
|
+
copilot login --config-dir "/absolute/path/to/second-profile"
|
|
30
|
+
|
|
31
|
+
export COPILOT_CONFIG_DIRS="$HOME/.copilot:/absolute/path/to/second-profile"
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
if you want fleet mode on every request:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
export COPILOT_ENABLE_FLEET=1
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## the quick local run
|
|
41
|
+
|
|
42
|
+
if you are inside this repo and just want to boot the server locally:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
npm install
|
|
46
|
+
npm run build
|
|
47
|
+
npm run doctor -- --json
|
|
48
|
+
npm run serve
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
the stable local entrypoints are:
|
|
52
|
+
|
|
53
|
+
- `bin/mcp-copilot-worker.mjs`
|
|
54
|
+
- `node --import tsx src/index.ts`
|
|
55
|
+
- `npm run serve`
|
|
56
|
+
|
|
57
|
+
do not treat `node dist/src/index.js` as a supported runtime path here. the upstream sdk still has an esm resolution edge around `vscode-jsonrpc/node` in that mode.
|
|
58
|
+
|
|
59
|
+
## the quick published run
|
|
60
|
+
|
|
61
|
+
if you want to use the published package with `mcpc`, this is the clean path:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
cd /tmp
|
|
65
|
+
|
|
66
|
+
cat >/tmp/mcp-copilot-worker.json <<'EOF'
|
|
67
|
+
{
|
|
68
|
+
"mcpServers": {
|
|
69
|
+
"mcp-copilot-worker": {
|
|
70
|
+
"command": "npx",
|
|
71
|
+
"args": ["-y", "mcp-copilot-worker"]
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
EOF
|
|
76
|
+
|
|
77
|
+
mcpc --config /tmp/mcp-copilot-worker.json mcp-copilot-worker connect @mcp-worker
|
|
78
|
+
mcpc @mcp-worker tools-list
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
small gotcha: if you are testing the published package while standing inside this source repo, `cd /tmp` first. that keeps npm from getting cute with the local workspace name.
|
|
82
|
+
|
|
83
|
+
## 60-second sanity check
|
|
84
|
+
|
|
85
|
+
once the session is connected, launch a tiny task:
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
mcpc @mcp-worker tools-call spawn-agent '{
|
|
89
|
+
"prompt":"use only shell commands in the workspace. calculate 30 + 3, write only the final numeric result followed by a newline to /tmp/mcp-math-result.txt, and stop immediately. do not ask questions, do not explain the math, and do not modify any repo files. this instruction is intentionally verbose so it satisfies the server prompt-length guardrail for general tasks.",
|
|
90
|
+
"agent_type":"general",
|
|
91
|
+
"cwd":"'"$PWD"'"
|
|
92
|
+
}' --json
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
then check the result:
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
cat /tmp/mcp-math-result.txt
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
you should see:
|
|
102
|
+
|
|
103
|
+
```text
|
|
104
|
+
33
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## the tool surface
|
|
108
|
+
|
|
109
|
+
the public mcp api is intentionally small:
|
|
22
110
|
|
|
23
111
|
- `spawn-agent`
|
|
24
|
-
Launches a new Copilot-backed task.
|
|
25
112
|
- `message-agent`
|
|
26
|
-
Resumes an existing Copilot session by creating a continuation task with a new `task_id`.
|
|
27
113
|
- `cancel-agent`
|
|
28
|
-
Cancels one task, many tasks, or clears all tracked tasks.
|
|
29
114
|
- `answer-agent`
|
|
30
|
-
Submits an answer to a pending question and resumes the waiting task.
|
|
31
115
|
|
|
32
|
-
|
|
116
|
+
resources:
|
|
33
117
|
|
|
34
118
|
- `system:///status`
|
|
35
119
|
- `task:///all`
|
|
36
120
|
- `task:///{id}`
|
|
37
121
|
- `task:///{id}/session`
|
|
38
122
|
|
|
39
|
-
|
|
123
|
+
task handlers:
|
|
40
124
|
|
|
41
125
|
- `tasks/list`
|
|
42
126
|
- `tasks/get`
|
|
43
127
|
- `tasks/result`
|
|
44
128
|
- `tasks/cancel`
|
|
45
129
|
|
|
46
|
-
##
|
|
130
|
+
## how each tool behaves
|
|
47
131
|
|
|
48
|
-
`spawn-agent`
|
|
132
|
+
### `spawn-agent`
|
|
133
|
+
|
|
134
|
+
accepted fields:
|
|
49
135
|
|
|
50
136
|
- `prompt`
|
|
51
137
|
- `agent_type`: `coder | planner | researcher | tester | general`
|
|
@@ -57,38 +143,54 @@ It exposes a small MCP surface for launching resumable Copilot-backed background
|
|
|
57
143
|
- `labels`
|
|
58
144
|
- `isolation_mode`: `shared | isolated`
|
|
59
145
|
|
|
60
|
-
|
|
146
|
+
validation rules:
|
|
147
|
+
|
|
148
|
+
- `coder` needs at least 1000 characters and at least one `context_files` entry
|
|
149
|
+
- `planner` and `tester` need at least 300 characters
|
|
150
|
+
- `researcher` and `general` need at least 200 characters
|
|
151
|
+
- `context_files` cap at 20 files, 200 kb each, 500 kb total
|
|
152
|
+
|
|
153
|
+
### `message-agent`
|
|
154
|
+
|
|
155
|
+
use this when you want to continue an existing session with a new markdown-sized instruction.
|
|
156
|
+
|
|
157
|
+
accepted fields:
|
|
61
158
|
|
|
62
159
|
- `task_id`
|
|
63
160
|
- `message`
|
|
64
161
|
- `timeout`
|
|
65
162
|
- `cwd`
|
|
66
163
|
|
|
67
|
-
`
|
|
164
|
+
important bit: this creates a continuation task with a new `task_id`. it is not an in-place mutation of the original task.
|
|
165
|
+
|
|
166
|
+
### `cancel-agent`
|
|
167
|
+
|
|
168
|
+
accepted fields:
|
|
68
169
|
|
|
69
170
|
- `task_id`
|
|
70
|
-
A single task id, an array of task ids, or `"all"`.
|
|
71
171
|
- `clear`
|
|
72
172
|
- `confirm`
|
|
73
173
|
|
|
74
|
-
`
|
|
174
|
+
`task_id` can be one id, an array of ids, or `"all"`.
|
|
175
|
+
|
|
176
|
+
if you use `"all"`, both `clear=true` and `confirm=true` are required.
|
|
177
|
+
|
|
178
|
+
### `answer-agent`
|
|
179
|
+
|
|
180
|
+
accepted fields:
|
|
75
181
|
|
|
76
182
|
- `task_id`
|
|
77
183
|
- `answer`
|
|
78
184
|
- `answers`
|
|
79
185
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
Validation is role-aware:
|
|
186
|
+
right now the runtime resolves the first string answer it receives. for copilot-style questions, the practical path is to send one answer.
|
|
83
187
|
|
|
84
|
-
|
|
85
|
-
- `planner` and `tester` prompts must be at least 300 characters.
|
|
86
|
-
- `researcher` and `general` prompts must be at least 200 characters.
|
|
87
|
-
- `context_files` are capped at 20 files, 200 KB each, 500 KB total.
|
|
188
|
+
## where state lives
|
|
88
189
|
|
|
89
|
-
|
|
190
|
+
- task state: `~/.super-agents/<workspace-md5>.json`
|
|
191
|
+
- live output logs: `<workspace>/.super-agents/<task-id>.output`
|
|
90
192
|
|
|
91
|
-
|
|
193
|
+
tracked statuses:
|
|
92
194
|
|
|
93
195
|
- `pending`
|
|
94
196
|
- `waiting`
|
|
@@ -100,110 +202,78 @@ Tracked tasks move through these statuses:
|
|
|
100
202
|
- `rate_limited`
|
|
101
203
|
- `timed_out`
|
|
102
204
|
|
|
103
|
-
##
|
|
205
|
+
## model rules that matter
|
|
104
206
|
|
|
105
|
-
|
|
106
|
-
- Set `COPILOT_ENABLE_FLEET=1` to start Copilot fleet mode before every task request.
|
|
107
|
-
- The runtime rotates profiles on rate-limit failures with cooldown tracking.
|
|
108
|
-
- Running tasks stream assistant output and tool lifecycle events into the task log.
|
|
109
|
-
- Questions from Copilot move tasks into `waiting_answer` until `answer-agent` resumes them.
|
|
110
|
-
- Dependent tasks stay in `waiting` until all prerequisite tasks complete.
|
|
111
|
-
- `isolated` mode prefers git worktrees and falls back to a copied workspace.
|
|
112
|
-
- `spawn-agent` validates the requested model against the live Copilot model whitelist for the active profile, shows only the newest version of each model family in the MCP schema, transparently maps older aliases like `claude-sonnet-4.5` to the current latest model when available, and manually excludes `gpt-4.1` and `claude-opus-4.6-fast`.
|
|
207
|
+
model selection is validated live against the active copilot profile. if a model is not allowed for your subscription, the server throws an error with the exact whitelist it sees right now.
|
|
113
208
|
|
|
114
|
-
|
|
209
|
+
the runtime also:
|
|
115
210
|
|
|
116
|
-
|
|
211
|
+
- keeps only the newest visible model in each family in the mcp schema
|
|
212
|
+
- accepts older aliases like `claude-sonnet-4.5` and maps them forward when possible
|
|
213
|
+
- hard-blocks `gpt-4.1`
|
|
214
|
+
- hard-blocks `claude-opus-4.6-fast`
|
|
117
215
|
|
|
118
|
-
|
|
119
|
-
- `node --import tsx src/index.ts`
|
|
216
|
+
on the account used to verify this repo, the current canonical set was:
|
|
120
217
|
|
|
121
|
-
|
|
218
|
+
- `claude-haiku-4.5`
|
|
219
|
+
- `claude-opus-4.6`
|
|
220
|
+
- `claude-sonnet-4.6`
|
|
221
|
+
- `gpt-5.3-codex`
|
|
222
|
+
- `gpt-5.4`
|
|
223
|
+
- `gpt-5.4-mini`
|
|
122
224
|
|
|
123
|
-
|
|
124
|
-
- `npm run doctor`
|
|
125
|
-
- `npm run smoke`
|
|
126
|
-
- `npm run test:unit`
|
|
127
|
-
- `npm run build`
|
|
225
|
+
## runtime notes
|
|
128
226
|
|
|
129
|
-
|
|
227
|
+
- copilot profiles come from `COPILOT_CONFIG_DIRS` or default to `~/.copilot`
|
|
228
|
+
- `COPILOT_ENABLE_FLEET=1` starts fleet mode before every task request
|
|
229
|
+
- rate limits trigger profile cooldown behavior
|
|
230
|
+
- questions from copilot move tasks into `waiting_answer` until `answer-agent` resumes them
|
|
231
|
+
- dependency chains stay parked in `waiting` until upstream tasks complete
|
|
232
|
+
- `isolated` mode prefers git worktrees and falls back to copying the workspace
|
|
130
233
|
|
|
131
|
-
|
|
234
|
+
## local dev checks
|
|
132
235
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
- `bin/mcp-copilot-worker.mjs`
|
|
136
|
-
- `node --import tsx src/index.ts`
|
|
137
|
-
- `npm run serve`
|
|
138
|
-
|
|
139
|
-
## Requirements
|
|
140
|
-
|
|
141
|
-
- Node.js 22+
|
|
142
|
-
- GitHub Copilot CLI installed
|
|
143
|
-
- A valid local Copilot OAuth login
|
|
144
|
-
- Optional: `mcpc 0.1.11` for MCP CLI testing
|
|
145
|
-
|
|
146
|
-
## Quick Start
|
|
236
|
+
if you are changing this repo and want the same checks we used during verification:
|
|
147
237
|
|
|
148
238
|
```bash
|
|
149
|
-
npm install
|
|
150
239
|
npm run build
|
|
151
|
-
npm run
|
|
152
|
-
npm run
|
|
240
|
+
npm run test:unit
|
|
241
|
+
npm run smoke
|
|
242
|
+
node --import tsx src/cli/doctor.ts --json
|
|
153
243
|
```
|
|
154
244
|
|
|
155
|
-
|
|
245
|
+
for a local wrapper test through `mcpc`:
|
|
156
246
|
|
|
157
247
|
```json
|
|
158
248
|
{
|
|
159
249
|
"mcpServers": {
|
|
160
250
|
"mcp-copilot-worker": {
|
|
161
|
-
"command": "/absolute/path/to/bin/mcp-copilot-worker.mjs"
|
|
162
|
-
"env": {
|
|
163
|
-
"COPILOT_CLI_PATH": "/opt/homebrew/bin/copilot"
|
|
164
|
-
}
|
|
251
|
+
"command": "/absolute/path/to/bin/mcp-copilot-worker.mjs"
|
|
165
252
|
}
|
|
166
253
|
}
|
|
167
254
|
}
|
|
168
255
|
```
|
|
169
256
|
|
|
170
|
-
|
|
257
|
+
then:
|
|
171
258
|
|
|
172
259
|
```bash
|
|
173
|
-
mcpc --config /path/to/config.json mcp-copilot-worker connect @mcp-
|
|
174
|
-
mcpc @mcp-
|
|
175
|
-
mcpc @mcp-
|
|
260
|
+
mcpc --config /path/to/config.json mcp-copilot-worker connect @mcp-worker
|
|
261
|
+
mcpc @mcp-worker tools-list
|
|
262
|
+
mcpc @mcp-worker resources-read task:///all
|
|
176
263
|
```
|
|
177
264
|
|
|
178
|
-
|
|
265
|
+
## short troubleshooting
|
|
179
266
|
|
|
180
|
-
|
|
181
|
-
{
|
|
182
|
-
"mcpServers": {
|
|
183
|
-
"mcp-copilot-worker": {
|
|
184
|
-
"command": "npx",
|
|
185
|
-
"args": ["-y", "mcp-copilot-worker"],
|
|
186
|
-
"env": {
|
|
187
|
-
"COPILOT_CLI_PATH": "/opt/homebrew/bin/copilot"
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
```
|
|
267
|
+
if it barks, these are the first checks worth doing:
|
|
193
268
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
- `npm run build`
|
|
199
|
-
- `npm run test:unit`
|
|
200
|
-
- `npm run smoke`
|
|
201
|
-
- `node --import tsx src/cli/doctor.ts --json`
|
|
202
|
-
- `mcpc` live-session E2E tests through `bin/mcp-copilot-worker.mjs`
|
|
269
|
+
```bash
|
|
270
|
+
copilot -p "reply with exactly ok."
|
|
271
|
+
npm run doctor -- --json
|
|
272
|
+
```
|
|
203
273
|
|
|
204
|
-
|
|
274
|
+
common causes:
|
|
205
275
|
|
|
206
|
-
-
|
|
207
|
-
-
|
|
208
|
-
-
|
|
209
|
-
-
|
|
276
|
+
- copilot cli is installed but not logged in
|
|
277
|
+
- you picked a model your account does not allow
|
|
278
|
+
- you are testing the published package from inside the source repo instead of a neutral cwd like `/tmp`
|
|
279
|
+
- you tried to launch `dist/src/index.js` directly instead of the wrapper or source entrypoint
|