@workel/mcp 0.1.0 → 0.1.1
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/LICENSE +21 -0
- package/README.md +5 -5
- package/dist/api/client.d.ts.map +1 -1
- package/dist/api/client.js +56 -1
- package/dist/api/client.js.map +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +25 -2
- package/dist/server.js.map +1 -1
- package/dist/tools/workel_project_columns.js +1 -1
- package/dist/tools/workel_project_columns.js.map +1 -1
- package/dist/tools/workel_task_comments.d.ts +1 -1
- package/dist/tools/workel_task_comments.d.ts.map +1 -1
- package/dist/tools/workel_task_comments.js +10 -8
- package/dist/tools/workel_task_comments.js.map +1 -1
- package/package.json +12 -3
- package/dist/remote.d.ts +0 -164
- package/dist/remote.d.ts.map +0 -1
- package/dist/remote.js +0 -456
- package/dist/remote.js.map +0 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Workel
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -53,10 +53,10 @@ Two things worth understanding before touching the flags described below:
|
|
|
53
53
|
## Install
|
|
54
54
|
|
|
55
55
|
```
|
|
56
|
-
npx -y @workel/mcp@0.1.
|
|
56
|
+
npx -y @workel/mcp@0.1.1
|
|
57
57
|
```
|
|
58
58
|
|
|
59
|
-
Pin the version — `0.1.
|
|
59
|
+
Pin the version — `0.1.1` above is this package's current release; check
|
|
60
60
|
`npm view @workel/mcp version` for the latest one before you pin it. The
|
|
61
61
|
unpinned form below is **convenience only**, fine for a one-off manual try,
|
|
62
62
|
not for anything an agent's config runs unattended:
|
|
@@ -77,7 +77,7 @@ npx -y @workel/mcp
|
|
|
77
77
|
|
|
78
78
|
## `doctor`
|
|
79
79
|
|
|
80
|
-
Run `npx -y @workel/mcp@0.1.
|
|
80
|
+
Run `npx -y @workel/mcp@0.1.1 doctor` any time your MCP client reports only
|
|
81
81
|
"server failed to start" with no further detail. It runs the exact same
|
|
82
82
|
startup check the server itself runs — load config, then probe `GET /me` —
|
|
83
83
|
and prints a plain-text report to stdout instead of trying to speak the MCP
|
|
@@ -107,7 +107,7 @@ This release registers the following read-only tools. `workel_whoami` needs
|
|
|
107
107
|
no scope at all and works with any valid key; every other tool is only
|
|
108
108
|
registered when the key's scopes (discovered via the `GET /me` probe above)
|
|
109
109
|
include the scope listed. List tools return 25 results per call by default
|
|
110
|
-
(100
|
|
110
|
+
(50 max — this client caps below the API's own 100 deliberately, see src/tools/conventions.ts) and page via an opaque `cursor` / `next_cursor` pair.
|
|
111
111
|
|
|
112
112
|
| Tool | Scope | What it does |
|
|
113
113
|
|---|---|---|
|
|
@@ -117,7 +117,7 @@ include the scope listed. List tools return 25 results per call by default
|
|
|
117
117
|
| `workel_list_project_columns` | `read:projects` | List a project's board columns — its kanban lists such as "To Do" or "Done" — not the tasks inside them. |
|
|
118
118
|
| `workel_list_tasks` | `read:tasks` | List tasks, filterable by project, column, completion, and due-date/update-time. There is no text search on this endpoint. |
|
|
119
119
|
| `workel_get_task` | `read:tasks` | Fetch one task by id, including its full (possibly truncated) description. |
|
|
120
|
-
| `workel_list_task_comments` | `read:tasks` | List every comment on a task
|
|
120
|
+
| `workel_list_task_comments` | `read:tasks` | List every comment on a task — top-level comments and replies together. Order is unspecified; sort by `created_at`. |
|
|
121
121
|
| `workel_list_members` | `read:members` | List the workspace's active members — the only tool that returns email addresses. |
|
|
122
122
|
| `workel_list_events` | `read:events` | List events on the workspace and any of its visible projects. |
|
|
123
123
|
|
package/dist/api/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/api/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AAKH,OAAO,EAAe,KAAK,cAAc,EAAoB,MAAM,UAAU,CAAC;AAE9E,MAAM,MAAM,SAAS,GAAG,OAAO,KAAK,CAAC;AACrC,MAAM,MAAM,SAAS,GAAG,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AAEtD,sGAAsG;AACtG,eAAO,MAAM,0BAA0B,QAAS,CAAC;AAEjD,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,SAAS,CAAC;IACjB,KAAK,EAAE,SAAS,CAAC;IACjB;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;GAGG;AACH,MAAM,MAAM,WAAW,GA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CAAC,CAAC,GAAG,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC;CAC/E;AASD;;;;;GAKG;AACH,qBAAa,cAAe,SAAQ,KAAK;IACvC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;gBAEtB,MAAM,EAAE,cAAc;CAQnC;AA6ID,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,mBAAmB,GAAG,eAAe,CAsKhF;AAMD;;;;;;GAMG;AACH,wBAAgB,4BAA4B,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,eAAe,CAQlG"}
|
package/dist/api/client.js
CHANGED
|
@@ -150,6 +150,45 @@ async function readResponseBody(response) {
|
|
|
150
150
|
* once it reaches a tool. Throwing a mapped, retryable error instead means
|
|
151
151
|
* the failure reads the same as every other API failure.
|
|
152
152
|
*/
|
|
153
|
+
/** Hostname only — never the full URL, which can carry caller-supplied path segments. */
|
|
154
|
+
function extractHostname(url) {
|
|
155
|
+
try {
|
|
156
|
+
return new URL(url).hostname;
|
|
157
|
+
}
|
|
158
|
+
catch {
|
|
159
|
+
return 'the Workel API';
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Converts a rejected `fetch` into the same `WorkelApiError` shape every other
|
|
164
|
+
* failure produces. Always `terminal: false` — DNS, TLS, socket and deadline
|
|
165
|
+
* failures are transient by nature, and telling the model so is the difference
|
|
166
|
+
* between it retrying sensibly and it giving up or hammering.
|
|
167
|
+
*/
|
|
168
|
+
function transportError(err, host, timeoutMs) {
|
|
169
|
+
const name = err instanceof Error ? err.name : '';
|
|
170
|
+
const isTimeout = name === 'TimeoutError' || name === 'AbortError';
|
|
171
|
+
// `err.cause` is where undici puts the real reason (ENOTFOUND, ECONNREFUSED,
|
|
172
|
+
// CERT_HAS_EXPIRED); the top-level message is almost always just "fetch failed".
|
|
173
|
+
// `cause` is ES2022; this package targets lower, so read it structurally
|
|
174
|
+
// rather than widening the whole build's lib for one field.
|
|
175
|
+
const rawCause = err instanceof Error ? err.cause : undefined;
|
|
176
|
+
const cause = rawCause instanceof Error ? rawCause.message : '';
|
|
177
|
+
// Redact at construction, not just at the tool boundary: when the throwable
|
|
178
|
+
// has no `cause` we fall back to its own message, and undici puts the entire
|
|
179
|
+
// Authorization header value in that message for a header-illegal key.
|
|
180
|
+
const detail = (0, redact_1.redact)(cause || (err instanceof Error ? err.message : String(err)));
|
|
181
|
+
const message = isTimeout
|
|
182
|
+
? `The request to ${host} exceeded this client's ${Math.round(timeoutMs / 1000)}s timeout before a response arrived. This is a network or server-side delay, not a problem with your request — retrying shortly is reasonable.`
|
|
183
|
+
: `Could not reach ${host}: ${detail}. This is a network-level failure, not a problem with your request — check connectivity and retry shortly.`;
|
|
184
|
+
return new WorkelApiError({
|
|
185
|
+
code: errors_1.NO_ENVELOPE_CODE,
|
|
186
|
+
status: 0,
|
|
187
|
+
terminal: false,
|
|
188
|
+
requestId: null,
|
|
189
|
+
message,
|
|
190
|
+
});
|
|
191
|
+
}
|
|
153
192
|
function assertParsedBody(body, requestId) {
|
|
154
193
|
if (body !== null)
|
|
155
194
|
return;
|
|
@@ -177,7 +216,18 @@ function createWorkelApiClient(deps) {
|
|
|
177
216
|
const timeoutMs = deps.timeoutMs ?? exports.DEFAULT_REQUEST_TIMEOUT_MS;
|
|
178
217
|
/** Wraps `doFetch` with a fresh per-attempt deadline (see `timeoutMs`). */
|
|
179
218
|
async function fetchWithDeadline(url, init) {
|
|
180
|
-
|
|
219
|
+
try {
|
|
220
|
+
return await doFetch(url, { ...init, signal: AbortSignal.timeout(timeoutMs) });
|
|
221
|
+
}
|
|
222
|
+
catch (err) {
|
|
223
|
+
// A rejected fetch never reaches throwMappedError (that path needs a
|
|
224
|
+
// Response), so without this every transport failure arrived at the model
|
|
225
|
+
// as the bare string "fetch failed" — no cause, no context, and no signal
|
|
226
|
+
// that retrying is reasonable. Never let the raw throwable through: undici
|
|
227
|
+
// embeds the whole Authorization header value in a header-illegal-value
|
|
228
|
+
// TypeError.
|
|
229
|
+
throw transportError(err, extractHostname(url), timeoutMs);
|
|
230
|
+
}
|
|
181
231
|
}
|
|
182
232
|
const requestHeaders = {
|
|
183
233
|
Authorization: `Bearer ${apiKey}`,
|
|
@@ -271,6 +321,11 @@ function createWorkelApiClient(deps) {
|
|
|
271
321
|
return throwMappedError(response);
|
|
272
322
|
}
|
|
273
323
|
const responseBody = await readResponseBody(response);
|
|
324
|
+
// Same guard `get()` applies at its own seam: a 2xx with an empty or
|
|
325
|
+
// unparseable body is a broken response, not data. Without this the four
|
|
326
|
+
// write tools dereference null and throw a raw TypeError at the model
|
|
327
|
+
// instead of the uniform mapped error every other failure produces.
|
|
328
|
+
assertParsedBody(responseBody, extractRequestId(response));
|
|
274
329
|
const result = { data: responseBody, requestId: extractRequestId(response) };
|
|
275
330
|
if (method === 'POST') {
|
|
276
331
|
result.replayed = isReplayedResponse(response);
|
package/dist/api/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/api/client.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;;;
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/api/client.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;;;AAwOH,sDAsKC;AAaD,oEAQC;AAjaD,6CAAyC;AACzC,sCAAuC;AACvC,qCAAkC;AAClC,qCAA8E;AAK9E,sGAAsG;AACzF,QAAA,0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BAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAGpE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,KAAK,EAAkB,WAAW,EAAc,MAAM,oBAAoB,CAAC;AAIlF;;;;;;GAMG;AACH,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAiDD;;;GAGG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,eAAe,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,GAAE,WAAW,EAAO,GAAG,SAAS,CAmC3G"}
|
package/dist/server.js
CHANGED
|
@@ -17,8 +17,15 @@
|
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
exports.buildServer = buildServer;
|
|
19
19
|
const mcp_js_1 = require("@modelcontextprotocol/sdk/server/mcp.js");
|
|
20
|
+
const redact_1 = require("./api/redact");
|
|
21
|
+
const version_1 = require("./version");
|
|
20
22
|
const SERVER_NAME = 'workel';
|
|
21
|
-
|
|
23
|
+
/**
|
|
24
|
+
* Read from package.json via ./version rather than duplicated as a literal:
|
|
25
|
+
* `serverInfo.version` is what every connected host reports for this server,
|
|
26
|
+
* so a stale literal silently misidentifies the build during an incident.
|
|
27
|
+
*/
|
|
28
|
+
const SERVER_VERSION = version_1.VERSION;
|
|
22
29
|
function isPermitted(descriptor, caps) {
|
|
23
30
|
return descriptor.scope === undefined || caps.scopes.includes(descriptor.scope);
|
|
24
31
|
}
|
|
@@ -52,7 +59,23 @@ function buildServer(client, caps, tools = []) {
|
|
|
52
59
|
description: descriptor.description,
|
|
53
60
|
inputSchema: descriptor.inputSchema,
|
|
54
61
|
annotations: descriptor.annotations,
|
|
55
|
-
}, async (args) =>
|
|
62
|
+
}, async (args) => {
|
|
63
|
+
try {
|
|
64
|
+
return toSdkToolResult(await descriptor.handler(args));
|
|
65
|
+
}
|
|
66
|
+
catch (err) {
|
|
67
|
+
/**
|
|
68
|
+
* The last line of defence before a throwable becomes model-visible
|
|
69
|
+
* text. Only WorkelApiError is redacted upstream (client.ts); anything
|
|
70
|
+
* else — notably undici embedding the whole Authorization header value
|
|
71
|
+
* in a TypeError for a header-illegal key — would otherwise reach the
|
|
72
|
+
* model verbatim, and from there the provider's logs and any exported
|
|
73
|
+
* transcript. Never remove without replacing the redaction.
|
|
74
|
+
*/
|
|
75
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
76
|
+
return { content: [{ type: 'text', text: (0, redact_1.redact)(message) }], isError: true };
|
|
77
|
+
}
|
|
78
|
+
});
|
|
56
79
|
}
|
|
57
80
|
return server;
|
|
58
81
|
}
|
package/dist/server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;AAwEH,kCAmCC;AAzGD,oEAAoE;AAKpE,yCAAsC;AACtC,uCAAoC;AAapC,MAAM,WAAW,GAAG,QAAQ,CAAC;AAC7B;;;;GAIG;AACH,MAAM,cAAc,GAAG,iBAAO,CAAC;AAE/B,SAAS,WAAW,CAAC,UAA0B,EAAE,IAAgB;IAC/D,OAAO,UAAU,CAAC,KAAK,KAAK,SAAS,IAAI,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;AAClF,CAAC;AAED;;;;;;;;;;;GAWG;AACH,SAAS,eAAe,CAAC,MAAkB;IACzC,OAAO,MAAmC,CAAC;AAC7C,CAAC;AAqBD;;;GAGG;AACH,SAAgB,WAAW,CAAC,MAAuB,EAAE,IAAgB,EAAE,QAAuB,EAAE;IAC9F,MAAM,MAAM,GAAG,IAAI,kBAAS,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,cAAc,EAAE,CAAC,CAAC;IAC7E,MAAM,YAAY,GAAG,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,MAAM,CAAkC,CAAC;IAEvF,KAAK,MAAM,OAAO,IAAI,KAAK,EAAE,CAAC;QAC5B,MAAM,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;QACnC,IAAI,CAAC,WAAW,CAAC,UAAU,EAAE,IAAI,CAAC;YAAE,SAAS;QAE7C,YAAY,CACV,UAAU,CAAC,IAAI,EACf;YACE,WAAW,EAAE,UAAU,CAAC,WAAW;YACnC,WAAW,EAAE,UAAU,CAAC,WAAW;YACnC,WAAW,EAAE,UAAU,CAAC,WAAW;SACpC,EACD,KAAK,EAAE,IAAI,EAAE,EAAE;YACb,IAAI,CAAC;gBACH,OAAO,eAAe,CAAC,MAAM,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;YACzD,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb;;;;;;;mBAOG;gBACH,MAAM,OAAO,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;gBACjE,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAA,eAAM,EAAC,OAAO,CAAC,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,EAAoB,CAAC;YACjG,CAAC;QACH,CAAC,CACF,CAAC;IACJ,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -16,7 +16,7 @@ const mapping_1 = require("../api/mapping");
|
|
|
16
16
|
const output_1 = require("../output");
|
|
17
17
|
const defineTool_1 = require("./defineTool");
|
|
18
18
|
const conventions_1 = require("./conventions");
|
|
19
|
-
const DESCRIPTION = "List the board columns of a project
|
|
19
|
+
const DESCRIPTION = "List the board columns of a project. The order returned is not the board's display order — sort by each column's `order` field to reconstruct it. These columns are " +
|
|
20
20
|
'kanban lists, not tasks — a column such as "To Do" or "Done" holds tasks but is not one itself; ' +
|
|
21
21
|
'use workel_list_tasks with the returned column id (a task\'s `column_id`) to see the tasks inside ' +
|
|
22
22
|
'one. `is_done` marks a column whose tasks are treated as complete. A project id that is not ' +
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workel_project_columns.js","sourceRoot":"","sources":["../../src/tools/workel_project_columns.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;AAEH,6BAAwB;AAExB,4CAA0D;AAC1D,sCAAyC;AACzC,6CAA4D;AAC5D,+CAAsG;AAEtG,MAAM,WAAW,GACf,
|
|
1
|
+
{"version":3,"file":"workel_project_columns.js","sourceRoot":"","sources":["../../src/tools/workel_project_columns.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;AAEH,6BAAwB;AAExB,4CAA0D;AAC1D,sCAAyC;AACzC,6CAA4D;AAC5D,+CAAsG;AAEtG,MAAM,WAAW,GACf,sKAAsK;IACtK,kGAAkG;IAClG,oGAAoG;IACpG,8FAA8F;IAC9F,+FAA+F;IAC/F,iGAAiG;IACjG,6CAA6C;IAC7C,oCAAsB,CAAC;AAElB,MAAM,wBAAwB,GAAgB,CAAC,MAAM,EAAE,EAAE,CAC9D,IAAA,uBAAU,EAAC;IACT,IAAI,EAAE,6BAA6B;IACnC,WAAW,EAAE,WAAW;IACxB,WAAW,EAAE;QACX,EAAE,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;QACrB,KAAK,EAAE,yBAAW;QAClB,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;KAC9B;IACD,WAAW,EAAE,EAAE,GAAG,8BAAgB,EAAE,KAAK,EAAE,sBAAsB,EAAE;IACnE,KAAK,EAAE,eAAe;IACtB,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;QACtB,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,IAAsD,CAAC;QACrF,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,GAAG,CAC7B,aAAa,kBAAkB,CAAC,EAAE,CAAC,QAAQ,EAC3C,EAAE,KAAK,EAAE,MAAM,EAAE,CAClB,CAAC;QACF,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,kCAAwB,CAAC,CAAC;QAC7D,OAAO,IAAA,4BAAc,EAAC,IAAA,qBAAY,EAAC,KAAK,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;IAC3E,CAAC;CACF,CAAC,CAAC;AApBQ,QAAA,wBAAwB,4BAoBhC"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* scope, same scope as the task tools — comments are not their own scope
|
|
4
4
|
* on this surface).
|
|
5
5
|
*
|
|
6
|
-
* Returns every comment on the task,
|
|
6
|
+
* Returns every comment on the task, top-level and replies
|
|
7
7
|
* alike — there is no threading filter. The parent task is resolved
|
|
8
8
|
* through the same visible-project chain `workel_get_task` uses, so a
|
|
9
9
|
* task outside it (or a genuinely nonexistent id) 404s before any comment
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workel_task_comments.d.ts","sourceRoot":"","sources":["../../src/tools/workel_task_comments.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAMH,OAAO,EAAc,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"workel_task_comments.d.ts","sourceRoot":"","sources":["../../src/tools/workel_task_comments.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAMH,OAAO,EAAc,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAc5D,eAAO,MAAM,sBAAsB,EAAE,WAuBjC,CAAC"}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* scope, same scope as the task tools — comments are not their own scope
|
|
5
5
|
* on this surface).
|
|
6
6
|
*
|
|
7
|
-
* Returns every comment on the task,
|
|
7
|
+
* Returns every comment on the task, top-level and replies
|
|
8
8
|
* alike — there is no threading filter. The parent task is resolved
|
|
9
9
|
* through the same visible-project chain `workel_get_task` uses, so a
|
|
10
10
|
* task outside it (or a genuinely nonexistent id) 404s before any comment
|
|
@@ -24,13 +24,15 @@ const mapping_1 = require("../api/mapping");
|
|
|
24
24
|
const output_1 = require("../output");
|
|
25
25
|
const defineTool_1 = require("./defineTool");
|
|
26
26
|
const conventions_1 = require("./conventions");
|
|
27
|
-
const DESCRIPTION = 'List every comment on a task
|
|
28
|
-
'
|
|
29
|
-
'
|
|
30
|
-
|
|
31
|
-
'
|
|
32
|
-
'
|
|
33
|
-
|
|
27
|
+
const DESCRIPTION = 'List every comment on a task — top-level comments and replies together, with no threading '
|
|
28
|
+
+ 'filter available. The order returned is NOT chronological: sort by each comment\'s '
|
|
29
|
+
+ '`created_at` to find the newest — the last item on a page is not the latest comment. '
|
|
30
|
+
+ 'A task id that is not visible to this API key (its project is archived, private, the inbox '
|
|
31
|
+
+ 'project, or in a different workspace, or the id is genuinely nonexistent) returns a '
|
|
32
|
+
+ 'not-found result either way. There is no tool to fetch a single comment on its own — this '
|
|
33
|
+
+ "list is the only way to read a comment's body through this API. Paginated via an opaque "
|
|
34
|
+
+ '`cursor`; a `null` next_cursor means there are no more pages. '
|
|
35
|
+
+ conventions_1.UNTRUSTED_CONTENT_NOTE;
|
|
34
36
|
const workelListTaskComments = (client) => (0, defineTool_1.defineTool)({
|
|
35
37
|
name: 'workel_list_task_comments',
|
|
36
38
|
description: DESCRIPTION,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workel_task_comments.js","sourceRoot":"","sources":["../../src/tools/workel_task_comments.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;;AAEH,6BAAwB;AAExB,4CAAwD;AACxD,sCAAuD;AACvD,6CAA4D;AAC5D,+CAAsG;AAEtG,MAAM,WAAW,GACf,
|
|
1
|
+
{"version":3,"file":"workel_task_comments.js","sourceRoot":"","sources":["../../src/tools/workel_task_comments.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;;AAEH,6BAAwB;AAExB,4CAAwD;AACxD,sCAAuD;AACvD,6CAA4D;AAC5D,+CAAsG;AAEtG,MAAM,WAAW,GACf,4FAA4F;MAC1F,qFAAqF;MACrF,uFAAuF;MACvF,6FAA6F;MAC7F,sFAAsF;MACtF,4FAA4F;MAC5F,0FAA0F;MAC1F,gEAAgE;MAChE,oCAAsB,CAAC;AAEpB,MAAM,sBAAsB,GAAgB,CAAC,MAAM,EAAE,EAAE,CAC5D,IAAA,uBAAU,EAAC;IACT,IAAI,EAAE,2BAA2B;IACjC,WAAW,EAAE,WAAW;IACxB,WAAW,EAAE;QACX,EAAE,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;QACrB,KAAK,EAAE,yBAAW;QAClB,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;KAC9B;IACD,WAAW,EAAE,EAAE,GAAG,8BAAgB,EAAE,KAAK,EAAE,oBAAoB,EAAE;IACjE,KAAK,EAAE,YAAY;IACnB,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;QACtB,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,IAAsD,CAAC;QACrF,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,GAAG,CAC7B,UAAU,kBAAkB,CAAC,EAAE,CAAC,WAAW,EAC3C,EAAE,KAAK,EAAE,MAAM,EAAE,CAClB,CAAC;QACF,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE;YAC7C,MAAM,MAAM,GAAG,IAAA,gCAAsB,EAAC,OAAO,CAAC,CAAC;YAC/C,OAAO,EAAE,GAAG,MAAM,EAAE,IAAI,EAAE,IAAA,qBAAY,EAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;QACxD,CAAC,CAAC,CAAC;QACH,OAAO,IAAA,4BAAc,EAAC,IAAA,qBAAY,EAAC,KAAK,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;IAC3E,CAAC;CACF,CAAC,CAAC;AAvBQ,QAAA,sBAAsB,0BAuB9B"}
|
package/package.json
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workel/mcp",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"publishConfig": {
|
|
5
|
+
"access": "public"
|
|
6
|
+
},
|
|
7
|
+
"description": "Official Model Context Protocol server for Workel — a thin client of the Workel Public API v1",
|
|
5
8
|
"main": "dist/index.js",
|
|
6
9
|
"bin": {
|
|
7
10
|
"workel-mcp": "dist/index.js"
|
|
8
11
|
},
|
|
9
12
|
"files": [
|
|
10
|
-
"dist"
|
|
13
|
+
"dist",
|
|
14
|
+
"LICENSE"
|
|
11
15
|
],
|
|
12
16
|
"engines": {
|
|
13
17
|
"node": ">=20"
|
|
@@ -27,7 +31,12 @@
|
|
|
27
31
|
"ai",
|
|
28
32
|
"agents"
|
|
29
33
|
],
|
|
34
|
+
"author": "Workel",
|
|
30
35
|
"license": "MIT",
|
|
36
|
+
"homepage": "https://developer.workel.com",
|
|
37
|
+
"bugs": {
|
|
38
|
+
"url": "https://developer.workel.com"
|
|
39
|
+
},
|
|
31
40
|
"dependencies": {
|
|
32
41
|
"@modelcontextprotocol/sdk": "^1.30.0",
|
|
33
42
|
"zod": "^3.23.8"
|
package/dist/remote.d.ts
DELETED
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The stateless Streamable HTTP entry — the v2 remote transport
|
|
3
|
-
* (docs/MCP_SERVER_PLAN.md §"Phase 5 — v2 remote (bearer)"). This is
|
|
4
|
-
* Phase 5 as CODE ONLY: nothing here is deployed, wired into CI, or given a
|
|
5
|
-
* hostname. Its job is to prove `buildServer()` (`./server.ts`) is really
|
|
6
|
-
* transport-independent — this module never edits it, only imports it — and
|
|
7
|
-
* to make the remote-specific risks the stdio transport never had to face
|
|
8
|
-
* concrete and testable: a curl-style `wk_`-only bearer check, a bare
|
|
9
|
-
* `WWW-Authenticate: Bearer` challenge with none of the OAuth metadata that
|
|
10
|
-
* is known to make some MCP clients silently ignore a static header, Origin
|
|
11
|
-
* validation, and a front throttle keyed on a HASH of the bearer rather
|
|
12
|
-
* than the caller's IP — per-IP is worthless here, since claude.ai and the
|
|
13
|
-
* OpenAI Agents SDK both call out from shared provider egress ranges, so
|
|
14
|
-
* every real tenant would collide in one IP-keyed bucket while a hashed-key
|
|
15
|
-
* bucket keeps them apart without ever storing the raw key.
|
|
16
|
-
*
|
|
17
|
-
* Every request pipeline step below runs in a FIXED order and each step is
|
|
18
|
-
* an unconditional early return — that order IS the security property, not
|
|
19
|
-
* an implementation detail:
|
|
20
|
-
*
|
|
21
|
-
* 1. method — only POST is ever handled; everything else is 405.
|
|
22
|
-
* 2. Origin — a PRESENT, disallowed Origin is 403. An ABSENT Origin
|
|
23
|
-
* is allowed: server-to-server connectors (the only
|
|
24
|
-
* caller this endpoint is designed for) send none, and
|
|
25
|
-
* refusing them would break the one caller that matters.
|
|
26
|
-
* 3. auth — no `Authorization` header, or a bearer not shaped like
|
|
27
|
-
* `wk_...`, is 401 with a BARE `WWW-Authenticate: Bearer`
|
|
28
|
-
* challenge — no `realm`, no `resource_metadata`, no
|
|
29
|
-
* parameters at all — and, critically, NO upstream fetch
|
|
30
|
-
* happens for either failure. A `wk_`-shaped bearer that
|
|
31
|
-
* turns out to be wrong is not this module's problem to
|
|
32
|
-
* diagnose: it goes to dispatch and comes back as
|
|
33
|
-
* whatever the real Workel API says.
|
|
34
|
-
* 4. throttle — a fixed window per SHA-256(bearer), sized (see
|
|
35
|
-
* `REQUESTS_ALLOWED_PER_WINDOW` below) to match the
|
|
36
|
-
* Public API v1's own per-key write ceiling
|
|
37
|
-
* (`RouteServiceProvider.php`), so this front door is
|
|
38
|
-
* never the tighter one. Exceeding it is a 429
|
|
39
|
-
* response carrying `Retry-After`.
|
|
40
|
-
* 5. dispatch — a brand-new `WorkelApiClient` bound to THIS request's
|
|
41
|
-
* bearer, a brand-new `buildServer()` result, and a
|
|
42
|
-
* brand-new stateless transport, connected and handed
|
|
43
|
-
* the request. Nothing from one request — client,
|
|
44
|
-
* server, transport, or key — is ever reused by the
|
|
45
|
-
* next one; see `dispatch()` below.
|
|
46
|
-
*
|
|
47
|
-
* No per-request `/me` scope probe (a deliberate scope decision, not an
|
|
48
|
-
* oversight — see the docblock on `computeCaps()` below for why, and the
|
|
49
|
-
* final report's `decisions_outside_brief` for the tradeoff it accepts).
|
|
50
|
-
*
|
|
51
|
-
* Env reads: the ONLY function in this file that ever reads an environment
|
|
52
|
-
* variable is `startRemote()`, and the ONLY way it does so is through
|
|
53
|
-
* `config.ts`'s existing exported `loadConfig()` — see the docblock on
|
|
54
|
-
* `startRemote()` for the one real friction point that decision creates
|
|
55
|
-
* (`loadConfig` requires `WORKEL_API_KEY`, which this transport has no use
|
|
56
|
-
* for) and why it is accepted rather than worked around by touching
|
|
57
|
-
* `config.ts`, which is out of scope for this module.
|
|
58
|
-
*/
|
|
59
|
-
import * as http from 'node:http';
|
|
60
|
-
import { type FetchLike } from './api/client';
|
|
61
|
-
export interface RemoteRequest extends AsyncIterable<Buffer> {
|
|
62
|
-
method?: string;
|
|
63
|
-
headers: Record<string, string | string[] | undefined>;
|
|
64
|
-
}
|
|
65
|
-
export interface RemoteResponse {
|
|
66
|
-
writeHead(statusCode: number, headers?: Record<string, string>): void;
|
|
67
|
-
end(chunk?: string): void;
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* `message` is always a static string literal at every call site in this
|
|
71
|
-
* file — nothing dynamic (an Origin value, a throttle key, an upstream
|
|
72
|
-
* error) is ever string-interpolated into it. Anything dynamic rides in
|
|
73
|
-
* `meta`, and `log()` below runs `meta` through `redactDeep` before it ever
|
|
74
|
-
* reaches this interface's implementation — see `log()`'s docblock for why
|
|
75
|
-
* that is a real, load-bearing second line of defense and not just
|
|
76
|
-
* decoration.
|
|
77
|
-
*/
|
|
78
|
-
export interface RemoteLogger {
|
|
79
|
-
info(message: string, meta?: Record<string, unknown>): void;
|
|
80
|
-
warn(message: string, meta?: Record<string, unknown>): void;
|
|
81
|
-
error(message: string, meta?: Record<string, unknown>): void;
|
|
82
|
-
}
|
|
83
|
-
export interface RemoteHandlerDeps {
|
|
84
|
-
fetch: FetchLike;
|
|
85
|
-
logger: RemoteLogger;
|
|
86
|
-
/** Defaults to `[]` when omitted — see the file docblock, step 2: an empty allowlist refuses every PRESENT Origin, but an absent Origin is still allowed regardless of this list's contents. */
|
|
87
|
-
allowedOrigins?: string[];
|
|
88
|
-
now: () => number;
|
|
89
|
-
/** The Public API v1 base URL every per-request `WorkelApiClient` is built against. */
|
|
90
|
-
baseUrl: string;
|
|
91
|
-
/**
|
|
92
|
-
* Gate (b) of D5 ("Read-only by default; writes are a double opt-in",
|
|
93
|
-
* docs/MCP_SERVER_PLAN.md), resolved ONCE by the caller (`startRemote`,
|
|
94
|
-
* from `config.ts`'s `loadConfig().enableWrites`) and passed in as a
|
|
95
|
-
* plain boolean — never re-read from the environment inside the request
|
|
96
|
-
* pipeline itself. `registeredWriteTools(writesEnabled)` (`./tools/registration.ts`)
|
|
97
|
-
* is the same gate (b) `boot.ts` applies for stdio; passing this value
|
|
98
|
-
* explicitly is what keeps this file from needing its own `process.env`
|
|
99
|
-
* read to apply it.
|
|
100
|
-
*/
|
|
101
|
-
writesEnabled: boolean;
|
|
102
|
-
}
|
|
103
|
-
export type RemoteRequestHandler = (req: RemoteRequest, res: RemoteResponse) => Promise<void>;
|
|
104
|
-
/**
|
|
105
|
-
* Sized to match the Public API v1's own per-key write ceiling
|
|
106
|
-
* (`public-api` in `RouteServiceProvider.php`) so this front door is
|
|
107
|
-
* never the tighter one for a legitimately busy key. Exported so
|
|
108
|
-
* `remote.test.ts` can assert against this single source of the number
|
|
109
|
-
* rather than restating it as a second, driftable literal.
|
|
110
|
-
*/
|
|
111
|
-
export declare const REQUESTS_ALLOWED_PER_WINDOW = 120;
|
|
112
|
-
/**
|
|
113
|
-
* The largest request body this server will buffer. JSON-RPC tool calls are
|
|
114
|
-
* kilobytes; this is generous. The cap is load-bearing: the only gate ahead
|
|
115
|
-
* of this read is a `wk_` PREFIX test, never an upstream key verification, so
|
|
116
|
-
* an attacker who has never held a valid key can reach it. Uncapped, a single
|
|
117
|
-
* request buffered 200 MiB off-heap (+915 MB RSS) with zero upstream calls.
|
|
118
|
-
*/
|
|
119
|
-
export declare const MAX_REQUEST_BODY_BYTES: number;
|
|
120
|
-
/** Thrown by `readRawBody` when a body exceeds `MAX_REQUEST_BODY_BYTES`; the handler turns it into a 413. */
|
|
121
|
-
export declare class RequestBodyTooLargeError extends Error {
|
|
122
|
-
constructor();
|
|
123
|
-
}
|
|
124
|
-
/**
|
|
125
|
-
* Builds the stateless request pipeline described in the file docblock.
|
|
126
|
-
* Returns a plain `async (req, res) => void` function with no top-level
|
|
127
|
-
* side effects of its own — constructing it opens no socket and reaches no
|
|
128
|
-
* network; only actually CALLING the returned function (once per real HTTP
|
|
129
|
-
* request, from `startRemote`'s `http.Server`, or directly from a test)
|
|
130
|
-
* does anything.
|
|
131
|
-
*/
|
|
132
|
-
export declare function createRemoteHandler(deps: RemoteHandlerDeps): RemoteRequestHandler;
|
|
133
|
-
export interface StartRemoteOptions {
|
|
134
|
-
env?: NodeJS.ProcessEnv;
|
|
135
|
-
fetch?: FetchLike;
|
|
136
|
-
logger?: RemoteLogger;
|
|
137
|
-
now?: () => number;
|
|
138
|
-
allowedOrigins?: string[];
|
|
139
|
-
port?: number;
|
|
140
|
-
}
|
|
141
|
-
/**
|
|
142
|
-
* Binds `createRemoteHandler`'s pipeline to a real Node `http.Server`. This
|
|
143
|
-
* is the only place in the file that reads `process.env` — and even here,
|
|
144
|
-
* only through `config.ts`'s existing exported `loadConfig()`, never a new
|
|
145
|
-
* `env.SOMETHING` read of this module's own invention.
|
|
146
|
-
*
|
|
147
|
-
* That constraint has one real, honestly-stated cost: `loadConfig` requires
|
|
148
|
-
* `WORKEL_API_KEY` to be set (`config.ts`'s `resolveApiKey`), a requirement
|
|
149
|
-
* that makes sense for the stdio entry (`index.ts`), which serves exactly
|
|
150
|
-
* one configured key for its whole process lifetime, but does NOT describe
|
|
151
|
-
* this transport at all — the remote server's bearer arrives fresh on
|
|
152
|
-
* every request (`dispatch()` above) and `WORKEL_API_KEY`, if set, is never
|
|
153
|
-
* read by any request this process handles. Reusing `loadConfig` here is
|
|
154
|
-
* still the right call for `baseUrl`/`enableWrites` — this file must not
|
|
155
|
-
* re-derive `config.ts`'s own validation (an `https://` scheme check, a
|
|
156
|
-
* boolean-flag parse) a second, drifting time — but it means an operator
|
|
157
|
-
* deploying this entry must still set an (unused-per-request)
|
|
158
|
-
* `WORKEL_API_KEY` purely to satisfy that loader. `config.ts` is out of
|
|
159
|
-
* scope for this change; a follow-up that gives it a remote-shaped loader
|
|
160
|
-
* (or exports its currently-private `resolveBaseUrl`/`parseBooleanFlag`
|
|
161
|
-
* helpers directly) is the honest fix, not a workaround added here.
|
|
162
|
-
*/
|
|
163
|
-
export declare function startRemote(opts?: StartRemoteOptions): http.Server;
|
|
164
|
-
//# sourceMappingURL=remote.d.ts.map
|
package/dist/remote.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"remote.d.ts","sourceRoot":"","sources":["../src/remote.ts"],"names":[],"mappings":"AAA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AAO,CAAC;CACxB;AAED,MAAM,MAAM,oBAAoB,GAAG,CAAC,GAAG,EAAE,aAAa,EAAE,GAAG,EAAE,cAAc,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AAK9F;;;;;;GAMG;AACH,eAAO,MAAM,2BAA2B,MAAM,CAAC;AAuG/C;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB,QAAkB,CAAC;AAEtD,6GAA6G;AAC7G,qBAAa,wBAAyB,SAAQ,KAAK;;CAKlD;AAuJD;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,iBAAiB,GAAG,oBAAoB,CAqDjF;AAED,MAAM,WAAW,kBAAkB;IACjC,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IACxB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAQD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,WAAW,CAAC,IAAI,GAAE,kBAAuB,GAAG,IAAI,CAAC,MAAM,CAmBtE"}
|
package/dist/remote.js
DELETED
|
@@ -1,456 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* The stateless Streamable HTTP entry — the v2 remote transport
|
|
4
|
-
* (docs/MCP_SERVER_PLAN.md §"Phase 5 — v2 remote (bearer)"). This is
|
|
5
|
-
* Phase 5 as CODE ONLY: nothing here is deployed, wired into CI, or given a
|
|
6
|
-
* hostname. Its job is to prove `buildServer()` (`./server.ts`) is really
|
|
7
|
-
* transport-independent — this module never edits it, only imports it — and
|
|
8
|
-
* to make the remote-specific risks the stdio transport never had to face
|
|
9
|
-
* concrete and testable: a curl-style `wk_`-only bearer check, a bare
|
|
10
|
-
* `WWW-Authenticate: Bearer` challenge with none of the OAuth metadata that
|
|
11
|
-
* is known to make some MCP clients silently ignore a static header, Origin
|
|
12
|
-
* validation, and a front throttle keyed on a HASH of the bearer rather
|
|
13
|
-
* than the caller's IP — per-IP is worthless here, since claude.ai and the
|
|
14
|
-
* OpenAI Agents SDK both call out from shared provider egress ranges, so
|
|
15
|
-
* every real tenant would collide in one IP-keyed bucket while a hashed-key
|
|
16
|
-
* bucket keeps them apart without ever storing the raw key.
|
|
17
|
-
*
|
|
18
|
-
* Every request pipeline step below runs in a FIXED order and each step is
|
|
19
|
-
* an unconditional early return — that order IS the security property, not
|
|
20
|
-
* an implementation detail:
|
|
21
|
-
*
|
|
22
|
-
* 1. method — only POST is ever handled; everything else is 405.
|
|
23
|
-
* 2. Origin — a PRESENT, disallowed Origin is 403. An ABSENT Origin
|
|
24
|
-
* is allowed: server-to-server connectors (the only
|
|
25
|
-
* caller this endpoint is designed for) send none, and
|
|
26
|
-
* refusing them would break the one caller that matters.
|
|
27
|
-
* 3. auth — no `Authorization` header, or a bearer not shaped like
|
|
28
|
-
* `wk_...`, is 401 with a BARE `WWW-Authenticate: Bearer`
|
|
29
|
-
* challenge — no `realm`, no `resource_metadata`, no
|
|
30
|
-
* parameters at all — and, critically, NO upstream fetch
|
|
31
|
-
* happens for either failure. A `wk_`-shaped bearer that
|
|
32
|
-
* turns out to be wrong is not this module's problem to
|
|
33
|
-
* diagnose: it goes to dispatch and comes back as
|
|
34
|
-
* whatever the real Workel API says.
|
|
35
|
-
* 4. throttle — a fixed window per SHA-256(bearer), sized (see
|
|
36
|
-
* `REQUESTS_ALLOWED_PER_WINDOW` below) to match the
|
|
37
|
-
* Public API v1's own per-key write ceiling
|
|
38
|
-
* (`RouteServiceProvider.php`), so this front door is
|
|
39
|
-
* never the tighter one. Exceeding it is a 429
|
|
40
|
-
* response carrying `Retry-After`.
|
|
41
|
-
* 5. dispatch — a brand-new `WorkelApiClient` bound to THIS request's
|
|
42
|
-
* bearer, a brand-new `buildServer()` result, and a
|
|
43
|
-
* brand-new stateless transport, connected and handed
|
|
44
|
-
* the request. Nothing from one request — client,
|
|
45
|
-
* server, transport, or key — is ever reused by the
|
|
46
|
-
* next one; see `dispatch()` below.
|
|
47
|
-
*
|
|
48
|
-
* No per-request `/me` scope probe (a deliberate scope decision, not an
|
|
49
|
-
* oversight — see the docblock on `computeCaps()` below for why, and the
|
|
50
|
-
* final report's `decisions_outside_brief` for the tradeoff it accepts).
|
|
51
|
-
*
|
|
52
|
-
* Env reads: the ONLY function in this file that ever reads an environment
|
|
53
|
-
* variable is `startRemote()`, and the ONLY way it does so is through
|
|
54
|
-
* `config.ts`'s existing exported `loadConfig()` — see the docblock on
|
|
55
|
-
* `startRemote()` for the one real friction point that decision creates
|
|
56
|
-
* (`loadConfig` requires `WORKEL_API_KEY`, which this transport has no use
|
|
57
|
-
* for) and why it is accepted rather than worked around by touching
|
|
58
|
-
* `config.ts`, which is out of scope for this module.
|
|
59
|
-
*/
|
|
60
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
61
|
-
if (k2 === undefined) k2 = k;
|
|
62
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
63
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
64
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
65
|
-
}
|
|
66
|
-
Object.defineProperty(o, k2, desc);
|
|
67
|
-
}) : (function(o, m, k, k2) {
|
|
68
|
-
if (k2 === undefined) k2 = k;
|
|
69
|
-
o[k2] = m[k];
|
|
70
|
-
}));
|
|
71
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
72
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
73
|
-
}) : function(o, v) {
|
|
74
|
-
o["default"] = v;
|
|
75
|
-
});
|
|
76
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
77
|
-
var ownKeys = function(o) {
|
|
78
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
79
|
-
var ar = [];
|
|
80
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
81
|
-
return ar;
|
|
82
|
-
};
|
|
83
|
-
return ownKeys(o);
|
|
84
|
-
};
|
|
85
|
-
return function (mod) {
|
|
86
|
-
if (mod && mod.__esModule) return mod;
|
|
87
|
-
var result = {};
|
|
88
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
89
|
-
__setModuleDefault(result, mod);
|
|
90
|
-
return result;
|
|
91
|
-
};
|
|
92
|
-
})();
|
|
93
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
94
|
-
exports.RequestBodyTooLargeError = exports.MAX_REQUEST_BODY_BYTES = exports.REQUESTS_ALLOWED_PER_WINDOW = void 0;
|
|
95
|
-
exports.createRemoteHandler = createRemoteHandler;
|
|
96
|
-
exports.startRemote = startRemote;
|
|
97
|
-
const http = __importStar(require("node:http"));
|
|
98
|
-
const node_crypto_1 = require("node:crypto");
|
|
99
|
-
const config_1 = require("./config");
|
|
100
|
-
const client_1 = require("./api/client");
|
|
101
|
-
const boot_1 = require("./boot");
|
|
102
|
-
const redact_1 = require("./api/redact");
|
|
103
|
-
const server_1 = require("./server");
|
|
104
|
-
const tools_1 = require("./tools");
|
|
105
|
-
const registration_1 = require("./tools/registration");
|
|
106
|
-
const webStandardStreamableHttp_js_1 = require("@modelcontextprotocol/sdk/server/webStandardStreamableHttp.js");
|
|
107
|
-
/** Never matched against anything user-supplied; see `config.ts`'s own key-format note — no exported constant exists there to reuse, so this is declared once, here. */
|
|
108
|
-
const WK_BEARER_PATTERN = /^wk_/;
|
|
109
|
-
/**
|
|
110
|
-
* Sized to match the Public API v1's own per-key write ceiling
|
|
111
|
-
* (`public-api` in `RouteServiceProvider.php`) so this front door is
|
|
112
|
-
* never the tighter one for a legitimately busy key. Exported so
|
|
113
|
-
* `remote.test.ts` can assert against this single source of the number
|
|
114
|
-
* rather than restating it as a second, driftable literal.
|
|
115
|
-
*/
|
|
116
|
-
exports.REQUESTS_ALLOWED_PER_WINDOW = 120;
|
|
117
|
-
const THROTTLE_WINDOW_MS = 60000;
|
|
118
|
-
/** A Fetch-API `Request` needs an absolute URL even though nothing downstream of this file ever inspects its path — every request this server accepts is handled identically regardless of what path it arrived on (see the file docblock, step 1). `.invalid` is the RFC 2606 TLD reserved for exactly this "never a real, resolvable domain" purpose. */
|
|
119
|
-
const INTERNAL_REQUEST_URL = 'http://mcp.internal.invalid/mcp';
|
|
120
|
-
const DEFAULT_REMOTE_PORT = 8787;
|
|
121
|
-
/**
|
|
122
|
-
* Module-local by design (not per-handler-instance): a long-running remote
|
|
123
|
-
* process serves many requests through the SAME `createRemoteHandler`
|
|
124
|
-
* closure, and the throttle must persist across them — a Map recreated
|
|
125
|
-
* per-request would throttle nothing. Keyed on the hashed bearer (never the
|
|
126
|
-
* raw one), so this Map itself never holds a real API key.
|
|
127
|
-
*/
|
|
128
|
-
const throttleState = new Map();
|
|
129
|
-
/** SHA-256, not a substring/prefix of the bearer — the whole point is that this value can be logged and bucketed without ever being reversible to, or containing a recognizable fragment of, the real key. Truncated to 16 hex chars purely to keep log lines short; 64 bits of a cryptographic digest is already far more collision-resistant than this bucket size needs. */
|
|
130
|
-
function hashBearer(bearer) {
|
|
131
|
-
return (0, node_crypto_1.createHash)('sha256').update(bearer).digest('hex').slice(0, 16);
|
|
132
|
-
}
|
|
133
|
-
/**
|
|
134
|
-
* Fixed window. Prunes every expired entry on each write so a long-running
|
|
135
|
-
* process serving many distinct bearers over time doesn't grow this Map
|
|
136
|
-
* without bound — a hashed key that stops being used simply falls out of
|
|
137
|
-
* the map the next time ANY request causes a write.
|
|
138
|
-
*/
|
|
139
|
-
function checkThrottle(hash, now) {
|
|
140
|
-
for (const [key, entry] of throttleState) {
|
|
141
|
-
if (now - entry.windowStart >= THROTTLE_WINDOW_MS)
|
|
142
|
-
throttleState.delete(key);
|
|
143
|
-
}
|
|
144
|
-
const existing = throttleState.get(hash);
|
|
145
|
-
if (existing === undefined || now - existing.windowStart >= THROTTLE_WINDOW_MS) {
|
|
146
|
-
throttleState.set(hash, { count: 1, windowStart: now });
|
|
147
|
-
return { allowed: true };
|
|
148
|
-
}
|
|
149
|
-
if (existing.count >= exports.REQUESTS_ALLOWED_PER_WINDOW) {
|
|
150
|
-
const retryAfterSeconds = Math.max(1, Math.ceil((existing.windowStart + THROTTLE_WINDOW_MS - now) / 1000));
|
|
151
|
-
return { allowed: false, retryAfterSeconds };
|
|
152
|
-
}
|
|
153
|
-
existing.count += 1;
|
|
154
|
-
return { allowed: true };
|
|
155
|
-
}
|
|
156
|
-
function normalizeHeaderValue(value) {
|
|
157
|
-
return Array.isArray(value) ? value[0] : value;
|
|
158
|
-
}
|
|
159
|
-
/** RFC 6750's scheme name (`Bearer`) is case-sensitive; this matches it exactly, the same way every real client sends it. */
|
|
160
|
-
function extractBearerToken(authorizationHeader) {
|
|
161
|
-
if (authorizationHeader === undefined)
|
|
162
|
-
return null;
|
|
163
|
-
// RFC 7235 §2.1: the auth-scheme name is case-INsensitive ("Bearer",
|
|
164
|
-
// "bearer" and "BEARER" are the same scheme), so matching the literal
|
|
165
|
-
// string would reject spec-conformant clients.
|
|
166
|
-
const separator = authorizationHeader.indexOf(' ');
|
|
167
|
-
if (separator === -1)
|
|
168
|
-
return null;
|
|
169
|
-
if (authorizationHeader.slice(0, separator).toLowerCase() !== 'bearer')
|
|
170
|
-
return null;
|
|
171
|
-
const token = authorizationHeader.slice(separator + 1).trim();
|
|
172
|
-
return token.length > 0 ? token : null;
|
|
173
|
-
}
|
|
174
|
-
/** Absent Origin is always allowed, regardless of `allowedOrigins`'s contents — see the file docblock, step 2. */
|
|
175
|
-
function isOriginAllowed(originHeader, allowedOrigins) {
|
|
176
|
-
return originHeader === undefined || allowedOrigins.includes(originHeader);
|
|
177
|
-
}
|
|
178
|
-
function jsonRpcError(code, message) {
|
|
179
|
-
return { jsonrpc: '2.0', id: null, error: { code, message } };
|
|
180
|
-
}
|
|
181
|
-
/**
|
|
182
|
-
* `redactDeep` (`./api/redact.ts`) scrubs any `wk_`-shaped token it finds
|
|
183
|
-
* anywhere in `meta`, unconditionally — that pattern match needs no prior
|
|
184
|
-
* `registerSecret()` call to work. That is deliberate here: `registerSecret`
|
|
185
|
-
* adds to a process-global, never-cleared Set, which is exactly correct for
|
|
186
|
-
* `boot.ts`'s single-process, single-key stdio lifetime but would be a slow
|
|
187
|
-
* unbounded leak on a long-running remote process serving one bearer per
|
|
188
|
-
* request — this module never calls it. `redactDeep`'s pattern-only
|
|
189
|
-
* matching is the one piece of `redact.ts` that fits a multi-tenant
|
|
190
|
-
* process, and it is what actually makes "no logger call ever contains a
|
|
191
|
-
* substring of the raw bearer" true even if a future call site here
|
|
192
|
-
* accidentally passed one through — not just the discipline of every
|
|
193
|
-
* current call site staying static-string-only.
|
|
194
|
-
*/
|
|
195
|
-
function log(logger, level, message, meta = {}) {
|
|
196
|
-
logger[level](message, (0, redact_1.redactDeep)(meta));
|
|
197
|
-
}
|
|
198
|
-
/**
|
|
199
|
-
* The largest request body this server will buffer. JSON-RPC tool calls are
|
|
200
|
-
* kilobytes; this is generous. The cap is load-bearing: the only gate ahead
|
|
201
|
-
* of this read is a `wk_` PREFIX test, never an upstream key verification, so
|
|
202
|
-
* an attacker who has never held a valid key can reach it. Uncapped, a single
|
|
203
|
-
* request buffered 200 MiB off-heap (+915 MB RSS) with zero upstream calls.
|
|
204
|
-
*/
|
|
205
|
-
exports.MAX_REQUEST_BODY_BYTES = 4 * 1024 * 1024;
|
|
206
|
-
/** Thrown by `readRawBody` when a body exceeds `MAX_REQUEST_BODY_BYTES`; the handler turns it into a 413. */
|
|
207
|
-
class RequestBodyTooLargeError extends Error {
|
|
208
|
-
constructor() {
|
|
209
|
-
super('Request body exceeds the maximum accepted size.');
|
|
210
|
-
this.name = 'RequestBodyTooLargeError';
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
exports.RequestBodyTooLargeError = RequestBodyTooLargeError;
|
|
214
|
-
async function readRawBody(req) {
|
|
215
|
-
const chunks = [];
|
|
216
|
-
let total = 0;
|
|
217
|
-
for await (const chunk of req) {
|
|
218
|
-
total += chunk.length;
|
|
219
|
-
// Abort as soon as the running total crosses the cap — never after
|
|
220
|
-
// buffering the whole thing, which would defeat the point.
|
|
221
|
-
if (total > exports.MAX_REQUEST_BODY_BYTES)
|
|
222
|
-
throw new RequestBodyTooLargeError();
|
|
223
|
-
chunks.push(chunk);
|
|
224
|
-
}
|
|
225
|
-
return Buffer.concat(chunks);
|
|
226
|
-
}
|
|
227
|
-
/** `READ_TOOLS` (`./tools/index.ts`) unconditionally, `WRITE_TOOLS` (`./tools/registration.ts`) only when gate (b) is open — the exact same composition `boot.ts` would use if it wired writes in, expressed through the same exported `registeredWriteTools` gate rather than a second one. */
|
|
228
|
-
function toolsForRequest(writesEnabled) {
|
|
229
|
-
return [...tools_1.READ_TOOLS, ...(0, registration_1.registeredWriteTools)(writesEnabled)];
|
|
230
|
-
}
|
|
231
|
-
/**
|
|
232
|
-
* There is no per-request `GET /me` scope probe here, unlike `boot.ts`'s
|
|
233
|
-
* startup probe. `boot.ts` can afford one because it runs exactly once per
|
|
234
|
-
* process, for exactly one configured key. A stateless remote request
|
|
235
|
-
* carries a DIFFERENT bearer on every call — probing `/me` before every
|
|
236
|
-
* single tool invocation would double the upstream call count of this
|
|
237
|
-
* server for no correctness gain the API itself doesn't already provide:
|
|
238
|
-
* `buildServer`'s caps filter (gate (a) of D5) is UX ("don't offer a tool
|
|
239
|
-
* the key can't use"), and the API's own per-request scope check is — and
|
|
240
|
-
* remains — the real boundary regardless of what this function decides to
|
|
241
|
-
* register. So `caps` here is deliberately the UNION of every scope any
|
|
242
|
-
* INCLUDED tool declares (mirroring `boot.ts`'s own `skipStartupCheck`
|
|
243
|
-
* branch, which makes the identical trade for the identical reason): every
|
|
244
|
-
* tool this request is otherwise eligible for (by gate (b)) is offered, and
|
|
245
|
-
* a key that doesn't actually hold a given tool's scope finds out from the
|
|
246
|
-
* API's own 403 on the first real call, exactly as `boot.ts`'s doc already
|
|
247
|
-
* says is the honest fallback. See the final report's
|
|
248
|
-
* `decisions_outside_brief` for this tradeoff spelled out explicitly.
|
|
249
|
-
*/
|
|
250
|
-
function computeCaps(client, tools) {
|
|
251
|
-
const scopes = new Set();
|
|
252
|
-
for (const factory of tools) {
|
|
253
|
-
const descriptor = factory(client);
|
|
254
|
-
if (descriptor.scope !== undefined)
|
|
255
|
-
scopes.add(descriptor.scope);
|
|
256
|
-
}
|
|
257
|
-
return { scopes: Array.from(scopes) };
|
|
258
|
-
}
|
|
259
|
-
function collectResponseHeaders(webResponse) {
|
|
260
|
-
const headers = {};
|
|
261
|
-
webResponse.headers.forEach((value, key) => {
|
|
262
|
-
// Defense in depth: stateless mode (`sessionIdGenerator: undefined`)
|
|
263
|
-
// never sets this header inside the SDK, but every response on every
|
|
264
|
-
// path here MUST NOT carry one regardless of how that invariant is
|
|
265
|
-
// upheld upstream — see the file docblock's step 5 and the class
|
|
266
|
-
// invariant this whole transport exists to prove.
|
|
267
|
-
if (key.toLowerCase() === 'mcp-session-id')
|
|
268
|
-
return;
|
|
269
|
-
headers[key] = value;
|
|
270
|
-
});
|
|
271
|
-
return headers;
|
|
272
|
-
}
|
|
273
|
-
/**
|
|
274
|
-
* Runs an already-authorized, already-throttled POST all the way through:
|
|
275
|
-
* a fresh `WorkelApiClient` bound to `bearer`, a fresh `buildServer()`
|
|
276
|
-
* result, and a fresh stateless `WebStandardStreamableHTTPServerTransport`
|
|
277
|
-
* — none of the three are ever reused across requests, and none of them
|
|
278
|
-
* are ever cached anywhere this function can see on its next invocation.
|
|
279
|
-
*
|
|
280
|
-
* `WebStandardStreamableHTTPServerTransport` (not the Node-wrapper
|
|
281
|
-
* `StreamableHTTPServerTransport`, which bridges through `@hono/node-server`
|
|
282
|
-
* and needs a real `IncomingMessage`/`ServerResponse` pair with working
|
|
283
|
-
* stream/socket internals) operates on the Fetch API's `Request`/`Response`
|
|
284
|
-
* — Node has shipped both as real globals since v18, so building one from
|
|
285
|
-
* the bytes this function already read off `req` needs nothing beyond the
|
|
286
|
-
* standard library, and a caller can construct one in a test with zero
|
|
287
|
-
* mocking of Node's HTTP internals. `enableJsonResponse: true` is the other
|
|
288
|
-
* half of that choice: it turns off this transport's SSE-by-default
|
|
289
|
-
* response mode in favor of one buffered JSON `Response` per call — the
|
|
290
|
-
* only mode this server's short-lived, no-server-initiated-messages tool
|
|
291
|
-
* calls ever need, and the only one a test can assert on with a plain
|
|
292
|
-
* `await response.text()`.
|
|
293
|
-
*
|
|
294
|
-
* `sessionIdGenerator: undefined` also means: this transport instance
|
|
295
|
-
* throws if `handleRequest` is ever called on it a second time (see the
|
|
296
|
-
* class's own source) — reusing it across requests is not just against
|
|
297
|
-
* this function's contract, it is a hard runtime error, which is why a
|
|
298
|
-
* fresh one is constructed on every call with no fallback path that could
|
|
299
|
-
* accidentally reuse an old one.
|
|
300
|
-
*/
|
|
301
|
-
async function dispatch(req, respond, bearer, deps) {
|
|
302
|
-
const client = (0, client_1.createWorkelApiClient)({
|
|
303
|
-
baseUrl: deps.baseUrl,
|
|
304
|
-
apiKey: bearer,
|
|
305
|
-
fetch: deps.fetch,
|
|
306
|
-
sleep: boot_1.defaultSleep,
|
|
307
|
-
});
|
|
308
|
-
const tools = toolsForRequest(deps.writesEnabled);
|
|
309
|
-
const caps = computeCaps(client, tools);
|
|
310
|
-
const server = (0, server_1.buildServer)(client, caps, tools);
|
|
311
|
-
const transport = new webStandardStreamableHttp_js_1.WebStandardStreamableHTTPServerTransport({
|
|
312
|
-
sessionIdGenerator: undefined,
|
|
313
|
-
enableJsonResponse: true,
|
|
314
|
-
});
|
|
315
|
-
try {
|
|
316
|
-
await server.connect(transport);
|
|
317
|
-
const rawBody = await readRawBody(req);
|
|
318
|
-
const webRequest = new Request(INTERNAL_REQUEST_URL, {
|
|
319
|
-
method: 'POST',
|
|
320
|
-
headers: {
|
|
321
|
-
'content-type': 'application/json',
|
|
322
|
-
// Required by the transport's own Accept-header check regardless
|
|
323
|
-
// of what the real caller sent — this Request is an internal
|
|
324
|
-
// bridging artifact, not the caller's actual request, so it always
|
|
325
|
-
// declares exactly what the transport requires.
|
|
326
|
-
accept: 'application/json, text/event-stream',
|
|
327
|
-
},
|
|
328
|
-
body: rawBody,
|
|
329
|
-
});
|
|
330
|
-
const webResponse = await transport.handleRequest(webRequest);
|
|
331
|
-
const bodyText = await webResponse.text();
|
|
332
|
-
respond(webResponse.status, collectResponseHeaders(webResponse), bodyText);
|
|
333
|
-
}
|
|
334
|
-
catch (err) {
|
|
335
|
-
// An oversized body is the caller's fault and is not an internal error:
|
|
336
|
-
// reporting it as 500 would hide a deliberate, attacker-reachable limit
|
|
337
|
-
// behind a generic failure.
|
|
338
|
-
if (err instanceof RequestBodyTooLargeError) {
|
|
339
|
-
log(deps.logger, 'warn', 'remote.body_too_large', { limit: exports.MAX_REQUEST_BODY_BYTES });
|
|
340
|
-
respond(413, { 'Content-Type': 'application/json' }, JSON.stringify(jsonRpcError(-32600, 'Request body too large')));
|
|
341
|
-
return;
|
|
342
|
-
}
|
|
343
|
-
log(deps.logger, 'error', 'remote.dispatch_failed', {
|
|
344
|
-
message: err instanceof Error ? err.message : String(err),
|
|
345
|
-
});
|
|
346
|
-
respond(500, { 'Content-Type': 'application/json' }, JSON.stringify(jsonRpcError(-32603, 'Internal server error')));
|
|
347
|
-
}
|
|
348
|
-
finally {
|
|
349
|
-
await transport.close().catch(() => undefined);
|
|
350
|
-
await server.close().catch(() => undefined);
|
|
351
|
-
}
|
|
352
|
-
}
|
|
353
|
-
/**
|
|
354
|
-
* Builds the stateless request pipeline described in the file docblock.
|
|
355
|
-
* Returns a plain `async (req, res) => void` function with no top-level
|
|
356
|
-
* side effects of its own — constructing it opens no socket and reaches no
|
|
357
|
-
* network; only actually CALLING the returned function (once per real HTTP
|
|
358
|
-
* request, from `startRemote`'s `http.Server`, or directly from a test)
|
|
359
|
-
* does anything.
|
|
360
|
-
*/
|
|
361
|
-
function createRemoteHandler(deps) {
|
|
362
|
-
const allowedOrigins = deps.allowedOrigins ?? [];
|
|
363
|
-
return async function handleRemoteRequest(req, res) {
|
|
364
|
-
let responded = false;
|
|
365
|
-
const respond = (status, headers, body) => {
|
|
366
|
-
if (responded)
|
|
367
|
-
return;
|
|
368
|
-
responded = true;
|
|
369
|
-
res.writeHead(status, headers);
|
|
370
|
-
res.end(body);
|
|
371
|
-
};
|
|
372
|
-
const method = (req.method ?? '').toUpperCase();
|
|
373
|
-
if (method !== 'POST') {
|
|
374
|
-
respond(405, { Allow: 'POST', 'Content-Type': 'application/json' }, JSON.stringify(jsonRpcError(-32000, 'Method not allowed. This endpoint only accepts POST.')));
|
|
375
|
-
return;
|
|
376
|
-
}
|
|
377
|
-
const originHeader = normalizeHeaderValue(req.headers['origin']);
|
|
378
|
-
if (!isOriginAllowed(originHeader, allowedOrigins)) {
|
|
379
|
-
log(deps.logger, 'warn', 'remote.origin_rejected', { origin: originHeader ?? null });
|
|
380
|
-
respond(403, { 'Content-Type': 'application/json' }, JSON.stringify(jsonRpcError(-32003, 'Origin not allowed.')));
|
|
381
|
-
return;
|
|
382
|
-
}
|
|
383
|
-
const authorizationHeader = normalizeHeaderValue(req.headers['authorization']);
|
|
384
|
-
const bearer = extractBearerToken(authorizationHeader);
|
|
385
|
-
if (bearer === null || !WK_BEARER_PATTERN.test(bearer)) {
|
|
386
|
-
log(deps.logger, 'warn', 'remote.auth_rejected', { reason: bearer === null ? 'missing' : 'bad_prefix' });
|
|
387
|
-
// A bare `Bearer` challenge — no `realm`, no `resource_metadata`, no
|
|
388
|
-
// parameters at all. Real clients are known to ignore a static
|
|
389
|
-
// `Authorization` header once a challenge advertises OAuth metadata
|
|
390
|
-
// (docs/MCP_SERVER_PLAN.md, D10) — this server never issues one.
|
|
391
|
-
respond(401, { 'Content-Type': 'application/json', 'WWW-Authenticate': 'Bearer' }, JSON.stringify(jsonRpcError(-32001, 'Unauthorized')));
|
|
392
|
-
return;
|
|
393
|
-
}
|
|
394
|
-
const throttleHash = hashBearer(bearer);
|
|
395
|
-
const throttleResult = checkThrottle(throttleHash, deps.now());
|
|
396
|
-
if (!throttleResult.allowed) {
|
|
397
|
-
log(deps.logger, 'warn', 'remote.throttled', { throttleKey: throttleHash });
|
|
398
|
-
respond(429, { 'Content-Type': 'application/json', 'Retry-After': String(throttleResult.retryAfterSeconds) }, JSON.stringify(jsonRpcError(-32005, 'Too many requests.')));
|
|
399
|
-
return;
|
|
400
|
-
}
|
|
401
|
-
log(deps.logger, 'info', 'remote.dispatch', { throttleKey: throttleHash });
|
|
402
|
-
await dispatch(req, respond, bearer, deps);
|
|
403
|
-
};
|
|
404
|
-
}
|
|
405
|
-
const consoleLogger = {
|
|
406
|
-
info: (message, meta) => console.error(message, meta ?? {}),
|
|
407
|
-
warn: (message, meta) => console.error(message, meta ?? {}),
|
|
408
|
-
error: (message, meta) => console.error(message, meta ?? {}),
|
|
409
|
-
};
|
|
410
|
-
/**
|
|
411
|
-
* Binds `createRemoteHandler`'s pipeline to a real Node `http.Server`. This
|
|
412
|
-
* is the only place in the file that reads `process.env` — and even here,
|
|
413
|
-
* only through `config.ts`'s existing exported `loadConfig()`, never a new
|
|
414
|
-
* `env.SOMETHING` read of this module's own invention.
|
|
415
|
-
*
|
|
416
|
-
* That constraint has one real, honestly-stated cost: `loadConfig` requires
|
|
417
|
-
* `WORKEL_API_KEY` to be set (`config.ts`'s `resolveApiKey`), a requirement
|
|
418
|
-
* that makes sense for the stdio entry (`index.ts`), which serves exactly
|
|
419
|
-
* one configured key for its whole process lifetime, but does NOT describe
|
|
420
|
-
* this transport at all — the remote server's bearer arrives fresh on
|
|
421
|
-
* every request (`dispatch()` above) and `WORKEL_API_KEY`, if set, is never
|
|
422
|
-
* read by any request this process handles. Reusing `loadConfig` here is
|
|
423
|
-
* still the right call for `baseUrl`/`enableWrites` — this file must not
|
|
424
|
-
* re-derive `config.ts`'s own validation (an `https://` scheme check, a
|
|
425
|
-
* boolean-flag parse) a second, drifting time — but it means an operator
|
|
426
|
-
* deploying this entry must still set an (unused-per-request)
|
|
427
|
-
* `WORKEL_API_KEY` purely to satisfy that loader. `config.ts` is out of
|
|
428
|
-
* scope for this change; a follow-up that gives it a remote-shaped loader
|
|
429
|
-
* (or exports its currently-private `resolveBaseUrl`/`parseBooleanFlag`
|
|
430
|
-
* helpers directly) is the honest fix, not a workaround added here.
|
|
431
|
-
*/
|
|
432
|
-
function startRemote(opts = {}) {
|
|
433
|
-
const env = opts.env ?? process.env;
|
|
434
|
-
const config = (0, config_1.loadConfig)(env);
|
|
435
|
-
const handler = createRemoteHandler({
|
|
436
|
-
fetch: opts.fetch ?? fetch,
|
|
437
|
-
logger: opts.logger ?? consoleLogger,
|
|
438
|
-
allowedOrigins: opts.allowedOrigins ?? [],
|
|
439
|
-
now: opts.now ?? (() => Date.now()),
|
|
440
|
-
baseUrl: config.baseUrl,
|
|
441
|
-
writesEnabled: config.enableWrites,
|
|
442
|
-
});
|
|
443
|
-
const server = http.createServer((req, res) => {
|
|
444
|
-
void handler(req, res);
|
|
445
|
-
});
|
|
446
|
-
server.listen(opts.port ?? DEFAULT_REMOTE_PORT);
|
|
447
|
-
return server;
|
|
448
|
-
}
|
|
449
|
-
// Same idiom `index.ts` uses for the stdio entry: guarded so importing this
|
|
450
|
-
// module (every test in `remote.test.ts` does exactly that) never opens a
|
|
451
|
-
// real socket — only running this file directly (`node dist/remote.js`)
|
|
452
|
-
// does.
|
|
453
|
-
if (require.main === module) {
|
|
454
|
-
startRemote({ env: process.env, fetch, allowedOrigins: [] });
|
|
455
|
-
}
|
|
456
|
-
//# sourceMappingURL=remote.js.map
|
package/dist/remote.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"remote.js","sourceRoot":"","sources":["../src/remote.ts"],"names":[],"m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