@hop-top/kit 0.5.0-alpha.8 → 0.5.0-alpha.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +22 -0
- package/dist/{chunk-263IZ6Z6.js → chunk-B4ULGCCN.js} +43 -154
- package/dist/{chunk-JTMPNXVQ.js → chunk-P6GRX4RV.js} +486 -83
- package/dist/chunk-UZ65A27P.js +147 -0
- package/dist/{index-B-pqGHhU.d.ts → index-CaOXdl38.d.ts} +337 -24
- package/dist/index.d.ts +2 -2
- package/dist/index.js +4 -3
- package/dist/mcp/index.d.ts +2 -1
- package/dist/mcp/index.js +31 -2
- package/dist/{toolspec-UrWnoJ3Y.d.ts → toolspec-96rkLfsh.d.ts} +7 -2
- package/dist/toolspec.d.ts +1 -1
- package/dist/toolspec.js +3 -2
- package/package.json +1 -1
- package/src/mcp/README.md +6 -0
- package/src/mcp/args-separator.test.ts +164 -0
- package/src/mcp/args.test.ts +223 -0
- package/src/mcp/args.ts +160 -0
- package/src/mcp/audit.test.ts +520 -0
- package/src/mcp/audit.ts +70 -0
- package/src/mcp/bridge.test.ts +72 -0
- package/src/mcp/bridge.ts +50 -5
- package/src/mcp/conformance.test.ts +1 -1
- package/src/mcp/dispatch.ts +48 -2
- package/src/mcp/index.ts +33 -1
- package/src/mcp/legacy-notify.test.ts +59 -0
- package/src/mcp/legacy.ts +55 -15
- package/src/mcp/modern-confirm.ts +42 -10
- package/src/mcp/modern.ts +99 -35
- package/src/mcp/stdio.test.ts +313 -0
- package/src/mcp/stdio.ts +254 -0
- package/src/mcp/toolname.test.ts +147 -0
- package/src/mcp/types.ts +125 -18
- package/src/toolspec-internal.ts +24 -0
- package/src/toolspec-manifest.test.ts +25 -0
- package/src/toolspec-manifest.ts +5 -1
- package/src/toolspec.from-command.test.ts +51 -0
- package/src/toolspec.ts +29 -15
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
|
+
|
|
4
|
+
var _chunkUZ65A27Pjs = require('./chunk-UZ65A27P.js');
|
|
5
|
+
|
|
6
|
+
|
|
3
7
|
var _chunkR5U7XKVJjs = require('./chunk-R5U7XKVJ.js');
|
|
4
8
|
|
|
5
9
|
// src/mcp/index.ts
|
|
@@ -8,14 +12,22 @@ _chunkR5U7XKVJjs.__export.call(void 0, mcp_exports, {
|
|
|
8
12
|
DEFAULT_MCP_PATH: () => DEFAULT_MCP_PATH,
|
|
9
13
|
DEFAULT_MCP_SERVER_NAME: () => DEFAULT_MCP_SERVER_NAME,
|
|
10
14
|
DEFAULT_MCP_SERVER_VERSION: () => DEFAULT_MCP_SERVER_VERSION,
|
|
15
|
+
DEFAULT_TOOL_NAME_SEPARATOR: () => DEFAULT_TOOL_NAME_SEPARATOR,
|
|
11
16
|
DestructiveBlockedError: () => DestructiveBlockedError,
|
|
12
17
|
ElicitationConfirmGate: () => ElicitationConfirmGate,
|
|
13
18
|
HEADER_MCP_METHOD: () => HEADER_MCP_METHOD,
|
|
14
19
|
HEADER_MCP_NAME: () => HEADER_MCP_NAME,
|
|
15
20
|
HEADER_MCP_PROTOCOL_VERSION: () => HEADER_MCP_PROTOCOL_VERSION,
|
|
16
21
|
LegacyMcpHandler: () => LegacyMcpHandler,
|
|
22
|
+
MCP_ARGS_PROPERTY: () => MCP_ARGS_PROPERTY,
|
|
23
|
+
MCP_AUDIT_AUTH_REFUSED: () => MCP_AUDIT_AUTH_REFUSED,
|
|
24
|
+
MCP_AUDIT_CONFIRMATION_DECLINED: () => MCP_AUDIT_CONFIRMATION_DECLINED,
|
|
25
|
+
MCP_AUDIT_CONFIRMATION_REQUIRED: () => MCP_AUDIT_CONFIRMATION_REQUIRED,
|
|
26
|
+
MCP_AUDIT_CONFIRMATION_STATE_REJECTED: () => MCP_AUDIT_CONFIRMATION_STATE_REJECTED,
|
|
27
|
+
MCP_AUDIT_DESTRUCTIVE_BLOCKED: () => MCP_AUDIT_DESTRUCTIVE_BLOCKED,
|
|
17
28
|
MCP_AUTH_CHALLENGE: () => MCP_AUTH_CHALLENGE,
|
|
18
29
|
MCP_CONFIRM_KEY: () => MCP_CONFIRM_KEY,
|
|
30
|
+
MCP_CONFIRM_REJECTION_STATE: () => MCP_CONFIRM_REJECTION_STATE,
|
|
19
31
|
MCP_CONFIRM_STATE_TTL_SECONDS: () => MCP_CONFIRM_STATE_TTL_SECONDS,
|
|
20
32
|
MCP_CONFIRM_STATE_VERSION: () => MCP_CONFIRM_STATE_VERSION,
|
|
21
33
|
MCP_ERR_HEADER_MISMATCH: () => MCP_ERR_HEADER_MISMATCH,
|
|
@@ -46,6 +58,7 @@ _chunkR5U7XKVJjs.__export.call(void 0, mcp_exports, {
|
|
|
46
58
|
TASKS_SUPPORTED: () => TASKS_SUPPORTED,
|
|
47
59
|
TASK_METHODS: () => TASK_METHODS,
|
|
48
60
|
UnknownCommandError: () => UnknownCommandError,
|
|
61
|
+
auditRefusal: () => auditRefusal,
|
|
49
62
|
buildToolEnvelope: () => buildToolEnvelope,
|
|
50
63
|
canonicalJSONStringify: () => canonicalJSONStringify,
|
|
51
64
|
clientSupportsFormElicitation: () => clientSupportsFormElicitation,
|
|
@@ -62,9 +75,13 @@ _chunkR5U7XKVJjs.__export.call(void 0, mcp_exports, {
|
|
|
62
75
|
headerConfirmationGate: () => headerConfirmationGate,
|
|
63
76
|
invocationMeta: () => invocationMeta,
|
|
64
77
|
isTaskMethod: () => isTaskMethod,
|
|
78
|
+
mcpArgsPublished: () => mcpArgsPublished,
|
|
65
79
|
mcpConfirmArgsDigest: () => mcpConfirmArgsDigest,
|
|
66
80
|
mcpConfirmPrincipal: () => mcpConfirmPrincipal,
|
|
81
|
+
mcpInputSchema: () => mcpInputSchema,
|
|
67
82
|
mcpMountConfig: () => mcpMountConfig,
|
|
83
|
+
mcpSplitArguments: () => mcpSplitArguments,
|
|
84
|
+
mcpToolDescription: () => mcpToolDescription,
|
|
68
85
|
methodNotAllowedResponse: () => methodNotAllowedResponse,
|
|
69
86
|
mintMcpConfirmState: () => mintMcpConfirmState,
|
|
70
87
|
modernInvocationExtra: () => modernInvocationExtra,
|
|
@@ -76,6 +93,7 @@ _chunkR5U7XKVJjs.__export.call(void 0, mcp_exports, {
|
|
|
76
93
|
rawToolCallName: () => rawToolCallName,
|
|
77
94
|
renderCallResult: () => renderCallResult,
|
|
78
95
|
resolveMcpConfig: () => resolveMcpConfig,
|
|
96
|
+
serveStdio: () => serveStdio,
|
|
79
97
|
singleHeaderValue: () => singleHeaderValue,
|
|
80
98
|
toolName: () => toolName,
|
|
81
99
|
validModernRequestId: () => validModernRequestId,
|
|
@@ -90,6 +108,89 @@ _chunkR5U7XKVJjs.__export.call(void 0, mcp_exports, {
|
|
|
90
108
|
|
|
91
109
|
|
|
92
110
|
var _server = require('@modelcontextprotocol/server');
|
|
111
|
+
|
|
112
|
+
// src/mcp/args.ts
|
|
113
|
+
var MCP_ARGS_PROPERTY = "args";
|
|
114
|
+
var NOTE_ARGS_FLAG_TAKEN = 'Takes positional arguments that cannot be passed over MCP: its --args flag holds the "args" property.';
|
|
115
|
+
function mcpArgsPublished(leaf) {
|
|
116
|
+
if (!leaf.args || leaf.args.length === 0) return false;
|
|
117
|
+
return !Object.prototype.hasOwnProperty.call(
|
|
118
|
+
_nullishCoalesce(leaf.properties, () => ( {})),
|
|
119
|
+
MCP_ARGS_PROPERTY
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
function mcpToolDescription(leaf) {
|
|
123
|
+
const desc = leaf.description;
|
|
124
|
+
if (!leaf.args || leaf.args.length === 0 || mcpArgsPublished(leaf)) {
|
|
125
|
+
return desc;
|
|
126
|
+
}
|
|
127
|
+
return desc === "" ? NOTE_ARGS_FLAG_TAKEN : `${desc} ${NOTE_ARGS_FLAG_TAKEN}`;
|
|
128
|
+
}
|
|
129
|
+
function mcpInputSchema(leaf) {
|
|
130
|
+
const properties = { ..._nullishCoalesce(leaf.properties, () => ( {})) };
|
|
131
|
+
const required = [..._nullishCoalesce(leaf.required, () => ( []))];
|
|
132
|
+
if (mcpArgsPublished(leaf)) {
|
|
133
|
+
const declared = _nullishCoalesce(leaf.args, () => ( []));
|
|
134
|
+
const prop = {
|
|
135
|
+
type: "array",
|
|
136
|
+
items: { type: "string" },
|
|
137
|
+
description: argsDescription(declared)
|
|
138
|
+
};
|
|
139
|
+
const n = requiredCount(declared);
|
|
140
|
+
if (n > 0) {
|
|
141
|
+
prop.minItems = n;
|
|
142
|
+
required.push(MCP_ARGS_PROPERTY);
|
|
143
|
+
}
|
|
144
|
+
properties[MCP_ARGS_PROPERTY] = prop;
|
|
145
|
+
}
|
|
146
|
+
const schema = { type: "object", properties };
|
|
147
|
+
if (required.length > 0) schema.required = required;
|
|
148
|
+
return schema;
|
|
149
|
+
}
|
|
150
|
+
function mcpSplitArguments(leaf, args) {
|
|
151
|
+
if (!mcpArgsPublished(leaf)) return { flags: args };
|
|
152
|
+
const declared = _nullishCoalesce(leaf.args, () => ( []));
|
|
153
|
+
const src = _nullishCoalesce(args, () => ( {}));
|
|
154
|
+
if (!Object.prototype.hasOwnProperty.call(src, MCP_ARGS_PROPERTY)) {
|
|
155
|
+
return _nullishCoalesce(requireArgs(declared, []), () => ( { flags: args }));
|
|
156
|
+
}
|
|
157
|
+
const flags = {};
|
|
158
|
+
for (const [k, v] of Object.entries(src)) {
|
|
159
|
+
if (k !== MCP_ARGS_PROPERTY) flags[k] = v;
|
|
160
|
+
}
|
|
161
|
+
const raw = src[MCP_ARGS_PROPERTY];
|
|
162
|
+
if (raw !== null && !Array.isArray(raw)) {
|
|
163
|
+
return { error: '"args" must be an array of strings' };
|
|
164
|
+
}
|
|
165
|
+
const list = _nullishCoalesce(raw, () => ( []));
|
|
166
|
+
if (!list.every((v) => typeof v === "string")) {
|
|
167
|
+
return { error: '"args" must be an array of strings' };
|
|
168
|
+
}
|
|
169
|
+
const positional = list;
|
|
170
|
+
const missing = requireArgs(declared, positional);
|
|
171
|
+
if (missing) return missing;
|
|
172
|
+
return {
|
|
173
|
+
flags: Object.keys(flags).length > 0 ? flags : void 0,
|
|
174
|
+
args: positional
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
function requireArgs(declared, supplied) {
|
|
178
|
+
if (supplied.length < requiredCount(declared)) {
|
|
179
|
+
return {
|
|
180
|
+
error: `missing required argument: ${_nullishCoalesce(_optionalChain([declared, 'access', _ => _[supplied.length], 'optionalAccess', _2 => _2.name]), () => ( ""))}`
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
return void 0;
|
|
184
|
+
}
|
|
185
|
+
function requiredCount(declared) {
|
|
186
|
+
return declared.filter((a) => a.required).length;
|
|
187
|
+
}
|
|
188
|
+
function argsDescription(declared) {
|
|
189
|
+
const names = declared.map((a) => a.required ? a.name : `${a.name}?`);
|
|
190
|
+
return `Positional arguments in order: ${names.join(", ")}`;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
// src/mcp/types.ts
|
|
93
194
|
var META_KEY_PROTOCOL_VERSION = _server.PROTOCOL_VERSION_META_KEY;
|
|
94
195
|
var META_KEY_CLIENT_INFO = _server.CLIENT_INFO_META_KEY;
|
|
95
196
|
var META_KEY_CLIENT_CAPABILITIES = _server.CLIENT_CAPABILITIES_META_KEY;
|
|
@@ -112,6 +213,7 @@ var RESULT_TYPE_INPUT_REQUIRED = "input_required";
|
|
|
112
213
|
var DEFAULT_MCP_SERVER_NAME = "cmdsurface";
|
|
113
214
|
var DEFAULT_MCP_SERVER_VERSION = "0.0.0";
|
|
114
215
|
var DEFAULT_MCP_PATH = "/mcp";
|
|
216
|
+
var DEFAULT_TOOL_NAME_SEPARATOR = ".";
|
|
115
217
|
var SURFACE_CLI = "cli";
|
|
116
218
|
var SURFACE_LIB = "lib";
|
|
117
219
|
var SURFACE_MCP = "mcp";
|
|
@@ -192,10 +294,14 @@ function resolveMcpConfig(opts = {}) {
|
|
|
192
294
|
}
|
|
193
295
|
confirmationKey = key;
|
|
194
296
|
}
|
|
297
|
+
const toolNameSeparator = _nullishCoalesce(opts.toolNameSeparator, () => ( DEFAULT_TOOL_NAME_SEPARATOR));
|
|
298
|
+
if (toolNameSeparator === "") {
|
|
299
|
+
throw new Error("cmdsurface: toolNameSeparator: empty separator");
|
|
300
|
+
}
|
|
195
301
|
return {
|
|
196
302
|
path: _nullishCoalesce(opts.path, () => ( DEFAULT_MCP_PATH)),
|
|
197
|
-
serverName: _nullishCoalesce(_optionalChain([opts, 'access',
|
|
198
|
-
serverVersion: _nullishCoalesce(_optionalChain([opts, 'access',
|
|
303
|
+
serverName: _nullishCoalesce(_optionalChain([opts, 'access', _3 => _3.serverInfo, 'optionalAccess', _4 => _4.name]), () => ( DEFAULT_MCP_SERVER_NAME)),
|
|
304
|
+
serverVersion: _nullishCoalesce(_optionalChain([opts, 'access', _5 => _5.serverInfo, 'optionalAccess', _6 => _6.version]), () => ( DEFAULT_MCP_SERVER_VERSION)),
|
|
199
305
|
legacyEnabled,
|
|
200
306
|
modernEnabled,
|
|
201
307
|
cacheTtlMs,
|
|
@@ -203,28 +309,35 @@ function resolveMcpConfig(opts = {}) {
|
|
|
203
309
|
originAllowlist: _nullishCoalesce(opts.originAllowlist, () => ( [])),
|
|
204
310
|
confirmationKey,
|
|
205
311
|
policy: _nullishCoalesce(opts.policy, () => ( defaultPolicy())),
|
|
206
|
-
verifier: opts.verifier
|
|
312
|
+
verifier: opts.verifier,
|
|
313
|
+
toolNameSeparator,
|
|
314
|
+
audit: opts.audit
|
|
207
315
|
};
|
|
208
316
|
}
|
|
209
|
-
function toolName(path) {
|
|
210
|
-
return path.join(
|
|
317
|
+
function toolName(path, separator = DEFAULT_TOOL_NAME_SEPARATOR) {
|
|
318
|
+
return path.join(separator);
|
|
211
319
|
}
|
|
212
|
-
function pathFromToolName(name) {
|
|
320
|
+
function pathFromToolName(name, separator = DEFAULT_TOOL_NAME_SEPARATOR) {
|
|
213
321
|
if (name === "") return [];
|
|
214
|
-
return name.split(
|
|
322
|
+
return name.split(separator);
|
|
215
323
|
}
|
|
216
|
-
function
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
324
|
+
function checkToolNameSeparator(leaves, separator) {
|
|
325
|
+
if (separator === DEFAULT_TOOL_NAME_SEPARATOR) return;
|
|
326
|
+
for (const leaf of leaves) {
|
|
327
|
+
for (const seg of leaf.path) {
|
|
328
|
+
if (seg.includes(separator)) {
|
|
329
|
+
throw new Error(
|
|
330
|
+
`cmdsurface: toolNameSeparator: command ${JSON.stringify(seg)} in ${JSON.stringify(leaf.path.join(" "))} contains separator ${JSON.stringify(separator)}`
|
|
331
|
+
);
|
|
332
|
+
}
|
|
333
|
+
}
|
|
223
334
|
}
|
|
335
|
+
}
|
|
336
|
+
function buildToolEnvelope(leaf, separator = DEFAULT_TOOL_NAME_SEPARATOR) {
|
|
224
337
|
return {
|
|
225
|
-
name: toolName(leaf.path),
|
|
226
|
-
description: leaf
|
|
227
|
-
inputSchema:
|
|
338
|
+
name: toolName(leaf.path, separator),
|
|
339
|
+
description: mcpToolDescription(leaf),
|
|
340
|
+
inputSchema: mcpInputSchema(leaf)
|
|
228
341
|
};
|
|
229
342
|
}
|
|
230
343
|
function renderCallResult(res) {
|
|
@@ -321,6 +434,29 @@ function invocationMeta(ident, extra) {
|
|
|
321
434
|
return meta;
|
|
322
435
|
}
|
|
323
436
|
|
|
437
|
+
// src/mcp/audit.ts
|
|
438
|
+
var MCP_AUDIT_AUTH_REFUSED = "cmdsurface: authentication refused";
|
|
439
|
+
var MCP_AUDIT_CONFIRMATION_REQUIRED = "mcpsdk: confirmation required";
|
|
440
|
+
var MCP_AUDIT_CONFIRMATION_DECLINED = "mcpsdk: confirmation declined";
|
|
441
|
+
var MCP_AUDIT_CONFIRMATION_STATE_REJECTED = "mcpsdk: confirmation requestState failed verification";
|
|
442
|
+
var MCP_AUDIT_DESTRUCTIVE_BLOCKED = "cmdsurface: destructive command blocked on this surface";
|
|
443
|
+
var MCP_CONFIRM_REJECTION_STATE = "request_state_verification_failed";
|
|
444
|
+
function auditRefusal(hook, path, specVersion, error, extra) {
|
|
445
|
+
if (hook === void 0) return;
|
|
446
|
+
const record = {
|
|
447
|
+
path: [...path],
|
|
448
|
+
surface: "mcp",
|
|
449
|
+
requestedAt: /* @__PURE__ */ new Date(),
|
|
450
|
+
specVersion,
|
|
451
|
+
error,
|
|
452
|
+
extra: { mcp_spec_version: specVersion, ..._nullishCoalesce(extra, () => ( {})) }
|
|
453
|
+
};
|
|
454
|
+
try {
|
|
455
|
+
hook(record);
|
|
456
|
+
} catch (e3) {
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
|
|
324
460
|
// src/mcp/legacy.ts
|
|
325
461
|
function writeResult(id, result, status) {
|
|
326
462
|
return jsonResponse(status, encodeEnvelope({ id, result }));
|
|
@@ -369,9 +505,14 @@ var LegacyMcpHandler = class {
|
|
|
369
505
|
400
|
|
370
506
|
);
|
|
371
507
|
}
|
|
508
|
+
if (rpc.id === void 0) {
|
|
509
|
+
return acceptedResponse();
|
|
510
|
+
}
|
|
372
511
|
switch (rpc.method) {
|
|
373
512
|
case "initialize":
|
|
374
513
|
return this.handleInitialize(rpc);
|
|
514
|
+
case "ping":
|
|
515
|
+
return writeResult(rpc.id, {}, 200);
|
|
375
516
|
case "tools/list":
|
|
376
517
|
return this.handleToolsList(rpc);
|
|
377
518
|
case "tools/call":
|
|
@@ -410,7 +551,7 @@ var LegacyMcpHandler = class {
|
|
|
410
551
|
const tools = [];
|
|
411
552
|
for (const leaf of this.bridge.leaves()) {
|
|
412
553
|
if (!isExposed(leaf)) continue;
|
|
413
|
-
tools.push(buildToolEnvelope(leaf));
|
|
554
|
+
tools.push(buildToolEnvelope(leaf, this.cfg.toolNameSeparator));
|
|
414
555
|
}
|
|
415
556
|
return tools;
|
|
416
557
|
}
|
|
@@ -430,7 +571,7 @@ var LegacyMcpHandler = class {
|
|
|
430
571
|
200
|
|
431
572
|
);
|
|
432
573
|
}
|
|
433
|
-
const leaf = resolveLeaf(this.bridge, name);
|
|
574
|
+
const leaf = resolveLeaf(this.bridge, name, this.cfg.toolNameSeparator);
|
|
434
575
|
if (leaf === void 0 || !isExposed(leaf)) {
|
|
435
576
|
return writeError(
|
|
436
577
|
rpc.id,
|
|
@@ -439,12 +580,18 @@ var LegacyMcpHandler = class {
|
|
|
439
580
|
);
|
|
440
581
|
}
|
|
441
582
|
const ident = await establishCaller(this.cfg.verifier, req);
|
|
442
|
-
if (_optionalChain([leaf, 'access',
|
|
583
|
+
if (_optionalChain([leaf, 'access', _7 => _7.class, 'optionalAccess', _8 => _8.authRequired]) && ident === void 0) {
|
|
584
|
+
this.audit(leaf, MCP_AUDIT_AUTH_REFUSED);
|
|
443
585
|
return unauthenticated(
|
|
444
586
|
writeResult(rpc.id, errorResultBlock("authentication required"), 401)
|
|
445
587
|
);
|
|
446
588
|
}
|
|
447
|
-
|
|
589
|
+
const split = mcpSplitArguments(leaf, params.arguments);
|
|
590
|
+
if (split.error !== void 0) {
|
|
591
|
+
return writeResult(rpc.id, errorResultBlock(split.error), 200);
|
|
592
|
+
}
|
|
593
|
+
if (_optionalChain([leaf, 'access', _9 => _9.class, 'optionalAccess', _10 => _10.requiresConfirmation]) && !headerValue(req, "x-confirm-token")) {
|
|
594
|
+
this.audit(leaf, MCP_AUDIT_CONFIRMATION_REQUIRED);
|
|
448
595
|
return writeResult(
|
|
449
596
|
rpc.id,
|
|
450
597
|
errorResultBlock("confirmation required"),
|
|
@@ -454,7 +601,8 @@ var LegacyMcpHandler = class {
|
|
|
454
601
|
try {
|
|
455
602
|
const res = await this.bridge.invoke({
|
|
456
603
|
path: [...leaf.path],
|
|
457
|
-
|
|
604
|
+
...split.args !== void 0 ? { args: split.args } : {},
|
|
605
|
+
flags: split.flags,
|
|
458
606
|
meta: invocationMeta(ident)
|
|
459
607
|
});
|
|
460
608
|
return writeResult(rpc.id, renderCallResult(res), 200);
|
|
@@ -466,6 +614,9 @@ var LegacyMcpHandler = class {
|
|
|
466
614
|
200
|
|
467
615
|
);
|
|
468
616
|
}
|
|
617
|
+
if (err instanceof DestructiveBlockedError) {
|
|
618
|
+
this.audit(leaf, MCP_AUDIT_DESTRUCTIVE_BLOCKED);
|
|
619
|
+
}
|
|
469
620
|
return writeResult(
|
|
470
621
|
rpc.id,
|
|
471
622
|
errorResultBlock(errorMessage(err)),
|
|
@@ -473,6 +624,10 @@ var LegacyMcpHandler = class {
|
|
|
473
624
|
);
|
|
474
625
|
}
|
|
475
626
|
}
|
|
627
|
+
/** Emits one 2024-11-05 refusal record to the mount's audit hook. */
|
|
628
|
+
audit(leaf, error) {
|
|
629
|
+
auditRefusal(this.cfg.audit, leaf.path, MCP_SPEC_2024_11_05, error);
|
|
630
|
+
}
|
|
476
631
|
};
|
|
477
632
|
function unauthenticated(res) {
|
|
478
633
|
return {
|
|
@@ -481,10 +636,10 @@ function unauthenticated(res) {
|
|
|
481
636
|
};
|
|
482
637
|
}
|
|
483
638
|
function isExposed(leaf) {
|
|
484
|
-
return _optionalChain([leaf, 'access',
|
|
639
|
+
return _optionalChain([leaf, 'access', _11 => _11.enabled, 'optionalAccess', _12 => _12[SURFACE_MCP]]) !== false;
|
|
485
640
|
}
|
|
486
|
-
function resolveLeaf(bridge, name) {
|
|
487
|
-
const path = pathFromToolName(name);
|
|
641
|
+
function resolveLeaf(bridge, name, separator) {
|
|
642
|
+
const path = pathFromToolName(name, separator);
|
|
488
643
|
if (path.length === 0) return void 0;
|
|
489
644
|
return bridge.leaves().find(
|
|
490
645
|
(l) => l.path.length === path.length && l.path.every((seg, i) => seg === path[i])
|
|
@@ -540,10 +695,18 @@ var MCP_CONFIRM_STATE_TTL_SECONDS = 5 * 60;
|
|
|
540
695
|
var MCP_CONFIRM_STATE_VERSION = "v1";
|
|
541
696
|
var MAC_DOMAIN = `cmdsurface-mcp-confirm-${MCP_CONFIRM_STATE_VERSION}`;
|
|
542
697
|
var ElicitationConfirmGate = class {
|
|
543
|
-
|
|
698
|
+
/**
|
|
699
|
+
* `toolNameSeparator` names the tool in the confirmation prompt, as
|
|
700
|
+
* the mount's `toolNameSeparator` option does in tools/list. `audit`
|
|
701
|
+
* is the mount's refusal hook: it receives the gate's three refusals
|
|
702
|
+
* (confirmation required, declined, state rejected).
|
|
703
|
+
*/
|
|
704
|
+
constructor(key, toolNameSeparator, audit) {
|
|
705
|
+
this.toolNameSeparator = toolNameSeparator;
|
|
706
|
+
this.audit = audit;
|
|
544
707
|
/**
|
|
545
|
-
*
|
|
546
|
-
*
|
|
708
|
+
* In-memory records of rejected states, kept beside the mount's
|
|
709
|
+
* `audit` hook for callers holding the gate directly.
|
|
547
710
|
*/
|
|
548
711
|
this.rejections = [];
|
|
549
712
|
if (key.length === 0) {
|
|
@@ -558,9 +721,13 @@ var ElicitationConfirmGate = class {
|
|
|
558
721
|
* returned.
|
|
559
722
|
*/
|
|
560
723
|
evaluate(req, leaf, params) {
|
|
561
|
-
if (!_optionalChain([leaf, 'access',
|
|
724
|
+
if (!_optionalChain([leaf, 'access', _13 => _13.class, 'optionalAccess', _14 => _14.requiresConfirmation])) return void 0;
|
|
562
725
|
if (!clientSupportsFormElicitation(params)) {
|
|
563
|
-
|
|
726
|
+
const refused = headerConfirmationGate(req);
|
|
727
|
+
if (refused !== void 0) {
|
|
728
|
+
this.emit(leaf, MCP_AUDIT_CONFIRMATION_REQUIRED);
|
|
729
|
+
}
|
|
730
|
+
return refused;
|
|
564
731
|
}
|
|
565
732
|
const binding = {
|
|
566
733
|
tool: leaf.path.join(" "),
|
|
@@ -586,6 +753,7 @@ var ElicitationConfirmGate = class {
|
|
|
586
753
|
}
|
|
587
754
|
if (retry.action === "accept") return void 0;
|
|
588
755
|
if (retry.action === "decline" || retry.action === "cancel") {
|
|
756
|
+
this.emit(leaf, MCP_AUDIT_CONFIRMATION_DECLINED);
|
|
589
757
|
return { result: errorResultBlock("confirmation declined"), status: 200 };
|
|
590
758
|
}
|
|
591
759
|
return { result: this.inputRequired(leaf, binding), status: 200 };
|
|
@@ -609,7 +777,7 @@ var ElicitationConfirmGate = class {
|
|
|
609
777
|
method: "elicitation/create",
|
|
610
778
|
params: {
|
|
611
779
|
mode: "form",
|
|
612
|
-
message: `Approve execution of ${JSON.stringify(toolName(leaf.path))}?`,
|
|
780
|
+
message: `Approve execution of ${JSON.stringify(toolName(leaf.path, this.toolNameSeparator))}?`,
|
|
613
781
|
// No form fields: the approval rides the elicit action
|
|
614
782
|
// (accept / decline / cancel), so the requested schema is
|
|
615
783
|
// the empty object.
|
|
@@ -622,16 +790,23 @@ var ElicitationConfirmGate = class {
|
|
|
622
790
|
}
|
|
623
791
|
/**
|
|
624
792
|
* Records a failed `requestState` verification as a
|
|
625
|
-
* security-relevant audit event
|
|
626
|
-
*
|
|
627
|
-
*
|
|
628
|
-
*
|
|
793
|
+
* security-relevant audit event: in memory on `rejections`, and on
|
|
794
|
+
* the mount's audit hook with the `mcp_confirm_rejection` extra Go's
|
|
795
|
+
* surfaces attach. Best-effort by the same contract: recording never
|
|
796
|
+
* affects the response.
|
|
629
797
|
*/
|
|
630
798
|
auditRejection(leaf) {
|
|
631
799
|
this.rejections.push({
|
|
632
800
|
path: leaf.path.join(" "),
|
|
633
|
-
mcpConfirmRejection:
|
|
801
|
+
mcpConfirmRejection: MCP_CONFIRM_REJECTION_STATE
|
|
634
802
|
});
|
|
803
|
+
this.emit(leaf, MCP_AUDIT_CONFIRMATION_STATE_REJECTED, {
|
|
804
|
+
mcp_confirm_rejection: MCP_CONFIRM_REJECTION_STATE
|
|
805
|
+
});
|
|
806
|
+
}
|
|
807
|
+
/** Emits one 2026-07-28 refusal record to the mount's audit hook. */
|
|
808
|
+
emit(leaf, error, extra) {
|
|
809
|
+
auditRefusal(this.audit, leaf.path, MCP_SPEC_2026_07_28, error, extra);
|
|
635
810
|
}
|
|
636
811
|
};
|
|
637
812
|
function headerConfirmationGate(req) {
|
|
@@ -639,7 +814,7 @@ function headerConfirmationGate(req) {
|
|
|
639
814
|
return { result: errorResultBlock("confirmation required"), status: 428 };
|
|
640
815
|
}
|
|
641
816
|
function clientSupportsFormElicitation(params) {
|
|
642
|
-
const meta = plainObject(_optionalChain([plainObject, 'call',
|
|
817
|
+
const meta = plainObject(_optionalChain([plainObject, 'call', _15 => _15(params), 'optionalAccess', _16 => _16._meta]));
|
|
643
818
|
if (meta === void 0) return false;
|
|
644
819
|
const caps = plainObject(meta[META_KEY_CLIENT_CAPABILITIES]);
|
|
645
820
|
if (caps === void 0) return false;
|
|
@@ -653,7 +828,7 @@ function parseMcpConfirmRetry(params) {
|
|
|
653
828
|
if (obj === void 0) return { state: "", action: "" };
|
|
654
829
|
const state = typeof obj.requestState === "string" ? obj.requestState : "";
|
|
655
830
|
let action = "";
|
|
656
|
-
const entry = plainObject(_optionalChain([plainObject, 'call',
|
|
831
|
+
const entry = plainObject(_optionalChain([plainObject, 'call', _17 => _17(obj.inputResponses), 'optionalAccess', _18 => _18[MCP_CONFIRM_KEY]]));
|
|
657
832
|
if (entry !== void 0 && typeof entry.action === "string") {
|
|
658
833
|
action = entry.action;
|
|
659
834
|
}
|
|
@@ -665,7 +840,7 @@ function mcpConfirmPrincipal(req) {
|
|
|
665
840
|
return _crypto.createHash.call(void 0, "sha256").update(auth, "utf8").digest("hex");
|
|
666
841
|
}
|
|
667
842
|
function mcpConfirmArgsDigest(params) {
|
|
668
|
-
const args = _nullishCoalesce(plainObject(_optionalChain([plainObject, 'call',
|
|
843
|
+
const args = _nullishCoalesce(plainObject(_optionalChain([plainObject, 'call', _19 => _19(params), 'optionalAccess', _20 => _20.arguments])), () => ( null));
|
|
669
844
|
const canonical = canonicalJSONStringify(args);
|
|
670
845
|
return _crypto.createHash.call(void 0, "sha256").update(canonical, "utf8").digest("hex");
|
|
671
846
|
}
|
|
@@ -722,11 +897,23 @@ function plainObject(v) {
|
|
|
722
897
|
var SENTINEL_PREFIX = "=?base64?";
|
|
723
898
|
var SENTINEL_SUFFIX = "?=";
|
|
724
899
|
var ModernMcpHandler = class {
|
|
725
|
-
|
|
900
|
+
/**
|
|
901
|
+
* `transport` selects the binding. Streamable HTTP mirrors the method,
|
|
902
|
+
* tool name and protocol version into headers and requires them to
|
|
903
|
+
* agree with the body (V4, V6, V7). stdio has no header layer — the
|
|
904
|
+
* body is the only source of truth — so those three checks do not
|
|
905
|
+
* apply there; every other check runs unchanged.
|
|
906
|
+
*/
|
|
907
|
+
constructor(bridge, cfg, transport = "http") {
|
|
726
908
|
this.bridge = bridge;
|
|
727
909
|
this.cfg = cfg;
|
|
910
|
+
this.transport = transport;
|
|
728
911
|
if (cfg.confirmationKey !== void 0) {
|
|
729
|
-
this.confirmGate = new ElicitationConfirmGate(
|
|
912
|
+
this.confirmGate = new ElicitationConfirmGate(
|
|
913
|
+
cfg.confirmationKey,
|
|
914
|
+
cfg.toolNameSeparator,
|
|
915
|
+
cfg.audit
|
|
916
|
+
);
|
|
730
917
|
}
|
|
731
918
|
}
|
|
732
919
|
/**
|
|
@@ -765,27 +952,9 @@ var ModernMcpHandler = class {
|
|
|
765
952
|
return this.writeModernError(rpc, parsed.error);
|
|
766
953
|
}
|
|
767
954
|
const meta = parsed.meta;
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
return this.writeModernError(rpc,
|
|
771
|
-
code: MCP_ERR_HEADER_MISMATCH,
|
|
772
|
-
msg: `${HEADER_MCP_PROTOCOL_VERSION} header sent with conflicting duplicate values`,
|
|
773
|
-
status: 400
|
|
774
|
-
});
|
|
775
|
-
}
|
|
776
|
-
if (proto.value === "") {
|
|
777
|
-
return this.writeModernError(rpc, {
|
|
778
|
-
code: MCP_ERR_HEADER_MISMATCH,
|
|
779
|
-
msg: `missing ${HEADER_MCP_PROTOCOL_VERSION} header`,
|
|
780
|
-
status: 400
|
|
781
|
-
});
|
|
782
|
-
}
|
|
783
|
-
if (!meta.versionIsText || proto.value !== meta.version) {
|
|
784
|
-
return this.writeModernError(rpc, {
|
|
785
|
-
code: MCP_ERR_HEADER_MISMATCH,
|
|
786
|
-
msg: `${HEADER_MCP_PROTOCOL_VERSION} header ${JSON.stringify(proto.value)} does not match _meta protocolVersion ${goFormatValue(meta.versionRaw)}`,
|
|
787
|
-
status: 400
|
|
788
|
-
});
|
|
955
|
+
if (this.transport === "http") {
|
|
956
|
+
const versionErr = this.validateVersionHeader(req, meta);
|
|
957
|
+
if (versionErr) return this.writeModernError(rpc, versionErr);
|
|
789
958
|
}
|
|
790
959
|
if (meta.version !== MCP_SPEC_2026_07_28) {
|
|
791
960
|
return this.writeModernError(rpc, {
|
|
@@ -798,8 +967,10 @@ var ModernMcpHandler = class {
|
|
|
798
967
|
}
|
|
799
968
|
});
|
|
800
969
|
}
|
|
801
|
-
|
|
802
|
-
|
|
970
|
+
if (this.transport === "http") {
|
|
971
|
+
const methodErr = this.validateMethodHeader(req, rpc);
|
|
972
|
+
if (methodErr) return this.writeModernError(rpc, methodErr);
|
|
973
|
+
}
|
|
803
974
|
switch (rpc.method) {
|
|
804
975
|
case "server/discover":
|
|
805
976
|
return this.handleDiscover(rpc);
|
|
@@ -818,6 +989,32 @@ var ModernMcpHandler = class {
|
|
|
818
989
|
});
|
|
819
990
|
}
|
|
820
991
|
}
|
|
992
|
+
/** V4: MCP-Protocol-Version header present and equal to _meta's. */
|
|
993
|
+
validateVersionHeader(req, meta) {
|
|
994
|
+
const proto = singleHeaderValue(req, HEADER_MCP_PROTOCOL_VERSION);
|
|
995
|
+
if (!proto.ok) {
|
|
996
|
+
return {
|
|
997
|
+
code: MCP_ERR_HEADER_MISMATCH,
|
|
998
|
+
msg: `${HEADER_MCP_PROTOCOL_VERSION} header sent with conflicting duplicate values`,
|
|
999
|
+
status: 400
|
|
1000
|
+
};
|
|
1001
|
+
}
|
|
1002
|
+
if (proto.value === "") {
|
|
1003
|
+
return {
|
|
1004
|
+
code: MCP_ERR_HEADER_MISMATCH,
|
|
1005
|
+
msg: `missing ${HEADER_MCP_PROTOCOL_VERSION} header`,
|
|
1006
|
+
status: 400
|
|
1007
|
+
};
|
|
1008
|
+
}
|
|
1009
|
+
if (!meta.versionIsText || proto.value !== meta.version) {
|
|
1010
|
+
return {
|
|
1011
|
+
code: MCP_ERR_HEADER_MISMATCH,
|
|
1012
|
+
msg: `${HEADER_MCP_PROTOCOL_VERSION} header ${JSON.stringify(proto.value)} does not match _meta protocolVersion ${goFormatValue(meta.versionRaw)}`,
|
|
1013
|
+
status: 400
|
|
1014
|
+
};
|
|
1015
|
+
}
|
|
1016
|
+
return void 0;
|
|
1017
|
+
}
|
|
821
1018
|
/**
|
|
822
1019
|
* server/discover — the mandatory modern discovery method. Carries
|
|
823
1020
|
* no listChanged flag (notifications unimplemented), no extensions
|
|
@@ -843,7 +1040,7 @@ var ModernMcpHandler = class {
|
|
|
843
1040
|
const tools = [];
|
|
844
1041
|
for (const leaf of this.bridge.leaves()) {
|
|
845
1042
|
if (!isExposed(leaf)) continue;
|
|
846
|
-
tools.push(buildToolEnvelope(leaf));
|
|
1043
|
+
tools.push(buildToolEnvelope(leaf, this.cfg.toolNameSeparator));
|
|
847
1044
|
}
|
|
848
1045
|
const res = { tools };
|
|
849
1046
|
this.applyCacheHints(res);
|
|
@@ -857,9 +1054,11 @@ var ModernMcpHandler = class {
|
|
|
857
1054
|
* the legacy path would have blocked. Results carry no cache hints.
|
|
858
1055
|
*/
|
|
859
1056
|
async handleToolsCall(req, rpc, meta) {
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
1057
|
+
if (this.transport === "http") {
|
|
1058
|
+
const peek = rawToolCallName(rpc.params);
|
|
1059
|
+
const nameErr = this.validateNameHeader(req, peek);
|
|
1060
|
+
if (nameErr) return this.writeModernError(rpc, nameErr);
|
|
1061
|
+
}
|
|
863
1062
|
const params = _nullishCoalesce(rpc.params, () => ( {}));
|
|
864
1063
|
const name = typeof params.name === "string" ? params.name : "";
|
|
865
1064
|
if (name === "") {
|
|
@@ -869,7 +1068,7 @@ var ModernMcpHandler = class {
|
|
|
869
1068
|
200
|
|
870
1069
|
);
|
|
871
1070
|
}
|
|
872
|
-
const leaf = resolveLeaf(this.bridge, name);
|
|
1071
|
+
const leaf = resolveLeaf(this.bridge, name, this.cfg.toolNameSeparator);
|
|
873
1072
|
if (leaf === void 0 || !isExposed(leaf)) {
|
|
874
1073
|
return writeError(
|
|
875
1074
|
rpc.id,
|
|
@@ -878,11 +1077,16 @@ var ModernMcpHandler = class {
|
|
|
878
1077
|
);
|
|
879
1078
|
}
|
|
880
1079
|
const ident = await establishCaller(this.cfg.verifier, req);
|
|
881
|
-
if (_optionalChain([leaf, 'access',
|
|
1080
|
+
if (_optionalChain([leaf, 'access', _21 => _21.class, 'optionalAccess', _22 => _22.authRequired]) && ident === void 0) {
|
|
1081
|
+
this.audit(leaf, MCP_AUDIT_AUTH_REFUSED);
|
|
882
1082
|
return unauthenticated(
|
|
883
1083
|
this.writeCallError(rpc, "authentication required", 401)
|
|
884
1084
|
);
|
|
885
1085
|
}
|
|
1086
|
+
const split = mcpSplitArguments(leaf, params.arguments);
|
|
1087
|
+
if (split.error !== void 0) {
|
|
1088
|
+
return this.writeCallError(rpc, split.error, 200);
|
|
1089
|
+
}
|
|
886
1090
|
const gated = this.confirmationGate(req, leaf, rpc.params);
|
|
887
1091
|
if (gated !== void 0) {
|
|
888
1092
|
return writeResult(
|
|
@@ -894,7 +1098,8 @@ var ModernMcpHandler = class {
|
|
|
894
1098
|
try {
|
|
895
1099
|
const res = await this.bridge.invoke({
|
|
896
1100
|
path: [...leaf.path],
|
|
897
|
-
|
|
1101
|
+
...split.args !== void 0 ? { args: split.args } : {},
|
|
1102
|
+
flags: split.flags,
|
|
898
1103
|
meta: invocationMeta(ident, modernInvocationExtra(meta))
|
|
899
1104
|
});
|
|
900
1105
|
const out = renderCallResult(res);
|
|
@@ -910,9 +1115,16 @@ var ModernMcpHandler = class {
|
|
|
910
1115
|
200
|
|
911
1116
|
);
|
|
912
1117
|
}
|
|
1118
|
+
if (err instanceof DestructiveBlockedError) {
|
|
1119
|
+
this.audit(leaf, MCP_AUDIT_DESTRUCTIVE_BLOCKED);
|
|
1120
|
+
}
|
|
913
1121
|
return this.writeCallError(rpc, errorMessage(err), 200);
|
|
914
1122
|
}
|
|
915
1123
|
}
|
|
1124
|
+
/** Emits one 2026-07-28 refusal record to the mount's audit hook. */
|
|
1125
|
+
audit(leaf, error) {
|
|
1126
|
+
auditRefusal(this.cfg.audit, leaf.path, MCP_SPEC_2026_07_28, error);
|
|
1127
|
+
}
|
|
916
1128
|
/**
|
|
917
1129
|
* Selects and runs the confirmation strategy for one `tools/call`.
|
|
918
1130
|
* Returns `undefined` to proceed with the invocation.
|
|
@@ -923,8 +1135,14 @@ var ModernMcpHandler = class {
|
|
|
923
1135
|
* path, identical to what the legacy handler does.
|
|
924
1136
|
*/
|
|
925
1137
|
confirmationGate(req, leaf, params) {
|
|
926
|
-
if (!_optionalChain([leaf, 'access',
|
|
927
|
-
if (this.confirmGate === void 0)
|
|
1138
|
+
if (!_optionalChain([leaf, 'access', _23 => _23.class, 'optionalAccess', _24 => _24.requiresConfirmation])) return void 0;
|
|
1139
|
+
if (this.confirmGate === void 0) {
|
|
1140
|
+
const refused = headerConfirmationGate(req);
|
|
1141
|
+
if (refused !== void 0) {
|
|
1142
|
+
this.audit(leaf, MCP_AUDIT_CONFIRMATION_REQUIRED);
|
|
1143
|
+
}
|
|
1144
|
+
return refused;
|
|
1145
|
+
}
|
|
928
1146
|
return this.confirmGate.evaluate(req, leaf, params);
|
|
929
1147
|
}
|
|
930
1148
|
/** V6: Mcp-Method header presence + agreement with the body method. */
|
|
@@ -1091,7 +1309,7 @@ function validModernRequestId(id) {
|
|
|
1091
1309
|
let parsed;
|
|
1092
1310
|
try {
|
|
1093
1311
|
parsed = JSON.parse(raw);
|
|
1094
|
-
} catch (
|
|
1312
|
+
} catch (e4) {
|
|
1095
1313
|
return false;
|
|
1096
1314
|
}
|
|
1097
1315
|
if (typeof parsed === "string") return true;
|
|
@@ -1201,19 +1419,28 @@ function hasModernMetaMarker(params) {
|
|
|
1201
1419
|
}
|
|
1202
1420
|
return META_KEY_PROTOCOL_VERSION in meta;
|
|
1203
1421
|
}
|
|
1422
|
+
var MCP_DISPATCHER_FACTORY = /* @__PURE__ */ Symbol.for(
|
|
1423
|
+
"hop-top/kit/mcp/dispatcher-factory"
|
|
1424
|
+
);
|
|
1425
|
+
function dispatcherFactoryOf(handler) {
|
|
1426
|
+
return handler[MCP_DISPATCHER_FACTORY];
|
|
1427
|
+
}
|
|
1204
1428
|
function createMcpHandler(bridge, opts = {}) {
|
|
1205
1429
|
const cfg = resolveMcpConfig(opts);
|
|
1206
1430
|
const dispatcher = new McpDispatcher(bridge, cfg);
|
|
1207
|
-
|
|
1431
|
+
const handler = (req) => dispatcher.handle(req);
|
|
1432
|
+
handler[MCP_DISPATCHER_FACTORY] = (transport) => new McpDispatcher(bridge, cfg, transport);
|
|
1433
|
+
return handler;
|
|
1208
1434
|
}
|
|
1209
1435
|
function mcpMountConfig(opts = {}) {
|
|
1210
1436
|
return resolveMcpConfig(opts);
|
|
1211
1437
|
}
|
|
1212
1438
|
var McpDispatcher = class {
|
|
1213
|
-
constructor(bridge, cfg) {
|
|
1439
|
+
constructor(bridge, cfg, transport = "http") {
|
|
1214
1440
|
this.cfg = cfg;
|
|
1441
|
+
checkToolNameSeparator(bridge.leaves(), cfg.toolNameSeparator);
|
|
1215
1442
|
this.legacy = new LegacyMcpHandler(bridge, cfg);
|
|
1216
|
-
this.modern = new ModernMcpHandler(bridge, cfg);
|
|
1443
|
+
this.modern = new ModernMcpHandler(bridge, cfg, transport);
|
|
1217
1444
|
}
|
|
1218
1445
|
async handle(req) {
|
|
1219
1446
|
const verb = (req.method || "POST").toUpperCase();
|
|
@@ -1237,9 +1464,17 @@ var McpDispatcher = class {
|
|
|
1237
1464
|
let rpc;
|
|
1238
1465
|
try {
|
|
1239
1466
|
rpc = parseJsonRpcRequest(body);
|
|
1240
|
-
} catch (
|
|
1467
|
+
} catch (e5) {
|
|
1241
1468
|
return parseErrorResponse(body);
|
|
1242
1469
|
}
|
|
1470
|
+
return this.dispatch(req, rpc);
|
|
1471
|
+
}
|
|
1472
|
+
/**
|
|
1473
|
+
* Routes one already-parsed request to its era's handler (D2-D4).
|
|
1474
|
+
* The transport-neutral core behind `handle`; stdio calls it directly
|
|
1475
|
+
* after doing its own framing and parsing.
|
|
1476
|
+
*/
|
|
1477
|
+
dispatch(req, rpc) {
|
|
1243
1478
|
if (this.cfg.modernEnabled && !this.cfg.legacyEnabled) {
|
|
1244
1479
|
return this.modern.serve(req, rpc);
|
|
1245
1480
|
}
|
|
@@ -1278,6 +1513,134 @@ function rawIdBytes(_body, id) {
|
|
|
1278
1513
|
return _nullishCoalesce(JSON.stringify(id), () => ( "null"));
|
|
1279
1514
|
}
|
|
1280
1515
|
|
|
1516
|
+
// src/mcp/stdio.ts
|
|
1517
|
+
var _readline = require('readline');
|
|
1518
|
+
function serveStdio(target, opts = {}) {
|
|
1519
|
+
const serve = resolveServe(target, opts.mount);
|
|
1520
|
+
const input = _nullishCoalesce(opts.input, () => ( process.stdin));
|
|
1521
|
+
const output = _nullishCoalesce(opts.output, () => ( process.stdout));
|
|
1522
|
+
const log = _nullishCoalesce(opts.log, () => ( process.stderr));
|
|
1523
|
+
const inFlight = /* @__PURE__ */ new Set();
|
|
1524
|
+
const write = (line) => {
|
|
1525
|
+
output.write(line.endsWith("\n") ? line : `${line}
|
|
1526
|
+
`);
|
|
1527
|
+
};
|
|
1528
|
+
const warn = (msg) => {
|
|
1529
|
+
log.write(`mcp stdio: ${msg}
|
|
1530
|
+
`);
|
|
1531
|
+
};
|
|
1532
|
+
const rl = _readline.createInterface.call(void 0, { input, crlfDelay: Infinity, terminal: false });
|
|
1533
|
+
rl.on("line", (line) => {
|
|
1534
|
+
const task = handleLine(line, serve, write, warn);
|
|
1535
|
+
if (task === void 0) return;
|
|
1536
|
+
inFlight.add(task);
|
|
1537
|
+
void task.finally(() => inFlight.delete(task));
|
|
1538
|
+
});
|
|
1539
|
+
const onInputError = (err) => {
|
|
1540
|
+
warn(`input error: ${errorMessage(err)}`);
|
|
1541
|
+
rl.close();
|
|
1542
|
+
};
|
|
1543
|
+
const onOutputError = (err) => {
|
|
1544
|
+
warn(`output error: ${errorMessage(err)}`);
|
|
1545
|
+
rl.close();
|
|
1546
|
+
};
|
|
1547
|
+
input.on("error", onInputError);
|
|
1548
|
+
output.on("error", onOutputError);
|
|
1549
|
+
const done = new Promise((resolve) => {
|
|
1550
|
+
rl.once("close", () => {
|
|
1551
|
+
void drain(inFlight).then(() => {
|
|
1552
|
+
input.off("error", onInputError);
|
|
1553
|
+
output.off("error", onOutputError);
|
|
1554
|
+
resolve();
|
|
1555
|
+
});
|
|
1556
|
+
});
|
|
1557
|
+
});
|
|
1558
|
+
return {
|
|
1559
|
+
done,
|
|
1560
|
+
close() {
|
|
1561
|
+
rl.close();
|
|
1562
|
+
return done;
|
|
1563
|
+
}
|
|
1564
|
+
};
|
|
1565
|
+
}
|
|
1566
|
+
function resolveServe(target, mount) {
|
|
1567
|
+
if (typeof target === "function") {
|
|
1568
|
+
if (mount !== void 0) {
|
|
1569
|
+
throw new TypeError(
|
|
1570
|
+
"serveStdio: mount options apply to a bridge; a handler carries its own"
|
|
1571
|
+
);
|
|
1572
|
+
}
|
|
1573
|
+
const factory = dispatcherFactoryOf(target);
|
|
1574
|
+
if (factory !== void 0) {
|
|
1575
|
+
const dispatcher2 = factory("stdio");
|
|
1576
|
+
return (req, rpc) => dispatcher2.dispatch(req, rpc);
|
|
1577
|
+
}
|
|
1578
|
+
return (req) => target(req);
|
|
1579
|
+
}
|
|
1580
|
+
const dispatcher = new McpDispatcher(target, resolveMcpConfig(_nullishCoalesce(mount, () => ( {}))), "stdio");
|
|
1581
|
+
return (req, rpc) => dispatcher.dispatch(req, rpc);
|
|
1582
|
+
}
|
|
1583
|
+
async function drain(inFlight) {
|
|
1584
|
+
while (inFlight.size > 0) {
|
|
1585
|
+
await Promise.allSettled([...inFlight]);
|
|
1586
|
+
}
|
|
1587
|
+
}
|
|
1588
|
+
function handleLine(line, serve, write, warn) {
|
|
1589
|
+
const text = line.trim();
|
|
1590
|
+
if (text === "") return void 0;
|
|
1591
|
+
let decoded;
|
|
1592
|
+
try {
|
|
1593
|
+
decoded = JSON.parse(text);
|
|
1594
|
+
} catch (e6) {
|
|
1595
|
+
write(errorLine(null, { code: MCP_ERR_PARSE, message: `parse error: ${goJSONParseMessage(text)}` }));
|
|
1596
|
+
return void 0;
|
|
1597
|
+
}
|
|
1598
|
+
if (Array.isArray(decoded)) {
|
|
1599
|
+
write(errorLine(null, {
|
|
1600
|
+
code: MCP_ERR_INVALID_REQUEST,
|
|
1601
|
+
message: "invalid request: batch requests are not supported"
|
|
1602
|
+
}));
|
|
1603
|
+
return void 0;
|
|
1604
|
+
}
|
|
1605
|
+
if (decoded === null || typeof decoded !== "object") {
|
|
1606
|
+
write(errorLine(null, {
|
|
1607
|
+
code: MCP_ERR_INVALID_REQUEST,
|
|
1608
|
+
message: "invalid request: not a JSON-RPC object"
|
|
1609
|
+
}));
|
|
1610
|
+
return void 0;
|
|
1611
|
+
}
|
|
1612
|
+
const obj = decoded;
|
|
1613
|
+
const rpc = parseJsonRpcRequest(text);
|
|
1614
|
+
const isNotification = rpc.id === void 0;
|
|
1615
|
+
if (typeof obj.method !== "string") {
|
|
1616
|
+
if ("result" in obj || "error" in obj) {
|
|
1617
|
+
warn("ignored a JSON-RPC response from the client");
|
|
1618
|
+
return void 0;
|
|
1619
|
+
}
|
|
1620
|
+
if (isNotification) return void 0;
|
|
1621
|
+
write(errorLine(rpc.id, {
|
|
1622
|
+
code: MCP_ERR_INVALID_REQUEST,
|
|
1623
|
+
message: "invalid request: missing method"
|
|
1624
|
+
}));
|
|
1625
|
+
return void 0;
|
|
1626
|
+
}
|
|
1627
|
+
const req = { method: "POST", body: text };
|
|
1628
|
+
return serve(req, rpc).then(
|
|
1629
|
+
(res) => {
|
|
1630
|
+
if (isNotification || res.body === "") return;
|
|
1631
|
+
write(res.body);
|
|
1632
|
+
},
|
|
1633
|
+
(err) => {
|
|
1634
|
+
warn(`${rpc.method}: ${errorMessage(err)}`);
|
|
1635
|
+
if (isNotification) return;
|
|
1636
|
+
write(errorLine(rpc.id, { code: MCP_ERR_INTERNAL, message: "internal error" }));
|
|
1637
|
+
}
|
|
1638
|
+
);
|
|
1639
|
+
}
|
|
1640
|
+
function errorLine(id, error) {
|
|
1641
|
+
return encodeEnvelope({ id: id === null ? new RawJSON("null") : id, error });
|
|
1642
|
+
}
|
|
1643
|
+
|
|
1281
1644
|
// src/mcp/bridge.ts
|
|
1282
1645
|
var ANN_SIDE_EFFECT = "kit/side-effect";
|
|
1283
1646
|
var ANN_AUTH_REQUIRED = "kit/auth-required";
|
|
@@ -1295,7 +1658,9 @@ function commanderBridge(root, opts) {
|
|
|
1295
1658
|
...collectFlags(cmd),
|
|
1296
1659
|
class: classify(cmd)
|
|
1297
1660
|
};
|
|
1298
|
-
const
|
|
1661
|
+
const args = _chunkUZ65A27Pjs.declaredArgs.call(void 0, cmd);
|
|
1662
|
+
if (args.length > 0) leaf.args = args;
|
|
1663
|
+
const en = _optionalChain([opts, 'access', _25 => _25.enabled, 'optionalCall', _26 => _26(leaf)]);
|
|
1299
1664
|
if (en) leaf.enabled = en;
|
|
1300
1665
|
out.push(leaf);
|
|
1301
1666
|
});
|
|
@@ -1312,7 +1677,7 @@ function commanderBridge(root, opts) {
|
|
|
1312
1677
|
`unknown command: ${toolName(inv.path)}`
|
|
1313
1678
|
);
|
|
1314
1679
|
}
|
|
1315
|
-
if (_optionalChain([target, 'access',
|
|
1680
|
+
if (_optionalChain([target, 'access', _27 => _27.enabled, 'optionalAccess', _28 => _28[inv.meta.surface]]) === false) {
|
|
1316
1681
|
throw new SurfaceNotEnabledError(
|
|
1317
1682
|
`surface not enabled: ${inv.meta.surface}`
|
|
1318
1683
|
);
|
|
@@ -1402,14 +1767,52 @@ function flagProperty(opt) {
|
|
|
1402
1767
|
type,
|
|
1403
1768
|
description: _nullishCoalesce(opt.description, () => ( ""))
|
|
1404
1769
|
};
|
|
1405
|
-
|
|
1770
|
+
const choices = opt.argChoices;
|
|
1771
|
+
if (type === "array") {
|
|
1772
|
+
prop.items = { type: "string" };
|
|
1773
|
+
if (choices && choices.length > 0) prop.items.enum = [...choices];
|
|
1774
|
+
} else if (type === "string" && choices && choices.length > 0) {
|
|
1775
|
+
prop.enum = [...choices];
|
|
1776
|
+
}
|
|
1777
|
+
if (defaultMatches(type, opt.defaultValue)) {
|
|
1778
|
+
prop.default = Array.isArray(opt.defaultValue) ? [...opt.defaultValue] : opt.defaultValue;
|
|
1779
|
+
}
|
|
1406
1780
|
return prop;
|
|
1407
1781
|
}
|
|
1408
1782
|
function optionJSONType(opt) {
|
|
1409
1783
|
if (opt.variadic) return "array";
|
|
1410
|
-
if (
|
|
1784
|
+
if (opt.parseArg !== void 0 && Array.isArray(opt.defaultValue)) {
|
|
1785
|
+
return "array";
|
|
1786
|
+
}
|
|
1787
|
+
if (_chunkUZ65A27Pjs.takesNoValue.call(void 0, opt)) return "boolean";
|
|
1411
1788
|
return "string";
|
|
1412
1789
|
}
|
|
1790
|
+
function defaultMatches(type, value) {
|
|
1791
|
+
switch (type) {
|
|
1792
|
+
case "string":
|
|
1793
|
+
return typeof value === "string";
|
|
1794
|
+
case "boolean":
|
|
1795
|
+
return typeof value === "boolean";
|
|
1796
|
+
case "array":
|
|
1797
|
+
return Array.isArray(value) && value.every((v) => typeof v === "string");
|
|
1798
|
+
default:
|
|
1799
|
+
return false;
|
|
1800
|
+
}
|
|
1801
|
+
}
|
|
1802
|
+
|
|
1803
|
+
|
|
1804
|
+
|
|
1805
|
+
|
|
1806
|
+
|
|
1807
|
+
|
|
1808
|
+
|
|
1809
|
+
|
|
1810
|
+
|
|
1811
|
+
|
|
1812
|
+
|
|
1813
|
+
|
|
1814
|
+
|
|
1815
|
+
|
|
1413
1816
|
|
|
1414
1817
|
|
|
1415
1818
|
|
|
@@ -1488,4 +1891,4 @@ function optionJSONType(opt) {
|
|
|
1488
1891
|
|
|
1489
1892
|
|
|
1490
1893
|
|
|
1491
|
-
exports.META_KEY_PROTOCOL_VERSION = META_KEY_PROTOCOL_VERSION; exports.META_KEY_CLIENT_INFO = META_KEY_CLIENT_INFO; exports.META_KEY_CLIENT_CAPABILITIES = META_KEY_CLIENT_CAPABILITIES; exports.META_KEY_SERVER_INFO = META_KEY_SERVER_INFO; exports.HEADER_MCP_PROTOCOL_VERSION = HEADER_MCP_PROTOCOL_VERSION; exports.HEADER_MCP_METHOD = HEADER_MCP_METHOD; exports.HEADER_MCP_NAME = HEADER_MCP_NAME; exports.MCP_ERR_PARSE = MCP_ERR_PARSE; exports.MCP_ERR_INVALID_REQUEST = MCP_ERR_INVALID_REQUEST; exports.MCP_ERR_METHOD_NOT_FOUND = MCP_ERR_METHOD_NOT_FOUND; exports.MCP_ERR_INVALID_PARAMS = MCP_ERR_INVALID_PARAMS; exports.MCP_ERR_INTERNAL = MCP_ERR_INTERNAL; exports.MCP_ERR_HEADER_MISMATCH = MCP_ERR_HEADER_MISMATCH; exports.MCP_ERR_MISSING_CLIENT_CAPABILITY = MCP_ERR_MISSING_CLIENT_CAPABILITY; exports.MCP_ERR_UNSUPPORTED_VERSION = MCP_ERR_UNSUPPORTED_VERSION; exports.MCP_SPEC_2024_11_05 = MCP_SPEC_2024_11_05; exports.MCP_SPEC_2026_07_28 = MCP_SPEC_2026_07_28; exports.RESULT_TYPE_COMPLETE = RESULT_TYPE_COMPLETE; exports.RESULT_TYPE_INPUT_REQUIRED = RESULT_TYPE_INPUT_REQUIRED; exports.DEFAULT_MCP_SERVER_NAME = DEFAULT_MCP_SERVER_NAME; exports.DEFAULT_MCP_SERVER_VERSION = DEFAULT_MCP_SERVER_VERSION; exports.DEFAULT_MCP_PATH = DEFAULT_MCP_PATH; exports.SURFACE_CLI = SURFACE_CLI; exports.SURFACE_LIB = SURFACE_LIB; exports.SURFACE_MCP = SURFACE_MCP; exports.defaultPolicy = defaultPolicy; exports.policyAllowed = policyAllowed; exports.DestructiveBlockedError = DestructiveBlockedError; exports.UnknownCommandError = UnknownCommandError; exports.SurfaceNotEnabledError = SurfaceNotEnabledError; exports.MCP_AUTH_CHALLENGE = MCP_AUTH_CHALLENGE; exports.resolveMcpConfig = resolveMcpConfig; exports.toolName = toolName; exports.pathFromToolName = pathFromToolName; exports.buildToolEnvelope = buildToolEnvelope; exports.renderCallResult = renderCallResult; exports.errorResultBlock = errorResultBlock; exports.RawJSON = RawJSON; exports.canonicalJSONStringify = canonicalJSONStringify; exports.encodeEnvelope = encodeEnvelope; exports.SCOPES_EXTRA_KEY = SCOPES_EXTRA_KEY; exports.establishCaller = establishCaller; exports.invocationMeta = invocationMeta; exports.LegacyMcpHandler = LegacyMcpHandler; exports.TASKS_EXTENSION = TASKS_EXTENSION; exports.TASK_METHODS = TASK_METHODS; exports.isTaskMethod = isTaskMethod; exports.TASKS_SUPPORTED = TASKS_SUPPORTED; exports.discoverCapabilities = discoverCapabilities; exports.MCP_CONFIRM_KEY = MCP_CONFIRM_KEY; exports.MCP_CONFIRM_STATE_TTL_SECONDS = MCP_CONFIRM_STATE_TTL_SECONDS; exports.MCP_CONFIRM_STATE_VERSION = MCP_CONFIRM_STATE_VERSION; exports.ElicitationConfirmGate = ElicitationConfirmGate; exports.headerConfirmationGate = headerConfirmationGate; exports.clientSupportsFormElicitation = clientSupportsFormElicitation; exports.parseMcpConfirmRetry = parseMcpConfirmRetry; exports.mcpConfirmPrincipal = mcpConfirmPrincipal; exports.mcpConfirmArgsDigest = mcpConfirmArgsDigest; exports.mintMcpConfirmState = mintMcpConfirmState; exports.verifyMcpConfirmState = verifyMcpConfirmState; exports.ModernMcpHandler = ModernMcpHandler; exports.singleHeaderValue = singleHeaderValue; exports.validModernRequestId = validModernRequestId; exports.parseModernMeta = parseModernMeta; exports.rawToolCallName = rawToolCallName; exports.decodeMcpSentinel = decodeMcpSentinel; exports.modernInvocationExtra = modernInvocationExtra; exports.detectMcpEra = detectMcpEra; exports.hasModernMetaMarker = hasModernMetaMarker; exports.createMcpHandler = createMcpHandler; exports.mcpMountConfig = mcpMountConfig; exports.McpDispatcher = McpDispatcher; exports.methodNotAllowedResponse = methodNotAllowedResponse; exports.parseJsonRpcRequest = parseJsonRpcRequest; exports.commanderBridge = commanderBridge; exports.mcp_exports = mcp_exports;
|
|
1894
|
+
exports.MCP_ARGS_PROPERTY = MCP_ARGS_PROPERTY; exports.mcpArgsPublished = mcpArgsPublished; exports.mcpToolDescription = mcpToolDescription; exports.mcpInputSchema = mcpInputSchema; exports.mcpSplitArguments = mcpSplitArguments; exports.META_KEY_PROTOCOL_VERSION = META_KEY_PROTOCOL_VERSION; exports.META_KEY_CLIENT_INFO = META_KEY_CLIENT_INFO; exports.META_KEY_CLIENT_CAPABILITIES = META_KEY_CLIENT_CAPABILITIES; exports.META_KEY_SERVER_INFO = META_KEY_SERVER_INFO; exports.HEADER_MCP_PROTOCOL_VERSION = HEADER_MCP_PROTOCOL_VERSION; exports.HEADER_MCP_METHOD = HEADER_MCP_METHOD; exports.HEADER_MCP_NAME = HEADER_MCP_NAME; exports.MCP_ERR_PARSE = MCP_ERR_PARSE; exports.MCP_ERR_INVALID_REQUEST = MCP_ERR_INVALID_REQUEST; exports.MCP_ERR_METHOD_NOT_FOUND = MCP_ERR_METHOD_NOT_FOUND; exports.MCP_ERR_INVALID_PARAMS = MCP_ERR_INVALID_PARAMS; exports.MCP_ERR_INTERNAL = MCP_ERR_INTERNAL; exports.MCP_ERR_HEADER_MISMATCH = MCP_ERR_HEADER_MISMATCH; exports.MCP_ERR_MISSING_CLIENT_CAPABILITY = MCP_ERR_MISSING_CLIENT_CAPABILITY; exports.MCP_ERR_UNSUPPORTED_VERSION = MCP_ERR_UNSUPPORTED_VERSION; exports.MCP_SPEC_2024_11_05 = MCP_SPEC_2024_11_05; exports.MCP_SPEC_2026_07_28 = MCP_SPEC_2026_07_28; exports.RESULT_TYPE_COMPLETE = RESULT_TYPE_COMPLETE; exports.RESULT_TYPE_INPUT_REQUIRED = RESULT_TYPE_INPUT_REQUIRED; exports.DEFAULT_MCP_SERVER_NAME = DEFAULT_MCP_SERVER_NAME; exports.DEFAULT_MCP_SERVER_VERSION = DEFAULT_MCP_SERVER_VERSION; exports.DEFAULT_MCP_PATH = DEFAULT_MCP_PATH; exports.DEFAULT_TOOL_NAME_SEPARATOR = DEFAULT_TOOL_NAME_SEPARATOR; exports.SURFACE_CLI = SURFACE_CLI; exports.SURFACE_LIB = SURFACE_LIB; exports.SURFACE_MCP = SURFACE_MCP; exports.defaultPolicy = defaultPolicy; exports.policyAllowed = policyAllowed; exports.DestructiveBlockedError = DestructiveBlockedError; exports.UnknownCommandError = UnknownCommandError; exports.SurfaceNotEnabledError = SurfaceNotEnabledError; exports.MCP_AUTH_CHALLENGE = MCP_AUTH_CHALLENGE; exports.resolveMcpConfig = resolveMcpConfig; exports.toolName = toolName; exports.pathFromToolName = pathFromToolName; exports.buildToolEnvelope = buildToolEnvelope; exports.renderCallResult = renderCallResult; exports.errorResultBlock = errorResultBlock; exports.RawJSON = RawJSON; exports.canonicalJSONStringify = canonicalJSONStringify; exports.encodeEnvelope = encodeEnvelope; exports.SCOPES_EXTRA_KEY = SCOPES_EXTRA_KEY; exports.establishCaller = establishCaller; exports.invocationMeta = invocationMeta; exports.MCP_AUDIT_AUTH_REFUSED = MCP_AUDIT_AUTH_REFUSED; exports.MCP_AUDIT_CONFIRMATION_REQUIRED = MCP_AUDIT_CONFIRMATION_REQUIRED; exports.MCP_AUDIT_CONFIRMATION_DECLINED = MCP_AUDIT_CONFIRMATION_DECLINED; exports.MCP_AUDIT_CONFIRMATION_STATE_REJECTED = MCP_AUDIT_CONFIRMATION_STATE_REJECTED; exports.MCP_AUDIT_DESTRUCTIVE_BLOCKED = MCP_AUDIT_DESTRUCTIVE_BLOCKED; exports.MCP_CONFIRM_REJECTION_STATE = MCP_CONFIRM_REJECTION_STATE; exports.auditRefusal = auditRefusal; exports.LegacyMcpHandler = LegacyMcpHandler; exports.TASKS_EXTENSION = TASKS_EXTENSION; exports.TASK_METHODS = TASK_METHODS; exports.isTaskMethod = isTaskMethod; exports.TASKS_SUPPORTED = TASKS_SUPPORTED; exports.discoverCapabilities = discoverCapabilities; exports.MCP_CONFIRM_KEY = MCP_CONFIRM_KEY; exports.MCP_CONFIRM_STATE_TTL_SECONDS = MCP_CONFIRM_STATE_TTL_SECONDS; exports.MCP_CONFIRM_STATE_VERSION = MCP_CONFIRM_STATE_VERSION; exports.ElicitationConfirmGate = ElicitationConfirmGate; exports.headerConfirmationGate = headerConfirmationGate; exports.clientSupportsFormElicitation = clientSupportsFormElicitation; exports.parseMcpConfirmRetry = parseMcpConfirmRetry; exports.mcpConfirmPrincipal = mcpConfirmPrincipal; exports.mcpConfirmArgsDigest = mcpConfirmArgsDigest; exports.mintMcpConfirmState = mintMcpConfirmState; exports.verifyMcpConfirmState = verifyMcpConfirmState; exports.ModernMcpHandler = ModernMcpHandler; exports.singleHeaderValue = singleHeaderValue; exports.validModernRequestId = validModernRequestId; exports.parseModernMeta = parseModernMeta; exports.rawToolCallName = rawToolCallName; exports.decodeMcpSentinel = decodeMcpSentinel; exports.modernInvocationExtra = modernInvocationExtra; exports.detectMcpEra = detectMcpEra; exports.hasModernMetaMarker = hasModernMetaMarker; exports.createMcpHandler = createMcpHandler; exports.mcpMountConfig = mcpMountConfig; exports.McpDispatcher = McpDispatcher; exports.methodNotAllowedResponse = methodNotAllowedResponse; exports.parseJsonRpcRequest = parseJsonRpcRequest; exports.serveStdio = serveStdio; exports.commanderBridge = commanderBridge; exports.mcp_exports = mcp_exports;
|