@frontmcp/sdk 1.10.4 → 1.10.6
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/browser/common/tokens/server.tokens.mjs +2 -1
- package/browser/common/types/options/transport/schema.mjs +2 -0
- package/browser/front-mcp/front-mcp.mjs +5 -1
- package/browser/index.cjs +187 -13
- package/browser/transport/flows/handle.mcp-20260728.flow.mjs +19 -5
- package/browser/transport/mcp-20260728/dispatcher.mjs +5 -3
- package/browser/transport/mcp-20260728/subscriptions.mjs +2 -1
- package/browser/transport/stdio-revision-router.mjs +147 -0
- package/common/tokens/server.tokens.d.ts +8 -0
- package/common/tokens/server.tokens.d.ts.map +1 -1
- package/common/types/options/transport/interfaces.d.ts +3 -1
- package/common/types/options/transport/interfaces.d.ts.map +1 -1
- package/common/types/options/transport/schema.d.ts.map +1 -1
- package/esm/index.mjs +190 -11
- package/front-mcp/front-mcp.d.ts +2 -0
- package/front-mcp/front-mcp.d.ts.map +1 -1
- package/index.js +187 -13
- package/package.json +11 -11
- package/transport/flows/handle.mcp-20260728.flow.d.ts +2 -0
- package/transport/flows/handle.mcp-20260728.flow.d.ts.map +1 -1
- package/transport/mcp-20260728/dispatcher.d.ts +2 -0
- package/transport/mcp-20260728/dispatcher.d.ts.map +1 -1
- package/transport/mcp-20260728/subscriptions.d.ts.map +1 -1
- package/transport/stdio-revision-router.d.ts +32 -0
- package/transport/stdio-revision-router.d.ts.map +1 -0
package/index.js
CHANGED
|
@@ -1592,7 +1592,8 @@ var init_server_tokens = __esm({
|
|
|
1592
1592
|
webCtx: tokenFactory.meta("webCtx"),
|
|
1593
1593
|
webEnv: tokenFactory.meta("webEnv"),
|
|
1594
1594
|
webTransport: tokenFactory.meta("webTransport"),
|
|
1595
|
-
relayedFrom: tokenFactory.meta("relayedFrom")
|
|
1595
|
+
relayedFrom: tokenFactory.meta("relayedFrom"),
|
|
1596
|
+
stdio: tokenFactory.meta("stdio")
|
|
1596
1597
|
};
|
|
1597
1598
|
}
|
|
1598
1599
|
});
|
|
@@ -3568,6 +3569,8 @@ var init_schema7 = __esm({
|
|
|
3568
3569
|
* friends), where statelessness is the natural fit and sessions cost a
|
|
3569
3570
|
* Durable Object; and to `'legacy'` everywhere else, so existing Node
|
|
3570
3571
|
* deployments are untouched.
|
|
3572
|
+
*
|
|
3573
|
+
* Over stdio (`'legacy'` by default) it applies until the connection sends `initialize`.
|
|
3571
3574
|
*/
|
|
3572
3575
|
defaultProtocolVersion: import_lazy_zod20.z.enum(["2026-07-28", "legacy"]).optional(),
|
|
3573
3576
|
// ============================================
|
|
@@ -19060,7 +19063,8 @@ function createSubscriptionStream(options) {
|
|
|
19060
19063
|
}
|
|
19061
19064
|
notify?.();
|
|
19062
19065
|
};
|
|
19063
|
-
signal?.
|
|
19066
|
+
if (signal?.aborted) cleanup();
|
|
19067
|
+
else signal?.addEventListener("abort", cleanup, { once: true });
|
|
19064
19068
|
async function* generate() {
|
|
19065
19069
|
try {
|
|
19066
19070
|
yield frame({
|
|
@@ -19257,7 +19261,7 @@ function shouldCreateTask(params) {
|
|
|
19257
19261
|
}
|
|
19258
19262
|
return { kind: "skip" };
|
|
19259
19263
|
}
|
|
19260
|
-
const ownership = resolveTaskOwner(
|
|
19264
|
+
const ownership = resolveTaskOwner(params.taskPrincipal);
|
|
19261
19265
|
if (!ownership.ok) return { kind: "refuse", reason: ownership.reason };
|
|
19262
19266
|
return { kind: "create", owner: ownership.owner };
|
|
19263
19267
|
}
|
|
@@ -19325,12 +19329,14 @@ async function dispatch20260728(options) {
|
|
|
19325
19329
|
frontmcpContext,
|
|
19326
19330
|
authInfo,
|
|
19327
19331
|
isAnonymous,
|
|
19332
|
+
transportPrincipal,
|
|
19328
19333
|
signal,
|
|
19329
19334
|
composeInstructions,
|
|
19330
19335
|
notificationSink,
|
|
19331
19336
|
traceContext
|
|
19332
19337
|
} = options;
|
|
19333
19338
|
const method = body["method"];
|
|
19339
|
+
const taskPrincipal = transportPrincipal ?? resolveTaskPrincipal(authInfo, isAnonymous);
|
|
19334
19340
|
const params = body["params"] ?? {};
|
|
19335
19341
|
const cacheScope = resolveCacheScope(isAnonymous, isShapedPerCaller(scope, method));
|
|
19336
19342
|
const serverInfo = scope.metadata.info;
|
|
@@ -19354,7 +19360,7 @@ async function dispatch20260728(options) {
|
|
|
19354
19360
|
}
|
|
19355
19361
|
};
|
|
19356
19362
|
}
|
|
19357
|
-
const ownership = resolveTaskOwner(
|
|
19363
|
+
const ownership = resolveTaskOwner(taskPrincipal);
|
|
19358
19364
|
if (!ownership.ok) {
|
|
19359
19365
|
return { kind: "error", status: 200, error: { code: -32602, message: ownership.reason } };
|
|
19360
19366
|
}
|
|
@@ -19407,7 +19413,7 @@ async function dispatch20260728(options) {
|
|
|
19407
19413
|
});
|
|
19408
19414
|
frontmcpContext?.setMrtrExchange(exchange);
|
|
19409
19415
|
if (notificationSink) frontmcpContext?.setRequestNotificationSink(notificationSink);
|
|
19410
|
-
const taskDecision = shouldCreateTask({ scope, method, params, clientCapabilities,
|
|
19416
|
+
const taskDecision = shouldCreateTask({ scope, method, params, clientCapabilities, taskPrincipal });
|
|
19411
19417
|
if (taskDecision.kind === "refuse") {
|
|
19412
19418
|
return { kind: "error", status: 200, error: { code: -32602, message: taskDecision.reason } };
|
|
19413
19419
|
}
|
|
@@ -45995,7 +46001,7 @@ var init_handle_mcp_20260728_flow = __esm({
|
|
|
45995
46001
|
}
|
|
45996
46002
|
const body = request.body ?? {};
|
|
45997
46003
|
const scope = this.scope;
|
|
45998
|
-
const
|
|
46004
|
+
const clientDeclaredRevision = declaresProtocol20260728({
|
|
45999
46005
|
headers: request.headers,
|
|
46000
46006
|
body
|
|
46001
46007
|
});
|
|
@@ -46003,7 +46009,7 @@ var init_handle_mcp_20260728_flow = __esm({
|
|
|
46003
46009
|
headers: request.headers,
|
|
46004
46010
|
body,
|
|
46005
46011
|
lookupToolSchema: (toolName) => this.findToolSchema(scope, toolName),
|
|
46006
|
-
strictHeaders
|
|
46012
|
+
strictHeaders: clientDeclaredRevision && !this.stdioOrigin
|
|
46007
46013
|
});
|
|
46008
46014
|
if (!result.ok) {
|
|
46009
46015
|
this.log.info("validate: rejected", { code: result.error.code, message: result.error.message });
|
|
@@ -46011,7 +46017,11 @@ var init_handle_mcp_20260728_flow = __esm({
|
|
|
46011
46017
|
return;
|
|
46012
46018
|
}
|
|
46013
46019
|
this.state.set("version", result.version);
|
|
46014
|
-
this.state.set("clientDeclaredRevision",
|
|
46020
|
+
this.state.set("clientDeclaredRevision", clientDeclaredRevision);
|
|
46021
|
+
}
|
|
46022
|
+
/** Set when the request arrived over stdio rather than HTTP. */
|
|
46023
|
+
get stdioOrigin() {
|
|
46024
|
+
return this.rawInput.request[ServerRequestTokens.stdio];
|
|
46015
46025
|
}
|
|
46016
46026
|
/**
|
|
46017
46027
|
* Re-enter this request's `FrontMcpContext` for work deferred past the flow.
|
|
@@ -46070,6 +46080,9 @@ var init_handle_mcp_20260728_flow = __esm({
|
|
|
46070
46080
|
const controller = new AbortController();
|
|
46071
46081
|
const abort = () => controller.abort();
|
|
46072
46082
|
response?.on?.("close", abort);
|
|
46083
|
+
const stdioSignal = this.stdioOrigin?.signal;
|
|
46084
|
+
if (stdioSignal?.aborted) abort();
|
|
46085
|
+
else stdioSignal?.addEventListener("abort", abort, { once: true });
|
|
46073
46086
|
const { acknowledged, stream } = createSubscriptionStream({
|
|
46074
46087
|
scope: this.scope,
|
|
46075
46088
|
subscriptionId: subscriptionId.data,
|
|
@@ -46112,6 +46125,7 @@ var init_handle_mcp_20260728_flow = __esm({
|
|
|
46112
46125
|
const params = body["params"] ?? {};
|
|
46113
46126
|
const meta = params["_meta"] ?? {};
|
|
46114
46127
|
const auth = request[ServerRequestTokens.auth];
|
|
46128
|
+
const stdio = this.stdioOrigin;
|
|
46115
46129
|
const clientCapabilities = meta[import_protocol50.MCP_20260728_META.clientCapabilities] ?? {};
|
|
46116
46130
|
const logLevel = typeof meta[import_protocol50.MCP_20260728_META.logLevel] === "string" ? meta[import_protocol50.MCP_20260728_META.logLevel] : void 0;
|
|
46117
46131
|
const rawProgressToken = meta["progressToken"];
|
|
@@ -46140,15 +46154,21 @@ var init_handle_mcp_20260728_flow = __esm({
|
|
|
46140
46154
|
// off an id. It names the request only, the same per-request id as the request
|
|
46141
46155
|
// context's `sessionId`; the request context does not vouch for it (#629).
|
|
46142
46156
|
sessionId: auth.session?.id ?? this.tryGetContext()?.sessionId
|
|
46143
|
-
} :
|
|
46157
|
+
} : (
|
|
46158
|
+
// A stdio caller presents no credential, so the handlers get only the per-request id.
|
|
46159
|
+
stdio && { sessionId: this.tryGetContext()?.sessionId }
|
|
46160
|
+
),
|
|
46144
46161
|
isAnonymous: this.state.required.isAnonymous,
|
|
46162
|
+
transportPrincipal: stdio?.principal,
|
|
46163
|
+
signal: stdio?.signal,
|
|
46145
46164
|
clientDeclaredRevision: this.state.clientDeclaredRevision !== false,
|
|
46146
46165
|
// The instructions `initialize` sends: the server's, the channel hint and the skill catalog, for this caller
|
|
46147
46166
|
composeInstructions: (caller) => composeCallerInstructions(this.scope, { ctx: caller, skillUriHints: true }),
|
|
46148
46167
|
notificationSink: sink,
|
|
46149
46168
|
traceContext: extractTraceContext(meta)
|
|
46150
46169
|
};
|
|
46151
|
-
|
|
46170
|
+
const streams = stdio !== void 0 || acceptsEventStream(request.headers);
|
|
46171
|
+
if (sink.active && streams) {
|
|
46152
46172
|
this.respond({
|
|
46153
46173
|
kind: "sse",
|
|
46154
46174
|
status: 200,
|
|
@@ -72509,6 +72529,156 @@ var init_ipc_server_transport = __esm({
|
|
|
72509
72529
|
}
|
|
72510
72530
|
});
|
|
72511
72531
|
|
|
72532
|
+
// libs/sdk/src/transport/stdio-revision-router.ts
|
|
72533
|
+
var stdio_revision_router_exports = {};
|
|
72534
|
+
__export(stdio_revision_router_exports, {
|
|
72535
|
+
StdioRevisionRouter: () => StdioRevisionRouter
|
|
72536
|
+
});
|
|
72537
|
+
function eventData(event) {
|
|
72538
|
+
return event.split("\n").filter((line) => line.startsWith(EVENT_DATA_FIELD)).map((line) => line.slice(EVENT_DATA_FIELD.length).trimStart()).join("\n");
|
|
72539
|
+
}
|
|
72540
|
+
async function* eventStreamMessages(stream) {
|
|
72541
|
+
const decoder2 = new TextDecoder();
|
|
72542
|
+
let pending = "";
|
|
72543
|
+
for await (const chunk of stream) {
|
|
72544
|
+
pending += decoder2.decode(chunk, { stream: true });
|
|
72545
|
+
let boundary = pending.indexOf(EVENT_SEPARATOR);
|
|
72546
|
+
while (boundary !== -1) {
|
|
72547
|
+
const data = eventData(pending.slice(0, boundary));
|
|
72548
|
+
pending = pending.slice(boundary + EVENT_SEPARATOR.length);
|
|
72549
|
+
if (data) yield JSON.parse(data);
|
|
72550
|
+
boundary = pending.indexOf(EVENT_SEPARATOR);
|
|
72551
|
+
}
|
|
72552
|
+
}
|
|
72553
|
+
}
|
|
72554
|
+
function isAsyncIterable(stream) {
|
|
72555
|
+
return Symbol.asyncIterator in stream;
|
|
72556
|
+
}
|
|
72557
|
+
function internalError(id) {
|
|
72558
|
+
return { jsonrpc: "2.0", id, error: { code: -32603, message: "Internal error" } };
|
|
72559
|
+
}
|
|
72560
|
+
var import_protocol60, EVENT_SEPARATOR, EVENT_DATA_FIELD, StdioRevisionRouter;
|
|
72561
|
+
var init_stdio_revision_router = __esm({
|
|
72562
|
+
"libs/sdk/src/transport/stdio-revision-router.ts"() {
|
|
72563
|
+
"use strict";
|
|
72564
|
+
import_protocol60 = require("@frontmcp/protocol");
|
|
72565
|
+
init_common();
|
|
72566
|
+
init_flow_error_output();
|
|
72567
|
+
init_mcp_20260728();
|
|
72568
|
+
EVENT_SEPARATOR = "\n\n";
|
|
72569
|
+
EVENT_DATA_FIELD = "data:";
|
|
72570
|
+
StdioRevisionRouter = class {
|
|
72571
|
+
constructor(inner, options) {
|
|
72572
|
+
this.inner = inner;
|
|
72573
|
+
this.options = options;
|
|
72574
|
+
}
|
|
72575
|
+
inner;
|
|
72576
|
+
options;
|
|
72577
|
+
onclose;
|
|
72578
|
+
onerror;
|
|
72579
|
+
onmessage;
|
|
72580
|
+
inFlight = /* @__PURE__ */ new Map();
|
|
72581
|
+
/** `initialize` makes the connection session-era for good; a 2026-07-28 message first makes it stateless. */
|
|
72582
|
+
era = "unknown";
|
|
72583
|
+
async start() {
|
|
72584
|
+
this.inner.onmessage = (message, extra) => this.route(message, extra);
|
|
72585
|
+
this.inner.onerror = (error) => this.onerror?.(error);
|
|
72586
|
+
this.inner.onclose = () => {
|
|
72587
|
+
this.cancelAll();
|
|
72588
|
+
this.onclose?.();
|
|
72589
|
+
};
|
|
72590
|
+
await this.inner.start();
|
|
72591
|
+
}
|
|
72592
|
+
async send(message, options) {
|
|
72593
|
+
if (this.era === "modern" && (0, import_protocol60.isJSONRPCNotification)(message)) return;
|
|
72594
|
+
await this.inner.send(message, options);
|
|
72595
|
+
}
|
|
72596
|
+
async close() {
|
|
72597
|
+
this.cancelAll();
|
|
72598
|
+
await this.inner.close();
|
|
72599
|
+
}
|
|
72600
|
+
route(message, extra) {
|
|
72601
|
+
if (this.cancelsModernRequest(message)) return;
|
|
72602
|
+
if (((0, import_protocol60.isJSONRPCRequest)(message) || (0, import_protocol60.isJSONRPCNotification)(message)) && this.servesModern(message)) {
|
|
72603
|
+
if (this.era === "unknown") this.era = "modern";
|
|
72604
|
+
void this.serveModern(message);
|
|
72605
|
+
return;
|
|
72606
|
+
}
|
|
72607
|
+
if ((0, import_protocol60.isJSONRPCRequest)(message) && message.method === "initialize") this.era = "legacy";
|
|
72608
|
+
this.onmessage?.(message, extra);
|
|
72609
|
+
}
|
|
72610
|
+
servesModern(message) {
|
|
72611
|
+
const configured = this.options.scope.metadata.transport?.defaultProtocolVersion ?? "legacy";
|
|
72612
|
+
return isProtocol20260728Request({
|
|
72613
|
+
headers: void 0,
|
|
72614
|
+
body: message,
|
|
72615
|
+
defaultVersion: this.era === "legacy" ? "legacy" : configured
|
|
72616
|
+
});
|
|
72617
|
+
}
|
|
72618
|
+
cancelsModernRequest(message) {
|
|
72619
|
+
if (!(0, import_protocol60.isJSONRPCNotification)(message) || message.method !== "notifications/cancelled") return false;
|
|
72620
|
+
const requestId = message.params?.["requestId"];
|
|
72621
|
+
if (typeof requestId !== "string" && typeof requestId !== "number") return false;
|
|
72622
|
+
const controller = this.inFlight.get(requestId);
|
|
72623
|
+
if (!controller) return false;
|
|
72624
|
+
this.inFlight.delete(requestId);
|
|
72625
|
+
controller.abort();
|
|
72626
|
+
return true;
|
|
72627
|
+
}
|
|
72628
|
+
async serveModern(message) {
|
|
72629
|
+
const id = (0, import_protocol60.isJSONRPCRequest)(message) ? message.id : void 0;
|
|
72630
|
+
const controller = new AbortController();
|
|
72631
|
+
if (id !== void 0) this.inFlight.set(id, controller);
|
|
72632
|
+
try {
|
|
72633
|
+
const output = await this.runFlow(message, controller.signal);
|
|
72634
|
+
if (id !== void 0) await this.reply(output, id, controller.signal);
|
|
72635
|
+
} catch (error) {
|
|
72636
|
+
this.options.scope.logger.child("StdioRevisionRouter").error("failed to serve a 2026-07-28 message", {
|
|
72637
|
+
method: message.method,
|
|
72638
|
+
error: error instanceof Error ? error.message : String(error)
|
|
72639
|
+
});
|
|
72640
|
+
} finally {
|
|
72641
|
+
if (id !== void 0 && this.inFlight.get(id) === controller) this.inFlight.delete(id);
|
|
72642
|
+
}
|
|
72643
|
+
}
|
|
72644
|
+
async runFlow(message, signal) {
|
|
72645
|
+
const origin = { principal: this.options.principal, signal };
|
|
72646
|
+
const request = {
|
|
72647
|
+
method: "POST",
|
|
72648
|
+
path: "/",
|
|
72649
|
+
url: "/",
|
|
72650
|
+
headers: {},
|
|
72651
|
+
query: {},
|
|
72652
|
+
body: message,
|
|
72653
|
+
[ServerRequestTokens.stdio]: origin
|
|
72654
|
+
};
|
|
72655
|
+
try {
|
|
72656
|
+
return await this.options.scope.runFlow("handle:mcp-202607280728", { request, response: {} });
|
|
72657
|
+
} catch (error) {
|
|
72658
|
+
return flowErrorToHttpOutput(error);
|
|
72659
|
+
}
|
|
72660
|
+
}
|
|
72661
|
+
async reply(output, id, signal) {
|
|
72662
|
+
if (output?.kind === "sse" && isAsyncIterable(output.stream)) {
|
|
72663
|
+
for await (const message of eventStreamMessages(output.stream)) {
|
|
72664
|
+
if (signal.aborted) return;
|
|
72665
|
+
await this.inner.send(message);
|
|
72666
|
+
}
|
|
72667
|
+
return;
|
|
72668
|
+
}
|
|
72669
|
+
if (signal.aborted) return;
|
|
72670
|
+
const body = output?.kind === "json" ? output.body : void 0;
|
|
72671
|
+
const isReply = (0, import_protocol60.isJSONRPCResultResponse)(body) || (0, import_protocol60.isJSONRPCErrorResponse)(body);
|
|
72672
|
+
await this.inner.send(isReply ? body : internalError(id));
|
|
72673
|
+
}
|
|
72674
|
+
cancelAll() {
|
|
72675
|
+
for (const controller of this.inFlight.values()) controller.abort();
|
|
72676
|
+
this.inFlight.clear();
|
|
72677
|
+
}
|
|
72678
|
+
};
|
|
72679
|
+
}
|
|
72680
|
+
});
|
|
72681
|
+
|
|
72512
72682
|
// libs/sdk/src/front-mcp/front-mcp.ts
|
|
72513
72683
|
var front_mcp_exports = {};
|
|
72514
72684
|
__export(front_mcp_exports, {
|
|
@@ -73021,6 +73191,8 @@ var init_front_mcp = __esm({
|
|
|
73021
73191
|
* transport and returns only when the connection closes. **No TCP port is
|
|
73022
73192
|
* bound** — the HTTP server is disabled for this entry point (#451).
|
|
73023
73193
|
*
|
|
73194
|
+
* One connection serves every revision: `initialize` opens a session, a 2026-07-28 request is served statelessly.
|
|
73195
|
+
*
|
|
73024
73196
|
* Accepts either a `@FrontMcp`-decorated class or the same config object you
|
|
73025
73197
|
* pass to `@FrontMcp()` (#450).
|
|
73026
73198
|
*
|
|
@@ -73157,7 +73329,9 @@ var init_front_mcp = __esm({
|
|
|
73157
73329
|
mcpServer.setRequestHandler(handler.requestSchema, wrappedHandler);
|
|
73158
73330
|
}
|
|
73159
73331
|
const { IpcServerTransport: IpcServerTransport2, isIpcStdioRequested: isIpcStdioRequested2 } = await Promise.resolve().then(() => (init_ipc_server_transport(), ipc_server_transport_exports));
|
|
73160
|
-
const
|
|
73332
|
+
const { StdioRevisionRouter: StdioRevisionRouter2 } = await Promise.resolve().then(() => (init_stdio_revision_router(), stdio_revision_router_exports));
|
|
73333
|
+
const stdioTransport = isIpcStdioRequested2() ? new IpcServerTransport2() : new StdioServerTransport();
|
|
73334
|
+
const transport = new StdioRevisionRouter2(stdioTransport, { scope, principal: sessionId });
|
|
73161
73335
|
startupCleanups.push(() => transport.close());
|
|
73162
73336
|
await mcpServer.connect(transport);
|
|
73163
73337
|
startupSucceeded = true;
|
|
@@ -75395,7 +75569,7 @@ __export(index_exports, {
|
|
|
75395
75569
|
OrchestratorJwksNotAvailableError: () => import_auth15.OrchestratorJwksNotAvailableError,
|
|
75396
75570
|
PLATFORM_CLIENT_INFO: () => PLATFORM_CLIENT_INFO,
|
|
75397
75571
|
PRIMITIVE_FILTER_KEYS: () => PRIMITIVE_FILTER_KEYS,
|
|
75398
|
-
PROTOCOL_2026_07_28: () =>
|
|
75572
|
+
PROTOCOL_2026_07_28: () => import_protocol61.PROTOCOL_2026_07_28,
|
|
75399
75573
|
PROTOCOL_PRESETS: () => PROTOCOL_PRESETS,
|
|
75400
75574
|
PayloadTooLargeError: () => PayloadTooLargeError,
|
|
75401
75575
|
Plugin: () => FrontMcpPlugin,
|
|
@@ -76765,7 +76939,7 @@ init_mcp_20260728();
|
|
|
76765
76939
|
init_mcp_20260728();
|
|
76766
76940
|
init_mcp_20260728();
|
|
76767
76941
|
init_mcp_stateless_client_adapter();
|
|
76768
|
-
var
|
|
76942
|
+
var import_protocol61 = require("@frontmcp/protocol");
|
|
76769
76943
|
init_ext_apps2();
|
|
76770
76944
|
var import_auth67 = require("@frontmcp/auth");
|
|
76771
76945
|
var import_auth68 = require("@frontmcp/auth");
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@frontmcp/sdk",
|
|
3
|
-
"version": "1.10.
|
|
4
|
-
"description": "TypeScript framework for
|
|
3
|
+
"version": "1.10.6",
|
|
4
|
+
"description": "The TypeScript framework for MCP servers: typed tools with Zod, dependency injection, auth, testing, agents and jobs, and builds for Node, Vercel, AWS Lambda and Cloudflare Workers.",
|
|
5
5
|
"author": "AgentFront <info@agentfront.dev>",
|
|
6
6
|
"homepage": "https://frontmcp.dev/reference/sdk",
|
|
7
7
|
"license": "Apache-2.0",
|
|
@@ -97,8 +97,8 @@
|
|
|
97
97
|
"peerDependencies": {
|
|
98
98
|
"@anthropic-ai/sdk": "^0.30.0 || ^0.78.0",
|
|
99
99
|
"@enclave-vm/core": "^2.16.0",
|
|
100
|
-
"@frontmcp/observability": "1.10.
|
|
101
|
-
"@frontmcp/storage-sqlite": "1.10.
|
|
100
|
+
"@frontmcp/observability": "1.10.6",
|
|
101
|
+
"@frontmcp/storage-sqlite": "1.10.6",
|
|
102
102
|
"@opentelemetry/api": "^1.9.0",
|
|
103
103
|
"@opentelemetry/sdk-trace-base": "^2.8.0",
|
|
104
104
|
"content-type": "^1.0.5",
|
|
@@ -131,13 +131,13 @@
|
|
|
131
131
|
}
|
|
132
132
|
},
|
|
133
133
|
"dependencies": {
|
|
134
|
-
"@frontmcp/auth": "1.10.
|
|
135
|
-
"@frontmcp/di": "1.10.
|
|
136
|
-
"@frontmcp/guard": "1.10.
|
|
137
|
-
"@frontmcp/lazy-zod": "1.10.
|
|
138
|
-
"@frontmcp/protocol": "1.10.
|
|
139
|
-
"@frontmcp/uipack": "1.10.
|
|
140
|
-
"@frontmcp/utils": "1.10.
|
|
134
|
+
"@frontmcp/auth": "1.10.6",
|
|
135
|
+
"@frontmcp/di": "1.10.6",
|
|
136
|
+
"@frontmcp/guard": "1.10.6",
|
|
137
|
+
"@frontmcp/lazy-zod": "1.10.6",
|
|
138
|
+
"@frontmcp/protocol": "1.10.6",
|
|
139
|
+
"@frontmcp/uipack": "1.10.6",
|
|
140
|
+
"@frontmcp/utils": "1.10.6",
|
|
141
141
|
"@types/cors": "^2.8.17",
|
|
142
142
|
"ioredis": "^5.8.0",
|
|
143
143
|
"jose": "^6.1.3",
|
|
@@ -36,6 +36,8 @@ export default class HandleMcp20260728Flow extends FlowBase<typeof name> {
|
|
|
36
36
|
* resolved in favour of one side.
|
|
37
37
|
*/
|
|
38
38
|
validate(): Promise<void>;
|
|
39
|
+
/** Set when the request arrived over stdio rather than HTTP. */
|
|
40
|
+
private get stdioOrigin();
|
|
39
41
|
/**
|
|
40
42
|
* Re-enter this request's `FrontMcpContext` for work deferred past the flow.
|
|
41
43
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handle.mcp-20260728.flow.d.ts","sourceRoot":"","sources":["../../../src/transport/flows/handle.mcp-20260728.flow.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"handle.mcp-20260728.flow.d.ts","sourceRoot":"","sources":["../../../src/transport/flows/handle.mcp-20260728.flow.ts"],"names":[],"mappings":"AAqBA,OAAO,EAGL,QAAQ,EAER,eAAe,EACf,gBAAgB,EAKhB,KAAK,cAAc,EAEpB,MAAM,cAAc,CAAC;AAMtB,OAAO,EAIL,yBAAyB,EACzB,WAAW,EACX,UAAU,EAKX,MAAM,iBAAiB,CAAC;AAEzB,eAAO,MAAM,IAAI;;;;;CAKoB,CAAC;AAwBtC,eAAO,MAAM,WAAW;;;;;;;;;gCAOtB,CAAC;AAEH,QAAA,MAAM,IAAI,EAAG,yBAAkC,CAAC;AAGhD,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,WAAW;QACnB,yBAAyB,EAAE,cAAc,CACvC,qBAAqB,EACrB,OAAO,IAAI,EACX,OAAO,eAAe,EACtB,OAAO,gBAAgB,EACvB,OAAO,WAAW,CACnB,CAAC;KACH;CACF;AAuBD,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,CAMrG;AA2FD,MAAM,CAAC,OAAO,OAAO,qBAAsB,SAAQ,QAAQ,CAAC,OAAO,IAAI,CAAC;IACtE,IAAI,4BAAQ;IAEZ,OAAO,KAAK,GAAG,GAEd;IAGK,UAAU;IAOhB;;;;;;;OAOG;IAEG,QAAQ;IA8Cd,gEAAgE;IAChE,OAAO,KAAK,WAAW,GAEtB;IAED;;;;;;;;OAQG;IACH,OAAO,CAAC,kBAAkB;IAe1B;;;OAGG;IACH,OAAO,CAAC,cAAc;IAKhB,MAAM;IAYZ;;;;OAIG;IAIG,kBAAkB;IAIxB;;;;;OAKG;IAIG,mBAAmB;IA6DzB;;;;OAIG;YACW,gBAAgB;IAUxB,aAAa;IA4Gb,OAAO;CAKd;AAED,mGAAmG;AACnG,OAAO,EAAE,yBAAyB,EAAE,WAAW,EAAE,UAAU,EAAE,CAAC"}
|
|
@@ -20,6 +20,8 @@ export interface DispatchOptions {
|
|
|
20
20
|
authInfo?: Record<string, unknown>;
|
|
21
21
|
/** True when the caller is unauthenticated, which makes results publicly cacheable. */
|
|
22
22
|
isAnonymous: boolean;
|
|
23
|
+
/** The caller's principal when the transport identifies it (stdio: the connection); it owns the caller's tasks. */
|
|
24
|
+
transportPrincipal?: string;
|
|
23
25
|
signal?: AbortSignal;
|
|
24
26
|
/** Lazily composed instructions for `server/discover`, for the calling context. */
|
|
25
27
|
composeInstructions?: McpHandlerOptions['composeInstructions'];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dispatcher.d.ts","sourceRoot":"","sources":["../../../src/transport/mcp-20260728/dispatcher.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,eAAe,CAAC;AAErD,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,aAAa,CAAC;AAKzC,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AAG5E,OAAO,EAAE,KAAK,uBAAuB,EAAE,MA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
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type JSONRPCMessage, type Transport } from '@frontmcp/protocol';
|
|
2
|
+
import { type Scope } from '../scope';
|
|
3
|
+
type SendOptions = Parameters<Transport['send']>[1];
|
|
4
|
+
export interface StdioRevisionRouterOptions {
|
|
5
|
+
scope: Scope;
|
|
6
|
+
/** Names the connection; it owns the tasks its 2026-07-28 requests create. */
|
|
7
|
+
principal: string;
|
|
8
|
+
}
|
|
9
|
+
/** Runs MCP 2026-07-28 messages through `handle:mcp-202607280728`, and passes the rest to the session-era server. */
|
|
10
|
+
export declare class StdioRevisionRouter implements Transport {
|
|
11
|
+
private readonly inner;
|
|
12
|
+
private readonly options;
|
|
13
|
+
onclose?: () => void;
|
|
14
|
+
onerror?: (error: Error) => void;
|
|
15
|
+
onmessage?: Transport['onmessage'];
|
|
16
|
+
private readonly inFlight;
|
|
17
|
+
/** `initialize` makes the connection session-era for good; a 2026-07-28 message first makes it stateless. */
|
|
18
|
+
private era;
|
|
19
|
+
constructor(inner: Transport, options: StdioRevisionRouterOptions);
|
|
20
|
+
start(): Promise<void>;
|
|
21
|
+
send(message: JSONRPCMessage, options?: SendOptions): Promise<void>;
|
|
22
|
+
close(): Promise<void>;
|
|
23
|
+
private route;
|
|
24
|
+
private servesModern;
|
|
25
|
+
private cancelsModernRequest;
|
|
26
|
+
private serveModern;
|
|
27
|
+
private runFlow;
|
|
28
|
+
private reply;
|
|
29
|
+
private cancelAll;
|
|
30
|
+
}
|
|
31
|
+
export {};
|
|
32
|
+
//# sourceMappingURL=stdio-revision-router.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stdio-revision-router.d.ts","sourceRoot":"","sources":["../../src/transport/stdio-revision-router.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,cAAc,EAInB,KAAK,SAAS,EACf,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,UAAU,CAAC;AAItC,KAAK,WAAW,GAAG,UAAU,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAGpD,MAAM,WAAW,0BAA0B;IACzC,KAAK,EAAE,KAAK,CAAC;IACb,8EAA8E;IAC9E,SAAS,EAAE,MAAM,CAAC;CACnB;AAoCD,qHAAqH;AACrH,qBAAa,mBAAoB,YAAW,SAAS;IAWjD,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,OAAO;IAX1B,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IACjC,SAAS,CAAC,EAAE,SAAS,CAAC,WAAW,CAAC,CAAC;IAEnC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAyC;IAElE,6GAA6G;IAC7G,OAAO,CAAC,GAAG,CAA8C;gBAGtC,KAAK,EAAE,SAAS,EAChB,OAAO,EAAE,0BAA0B;IAGhD,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAUtB,IAAI,CAAC,OAAO,EAAE,cAAc,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAMnE,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAK5B,OAAO,CAAC,KAAK;IAab,OAAO,CAAC,YAAY;IASpB,OAAO,CAAC,oBAAoB;YAcd,WAAW;YAkBX,OAAO;YAqBP,KAAK;IAenB,OAAO,CAAC,SAAS;CAIlB"}
|