@frontmcp/sdk 1.10.9-rc.3 → 1.10.9-rc.4
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/auth/auth-ui/auth-ui.render.d.ts.map +1 -1
- package/browser/auth/auth-ui/auth-ui.render.mjs +1 -4
- package/browser/builtin/config/providers/config-loader.mjs +1 -1
- package/browser/direct/direct-client.mjs +3 -6
- package/browser/esm-loader/semver.utils.mjs +9 -7
- package/browser/index.cjs +607 -578
- package/browser/skill/sep-2640/sep-2640.builders.mjs +1 -1
- package/browser/skill/skill-md-parser.mjs +1 -1
- package/browser/third-party/js-yaml.mjs +6 -0
- package/browser/third-party/semver.mjs +17 -0
- package/browser/third-party/uipack-render.mjs +6 -0
- package/browser/transport/adapters/transport.sse.adapter.mjs +17 -5
- package/browser/transport/in-memory-server.mjs +7 -15
- package/browser/transport/transport.registry.mjs +4 -1
- package/browser/transport/web-standard-mcp.mjs +1 -15
- package/builtin/config/providers/config-loader.d.ts.map +1 -1
- package/esm/index.mjs +17 -17
- package/esm-loader/semver.utils.d.ts.map +1 -1
- package/index.js +18 -18
- package/package.json +25 -10
- package/third-party/js-yaml.d.ts +2 -0
- package/third-party/js-yaml.d.ts.map +1 -0
- package/third-party/js-yaml.js +1 -0
- package/third-party/lazy-js-yaml.d.ts +2 -0
- package/third-party/lazy-js-yaml.d.ts.map +1 -0
- package/third-party/lazy-js-yaml.js +1 -0
- package/third-party/lazy-semver.d.ts +2 -0
- package/third-party/lazy-semver.d.ts.map +1 -0
- package/third-party/lazy-semver.js +1 -0
- package/third-party/lazy-uipack-render.d.ts +2 -0
- package/third-party/lazy-uipack-render.d.ts.map +1 -0
- package/third-party/lazy-uipack-render.js +1 -0
- package/third-party/semver.d.ts +8 -0
- package/third-party/semver.d.ts.map +1 -0
- package/third-party/semver.js +1 -0
- package/third-party/uipack-render.d.ts +2 -0
- package/third-party/uipack-render.d.ts.map +1 -0
- package/third-party/uipack-render.js +1 -0
- package/transport/adapters/transport.sse.adapter.d.ts +2 -1
- package/transport/adapters/transport.sse.adapter.d.ts.map +1 -1
- package/transport/in-memory-server.d.ts.map +1 -1
- package/transport/transport.registry.d.ts.map +1 -1
- package/transport/web-standard-mcp.d.ts.map +1 -1
package/browser/index.cjs
CHANGED
|
@@ -8354,24 +8354,6 @@ var init_skills_mcp_types = __esm({
|
|
|
8354
8354
|
}
|
|
8355
8355
|
});
|
|
8356
8356
|
|
|
8357
|
-
// libs/sdk/src/utils/dynamic-import.utils.ts
|
|
8358
|
-
async function importWithRequireFallback(dynamicImport, requireFallback) {
|
|
8359
|
-
try {
|
|
8360
|
-
return await dynamicImport();
|
|
8361
|
-
} catch (importError) {
|
|
8362
|
-
try {
|
|
8363
|
-
return requireFallback();
|
|
8364
|
-
} catch {
|
|
8365
|
-
throw importError;
|
|
8366
|
-
}
|
|
8367
|
-
}
|
|
8368
|
-
}
|
|
8369
|
-
var init_dynamic_import_utils = __esm({
|
|
8370
|
-
"libs/sdk/src/utils/dynamic-import.utils.ts"() {
|
|
8371
|
-
"use strict";
|
|
8372
|
-
}
|
|
8373
|
-
});
|
|
8374
|
-
|
|
8375
8357
|
// libs/sdk/src/common/availability/availability.utils.ts
|
|
8376
8358
|
function callSurfaceOf(ctx) {
|
|
8377
8359
|
const surface = ctx?.surface;
|
|
@@ -10851,13 +10833,9 @@ __export(in_memory_server_exports, {
|
|
|
10851
10833
|
createInMemoryServer: () => createInMemoryServer
|
|
10852
10834
|
});
|
|
10853
10835
|
async function createInMemoryServer(scope, options) {
|
|
10854
|
-
const { ElicitResultSchema: ElicitResultSchema3, ErrorCode, InMemoryTransport, McpError: McpError4, McpServer: McpServer3 } = await importWithRequireFallback(
|
|
10855
|
-
() => import("@frontmcp/protocol"),
|
|
10856
|
-
() => require("@frontmcp/protocol")
|
|
10857
|
-
);
|
|
10858
10836
|
const { createMcpHandlers: createMcpHandlers2 } = await Promise.resolve().then(() => (init_mcp_handlers(), mcp_handlers_exports));
|
|
10859
10837
|
const sessionId = options?.sessionId ?? `in-memory:${(0, import_utils32.randomUUID)()}`;
|
|
10860
|
-
const [clientTransport, serverTransport] = InMemoryTransport.createLinkedPair();
|
|
10838
|
+
const [clientTransport, serverTransport] = import_protocol28.InMemoryTransport.createLinkedPair();
|
|
10861
10839
|
let currentAuthInfo = options?.authInfo ?? {};
|
|
10862
10840
|
const elicitTransport = {
|
|
10863
10841
|
type: "in-memory",
|
|
@@ -10877,12 +10855,12 @@ async function createInMemoryServer(scope, options) {
|
|
|
10877
10855
|
method: "elicitation/create",
|
|
10878
10856
|
params: { ...requestParams, _meta: { [ELICITATION_META_KEY]: { elicitId, expiresAt } } }
|
|
10879
10857
|
},
|
|
10880
|
-
|
|
10858
|
+
import_protocol28.ElicitResultSchema,
|
|
10881
10859
|
{ relatedRequestId, timeout: ttl }
|
|
10882
10860
|
);
|
|
10883
10861
|
} catch (error) {
|
|
10884
10862
|
await scope.elicitationStore?.deletePending(sessionId);
|
|
10885
|
-
if (error instanceof
|
|
10863
|
+
if (error instanceof import_protocol28.McpError && error.code === import_protocol28.ErrorCode.RequestTimeout) {
|
|
10886
10864
|
throw new ElicitationTimeoutError(elicitId, ttl);
|
|
10887
10865
|
}
|
|
10888
10866
|
throw error;
|
|
@@ -10892,7 +10870,7 @@ async function createInMemoryServer(scope, options) {
|
|
|
10892
10870
|
}
|
|
10893
10871
|
};
|
|
10894
10872
|
const serverOptions = buildScopedServerOptions(scope);
|
|
10895
|
-
const mcpServer = new
|
|
10873
|
+
const mcpServer = new import_protocol28.McpServer(scope.metadata.info, serverOptions);
|
|
10896
10874
|
const composeInstructions = (caller) => composeCallerInstructions(scope, { ctx: caller, skillUriHints: true });
|
|
10897
10875
|
const handlers = createMcpHandlers2({ scope, serverOptions, composeInstructions });
|
|
10898
10876
|
for (const handler of handlers) {
|
|
@@ -10925,16 +10903,16 @@ async function createInMemoryServer(scope, options) {
|
|
|
10925
10903
|
}
|
|
10926
10904
|
};
|
|
10927
10905
|
}
|
|
10928
|
-
var import_lazy_zod43, import_utils32;
|
|
10906
|
+
var import_lazy_zod43, import_protocol28, import_utils32;
|
|
10929
10907
|
var init_in_memory_server = __esm({
|
|
10930
10908
|
"libs/sdk/src/transport/in-memory-server.ts"() {
|
|
10931
10909
|
"use strict";
|
|
10932
10910
|
import_lazy_zod43 = require("@frontmcp/lazy-zod");
|
|
10911
|
+
import_protocol28 = require("@frontmcp/protocol");
|
|
10933
10912
|
import_utils32 = require("@frontmcp/utils");
|
|
10934
10913
|
init_elicitation_meta();
|
|
10935
10914
|
init_errors();
|
|
10936
10915
|
init_skill_instructions_helper();
|
|
10937
|
-
init_dynamic_import_utils();
|
|
10938
10916
|
init_build_scoped_server_options();
|
|
10939
10917
|
}
|
|
10940
10918
|
});
|
|
@@ -10983,17 +10961,16 @@ function walkForFile(dir, targetRelative, fs, path, matches, maxDepth = 10) {
|
|
|
10983
10961
|
} catch {
|
|
10984
10962
|
}
|
|
10985
10963
|
}
|
|
10986
|
-
var
|
|
10964
|
+
var import_protocol29, import_utils33, DirectClientImpl;
|
|
10987
10965
|
var init_direct_client = __esm({
|
|
10988
10966
|
"libs/sdk/src/direct/direct-client.ts"() {
|
|
10989
10967
|
"use strict";
|
|
10990
|
-
|
|
10968
|
+
import_protocol29 = require("@frontmcp/protocol");
|
|
10991
10969
|
import_utils33 = require("@frontmcp/utils");
|
|
10992
10970
|
init_list_all_pages_utils();
|
|
10993
10971
|
init_elicitation_meta();
|
|
10994
10972
|
init_errors();
|
|
10995
10973
|
init_skills_mcp_types();
|
|
10996
|
-
init_dynamic_import_utils();
|
|
10997
10974
|
init_llm_platform();
|
|
10998
10975
|
DirectClientImpl = class _DirectClientImpl {
|
|
10999
10976
|
// Use a flexible type to handle dynamic import type differences between ESM/CJS
|
|
@@ -11062,7 +11039,7 @@ var init_direct_client = __esm({
|
|
|
11062
11039
|
...options?.capabilities
|
|
11063
11040
|
}
|
|
11064
11041
|
};
|
|
11065
|
-
const mcpClient = new
|
|
11042
|
+
const mcpClient = new import_protocol29.Client(clientInfo, clientCapabilities);
|
|
11066
11043
|
await mcpClient.connect(clientTransport);
|
|
11067
11044
|
const serverInfo = mcpClient.getServerVersion();
|
|
11068
11045
|
const serverCapabilities = mcpClient.getServerCapabilities();
|
|
@@ -11096,13 +11073,9 @@ var init_direct_client = __esm({
|
|
|
11096
11073
|
*/
|
|
11097
11074
|
async setupNotificationHandlers(mcpClient) {
|
|
11098
11075
|
try {
|
|
11099
|
-
const { ResourceUpdatedNotificationSchema, ElicitRequestSchema } = await importWithRequireFallback(
|
|
11100
|
-
() => import("@frontmcp/protocol"),
|
|
11101
|
-
() => require("@frontmcp/protocol")
|
|
11102
|
-
);
|
|
11103
11076
|
if (typeof mcpClient.setNotificationHandler === "function") {
|
|
11104
11077
|
mcpClient.setNotificationHandler(
|
|
11105
|
-
ResourceUpdatedNotificationSchema,
|
|
11078
|
+
import_protocol29.ResourceUpdatedNotificationSchema,
|
|
11106
11079
|
(notification) => {
|
|
11107
11080
|
const uri = notification.params?.uri;
|
|
11108
11081
|
if (uri) {
|
|
@@ -11123,7 +11096,7 @@ var init_direct_client = __esm({
|
|
|
11123
11096
|
};
|
|
11124
11097
|
}
|
|
11125
11098
|
if (typeof mcpClient.setRequestHandler === "function") {
|
|
11126
|
-
mcpClient.setRequestHandler(ElicitRequestSchema, async (request) => {
|
|
11099
|
+
mcpClient.setRequestHandler(import_protocol29.ElicitRequestSchema, async (request) => {
|
|
11127
11100
|
const params = request.params;
|
|
11128
11101
|
if (params) {
|
|
11129
11102
|
return this.handleElicitationRequestInternal(toElicitationRequest(params));
|
|
@@ -13171,14 +13144,14 @@ function linkedAbortController(signal) {
|
|
|
13171
13144
|
else signal?.addEventListener("abort", () => controller.abort(signal.reason), { once: true });
|
|
13172
13145
|
return controller;
|
|
13173
13146
|
}
|
|
13174
|
-
var import_auth23, import_guard5, import_lazy_zod46,
|
|
13147
|
+
var import_auth23, import_guard5, import_lazy_zod46, import_protocol30, import_utils37, inputSchema, outputSchema, stateSchema, plan, name, toolClassHooksJoin, Stage, resolvedTools, CallToolFlow;
|
|
13175
13148
|
var init_call_tool_flow = __esm({
|
|
13176
13149
|
"libs/sdk/src/tool/flows/call-tool.flow.ts"() {
|
|
13177
13150
|
"use strict";
|
|
13178
13151
|
import_auth23 = require("@frontmcp/auth");
|
|
13179
13152
|
import_guard5 = require("@frontmcp/guard");
|
|
13180
13153
|
import_lazy_zod46 = require("@frontmcp/lazy-zod");
|
|
13181
|
-
|
|
13154
|
+
import_protocol30 = require("@frontmcp/protocol");
|
|
13182
13155
|
import_utils37 = require("@frontmcp/utils");
|
|
13183
13156
|
init_remote_capabilities_utils();
|
|
13184
13157
|
init_authorized_apps_utils();
|
|
@@ -13205,11 +13178,11 @@ var init_call_tool_flow = __esm({
|
|
|
13205
13178
|
init_ui_shared();
|
|
13206
13179
|
init_tool_credentials_gate();
|
|
13207
13180
|
inputSchema = import_lazy_zod46.z.object({
|
|
13208
|
-
request:
|
|
13181
|
+
request: import_protocol30.CallToolRequestSchema,
|
|
13209
13182
|
// z.any() used because ctx is the MCP SDK's ToolCallExtra type which varies by SDK version
|
|
13210
13183
|
ctx: import_lazy_zod46.z.any()
|
|
13211
13184
|
});
|
|
13212
|
-
outputSchema =
|
|
13185
|
+
outputSchema = import_protocol30.CallToolResultSchema;
|
|
13213
13186
|
stateSchema = import_lazy_zod46.z.object({
|
|
13214
13187
|
input: import_lazy_zod46.z.looseObject({
|
|
13215
13188
|
name: import_lazy_zod46.z.string().min(1).max(64),
|
|
@@ -14914,17 +14887,17 @@ async function registerRuntimeTool(scope, definition) {
|
|
|
14914
14887
|
appTools.unregisterToolInstance(provide);
|
|
14915
14888
|
};
|
|
14916
14889
|
}
|
|
14917
|
-
var
|
|
14890
|
+
var import_protocol31, import_utils39, MAX_TOOL_NAME_LENGTH, listedInputSchema;
|
|
14918
14891
|
var init_runtime_tools = __esm({
|
|
14919
14892
|
"libs/sdk/src/direct/runtime-tools.ts"() {
|
|
14920
14893
|
"use strict";
|
|
14921
|
-
|
|
14894
|
+
import_protocol31 = require("@frontmcp/protocol");
|
|
14922
14895
|
import_utils39 = require("@frontmcp/utils");
|
|
14923
14896
|
init_common();
|
|
14924
14897
|
init_errors();
|
|
14925
14898
|
init_tool_instance();
|
|
14926
14899
|
MAX_TOOL_NAME_LENGTH = 64;
|
|
14927
|
-
listedInputSchema =
|
|
14900
|
+
listedInputSchema = import_protocol31.ToolSchema.shape.inputSchema;
|
|
14928
14901
|
}
|
|
14929
14902
|
});
|
|
14930
14903
|
|
|
@@ -15992,13 +15965,13 @@ var init_utils2 = __esm({
|
|
|
15992
15965
|
function findPromptForGet(prompts, name48) {
|
|
15993
15966
|
return prompts.findByName(name48) ?? prompts.getPrompts(true).find((entry) => entry.fullName === name48);
|
|
15994
15967
|
}
|
|
15995
|
-
var import_auth24, import_lazy_zod49,
|
|
15968
|
+
var import_auth24, import_lazy_zod49, import_protocol32, inputSchema2, outputSchema2, stateSchema2, plan2, name2, promptClassHooksJoin, Stage2, resolvedPrompts, GetPromptFlow;
|
|
15996
15969
|
var init_get_prompt_flow = __esm({
|
|
15997
15970
|
"libs/sdk/src/prompt/flows/get-prompt.flow.ts"() {
|
|
15998
15971
|
"use strict";
|
|
15999
15972
|
import_auth24 = require("@frontmcp/auth");
|
|
16000
15973
|
import_lazy_zod49 = require("@frontmcp/lazy-zod");
|
|
16001
|
-
|
|
15974
|
+
import_protocol32 = require("@frontmcp/protocol");
|
|
16002
15975
|
init_remote_capabilities_utils();
|
|
16003
15976
|
init_public_access_utils();
|
|
16004
15977
|
init_common();
|
|
@@ -16010,11 +15983,11 @@ var init_get_prompt_flow = __esm({
|
|
|
16010
15983
|
init_flow_context_providers();
|
|
16011
15984
|
init_lineage_utils();
|
|
16012
15985
|
inputSchema2 = import_lazy_zod49.z.object({
|
|
16013
|
-
request:
|
|
15986
|
+
request: import_protocol32.GetPromptRequestSchema,
|
|
16014
15987
|
// z.any() used because ctx is the MCP SDK's PromptGetExtra type which varies by SDK version
|
|
16015
15988
|
ctx: import_lazy_zod49.z.any()
|
|
16016
15989
|
});
|
|
16017
|
-
outputSchema2 =
|
|
15990
|
+
outputSchema2 = import_protocol32.GetPromptResultSchema;
|
|
16018
15991
|
stateSchema2 = import_lazy_zod49.z.object({
|
|
16019
15992
|
input: import_lazy_zod49.z.object({
|
|
16020
15993
|
name: import_lazy_zod49.z.string().min(1),
|
|
@@ -16319,22 +16292,22 @@ var init_get_prompt_flow = __esm({
|
|
|
16319
16292
|
});
|
|
16320
16293
|
|
|
16321
16294
|
// libs/sdk/src/prompt/flows/prompts-list.flow.ts
|
|
16322
|
-
var import_reflect_metadata4, import_lazy_zod50,
|
|
16295
|
+
var import_reflect_metadata4, import_lazy_zod50, import_protocol33, inputSchema3, outputSchema3, stateSchema3, plan3, name3, Stage3, PromptsListFlow;
|
|
16323
16296
|
var init_prompts_list_flow = __esm({
|
|
16324
16297
|
"libs/sdk/src/prompt/flows/prompts-list.flow.ts"() {
|
|
16325
16298
|
"use strict";
|
|
16326
16299
|
init_common();
|
|
16327
16300
|
import_reflect_metadata4 = require("reflect-metadata");
|
|
16328
16301
|
import_lazy_zod50 = require("@frontmcp/lazy-zod");
|
|
16329
|
-
|
|
16302
|
+
import_protocol33 = require("@frontmcp/protocol");
|
|
16330
16303
|
init_public_access_utils();
|
|
16331
16304
|
init_availability();
|
|
16332
16305
|
init_errors();
|
|
16333
16306
|
inputSchema3 = import_lazy_zod50.z.object({
|
|
16334
|
-
request:
|
|
16307
|
+
request: import_protocol33.ListPromptsRequestSchema,
|
|
16335
16308
|
ctx: import_lazy_zod50.z.unknown()
|
|
16336
16309
|
});
|
|
16337
|
-
outputSchema3 =
|
|
16310
|
+
outputSchema3 = import_protocol33.ListPromptsResultSchema;
|
|
16338
16311
|
stateSchema3 = import_lazy_zod50.z.object({
|
|
16339
16312
|
cursor: import_lazy_zod50.z.string().optional(),
|
|
16340
16313
|
prompts: import_lazy_zod50.z.array(
|
|
@@ -16690,11 +16663,11 @@ var init_prompt_utils = __esm({
|
|
|
16690
16663
|
});
|
|
16691
16664
|
|
|
16692
16665
|
// libs/sdk/src/prompt/prompt.instance.ts
|
|
16693
|
-
var
|
|
16666
|
+
var import_protocol34, PromptInstance, FunctionPromptContext;
|
|
16694
16667
|
var init_prompt_instance = __esm({
|
|
16695
16668
|
"libs/sdk/src/prompt/prompt.instance.ts"() {
|
|
16696
16669
|
"use strict";
|
|
16697
|
-
|
|
16670
|
+
import_protocol34 = require("@frontmcp/protocol");
|
|
16698
16671
|
init_common();
|
|
16699
16672
|
init_errors();
|
|
16700
16673
|
init_entry_class_hooks();
|
|
@@ -16794,7 +16767,7 @@ var init_prompt_instance = __esm({
|
|
|
16794
16767
|
* Convert the raw prompt return value into an MCP GetPromptResult.
|
|
16795
16768
|
*/
|
|
16796
16769
|
parseOutput(raw) {
|
|
16797
|
-
return
|
|
16770
|
+
return import_protocol34.GetPromptResultSchema.parse(buildParsedPromptResult(raw, this.metadata));
|
|
16798
16771
|
}
|
|
16799
16772
|
/**
|
|
16800
16773
|
* Safe version of parseOutput that returns success/error instead of throwing.
|
|
@@ -17524,6 +17497,21 @@ var init_esm_auth_types = __esm({
|
|
|
17524
17497
|
}
|
|
17525
17498
|
});
|
|
17526
17499
|
|
|
17500
|
+
// libs/sdk/src/third-party/semver.ts
|
|
17501
|
+
var import_compare, import_gt, import_rcompare, import_satisfies, import_valid, import_max_satisfying, import_valid2;
|
|
17502
|
+
var init_semver = __esm({
|
|
17503
|
+
"libs/sdk/src/third-party/semver.ts"() {
|
|
17504
|
+
"use strict";
|
|
17505
|
+
import_compare = __toESM(require("semver/functions/compare.js"));
|
|
17506
|
+
import_gt = __toESM(require("semver/functions/gt.js"));
|
|
17507
|
+
import_rcompare = __toESM(require("semver/functions/rcompare.js"));
|
|
17508
|
+
import_satisfies = __toESM(require("semver/functions/satisfies.js"));
|
|
17509
|
+
import_valid = __toESM(require("semver/functions/valid.js"));
|
|
17510
|
+
import_max_satisfying = __toESM(require("semver/ranges/max-satisfying.js"));
|
|
17511
|
+
import_valid2 = __toESM(require("semver/ranges/valid.js"));
|
|
17512
|
+
}
|
|
17513
|
+
});
|
|
17514
|
+
|
|
17527
17515
|
// libs/sdk/src/esm-loader/semver.utils.ts
|
|
17528
17516
|
function isDistTag(range) {
|
|
17529
17517
|
return /^[a-zA-Z][a-zA-Z0-9]*$/.test(range) && (0, import_valid2.default)(range) === null;
|
|
@@ -17552,17 +17540,10 @@ function compareVersions(v1, v2) {
|
|
|
17552
17540
|
function isNewerVersion(v1, v2) {
|
|
17553
17541
|
return (0, import_gt.default)(v1, v2);
|
|
17554
17542
|
}
|
|
17555
|
-
var import_compare, import_gt, import_rcompare, import_satisfies, import_valid, import_max_satisfying, import_valid2;
|
|
17556
17543
|
var init_semver_utils = __esm({
|
|
17557
17544
|
"libs/sdk/src/esm-loader/semver.utils.ts"() {
|
|
17558
17545
|
"use strict";
|
|
17559
|
-
|
|
17560
|
-
import_gt = __toESM(require("semver/functions/gt.js"));
|
|
17561
|
-
import_rcompare = __toESM(require("semver/functions/rcompare.js"));
|
|
17562
|
-
import_satisfies = __toESM(require("semver/functions/satisfies.js"));
|
|
17563
|
-
import_valid = __toESM(require("semver/functions/valid.js"));
|
|
17564
|
-
import_max_satisfying = __toESM(require("semver/ranges/max-satisfying.js"));
|
|
17565
|
-
import_valid2 = __toESM(require("semver/ranges/valid.js"));
|
|
17546
|
+
init_semver();
|
|
17566
17547
|
}
|
|
17567
17548
|
});
|
|
17568
17549
|
|
|
@@ -18075,17 +18056,17 @@ function loadPackageOnce(scope, specifier, options) {
|
|
|
18075
18056
|
const packageLoader = options?.loader ?? scope.metadata.loader;
|
|
18076
18057
|
const loaderFingerprint = (0, import_utils48.sha256Hex)(JSON.stringify({ packageLoader, cacheTTL: options?.cacheTTL })).slice(0, 16);
|
|
18077
18058
|
const key = `${specifier.fullName}@${specifier.range}#${loaderFingerprint}`;
|
|
18078
|
-
let
|
|
18079
|
-
if (!
|
|
18059
|
+
let load2 = loads.get(key);
|
|
18060
|
+
if (!load2) {
|
|
18080
18061
|
const loader = createPackageModuleLoader({
|
|
18081
18062
|
loader: packageLoader,
|
|
18082
18063
|
cacheTTL: options?.cacheTTL,
|
|
18083
18064
|
logger: scope.logger
|
|
18084
18065
|
});
|
|
18085
|
-
|
|
18086
|
-
loads.set(key,
|
|
18066
|
+
load2 = loader.load(specifier);
|
|
18067
|
+
loads.set(key, load2);
|
|
18087
18068
|
}
|
|
18088
|
-
return
|
|
18069
|
+
return load2;
|
|
18089
18070
|
}
|
|
18090
18071
|
async function loadEsmEntries(scope, entryKind, source, recordsOf) {
|
|
18091
18072
|
const { manifest } = await loadPackageOnce(scope, source.specifier, source.options).catch((error) => {
|
|
@@ -18312,7 +18293,7 @@ function readParamHeaders(headers) {
|
|
|
18312
18293
|
}
|
|
18313
18294
|
function metaProtocolVersion(body) {
|
|
18314
18295
|
const meta = body?.params?._meta;
|
|
18315
|
-
const value = meta?.[
|
|
18296
|
+
const value = meta?.[import_protocol35.MCP_20260728_META.protocolVersion];
|
|
18316
18297
|
return typeof value === "string" ? value : void 0;
|
|
18317
18298
|
}
|
|
18318
18299
|
function declaresProtocol20260728(params) {
|
|
@@ -18342,7 +18323,7 @@ function headerMismatch(message) {
|
|
|
18342
18323
|
return {
|
|
18343
18324
|
ok: false,
|
|
18344
18325
|
status: 400,
|
|
18345
|
-
error: { code:
|
|
18326
|
+
error: { code: import_protocol35.MCP_20260728_ERROR_CODES.headerMismatch, message: `Header mismatch: ${message}` }
|
|
18346
18327
|
};
|
|
18347
18328
|
}
|
|
18348
18329
|
function collectHeaderParams(schema, path = [], out = /* @__PURE__ */ new Map()) {
|
|
@@ -18385,7 +18366,7 @@ function validate20260728Request(options) {
|
|
|
18385
18366
|
return (headerVersion ? versionSupported(headerVersion) : void 0) ?? { ok: true, version };
|
|
18386
18367
|
}
|
|
18387
18368
|
if (!bodyVersion && strictHeaders) {
|
|
18388
|
-
return headerMismatch(`request params._meta must declare "${
|
|
18369
|
+
return headerMismatch(`request params._meta must declare "${import_protocol35.MCP_20260728_META.protocolVersion}"`);
|
|
18389
18370
|
}
|
|
18390
18371
|
if (headerVersion && bodyVersion && headerVersion !== bodyVersion) {
|
|
18391
18372
|
return headerMismatch(
|
|
@@ -18441,7 +18422,7 @@ function versionSupported(version) {
|
|
|
18441
18422
|
ok: false,
|
|
18442
18423
|
status: 400,
|
|
18443
18424
|
error: {
|
|
18444
|
-
code:
|
|
18425
|
+
code: import_protocol35.MCP_20260728_ERROR_CODES.unsupportedProtocolVersion,
|
|
18445
18426
|
message: `Unsupported protocol version: ${version}`,
|
|
18446
18427
|
data: { supported: [...FRONTMCP_SUPPORTED_PROTOCOL_VERSIONS], requested: version }
|
|
18447
18428
|
}
|
|
@@ -18484,14 +18465,14 @@ function validateParamHeaders(headers, params, lookupToolSchema, strictHeaders)
|
|
|
18484
18465
|
}
|
|
18485
18466
|
return void 0;
|
|
18486
18467
|
}
|
|
18487
|
-
var
|
|
18468
|
+
var import_protocol35, IMPLEMENTED_PROTOCOL_VERSION;
|
|
18488
18469
|
var init_request_validation = __esm({
|
|
18489
18470
|
"libs/sdk/src/transport/mcp-20260728/request-validation.ts"() {
|
|
18490
18471
|
"use strict";
|
|
18491
|
-
|
|
18472
|
+
import_protocol35 = require("@frontmcp/protocol");
|
|
18492
18473
|
init_header_codec();
|
|
18493
18474
|
init_protocol_20260728_constants();
|
|
18494
|
-
IMPLEMENTED_PROTOCOL_VERSION =
|
|
18475
|
+
IMPLEMENTED_PROTOCOL_VERSION = import_protocol35.PROTOCOL_2026_07_28;
|
|
18495
18476
|
}
|
|
18496
18477
|
});
|
|
18497
18478
|
|
|
@@ -18689,7 +18670,7 @@ function decorateResult(result, options) {
|
|
|
18689
18670
|
_meta: {
|
|
18690
18671
|
...existingMeta,
|
|
18691
18672
|
...traceContext ?? {},
|
|
18692
|
-
[
|
|
18673
|
+
[import_protocol36.MCP_20260728_META.serverInfo]: serverInfo
|
|
18693
18674
|
}
|
|
18694
18675
|
};
|
|
18695
18676
|
if (CACHEABLE_METHODS.includes(method)) {
|
|
@@ -18719,11 +18700,11 @@ function isShapedPerCaller(scope, method) {
|
|
|
18719
18700
|
function resolveCacheScope(isAnonymous, shapedPerCaller = true) {
|
|
18720
18701
|
return isAnonymous && !shapedPerCaller ? "public" : "private";
|
|
18721
18702
|
}
|
|
18722
|
-
var
|
|
18703
|
+
var import_protocol36, ORDERED_LIST_FIELDS, RESULT_SHAPING_FLOWS;
|
|
18723
18704
|
var init_result_decorator = __esm({
|
|
18724
18705
|
"libs/sdk/src/transport/mcp-20260728/result-decorator.ts"() {
|
|
18725
18706
|
"use strict";
|
|
18726
|
-
|
|
18707
|
+
import_protocol36 = require("@frontmcp/protocol");
|
|
18727
18708
|
init_protocol_20260728_constants();
|
|
18728
18709
|
ORDERED_LIST_FIELDS = {
|
|
18729
18710
|
"tools/list": "tools",
|
|
@@ -19094,10 +19075,10 @@ function createSubscriptionStream(options) {
|
|
|
19094
19075
|
try {
|
|
19095
19076
|
yield frame({
|
|
19096
19077
|
jsonrpc: "2.0",
|
|
19097
|
-
method:
|
|
19078
|
+
method: import_protocol37.SUBSCRIPTIONS_ACKNOWLEDGED_METHOD,
|
|
19098
19079
|
params: {
|
|
19099
19080
|
notifications: acknowledged,
|
|
19100
|
-
_meta: { [
|
|
19081
|
+
_meta: { [import_protocol37.MCP_20260728_META.subscriptionId]: subscriptionId }
|
|
19101
19082
|
}
|
|
19102
19083
|
});
|
|
19103
19084
|
for (; ; ) {
|
|
@@ -19108,7 +19089,7 @@ function createSubscriptionStream(options) {
|
|
|
19108
19089
|
method: next.method,
|
|
19109
19090
|
params: {
|
|
19110
19091
|
...next.params,
|
|
19111
|
-
_meta: { [
|
|
19092
|
+
_meta: { [import_protocol37.MCP_20260728_META.subscriptionId]: subscriptionId }
|
|
19112
19093
|
}
|
|
19113
19094
|
});
|
|
19114
19095
|
}
|
|
@@ -19132,11 +19113,11 @@ function createSubscriptionStream(options) {
|
|
|
19132
19113
|
}
|
|
19133
19114
|
return { acknowledged, stream: generate() };
|
|
19134
19115
|
}
|
|
19135
|
-
var
|
|
19116
|
+
var import_protocol37, KEEPALIVE_INTERVAL_MS, encoder2, KEEPALIVE_FRAME;
|
|
19136
19117
|
var init_subscriptions = __esm({
|
|
19137
19118
|
"libs/sdk/src/transport/mcp-20260728/subscriptions.ts"() {
|
|
19138
19119
|
"use strict";
|
|
19139
|
-
|
|
19120
|
+
import_protocol37 = require("@frontmcp/protocol");
|
|
19140
19121
|
init_channel_utils();
|
|
19141
19122
|
KEEPALIVE_INTERVAL_MS = 15e3;
|
|
19142
19123
|
encoder2 = new TextEncoder();
|
|
@@ -19327,7 +19308,7 @@ function toJsonRpcError(error) {
|
|
|
19327
19308
|
return {
|
|
19328
19309
|
status: 400,
|
|
19329
19310
|
error: {
|
|
19330
|
-
code:
|
|
19311
|
+
code: import_protocol38.MCP_20260728_ERROR_CODES.missingRequiredClientCapability,
|
|
19331
19312
|
message: error.getPublicMessage(),
|
|
19332
19313
|
data: { requiredCapabilities: error.requiredCapabilities }
|
|
19333
19314
|
}
|
|
@@ -19366,7 +19347,7 @@ async function dispatch20260728(options) {
|
|
|
19366
19347
|
const cacheScope = resolveCacheScope(isAnonymous, isShapedPerCaller(scope, method));
|
|
19367
19348
|
const serverInfo = scope.metadata.info;
|
|
19368
19349
|
const decorate = (raw) => decorateResult(orderListResult(method, raw), { method, serverInfo, cacheScope, traceContext });
|
|
19369
|
-
if (
|
|
19350
|
+
if (import_protocol38.MCP_20260728_REMOVED_METHODS.includes(method)) {
|
|
19370
19351
|
return {
|
|
19371
19352
|
kind: "error",
|
|
19372
19353
|
status: 404,
|
|
@@ -19379,7 +19360,7 @@ async function dispatch20260728(options) {
|
|
|
19379
19360
|
kind: "error",
|
|
19380
19361
|
status: 400,
|
|
19381
19362
|
error: {
|
|
19382
|
-
code:
|
|
19363
|
+
code: import_protocol38.MCP_20260728_ERROR_CODES.missingRequiredClientCapability,
|
|
19383
19364
|
message: `${method} requires the ${TASKS_EXTENSION_ID} extension`,
|
|
19384
19365
|
data: { requiredCapabilities: { extensions: { [TASKS_EXTENSION_ID]: {} } } }
|
|
19385
19366
|
}
|
|
@@ -19452,7 +19433,7 @@ async function dispatch20260728(options) {
|
|
|
19452
19433
|
authInfo: taskDecision.kind === "create" ? { ...authInfo ?? {}, sessionId: taskDecision.owner } : authInfo,
|
|
19453
19434
|
sendNotification: async () => void 0,
|
|
19454
19435
|
sendRequest: async () => {
|
|
19455
|
-
throw new
|
|
19436
|
+
throw new import_protocol38.McpError(-32603, "Server-initiated requests were removed in protocol 2026-07-28; use MRTR");
|
|
19456
19437
|
}
|
|
19457
19438
|
};
|
|
19458
19439
|
try {
|
|
@@ -19480,12 +19461,12 @@ async function dispatch20260728(options) {
|
|
|
19480
19461
|
return { kind: "error", status: mapped.status, error: mapped.error };
|
|
19481
19462
|
}
|
|
19482
19463
|
}
|
|
19483
|
-
var import_auth25,
|
|
19464
|
+
var import_auth25, import_protocol38, import_utils50, MRTR_CAPABLE_METHODS;
|
|
19484
19465
|
var init_dispatcher = __esm({
|
|
19485
19466
|
"libs/sdk/src/transport/mcp-20260728/dispatcher.ts"() {
|
|
19486
19467
|
"use strict";
|
|
19487
19468
|
import_auth25 = require("@frontmcp/auth");
|
|
19488
|
-
|
|
19469
|
+
import_protocol38 = require("@frontmcp/protocol");
|
|
19489
19470
|
import_utils50 = require("@frontmcp/utils");
|
|
19490
19471
|
init_errors();
|
|
19491
19472
|
init_build_scoped_server_options();
|
|
@@ -19585,11 +19566,11 @@ function retryAfterMsOf(header) {
|
|
|
19585
19566
|
const ms = Number.isNaN(seconds) ? Date.parse(header) - Date.now() : seconds * 1e3;
|
|
19586
19567
|
return Number.isNaN(ms) ? void 0 : Math.max(0, ms);
|
|
19587
19568
|
}
|
|
19588
|
-
var
|
|
19569
|
+
var import_protocol39, McpStatelessError, DEFAULT_CLIENT_INFO, McpStatelessClient, TASKS_CLIENT_CAPABILITY;
|
|
19589
19570
|
var init_mcp_stateless_client = __esm({
|
|
19590
19571
|
"libs/sdk/src/transport/mcp-20260728/client/mcp-stateless.client.ts"() {
|
|
19591
19572
|
"use strict";
|
|
19592
|
-
|
|
19573
|
+
import_protocol39 = require("@frontmcp/protocol");
|
|
19593
19574
|
init_list_all_pages_utils();
|
|
19594
19575
|
init_header_codec();
|
|
19595
19576
|
init_protocol_20260728_constants();
|
|
@@ -19851,16 +19832,16 @@ var init_mcp_stateless_client = __esm({
|
|
|
19851
19832
|
/** Assemble the JSON-RPC body and its mirrored HTTP headers. */
|
|
19852
19833
|
buildRequest(method, params, id) {
|
|
19853
19834
|
const meta = {
|
|
19854
|
-
[
|
|
19855
|
-
[
|
|
19856
|
-
[
|
|
19835
|
+
[import_protocol39.MCP_20260728_META.protocolVersion]: import_protocol39.PROTOCOL_2026_07_28,
|
|
19836
|
+
[import_protocol39.MCP_20260728_META.clientInfo]: this.options.clientInfo ?? DEFAULT_CLIENT_INFO,
|
|
19837
|
+
[import_protocol39.MCP_20260728_META.clientCapabilities]: this.options.capabilities ?? {}
|
|
19857
19838
|
};
|
|
19858
|
-
if (this.options.logLevel) meta[
|
|
19839
|
+
if (this.options.logLevel) meta[import_protocol39.MCP_20260728_META.logLevel] = this.options.logLevel;
|
|
19859
19840
|
const body = { jsonrpc: "2.0", id, method, params: { ...params, _meta: meta } };
|
|
19860
19841
|
const headers = {
|
|
19861
19842
|
"content-type": "application/json",
|
|
19862
19843
|
accept: "application/json, text/event-stream",
|
|
19863
|
-
"MCP-Protocol-Version":
|
|
19844
|
+
"MCP-Protocol-Version": import_protocol39.PROTOCOL_2026_07_28,
|
|
19864
19845
|
"Mcp-Method": method,
|
|
19865
19846
|
...this.options.headers ?? {}
|
|
19866
19847
|
};
|
|
@@ -20586,12 +20567,12 @@ var init_resilience = __esm({
|
|
|
20586
20567
|
});
|
|
20587
20568
|
|
|
20588
20569
|
// libs/sdk/src/remote-mcp/mcp-client.service.ts
|
|
20589
|
-
var import_auth26,
|
|
20570
|
+
var import_auth26, import_protocol40, DEFAULT_RETRY_OPTIONS2, DEFAULT_CIRCUIT_BREAKER_OPTIONS, DEFAULT_HEALTH_CHECK_OPTIONS, DEFAULT_OPTIONS3, McpClientService;
|
|
20590
20571
|
var init_mcp_client_service = __esm({
|
|
20591
20572
|
"libs/sdk/src/remote-mcp/mcp-client.service.ts"() {
|
|
20592
20573
|
"use strict";
|
|
20593
20574
|
import_auth26 = require("@frontmcp/auth");
|
|
20594
|
-
|
|
20575
|
+
import_protocol40 = require("@frontmcp/protocol");
|
|
20595
20576
|
init_list_all_pages_utils();
|
|
20596
20577
|
init_mcp_error();
|
|
20597
20578
|
init_remote_errors();
|
|
@@ -20700,7 +20681,7 @@ var init_mcp_client_service = __esm({
|
|
|
20700
20681
|
return connection2026;
|
|
20701
20682
|
}
|
|
20702
20683
|
let transport = this.createTransport(request, headers);
|
|
20703
|
-
const client = new
|
|
20684
|
+
const client = new import_protocol40.Client(
|
|
20704
20685
|
{
|
|
20705
20686
|
name: this.options.clientName,
|
|
20706
20687
|
version: this.options.clientVersion
|
|
@@ -21194,9 +21175,9 @@ var init_mcp_client_service = __esm({
|
|
|
21194
21175
|
};
|
|
21195
21176
|
switch (transportType) {
|
|
21196
21177
|
case "http":
|
|
21197
|
-
return new
|
|
21178
|
+
return new import_protocol40.StreamableHTTPClientTransport(new URL(url), options);
|
|
21198
21179
|
case "sse":
|
|
21199
|
-
return new
|
|
21180
|
+
return new import_protocol40.SSEClientTransport(new URL(url), options);
|
|
21200
21181
|
case "worker":
|
|
21201
21182
|
case "npm":
|
|
21202
21183
|
case "esm":
|
|
@@ -21209,7 +21190,7 @@ var init_mcp_client_service = __esm({
|
|
|
21209
21190
|
* Create fallback SSE transport when Streamable HTTP fails
|
|
21210
21191
|
*/
|
|
21211
21192
|
createFallbackSSETransport(request, headers) {
|
|
21212
|
-
return new
|
|
21193
|
+
return new import_protocol40.SSEClientTransport(new URL(request.url), {
|
|
21213
21194
|
requestInit: headers ? { headers } : void 0,
|
|
21214
21195
|
fetch: createRemoteRequestFetch(headers !== void 0)
|
|
21215
21196
|
});
|
|
@@ -22255,13 +22236,13 @@ var init_ui_resource_handler = __esm({
|
|
|
22255
22236
|
});
|
|
22256
22237
|
|
|
22257
22238
|
// libs/sdk/src/resource/flows/read-resource.flow.ts
|
|
22258
|
-
var import_auth27, import_lazy_zod54,
|
|
22239
|
+
var import_auth27, import_lazy_zod54, import_protocol41, import_utils55, inputSchema4, outputSchema4, stateSchema4, plan4, name4, resourceClassHooksJoin, Stage4, resolvedResources, ReadResourceFlow;
|
|
22259
22240
|
var init_read_resource_flow = __esm({
|
|
22260
22241
|
"libs/sdk/src/resource/flows/read-resource.flow.ts"() {
|
|
22261
22242
|
"use strict";
|
|
22262
22243
|
import_auth27 = require("@frontmcp/auth");
|
|
22263
22244
|
import_lazy_zod54 = require("@frontmcp/lazy-zod");
|
|
22264
|
-
|
|
22245
|
+
import_protocol41 = require("@frontmcp/protocol");
|
|
22265
22246
|
import_utils55 = require("@frontmcp/utils");
|
|
22266
22247
|
init_remote_capabilities_utils();
|
|
22267
22248
|
init_common();
|
|
@@ -22274,11 +22255,11 @@ var init_read_resource_flow = __esm({
|
|
|
22274
22255
|
init_ui_shared();
|
|
22275
22256
|
init_lineage_utils();
|
|
22276
22257
|
inputSchema4 = import_lazy_zod54.z.object({
|
|
22277
|
-
request:
|
|
22258
|
+
request: import_protocol41.ReadResourceRequestSchema,
|
|
22278
22259
|
// z.any() used because ctx is the MCP SDK's ResourceReadExtra type which varies by SDK version
|
|
22279
22260
|
ctx: import_lazy_zod54.z.any()
|
|
22280
22261
|
});
|
|
22281
|
-
outputSchema4 =
|
|
22262
|
+
outputSchema4 = import_protocol41.ReadResourceResultSchema;
|
|
22282
22263
|
stateSchema4 = import_lazy_zod54.z.object({
|
|
22283
22264
|
input: import_lazy_zod54.z.object({
|
|
22284
22265
|
uri: import_lazy_zod54.z.string().min(1)
|
|
@@ -22617,21 +22598,21 @@ var init_read_resource_flow = __esm({
|
|
|
22617
22598
|
});
|
|
22618
22599
|
|
|
22619
22600
|
// libs/sdk/src/resource/flows/resource-templates-list.flow.ts
|
|
22620
|
-
var import_reflect_metadata7, import_lazy_zod55,
|
|
22601
|
+
var import_reflect_metadata7, import_lazy_zod55, import_protocol42, inputSchema5, outputSchema5, stateSchema5, plan5, name5, Stage5, ResourceTemplatesListFlow;
|
|
22621
22602
|
var init_resource_templates_list_flow = __esm({
|
|
22622
22603
|
"libs/sdk/src/resource/flows/resource-templates-list.flow.ts"() {
|
|
22623
22604
|
"use strict";
|
|
22624
22605
|
init_common();
|
|
22625
22606
|
import_reflect_metadata7 = require("reflect-metadata");
|
|
22626
22607
|
import_lazy_zod55 = require("@frontmcp/lazy-zod");
|
|
22627
|
-
|
|
22608
|
+
import_protocol42 = require("@frontmcp/protocol");
|
|
22628
22609
|
init_availability();
|
|
22629
22610
|
init_errors();
|
|
22630
22611
|
inputSchema5 = import_lazy_zod55.z.object({
|
|
22631
|
-
request:
|
|
22612
|
+
request: import_protocol42.ListResourceTemplatesRequestSchema,
|
|
22632
22613
|
ctx: import_lazy_zod55.z.unknown()
|
|
22633
22614
|
});
|
|
22634
|
-
outputSchema5 =
|
|
22615
|
+
outputSchema5 = import_protocol42.ListResourceTemplatesResultSchema;
|
|
22635
22616
|
stateSchema5 = import_lazy_zod55.z.object({
|
|
22636
22617
|
cursor: import_lazy_zod55.z.string().optional(),
|
|
22637
22618
|
templates: import_lazy_zod55.z.array(
|
|
@@ -22855,21 +22836,21 @@ var init_resource_templates_list_flow = __esm({
|
|
|
22855
22836
|
});
|
|
22856
22837
|
|
|
22857
22838
|
// libs/sdk/src/resource/flows/resources-list.flow.ts
|
|
22858
|
-
var import_reflect_metadata8, import_lazy_zod56,
|
|
22839
|
+
var import_reflect_metadata8, import_lazy_zod56, import_protocol43, inputSchema6, outputSchema6, stateSchema6, plan6, name6, Stage6, ResourcesListFlow;
|
|
22859
22840
|
var init_resources_list_flow = __esm({
|
|
22860
22841
|
"libs/sdk/src/resource/flows/resources-list.flow.ts"() {
|
|
22861
22842
|
"use strict";
|
|
22862
22843
|
init_common();
|
|
22863
22844
|
import_reflect_metadata8 = require("reflect-metadata");
|
|
22864
22845
|
import_lazy_zod56 = require("@frontmcp/lazy-zod");
|
|
22865
|
-
|
|
22846
|
+
import_protocol43 = require("@frontmcp/protocol");
|
|
22866
22847
|
init_availability();
|
|
22867
22848
|
init_errors();
|
|
22868
22849
|
inputSchema6 = import_lazy_zod56.z.object({
|
|
22869
|
-
request:
|
|
22850
|
+
request: import_protocol43.ListResourcesRequestSchema,
|
|
22870
22851
|
ctx: import_lazy_zod56.z.unknown()
|
|
22871
22852
|
});
|
|
22872
|
-
outputSchema6 =
|
|
22853
|
+
outputSchema6 = import_protocol43.ListResourcesResultSchema;
|
|
22873
22854
|
stateSchema6 = import_lazy_zod56.z.object({
|
|
22874
22855
|
cursor: import_lazy_zod56.z.string().optional(),
|
|
22875
22856
|
resources: import_lazy_zod56.z.array(
|
|
@@ -23114,12 +23095,12 @@ var init_resources_list_flow = __esm({
|
|
|
23114
23095
|
});
|
|
23115
23096
|
|
|
23116
23097
|
// libs/sdk/src/resource/flows/subscribe-resource.flow.ts
|
|
23117
|
-
var import_lazy_zod57,
|
|
23098
|
+
var import_lazy_zod57, import_protocol44, inputSchema7, outputSchema7, stateSchema7, plan7, name7, Stage7, SubscribeResourceFlow;
|
|
23118
23099
|
var init_subscribe_resource_flow = __esm({
|
|
23119
23100
|
"libs/sdk/src/resource/flows/subscribe-resource.flow.ts"() {
|
|
23120
23101
|
"use strict";
|
|
23121
23102
|
import_lazy_zod57 = require("@frontmcp/lazy-zod");
|
|
23122
|
-
|
|
23103
|
+
import_protocol44 = require("@frontmcp/protocol");
|
|
23123
23104
|
init_remote_capabilities_utils();
|
|
23124
23105
|
init_common();
|
|
23125
23106
|
init_availability();
|
|
@@ -23127,10 +23108,10 @@ var init_subscribe_resource_flow = __esm({
|
|
|
23127
23108
|
init_ui_shared();
|
|
23128
23109
|
init_mcp_surface();
|
|
23129
23110
|
inputSchema7 = import_lazy_zod57.z.object({
|
|
23130
|
-
request:
|
|
23111
|
+
request: import_protocol44.SubscribeRequestSchema,
|
|
23131
23112
|
ctx: import_lazy_zod57.z.unknown()
|
|
23132
23113
|
});
|
|
23133
|
-
outputSchema7 =
|
|
23114
|
+
outputSchema7 = import_protocol44.EmptyResultSchema;
|
|
23134
23115
|
stateSchema7 = import_lazy_zod57.z.object({
|
|
23135
23116
|
input: import_lazy_zod57.z.object({
|
|
23136
23117
|
uri: import_lazy_zod57.z.string().min(1)
|
|
@@ -23239,20 +23220,20 @@ var init_subscribe_resource_flow = __esm({
|
|
|
23239
23220
|
});
|
|
23240
23221
|
|
|
23241
23222
|
// libs/sdk/src/resource/flows/unsubscribe-resource.flow.ts
|
|
23242
|
-
var import_lazy_zod58,
|
|
23223
|
+
var import_lazy_zod58, import_protocol45, inputSchema8, outputSchema8, stateSchema8, plan8, name8, Stage8, UnsubscribeResourceFlow;
|
|
23243
23224
|
var init_unsubscribe_resource_flow = __esm({
|
|
23244
23225
|
"libs/sdk/src/resource/flows/unsubscribe-resource.flow.ts"() {
|
|
23245
23226
|
"use strict";
|
|
23246
23227
|
import_lazy_zod58 = require("@frontmcp/lazy-zod");
|
|
23247
|
-
|
|
23228
|
+
import_protocol45 = require("@frontmcp/protocol");
|
|
23248
23229
|
init_common();
|
|
23249
23230
|
init_errors();
|
|
23250
23231
|
init_mcp_surface();
|
|
23251
23232
|
inputSchema8 = import_lazy_zod58.z.object({
|
|
23252
|
-
request:
|
|
23233
|
+
request: import_protocol45.UnsubscribeRequestSchema,
|
|
23253
23234
|
ctx: import_lazy_zod58.z.unknown()
|
|
23254
23235
|
});
|
|
23255
|
-
outputSchema8 =
|
|
23236
|
+
outputSchema8 = import_protocol45.EmptyResultSchema;
|
|
23256
23237
|
stateSchema8 = import_lazy_zod58.z.object({
|
|
23257
23238
|
input: import_lazy_zod58.z.object({
|
|
23258
23239
|
uri: import_lazy_zod58.z.string().min(1)
|
|
@@ -24257,14 +24238,14 @@ var init_send_elicitation_result_utils = __esm({
|
|
|
24257
24238
|
});
|
|
24258
24239
|
|
|
24259
24240
|
// libs/sdk/src/tool/flows/tools-list.flow.ts
|
|
24260
|
-
var import_reflect_metadata9, import_lazy_zod59,
|
|
24241
|
+
var import_reflect_metadata9, import_lazy_zod59, import_protocol46, import_types2, import_utils58, inputSchema9, outputSchema9, stateSchema9, plan9, name9, Stage9, ToolsListFlow;
|
|
24261
24242
|
var init_tools_list_flow = __esm({
|
|
24262
24243
|
"libs/sdk/src/tool/flows/tools-list.flow.ts"() {
|
|
24263
24244
|
"use strict";
|
|
24264
24245
|
init_common();
|
|
24265
24246
|
import_reflect_metadata9 = require("reflect-metadata");
|
|
24266
24247
|
import_lazy_zod59 = require("@frontmcp/lazy-zod");
|
|
24267
|
-
|
|
24248
|
+
import_protocol46 = require("@frontmcp/protocol");
|
|
24268
24249
|
import_types2 = require("@frontmcp/uipack/types");
|
|
24269
24250
|
import_utils58 = require("@frontmcp/utils");
|
|
24270
24251
|
init_public_access_utils();
|
|
@@ -24274,10 +24255,10 @@ var init_tools_list_flow = __esm({
|
|
|
24274
24255
|
init_skill_mode_utils();
|
|
24275
24256
|
init_ui_shared();
|
|
24276
24257
|
inputSchema9 = import_lazy_zod59.z.object({
|
|
24277
|
-
request:
|
|
24258
|
+
request: import_protocol46.ListToolsRequestSchema,
|
|
24278
24259
|
ctx: import_lazy_zod59.z.unknown()
|
|
24279
24260
|
});
|
|
24280
|
-
outputSchema9 =
|
|
24261
|
+
outputSchema9 = import_protocol46.ListToolsResultSchema;
|
|
24281
24262
|
stateSchema9 = import_lazy_zod59.z.object({
|
|
24282
24263
|
cursor: import_lazy_zod59.z.string().optional(),
|
|
24283
24264
|
// z.any() used because AuthInfo is an external type from @frontmcp/protocol that varies by SDK version
|
|
@@ -26203,6 +26184,15 @@ var init_config_symbols = __esm({
|
|
|
26203
26184
|
}
|
|
26204
26185
|
});
|
|
26205
26186
|
|
|
26187
|
+
// libs/sdk/src/third-party/js-yaml.ts
|
|
26188
|
+
var import_js_yaml;
|
|
26189
|
+
var init_js_yaml = __esm({
|
|
26190
|
+
"libs/sdk/src/third-party/js-yaml.ts"() {
|
|
26191
|
+
"use strict";
|
|
26192
|
+
import_js_yaml = require("js-yaml");
|
|
26193
|
+
}
|
|
26194
|
+
});
|
|
26195
|
+
|
|
26206
26196
|
// libs/sdk/src/builtin/config/providers/env-loader.ts
|
|
26207
26197
|
function parseEnvContent(content) {
|
|
26208
26198
|
const result = {};
|
|
@@ -26412,7 +26402,7 @@ async function loadYamlConfig(basePath, configPath) {
|
|
|
26412
26402
|
const fullPath = (0, import_utils61.pathResolve)(basePath, baseName + ext);
|
|
26413
26403
|
if (await (0, import_utils61.fileExists)(fullPath)) {
|
|
26414
26404
|
const content = await (0, import_utils61.readFile)(fullPath);
|
|
26415
|
-
const parsed =
|
|
26405
|
+
const parsed = import_js_yaml.load(content);
|
|
26416
26406
|
if (parsed && typeof parsed === "object") {
|
|
26417
26407
|
return parsed;
|
|
26418
26408
|
}
|
|
@@ -26452,12 +26442,12 @@ function deepMerge(target, source) {
|
|
|
26452
26442
|
}
|
|
26453
26443
|
return result;
|
|
26454
26444
|
}
|
|
26455
|
-
var
|
|
26445
|
+
var import_utils61, UNSAFE_MERGE_KEYS;
|
|
26456
26446
|
var init_config_loader = __esm({
|
|
26457
26447
|
"libs/sdk/src/builtin/config/providers/config-loader.ts"() {
|
|
26458
26448
|
"use strict";
|
|
26459
|
-
yaml = __toESM(require("js-yaml"));
|
|
26460
26449
|
import_utils61 = require("@frontmcp/utils");
|
|
26450
|
+
init_js_yaml();
|
|
26461
26451
|
init_config_service();
|
|
26462
26452
|
init_env_loader();
|
|
26463
26453
|
UNSAFE_MERGE_KEYS = /* @__PURE__ */ new Set(["__proto__", "constructor", "prototype"]);
|
|
@@ -30424,7 +30414,7 @@ function parseSkillMdFrontmatter(content) {
|
|
|
30424
30414
|
const body = trimmed.substring(bodyStart);
|
|
30425
30415
|
let frontmatter = {};
|
|
30426
30416
|
try {
|
|
30427
|
-
const parsed =
|
|
30417
|
+
const parsed = import_js_yaml.load(yamlBlock);
|
|
30428
30418
|
if (typeof parsed === "object" && parsed !== null && !Array.isArray(parsed)) {
|
|
30429
30419
|
frontmatter = parsed;
|
|
30430
30420
|
}
|
|
@@ -30576,12 +30566,12 @@ function stripFrontmatter(content) {
|
|
|
30576
30566
|
const { body } = parseSkillMdFrontmatter(content);
|
|
30577
30567
|
return body;
|
|
30578
30568
|
}
|
|
30579
|
-
var
|
|
30569
|
+
var import_utils69;
|
|
30580
30570
|
var init_skill_md_parser = __esm({
|
|
30581
30571
|
"libs/sdk/src/skill/skill-md-parser.ts"() {
|
|
30582
30572
|
"use strict";
|
|
30583
|
-
yaml2 = __toESM(require("js-yaml"));
|
|
30584
30573
|
import_utils69 = require("@frontmcp/utils");
|
|
30574
|
+
init_js_yaml();
|
|
30585
30575
|
}
|
|
30586
30576
|
});
|
|
30587
30577
|
|
|
@@ -31223,6 +31213,24 @@ var init_skill_instance = __esm({
|
|
|
31223
31213
|
}
|
|
31224
31214
|
});
|
|
31225
31215
|
|
|
31216
|
+
// libs/sdk/src/utils/dynamic-import.utils.ts
|
|
31217
|
+
async function importWithRequireFallback(dynamicImport, requireFallback) {
|
|
31218
|
+
try {
|
|
31219
|
+
return await dynamicImport();
|
|
31220
|
+
} catch (importError) {
|
|
31221
|
+
try {
|
|
31222
|
+
return requireFallback();
|
|
31223
|
+
} catch {
|
|
31224
|
+
throw importError;
|
|
31225
|
+
}
|
|
31226
|
+
}
|
|
31227
|
+
}
|
|
31228
|
+
var init_dynamic_import_utils = __esm({
|
|
31229
|
+
"libs/sdk/src/utils/dynamic-import.utils.ts"() {
|
|
31230
|
+
"use strict";
|
|
31231
|
+
}
|
|
31232
|
+
});
|
|
31233
|
+
|
|
31226
31234
|
// libs/sdk/src/skill/providers/memory-skill.provider.ts
|
|
31227
31235
|
var memory_skill_provider_exports = {};
|
|
31228
31236
|
__export(memory_skill_provider_exports, {
|
|
@@ -32859,11 +32867,11 @@ var init_skill_registry = __esm({
|
|
|
32859
32867
|
/** The search and storage provider; the in-memory one, with its search index, is built the first time a skill needs it. */
|
|
32860
32868
|
storage() {
|
|
32861
32869
|
if (!this.storageProviderLoad) {
|
|
32862
|
-
const
|
|
32863
|
-
if (this.storageProviderLoad ===
|
|
32870
|
+
const load2 = this.createMemoryProvider().catch((error) => {
|
|
32871
|
+
if (this.storageProviderLoad === load2) this.storageProviderLoad = void 0;
|
|
32864
32872
|
throw error;
|
|
32865
32873
|
});
|
|
32866
|
-
this.storageProviderLoad =
|
|
32874
|
+
this.storageProviderLoad = load2;
|
|
32867
32875
|
}
|
|
32868
32876
|
return this.storageProviderLoad;
|
|
32869
32877
|
}
|
|
@@ -33483,14 +33491,14 @@ function invalidOutputFrom(outputError) {
|
|
|
33483
33491
|
function findAgentForCall(agents, toolName) {
|
|
33484
33492
|
return agents.findById(toolName) ?? agents.findByName(toolName) ?? agents.getAgents(true).find((entry) => entry.fullName === toolName || entry.name === toolName);
|
|
33485
33493
|
}
|
|
33486
|
-
var import_auth29, import_guard6, import_lazy_zod61,
|
|
33494
|
+
var import_auth29, import_guard6, import_lazy_zod61, import_protocol47, inputSchema10, outputSchema10, stateSchema10, plan10, name10, agentClassHooksJoin, Stage10, CallAgentFlow;
|
|
33487
33495
|
var init_call_agent_flow = __esm({
|
|
33488
33496
|
"libs/sdk/src/agent/flows/call-agent.flow.ts"() {
|
|
33489
33497
|
"use strict";
|
|
33490
33498
|
import_auth29 = require("@frontmcp/auth");
|
|
33491
33499
|
import_guard6 = require("@frontmcp/guard");
|
|
33492
33500
|
import_lazy_zod61 = require("@frontmcp/lazy-zod");
|
|
33493
|
-
|
|
33501
|
+
import_protocol47 = require("@frontmcp/protocol");
|
|
33494
33502
|
init_completion_events();
|
|
33495
33503
|
init_common();
|
|
33496
33504
|
init_errors();
|
|
@@ -33498,7 +33506,7 @@ var init_call_agent_flow = __esm({
|
|
|
33498
33506
|
init_flow_context_providers();
|
|
33499
33507
|
init_agent_call_chain();
|
|
33500
33508
|
inputSchema10 = import_lazy_zod61.z.object({
|
|
33501
|
-
request:
|
|
33509
|
+
request: import_protocol47.CallToolRequestSchema,
|
|
33502
33510
|
// z.any() used because ctx is the MCP SDK's ToolCallExtra type which varies by SDK version
|
|
33503
33511
|
ctx: import_lazy_zod61.z.any(),
|
|
33504
33512
|
/**
|
|
@@ -33509,7 +33517,7 @@ var init_call_agent_flow = __esm({
|
|
|
33509
33517
|
*/
|
|
33510
33518
|
gatedBy: import_lazy_zod61.z.literal("tools:call-tool").optional()
|
|
33511
33519
|
});
|
|
33512
|
-
outputSchema10 =
|
|
33520
|
+
outputSchema10 = import_protocol47.CallToolResultSchema;
|
|
33513
33521
|
stateSchema10 = import_lazy_zod61.z.object({
|
|
33514
33522
|
input: import_lazy_zod61.z.looseObject({
|
|
33515
33523
|
name: import_lazy_zod61.z.string().min(1).max(128),
|
|
@@ -37322,13 +37330,13 @@ function isListedTool(tool, listedNames) {
|
|
|
37322
37330
|
const baseName = tool.metadata.id ?? tool.metadata.name;
|
|
37323
37331
|
return listedNames.has(baseName) || listedNames.has(`${tool.owner.id}:${baseName}`);
|
|
37324
37332
|
}
|
|
37325
|
-
var import_auth34, import_lazy_zod63,
|
|
37333
|
+
var import_auth34, import_lazy_zod63, import_protocol48, inputSchema11, outputSchema11, PromptRefSchema, ResourceRefSchema, CompletionRefSchema, stateSchema11, plan11, name11, Stage11, resolvedReferences, MAX_TOOL_LIST_PAGES, CompleteFlow;
|
|
37326
37334
|
var init_complete_flow = __esm({
|
|
37327
37335
|
"libs/sdk/src/completion/flows/complete.flow.ts"() {
|
|
37328
37336
|
"use strict";
|
|
37329
37337
|
import_auth34 = require("@frontmcp/auth");
|
|
37330
37338
|
import_lazy_zod63 = require("@frontmcp/lazy-zod");
|
|
37331
|
-
|
|
37339
|
+
import_protocol48 = require("@frontmcp/protocol");
|
|
37332
37340
|
init_remote_capabilities_utils();
|
|
37333
37341
|
init_public_access_utils();
|
|
37334
37342
|
init_common();
|
|
@@ -37339,10 +37347,10 @@ var init_complete_flow = __esm({
|
|
|
37339
37347
|
init_ui_shared();
|
|
37340
37348
|
init_lineage_utils();
|
|
37341
37349
|
inputSchema11 = import_lazy_zod63.z.object({
|
|
37342
|
-
request:
|
|
37350
|
+
request: import_protocol48.CompleteRequestSchema,
|
|
37343
37351
|
ctx: import_lazy_zod63.z.unknown()
|
|
37344
37352
|
});
|
|
37345
|
-
outputSchema11 =
|
|
37353
|
+
outputSchema11 = import_protocol48.CompleteResultSchema;
|
|
37346
37354
|
PromptRefSchema = import_lazy_zod63.z.object({
|
|
37347
37355
|
type: import_lazy_zod63.z.literal("ref/prompt"),
|
|
37348
37356
|
name: import_lazy_zod63.z.string()
|
|
@@ -37705,23 +37713,23 @@ var init_job_utils = __esm({
|
|
|
37705
37713
|
});
|
|
37706
37714
|
|
|
37707
37715
|
// libs/sdk/src/logging/flows/set-level.flow.ts
|
|
37708
|
-
var import_lazy_zod64,
|
|
37716
|
+
var import_lazy_zod64, import_protocol49, inputSchema12, outputSchema12, stateSchema12, plan12, name12, Stage12, SetLevelFlow;
|
|
37709
37717
|
var init_set_level_flow = __esm({
|
|
37710
37718
|
"libs/sdk/src/logging/flows/set-level.flow.ts"() {
|
|
37711
37719
|
"use strict";
|
|
37712
37720
|
import_lazy_zod64 = require("@frontmcp/lazy-zod");
|
|
37713
|
-
|
|
37721
|
+
import_protocol49 = require("@frontmcp/protocol");
|
|
37714
37722
|
init_common();
|
|
37715
37723
|
init_errors();
|
|
37716
37724
|
init_mcp_surface();
|
|
37717
37725
|
inputSchema12 = import_lazy_zod64.z.object({
|
|
37718
|
-
request:
|
|
37726
|
+
request: import_protocol49.SetLevelRequestSchema,
|
|
37719
37727
|
ctx: import_lazy_zod64.z.unknown()
|
|
37720
37728
|
});
|
|
37721
|
-
outputSchema12 =
|
|
37729
|
+
outputSchema12 = import_protocol49.EmptyResultSchema;
|
|
37722
37730
|
stateSchema12 = import_lazy_zod64.z.object({
|
|
37723
37731
|
input: import_lazy_zod64.z.object({
|
|
37724
|
-
level:
|
|
37732
|
+
level: import_protocol49.LoggingLevelSchema
|
|
37725
37733
|
}),
|
|
37726
37734
|
sessionId: import_lazy_zod64.z.string().optional(),
|
|
37727
37735
|
output: outputSchema12
|
|
@@ -39925,7 +39933,7 @@ function buildFrontmatter(skill) {
|
|
|
39925
39933
|
}
|
|
39926
39934
|
function serializeSkillMd(skill, rawInstructions) {
|
|
39927
39935
|
const fm = buildFrontmatter(skill);
|
|
39928
|
-
const yamlBlock =
|
|
39936
|
+
const yamlBlock = import_js_yaml.dump(fm, {
|
|
39929
39937
|
lineWidth: -1,
|
|
39930
39938
|
// don't wrap long lines (descriptions, allowed-tools)
|
|
39931
39939
|
noRefs: true,
|
|
@@ -39939,11 +39947,10 @@ ${yamlBlock}
|
|
|
39939
39947
|
${body}
|
|
39940
39948
|
`;
|
|
39941
39949
|
}
|
|
39942
|
-
var yaml3;
|
|
39943
39950
|
var init_sep_2640_builders = __esm({
|
|
39944
39951
|
"libs/sdk/src/skill/sep-2640/sep-2640.builders.ts"() {
|
|
39945
39952
|
"use strict";
|
|
39946
|
-
|
|
39953
|
+
init_js_yaml();
|
|
39947
39954
|
init_sep_2640_constants();
|
|
39948
39955
|
init_sep_2640_uri();
|
|
39949
39956
|
}
|
|
@@ -40358,12 +40365,12 @@ var init_front_mcp_interface = __esm({
|
|
|
40358
40365
|
});
|
|
40359
40366
|
|
|
40360
40367
|
// libs/sdk/src/common/interfaces/server.interface.ts
|
|
40361
|
-
var
|
|
40368
|
+
var import_protocol50, ServerRequest, ServerResponse, FrontMcpServer;
|
|
40362
40369
|
var init_server_interface = __esm({
|
|
40363
40370
|
"libs/sdk/src/common/interfaces/server.interface.ts"() {
|
|
40364
40371
|
"use strict";
|
|
40365
|
-
|
|
40366
|
-
ServerRequest = class extends
|
|
40372
|
+
import_protocol50 = require("@frontmcp/protocol");
|
|
40373
|
+
ServerRequest = class extends import_protocol50.IncomingMessage {
|
|
40367
40374
|
path;
|
|
40368
40375
|
query;
|
|
40369
40376
|
/** Path parameters of the matched route (`:providerId` in `/oauth/provider/:providerId/callback`). */
|
|
@@ -40371,7 +40378,7 @@ var init_server_interface = __esm({
|
|
|
40371
40378
|
body;
|
|
40372
40379
|
authSession;
|
|
40373
40380
|
};
|
|
40374
|
-
ServerResponse = class extends
|
|
40381
|
+
ServerResponse = class extends import_protocol50.HttpServerResponse {
|
|
40375
40382
|
};
|
|
40376
40383
|
FrontMcpServer = class {
|
|
40377
40384
|
/** Stop accepting connections and close the open ones; a server that never listened has nothing to stop. */
|
|
@@ -43895,12 +43902,8 @@ __export(web_standard_mcp_exports, {
|
|
|
43895
43902
|
runWebStandardMcp: () => runWebStandardMcp
|
|
43896
43903
|
});
|
|
43897
43904
|
async function wireServer(scope, serverOptions, sessionId, sessionIdGenerator, enableJsonResponse) {
|
|
43898
|
-
const { McpServer: McpServer3, WebStandardStreamableHTTPServerTransport: WebStandardStreamableHTTPServerTransport2 } = await importWithRequireFallback(
|
|
43899
|
-
() => import("@frontmcp/protocol"),
|
|
43900
|
-
() => require("@frontmcp/protocol")
|
|
43901
|
-
);
|
|
43902
43905
|
const { createMcpHandlers: createMcpHandlers2 } = await Promise.resolve().then(() => (init_mcp_handlers(), mcp_handlers_exports));
|
|
43903
|
-
const mcpServer = new
|
|
43906
|
+
const mcpServer = new import_protocol51.McpServer(scope.metadata.info, serverOptions);
|
|
43904
43907
|
const composeInstructions = (caller) => composeCallerInstructions(scope, { ctx: caller, skillUriHints: true });
|
|
43905
43908
|
for (const handler of createMcpHandlers2({ scope, serverOptions, composeInstructions })) {
|
|
43906
43909
|
const originalHandler = handler.handler;
|
|
@@ -43911,7 +43914,7 @@ async function wireServer(scope, serverOptions, sessionId, sessionIdGenerator, e
|
|
|
43911
43914
|
};
|
|
43912
43915
|
mcpServer.setRequestHandler(handler.requestSchema, wrappedHandler);
|
|
43913
43916
|
}
|
|
43914
|
-
const transport = new
|
|
43917
|
+
const transport = new import_protocol51.WebStandardStreamableHTTPServerTransport({
|
|
43915
43918
|
sessionIdGenerator,
|
|
43916
43919
|
enableJsonResponse,
|
|
43917
43920
|
maxRequestBodySize: mcpTransportBodyLimit(scope.metadata.http?.bodyLimit)
|
|
@@ -43951,13 +43954,13 @@ async function runWebStandardMcp(scope, request, options) {
|
|
|
43951
43954
|
}
|
|
43952
43955
|
return response;
|
|
43953
43956
|
}
|
|
43954
|
-
var import_utils89;
|
|
43957
|
+
var import_protocol51, import_utils89;
|
|
43955
43958
|
var init_web_standard_mcp = __esm({
|
|
43956
43959
|
"libs/sdk/src/transport/web-standard-mcp.ts"() {
|
|
43957
43960
|
"use strict";
|
|
43961
|
+
import_protocol51 = require("@frontmcp/protocol");
|
|
43958
43962
|
import_utils89 = require("@frontmcp/utils");
|
|
43959
43963
|
init_skill_instructions_helper();
|
|
43960
|
-
init_dynamic_import_utils();
|
|
43961
43964
|
init_body_limit();
|
|
43962
43965
|
init_build_scoped_server_options();
|
|
43963
43966
|
}
|
|
@@ -45697,50 +45700,6 @@ var init_session_store_factory = __esm({
|
|
|
45697
45700
|
}
|
|
45698
45701
|
});
|
|
45699
45702
|
|
|
45700
|
-
// libs/sdk/src/transport/event-stores/session-scoped.event-store.ts
|
|
45701
|
-
function createSessionScopedEventStore(store, sessionId) {
|
|
45702
|
-
const prefix = `${sessionId}${SCOPE_SEPARATOR}`;
|
|
45703
|
-
const scope = (streamId) => `${prefix}${streamId}`;
|
|
45704
|
-
const unscope = (streamId) => {
|
|
45705
|
-
const value = String(streamId);
|
|
45706
|
-
return value.startsWith(prefix) ? value.slice(prefix.length) : value;
|
|
45707
|
-
};
|
|
45708
|
-
const resolveOwnedStream = async (eventId) => {
|
|
45709
|
-
const lookup = store.getStreamIdForEventId;
|
|
45710
|
-
if (lookup) {
|
|
45711
|
-
const resolved = await lookup.call(store, eventId);
|
|
45712
|
-
return resolved !== void 0 && String(resolved).startsWith(prefix) ? resolved : void 0;
|
|
45713
|
-
}
|
|
45714
|
-
if (!String(eventId).startsWith(prefix)) return void 0;
|
|
45715
|
-
const value = String(eventId);
|
|
45716
|
-
const lastColon = value.lastIndexOf(":");
|
|
45717
|
-
return lastColon === -1 ? void 0 : value.slice(0, lastColon);
|
|
45718
|
-
};
|
|
45719
|
-
return {
|
|
45720
|
-
async storeEvent(streamId, message) {
|
|
45721
|
-
return store.storeEvent(scope(streamId), message);
|
|
45722
|
-
},
|
|
45723
|
-
async getStreamIdForEventId(eventId) {
|
|
45724
|
-
const owned = await resolveOwnedStream(eventId);
|
|
45725
|
-
return owned === void 0 ? void 0 : unscope(owned);
|
|
45726
|
-
},
|
|
45727
|
-
async replayEventsAfter(lastEventId, options) {
|
|
45728
|
-
const owned = await resolveOwnedStream(lastEventId);
|
|
45729
|
-
if (owned === void 0) {
|
|
45730
|
-
return "default-stream";
|
|
45731
|
-
}
|
|
45732
|
-
return unscope(await store.replayEventsAfter(lastEventId, options));
|
|
45733
|
-
}
|
|
45734
|
-
};
|
|
45735
|
-
}
|
|
45736
|
-
var SCOPE_SEPARATOR;
|
|
45737
|
-
var init_session_scoped_event_store = __esm({
|
|
45738
|
-
"libs/sdk/src/transport/event-stores/session-scoped.event-store.ts"() {
|
|
45739
|
-
"use strict";
|
|
45740
|
-
SCOPE_SEPARATOR = " ";
|
|
45741
|
-
}
|
|
45742
|
-
});
|
|
45743
|
-
|
|
45744
45703
|
// libs/sdk/src/transport/transport.error.ts
|
|
45745
45704
|
var import_utils92, JSON_RPC2, rpcError, rpcRequest;
|
|
45746
45705
|
var init_transport_error = __esm({
|
|
@@ -45788,11 +45747,11 @@ function mergeExperimental(fragments) {
|
|
|
45788
45747
|
if (sawExtensions) out["extensions"] = extensions;
|
|
45789
45748
|
return out;
|
|
45790
45749
|
}
|
|
45791
|
-
var
|
|
45750
|
+
var import_protocol52, LocalTransportAdapter;
|
|
45792
45751
|
var init_transport_local_adapter = __esm({
|
|
45793
45752
|
"libs/sdk/src/transport/adapters/transport.local.adapter.ts"() {
|
|
45794
45753
|
"use strict";
|
|
45795
|
-
|
|
45754
|
+
import_protocol52 = require("@frontmcp/protocol");
|
|
45796
45755
|
init_common();
|
|
45797
45756
|
init_errors();
|
|
45798
45757
|
init_skill_instructions_helper();
|
|
@@ -45911,7 +45870,7 @@ var init_transport_local_adapter = __esm({
|
|
|
45911
45870
|
capabilities: JSON.stringify(serverOptions.capabilities),
|
|
45912
45871
|
serverInfo: JSON.stringify(serverOptions.serverInfo)
|
|
45913
45872
|
});
|
|
45914
|
-
this.server = new
|
|
45873
|
+
this.server = new import_protocol52.McpServer(info, serverOptions);
|
|
45915
45874
|
const handlers = createMcpHandlers({
|
|
45916
45875
|
scope: this.scope,
|
|
45917
45876
|
serverOptions,
|
|
@@ -45955,7 +45914,7 @@ var init_transport_local_adapter = __esm({
|
|
|
45955
45914
|
async ping(timeoutMs = 1e4) {
|
|
45956
45915
|
try {
|
|
45957
45916
|
await this.ready;
|
|
45958
|
-
await this.server.request({ method: "ping" },
|
|
45917
|
+
await this.server.request({ method: "ping" }, import_protocol52.EmptyResultSchema, { timeout: timeoutMs });
|
|
45959
45918
|
return true;
|
|
45960
45919
|
} catch {
|
|
45961
45920
|
return false;
|
|
@@ -46076,7 +46035,7 @@ var init_transport_local_adapter = __esm({
|
|
|
46076
46035
|
return true;
|
|
46077
46036
|
}
|
|
46078
46037
|
}
|
|
46079
|
-
const parsed =
|
|
46038
|
+
const parsed = import_protocol52.ElicitResultSchema.safeParse(req.body?.result);
|
|
46080
46039
|
if (!parsed.success) {
|
|
46081
46040
|
return false;
|
|
46082
46041
|
}
|
|
@@ -46143,18 +46102,334 @@ var init_transport_local_adapter = __esm({
|
|
|
46143
46102
|
}
|
|
46144
46103
|
});
|
|
46145
46104
|
|
|
46105
|
+
// libs/sdk/src/transport/adapters/polyfills/browser-sse-transport.ts
|
|
46106
|
+
var SSEServerTransport;
|
|
46107
|
+
var init_browser_sse_transport = __esm({
|
|
46108
|
+
"libs/sdk/src/transport/adapters/polyfills/browser-sse-transport.ts"() {
|
|
46109
|
+
"use strict";
|
|
46110
|
+
SSEServerTransport = class {
|
|
46111
|
+
constructor(_endpoint, _res, _options) {
|
|
46112
|
+
throw new Error("SSEServerTransport is not available in browser environments");
|
|
46113
|
+
}
|
|
46114
|
+
};
|
|
46115
|
+
}
|
|
46116
|
+
});
|
|
46117
|
+
|
|
46118
|
+
// libs/sdk/src/transport/adapters/sse-transport.ts
|
|
46119
|
+
var sse_transport_exports = {};
|
|
46120
|
+
__export(sse_transport_exports, {
|
|
46121
|
+
RecreateableSSEServerTransport: () => RecreateableSSEServerTransport
|
|
46122
|
+
});
|
|
46123
|
+
var RecreateableSSEServerTransport;
|
|
46124
|
+
var init_sse_transport = __esm({
|
|
46125
|
+
"libs/sdk/src/transport/adapters/sse-transport.ts"() {
|
|
46126
|
+
"use strict";
|
|
46127
|
+
init_browser_sse_transport();
|
|
46128
|
+
RecreateableSSEServerTransport = class extends SSEServerTransport {
|
|
46129
|
+
_isRecreatedSession = false;
|
|
46130
|
+
constructor(endpoint, res, options) {
|
|
46131
|
+
super(endpoint, res, options);
|
|
46132
|
+
if (options?.initialEventId !== void 0 && this.isValidEventId(options.initialEventId)) {
|
|
46133
|
+
this.setEventIdCounter(options.initialEventId);
|
|
46134
|
+
this._isRecreatedSession = true;
|
|
46135
|
+
}
|
|
46136
|
+
}
|
|
46137
|
+
/**
|
|
46138
|
+
* Validates that an event ID is a valid non-negative integer.
|
|
46139
|
+
* Protects against negative values, NaN, Infinity, and non-integer values.
|
|
46140
|
+
*/
|
|
46141
|
+
isValidEventId(eventId) {
|
|
46142
|
+
return Number.isInteger(eventId) && eventId >= 0 && eventId <= Number.MAX_SAFE_INTEGER;
|
|
46143
|
+
}
|
|
46144
|
+
/**
|
|
46145
|
+
* Returns whether this is a recreated session.
|
|
46146
|
+
*/
|
|
46147
|
+
get isRecreatedSession() {
|
|
46148
|
+
return this._isRecreatedSession;
|
|
46149
|
+
}
|
|
46150
|
+
/**
|
|
46151
|
+
* Returns the current event ID counter value.
|
|
46152
|
+
* Alias for lastEventId for consistency with the recreation API.
|
|
46153
|
+
*/
|
|
46154
|
+
get eventIdCounter() {
|
|
46155
|
+
return this.lastEventId;
|
|
46156
|
+
}
|
|
46157
|
+
/**
|
|
46158
|
+
* Sets the event ID counter for session recreation.
|
|
46159
|
+
* Use this when recreating a session from stored state to maintain
|
|
46160
|
+
* event ID continuity for SSE reconnection support.
|
|
46161
|
+
*
|
|
46162
|
+
* @param eventId - The event ID to restore (must be a non-negative integer)
|
|
46163
|
+
*/
|
|
46164
|
+
setEventIdCounter(eventId) {
|
|
46165
|
+
if (!this.isValidEventId(eventId)) {
|
|
46166
|
+
console.warn(
|
|
46167
|
+
`[RecreateableSSEServerTransport] Invalid eventId: ${eventId}. Must be a non-negative integer. Ignoring.`
|
|
46168
|
+
);
|
|
46169
|
+
return;
|
|
46170
|
+
}
|
|
46171
|
+
super.setEventIdCounter(eventId);
|
|
46172
|
+
}
|
|
46173
|
+
/**
|
|
46174
|
+
* Sets the transport to a recreated session state.
|
|
46175
|
+
* Use this when recreating a transport from a stored session.
|
|
46176
|
+
*
|
|
46177
|
+
* @param sessionId - The session ID (for verification, should match constructor)
|
|
46178
|
+
* @param lastEventId - The last event ID that was sent to the client
|
|
46179
|
+
*/
|
|
46180
|
+
setSessionState(sessionId, lastEventId) {
|
|
46181
|
+
if (this.sessionId !== sessionId) {
|
|
46182
|
+
const redact = (id) => `${id.slice(0, 8)}\u2026`;
|
|
46183
|
+
console.warn(
|
|
46184
|
+
`RecreateableSSEServerTransport: session ID mismatch. Expected ${redact(this.sessionId)}, got ${redact(sessionId)}. Using constructor value.`
|
|
46185
|
+
);
|
|
46186
|
+
}
|
|
46187
|
+
if (lastEventId !== void 0) {
|
|
46188
|
+
this.setEventIdCounter(lastEventId);
|
|
46189
|
+
}
|
|
46190
|
+
this._isRecreatedSession = true;
|
|
46191
|
+
}
|
|
46192
|
+
};
|
|
46193
|
+
}
|
|
46194
|
+
});
|
|
46195
|
+
|
|
46196
|
+
// libs/sdk/src/transport/adapters/transport.sse.adapter.ts
|
|
46197
|
+
async function loadSseTransport() {
|
|
46198
|
+
RecreateableTransport ??= (await Promise.resolve().then(() => (init_sse_transport(), sse_transport_exports))).RecreateableSSEServerTransport;
|
|
46199
|
+
}
|
|
46200
|
+
function sseTransportClass() {
|
|
46201
|
+
if (!RecreateableTransport) {
|
|
46202
|
+
throw new InternalMcpError("The SSE transport was used before loadSseTransport() loaded it");
|
|
46203
|
+
}
|
|
46204
|
+
return RecreateableTransport;
|
|
46205
|
+
}
|
|
46206
|
+
var import_lazy_zod74, RecreateableTransport, TransportSSEAdapter;
|
|
46207
|
+
var init_transport_sse_adapter = __esm({
|
|
46208
|
+
"libs/sdk/src/transport/adapters/transport.sse.adapter.ts"() {
|
|
46209
|
+
"use strict";
|
|
46210
|
+
import_lazy_zod74 = require("@frontmcp/lazy-zod");
|
|
46211
|
+
init_elicitation_types();
|
|
46212
|
+
init_errors();
|
|
46213
|
+
init_transport_error();
|
|
46214
|
+
init_transport_local_adapter();
|
|
46215
|
+
TransportSSEAdapter = class extends LocalTransportAdapter {
|
|
46216
|
+
sessionId;
|
|
46217
|
+
/**
|
|
46218
|
+
* Configures common error and close handlers for SSE transports.
|
|
46219
|
+
*/
|
|
46220
|
+
configureTransportHandlers(transport) {
|
|
46221
|
+
transport.onerror = (error) => {
|
|
46222
|
+
console.error("SSE error:", error instanceof Error ? error.message : "Unknown error");
|
|
46223
|
+
};
|
|
46224
|
+
transport.onclose = this.destroy.bind(this);
|
|
46225
|
+
}
|
|
46226
|
+
createTransport(sessionId, res) {
|
|
46227
|
+
this.sessionId = sessionId;
|
|
46228
|
+
this.logger.info(`new transport session: ${sessionId.slice(0, 40)}`);
|
|
46229
|
+
const SseTransport = sseTransportClass();
|
|
46230
|
+
const transport = new SseTransport(`${this.scope.fullPath}/message`, res, {
|
|
46231
|
+
sessionId
|
|
46232
|
+
});
|
|
46233
|
+
this.configureTransportHandlers(transport);
|
|
46234
|
+
return transport;
|
|
46235
|
+
}
|
|
46236
|
+
/**
|
|
46237
|
+
* Recreates a transport with preserved session state.
|
|
46238
|
+
* Use this when restoring a session from Redis or other storage.
|
|
46239
|
+
*
|
|
46240
|
+
* @param sessionId - The session ID to restore
|
|
46241
|
+
* @param res - The new response stream for SSE
|
|
46242
|
+
* @param lastEventId - The last event ID that was sent (for reconnection support)
|
|
46243
|
+
*/
|
|
46244
|
+
createTransportFromSession(sessionId, res, lastEventId) {
|
|
46245
|
+
this.sessionId = sessionId;
|
|
46246
|
+
this.logger.info(`recreating transport session: ${sessionId.slice(0, 40)}, lastEventId: ${lastEventId ?? "none"}`);
|
|
46247
|
+
const SseTransport = sseTransportClass();
|
|
46248
|
+
const transport = new SseTransport(`${this.scope.fullPath}/message`, res, {
|
|
46249
|
+
sessionId,
|
|
46250
|
+
initialEventId: lastEventId
|
|
46251
|
+
});
|
|
46252
|
+
this.configureTransportHandlers(transport);
|
|
46253
|
+
return transport;
|
|
46254
|
+
}
|
|
46255
|
+
initialize(req, res) {
|
|
46256
|
+
this.logger.verbose(`[${this.sessionId}] handle initialize request`);
|
|
46257
|
+
this.ensureAuthInfo(req, this);
|
|
46258
|
+
return Promise.resolve();
|
|
46259
|
+
}
|
|
46260
|
+
async handleRequest(req, res) {
|
|
46261
|
+
await this.ready;
|
|
46262
|
+
const authInfo = this.ensureAuthInfo(req, this);
|
|
46263
|
+
if (this.handleIfElicitResult(req)) {
|
|
46264
|
+
this.logger.verbose(`[${this.sessionId}] handled elicitation result`);
|
|
46265
|
+
res.writeHead(202, { "Content-Type": "application/json" });
|
|
46266
|
+
res.end(JSON.stringify({ jsonrpc: "2.0", id: null, result: {} }));
|
|
46267
|
+
return;
|
|
46268
|
+
}
|
|
46269
|
+
if (req.method === "GET") {
|
|
46270
|
+
this.logger.verbose(`[${this.sessionId}] handle get request`);
|
|
46271
|
+
return this.transport.handleMessage(req.body, {
|
|
46272
|
+
requestInfo: {
|
|
46273
|
+
headers: req.headers
|
|
46274
|
+
},
|
|
46275
|
+
authInfo
|
|
46276
|
+
});
|
|
46277
|
+
} else {
|
|
46278
|
+
this.logger.verbose(`[${this.sessionId}] handle post request`);
|
|
46279
|
+
return this.transport.handlePostMessage(req, res, req.body);
|
|
46280
|
+
}
|
|
46281
|
+
}
|
|
46282
|
+
/**
|
|
46283
|
+
* Send an elicitation request to the client.
|
|
46284
|
+
*
|
|
46285
|
+
* Only one elicit per session is allowed. A new elicit will cancel any pending one.
|
|
46286
|
+
* On timeout, an ElicitationTimeoutError is thrown to kill tool execution.
|
|
46287
|
+
*
|
|
46288
|
+
* In distributed mode, the pending elicitation is stored in Redis and results
|
|
46289
|
+
* are routed via pub/sub, allowing the response to be received by any node.
|
|
46290
|
+
*/
|
|
46291
|
+
async sendElicitRequest(relatedRequestId, message, requestedSchema, options) {
|
|
46292
|
+
const { mode = "form", ttl = DEFAULT_ELICIT_TTL, elicitationId, url } = options ?? {};
|
|
46293
|
+
if (mode === "url" && !url) {
|
|
46294
|
+
throw new InvalidInputError('url is required when mode is "url"');
|
|
46295
|
+
}
|
|
46296
|
+
await this.cancelPendingElicit();
|
|
46297
|
+
const elicitId = elicitationId || `elicit-${this.newRequestId}`;
|
|
46298
|
+
const sessionId = this.key.sessionId;
|
|
46299
|
+
const expiresAt = Date.now() + ttl;
|
|
46300
|
+
const store = this.requireElicitStore();
|
|
46301
|
+
await store.setPending({
|
|
46302
|
+
elicitId,
|
|
46303
|
+
sessionId,
|
|
46304
|
+
createdAt: Date.now(),
|
|
46305
|
+
expiresAt,
|
|
46306
|
+
message,
|
|
46307
|
+
mode
|
|
46308
|
+
});
|
|
46309
|
+
const params = {
|
|
46310
|
+
mode,
|
|
46311
|
+
message,
|
|
46312
|
+
requestedSchema: (0, import_lazy_zod74.toJSONSchema)(requestedSchema)
|
|
46313
|
+
};
|
|
46314
|
+
if (mode === "url") {
|
|
46315
|
+
params["elicitationId"] = elicitId;
|
|
46316
|
+
params["url"] = url;
|
|
46317
|
+
}
|
|
46318
|
+
this.logger.info("sendElicitRequest", { relatedRequestId, elicitId, mode, ttl });
|
|
46319
|
+
await this.transport.send(rpcRequest(this.newRequestId, "elicitation/create", params));
|
|
46320
|
+
return new Promise((resolve, reject) => {
|
|
46321
|
+
let settled = false;
|
|
46322
|
+
let unsubscribe;
|
|
46323
|
+
const cleanup = () => {
|
|
46324
|
+
clearTimeout(timeoutHandle);
|
|
46325
|
+
this.pendingElicit = void 0;
|
|
46326
|
+
void unsubscribe?.();
|
|
46327
|
+
};
|
|
46328
|
+
const safeResolve = (result) => {
|
|
46329
|
+
if (settled) return;
|
|
46330
|
+
settled = true;
|
|
46331
|
+
cleanup();
|
|
46332
|
+
resolve(result);
|
|
46333
|
+
};
|
|
46334
|
+
const safeReject = (err) => {
|
|
46335
|
+
if (settled) return;
|
|
46336
|
+
settled = true;
|
|
46337
|
+
cleanup();
|
|
46338
|
+
reject(err);
|
|
46339
|
+
};
|
|
46340
|
+
const timeoutHandle = setTimeout(async () => {
|
|
46341
|
+
if (settled) return;
|
|
46342
|
+
settled = true;
|
|
46343
|
+
this.pendingElicit = void 0;
|
|
46344
|
+
await unsubscribe?.();
|
|
46345
|
+
await store.deletePending(sessionId);
|
|
46346
|
+
reject(new ElicitationTimeoutError(elicitId, ttl));
|
|
46347
|
+
}, ttl);
|
|
46348
|
+
store.subscribeResult(
|
|
46349
|
+
elicitId,
|
|
46350
|
+
(result) => {
|
|
46351
|
+
safeResolve(result);
|
|
46352
|
+
},
|
|
46353
|
+
sessionId
|
|
46354
|
+
).then((unsub) => {
|
|
46355
|
+
unsubscribe = unsub;
|
|
46356
|
+
}).catch(async (err) => {
|
|
46357
|
+
if (settled) return;
|
|
46358
|
+
settled = true;
|
|
46359
|
+
clearTimeout(timeoutHandle);
|
|
46360
|
+
this.pendingElicit = void 0;
|
|
46361
|
+
await unsubscribe?.();
|
|
46362
|
+
await store.deletePending(sessionId);
|
|
46363
|
+
reject(err);
|
|
46364
|
+
});
|
|
46365
|
+
this.pendingElicit = {
|
|
46366
|
+
elicitId,
|
|
46367
|
+
timeoutHandle,
|
|
46368
|
+
resolve: safeResolve,
|
|
46369
|
+
reject: safeReject
|
|
46370
|
+
};
|
|
46371
|
+
});
|
|
46372
|
+
}
|
|
46373
|
+
};
|
|
46374
|
+
}
|
|
46375
|
+
});
|
|
46376
|
+
|
|
46377
|
+
// libs/sdk/src/transport/event-stores/session-scoped.event-store.ts
|
|
46378
|
+
function createSessionScopedEventStore(store, sessionId) {
|
|
46379
|
+
const prefix = `${sessionId}${SCOPE_SEPARATOR}`;
|
|
46380
|
+
const scope = (streamId) => `${prefix}${streamId}`;
|
|
46381
|
+
const unscope = (streamId) => {
|
|
46382
|
+
const value = String(streamId);
|
|
46383
|
+
return value.startsWith(prefix) ? value.slice(prefix.length) : value;
|
|
46384
|
+
};
|
|
46385
|
+
const resolveOwnedStream = async (eventId) => {
|
|
46386
|
+
const lookup = store.getStreamIdForEventId;
|
|
46387
|
+
if (lookup) {
|
|
46388
|
+
const resolved = await lookup.call(store, eventId);
|
|
46389
|
+
return resolved !== void 0 && String(resolved).startsWith(prefix) ? resolved : void 0;
|
|
46390
|
+
}
|
|
46391
|
+
if (!String(eventId).startsWith(prefix)) return void 0;
|
|
46392
|
+
const value = String(eventId);
|
|
46393
|
+
const lastColon = value.lastIndexOf(":");
|
|
46394
|
+
return lastColon === -1 ? void 0 : value.slice(0, lastColon);
|
|
46395
|
+
};
|
|
46396
|
+
return {
|
|
46397
|
+
async storeEvent(streamId, message) {
|
|
46398
|
+
return store.storeEvent(scope(streamId), message);
|
|
46399
|
+
},
|
|
46400
|
+
async getStreamIdForEventId(eventId) {
|
|
46401
|
+
const owned = await resolveOwnedStream(eventId);
|
|
46402
|
+
return owned === void 0 ? void 0 : unscope(owned);
|
|
46403
|
+
},
|
|
46404
|
+
async replayEventsAfter(lastEventId, options) {
|
|
46405
|
+
const owned = await resolveOwnedStream(lastEventId);
|
|
46406
|
+
if (owned === void 0) {
|
|
46407
|
+
return "default-stream";
|
|
46408
|
+
}
|
|
46409
|
+
return unscope(await store.replayEventsAfter(lastEventId, options));
|
|
46410
|
+
}
|
|
46411
|
+
};
|
|
46412
|
+
}
|
|
46413
|
+
var SCOPE_SEPARATOR;
|
|
46414
|
+
var init_session_scoped_event_store = __esm({
|
|
46415
|
+
"libs/sdk/src/transport/event-stores/session-scoped.event-store.ts"() {
|
|
46416
|
+
"use strict";
|
|
46417
|
+
SCOPE_SEPARATOR = " ";
|
|
46418
|
+
}
|
|
46419
|
+
});
|
|
46420
|
+
|
|
46146
46421
|
// libs/sdk/src/transport/adapters/streamable-http-transport.ts
|
|
46147
46422
|
var streamable_http_transport_exports = {};
|
|
46148
46423
|
__export(streamable_http_transport_exports, {
|
|
46149
46424
|
RecreateableStreamableHTTPServerTransport: () => RecreateableStreamableHTTPServerTransport
|
|
46150
46425
|
});
|
|
46151
|
-
var
|
|
46426
|
+
var import_protocol53, RecreateableStreamableHTTPServerTransport;
|
|
46152
46427
|
var init_streamable_http_transport = __esm({
|
|
46153
46428
|
"libs/sdk/src/transport/adapters/streamable-http-transport.ts"() {
|
|
46154
46429
|
"use strict";
|
|
46155
|
-
|
|
46430
|
+
import_protocol53 = require("@frontmcp/protocol");
|
|
46156
46431
|
init_transport_errors();
|
|
46157
|
-
RecreateableStreamableHTTPServerTransport = class extends
|
|
46432
|
+
RecreateableStreamableHTTPServerTransport = class extends import_protocol53.StreamableHTTPServerTransport {
|
|
46158
46433
|
/**
|
|
46159
46434
|
* Stores pending initialization state when setInitializationState is called
|
|
46160
46435
|
* before _webStandardTransport is ready. Applied on first handleRequest.
|
|
@@ -46263,7 +46538,7 @@ var init_streamable_http_transport = __esm({
|
|
|
46263
46538
|
async handleRequest(req, res, body) {
|
|
46264
46539
|
const oldWebTransport = this._webStandardTransport;
|
|
46265
46540
|
if (oldWebTransport && this._isStateless && oldWebTransport._hasHandledRequest) {
|
|
46266
|
-
const fresh = new
|
|
46541
|
+
const fresh = new import_protocol53.WebStandardStreamableHTTPServerTransport(this._constructorOptions);
|
|
46267
46542
|
fresh.onmessage = oldWebTransport.onmessage;
|
|
46268
46543
|
fresh.onclose = oldWebTransport.onclose;
|
|
46269
46544
|
fresh.onerror = oldWebTransport.onerror;
|
|
@@ -46286,13 +46561,13 @@ var init_streamable_http_transport = __esm({
|
|
|
46286
46561
|
|
|
46287
46562
|
// libs/sdk/src/transport/adapters/transport.streamable-http.adapter.ts
|
|
46288
46563
|
async function loadStreamableHttpTransport() {
|
|
46289
|
-
|
|
46564
|
+
RecreateableTransport2 ??= (await Promise.resolve().then(() => (init_streamable_http_transport(), streamable_http_transport_exports))).RecreateableStreamableHTTPServerTransport;
|
|
46290
46565
|
}
|
|
46291
|
-
var
|
|
46566
|
+
var import_lazy_zod75, RecreateableTransport2, resolveSessionIdGenerator, TransportStreamableHttpAdapter;
|
|
46292
46567
|
var init_transport_streamable_http_adapter = __esm({
|
|
46293
46568
|
"libs/sdk/src/transport/adapters/transport.streamable-http.adapter.ts"() {
|
|
46294
46569
|
"use strict";
|
|
46295
|
-
|
|
46570
|
+
import_lazy_zod75 = require("@frontmcp/lazy-zod");
|
|
46296
46571
|
init_errors();
|
|
46297
46572
|
init_session_scoped_event_store();
|
|
46298
46573
|
init_transport_error();
|
|
@@ -46307,12 +46582,12 @@ var init_transport_streamable_http_adapter = __esm({
|
|
|
46307
46582
|
const sharedEventStore = this.scope.eventStore;
|
|
46308
46583
|
const eventStore = sharedEventStore ? createSessionScopedEventStore(sharedEventStore, sessionId) : void 0;
|
|
46309
46584
|
const isStateless = this.key.type === "stateless-http";
|
|
46310
|
-
if (!
|
|
46585
|
+
if (!RecreateableTransport2) {
|
|
46311
46586
|
throw new InternalMcpError(
|
|
46312
46587
|
"The Streamable HTTP transport was used before loadStreamableHttpTransport() loaded it"
|
|
46313
46588
|
);
|
|
46314
46589
|
}
|
|
46315
|
-
return new
|
|
46590
|
+
return new RecreateableTransport2({
|
|
46316
46591
|
sessionIdGenerator,
|
|
46317
46592
|
isStateless,
|
|
46318
46593
|
onsessionclosed: () => {
|
|
@@ -46344,7 +46619,7 @@ var init_transport_streamable_http_adapter = __esm({
|
|
|
46344
46619
|
});
|
|
46345
46620
|
await this.ready;
|
|
46346
46621
|
this.logger.verbose("[StreamableHttpAdapter] transport state before handleRequest", {
|
|
46347
|
-
isRecreatable:
|
|
46622
|
+
isRecreatable: RecreateableTransport2 !== void 0 && this.transport instanceof RecreateableTransport2,
|
|
46348
46623
|
hasWebTransport: !!this.transport._webStandardTransport,
|
|
46349
46624
|
webTransportInitialized: this.transport._webStandardTransport?._initialized,
|
|
46350
46625
|
webTransportStarted: this.transport._webStandardTransport?._started,
|
|
@@ -46410,7 +46685,7 @@ var init_transport_streamable_http_adapter = __esm({
|
|
|
46410
46685
|
relatedRequestId,
|
|
46411
46686
|
sessionId,
|
|
46412
46687
|
message,
|
|
46413
|
-
requestedSchema: (0,
|
|
46688
|
+
requestedSchema: (0, import_lazy_zod75.toJSONSchema)(requestedSchema),
|
|
46414
46689
|
options
|
|
46415
46690
|
});
|
|
46416
46691
|
const { elicitId, expiresAt, requestParams, pendingRecord } = flowOutput;
|
|
@@ -46592,13 +46867,13 @@ function toClientInfo(value) {
|
|
|
46592
46867
|
const { name: name48, version } = value;
|
|
46593
46868
|
return typeof name48 === "string" && typeof version === "string" ? { name: name48, version } : void 0;
|
|
46594
46869
|
}
|
|
46595
|
-
var import_auth44,
|
|
46870
|
+
var import_auth44, import_lazy_zod76, import_protocol54, import_utils93, plan22, subscriptionParamsSchema, requestIdSchema, stateSchema20, name22, Stage22, encoder3, TRACE_META_KEYS, HandleMcp20260728Flow;
|
|
46596
46871
|
var init_handle_mcp_20260728_flow = __esm({
|
|
46597
46872
|
"libs/sdk/src/transport/flows/handle.mcp-20260728.flow.ts"() {
|
|
46598
46873
|
"use strict";
|
|
46599
46874
|
import_auth44 = require("@frontmcp/auth");
|
|
46600
|
-
|
|
46601
|
-
|
|
46875
|
+
import_lazy_zod76 = require("@frontmcp/lazy-zod");
|
|
46876
|
+
import_protocol54 = require("@frontmcp/protocol");
|
|
46602
46877
|
import_utils93 = require("@frontmcp/utils");
|
|
46603
46878
|
init_common();
|
|
46604
46879
|
init_tool_lookup_utils();
|
|
@@ -46612,22 +46887,22 @@ var init_handle_mcp_20260728_flow = __esm({
|
|
|
46612
46887
|
post: [],
|
|
46613
46888
|
finalize: ["cleanup"]
|
|
46614
46889
|
};
|
|
46615
|
-
subscriptionParamsSchema =
|
|
46616
|
-
notifications:
|
|
46617
|
-
toolsListChanged:
|
|
46618
|
-
promptsListChanged:
|
|
46619
|
-
resourcesListChanged:
|
|
46620
|
-
resourceSubscriptions:
|
|
46890
|
+
subscriptionParamsSchema = import_lazy_zod76.z.object({
|
|
46891
|
+
notifications: import_lazy_zod76.z.object({
|
|
46892
|
+
toolsListChanged: import_lazy_zod76.z.boolean().optional(),
|
|
46893
|
+
promptsListChanged: import_lazy_zod76.z.boolean().optional(),
|
|
46894
|
+
resourcesListChanged: import_lazy_zod76.z.boolean().optional(),
|
|
46895
|
+
resourceSubscriptions: import_lazy_zod76.z.array(import_lazy_zod76.z.string()).optional()
|
|
46621
46896
|
}).default({})
|
|
46622
46897
|
});
|
|
46623
|
-
requestIdSchema =
|
|
46624
|
-
stateSchema20 =
|
|
46898
|
+
requestIdSchema = import_lazy_zod76.z.union([import_lazy_zod76.z.string(), import_lazy_zod76.z.number()]);
|
|
46899
|
+
stateSchema20 = import_lazy_zod76.z.object({
|
|
46625
46900
|
/** Negotiated protocol version for this request. */
|
|
46626
|
-
version:
|
|
46627
|
-
requestType:
|
|
46628
|
-
isAnonymous:
|
|
46901
|
+
version: import_lazy_zod76.z.string().optional(),
|
|
46902
|
+
requestType: import_lazy_zod76.z.enum(["notification", "subscriptions", "message"]).optional(),
|
|
46903
|
+
isAnonymous: import_lazy_zod76.z.boolean().default(true),
|
|
46629
46904
|
/** Whether the client declared this revision itself (not served under it by default). */
|
|
46630
|
-
clientDeclaredRevision:
|
|
46905
|
+
clientDeclaredRevision: import_lazy_zod76.z.boolean().optional()
|
|
46631
46906
|
});
|
|
46632
46907
|
name22 = "handle:mcp-202607280728";
|
|
46633
46908
|
({ Stage: Stage22 } = FlowHooksOf(name22));
|
|
@@ -46771,7 +47046,7 @@ var init_handle_mcp_20260728_flow = __esm({
|
|
|
46771
47046
|
* session that initializes with that capability is subscribed to.
|
|
46772
47047
|
*/
|
|
46773
47048
|
async listenedChannels(meta) {
|
|
46774
|
-
const capabilities = meta?.[
|
|
47049
|
+
const capabilities = meta?.[import_protocol54.MCP_20260728_META.clientCapabilities];
|
|
46775
47050
|
if (!supportsChannels(capabilities) || !this.scope.channels) return [];
|
|
46776
47051
|
const listed = await this.scope.runFlowForOutput("channels:list", {});
|
|
46777
47052
|
return listed.channels.map((channel2) => channel2.name);
|
|
@@ -46783,12 +47058,12 @@ var init_handle_mcp_20260728_flow = __esm({
|
|
|
46783
47058
|
const meta = params["_meta"] ?? {};
|
|
46784
47059
|
const auth = request[ServerRequestTokens.auth];
|
|
46785
47060
|
const stdio = this.stdioOrigin;
|
|
46786
|
-
const clientCapabilities = meta[
|
|
46787
|
-
const logLevel = typeof meta[
|
|
47061
|
+
const clientCapabilities = meta[import_protocol54.MCP_20260728_META.clientCapabilities] ?? {};
|
|
47062
|
+
const logLevel = typeof meta[import_protocol54.MCP_20260728_META.logLevel] === "string" ? meta[import_protocol54.MCP_20260728_META.logLevel] : void 0;
|
|
46788
47063
|
const rawProgressToken = meta["progressToken"];
|
|
46789
47064
|
const progressToken = typeof rawProgressToken === "string" || typeof rawProgressToken === "number" ? rawProgressToken : void 0;
|
|
46790
47065
|
const sink = new RequestNotificationSink(logLevel, progressToken);
|
|
46791
|
-
const clientInfo = toClientInfo(meta[
|
|
47066
|
+
const clientInfo = toClientInfo(meta[import_protocol54.MCP_20260728_META.clientInfo]);
|
|
46792
47067
|
if (clientInfo) {
|
|
46793
47068
|
const platformType = resolvePlatformType(
|
|
46794
47069
|
clientInfo,
|
|
@@ -46933,11 +47208,11 @@ function resolveLegacySseSession(params) {
|
|
|
46933
47208
|
}
|
|
46934
47209
|
return { session: createSession(), createdNew: true, responded404: false };
|
|
46935
47210
|
}
|
|
46936
|
-
var
|
|
47211
|
+
var import_lazy_zod77, plan23, stateSessionSchema, stateSchema21, name23, Stage23, HandleSseFlow;
|
|
46937
47212
|
var init_handle_sse_flow = __esm({
|
|
46938
47213
|
"libs/sdk/src/transport/flows/handle.sse.flow.ts"() {
|
|
46939
47214
|
"use strict";
|
|
46940
|
-
|
|
47215
|
+
import_lazy_zod77 = require("@frontmcp/lazy-zod");
|
|
46941
47216
|
init_session_id_utils();
|
|
46942
47217
|
init_common();
|
|
46943
47218
|
init_errors();
|
|
@@ -46949,22 +47224,22 @@ var init_handle_sse_flow = __esm({
|
|
|
46949
47224
|
post: [],
|
|
46950
47225
|
finalize: ["cleanup"]
|
|
46951
47226
|
};
|
|
46952
|
-
stateSessionSchema =
|
|
46953
|
-
id:
|
|
46954
|
-
payload:
|
|
46955
|
-
nodeId:
|
|
46956
|
-
authSig:
|
|
46957
|
-
uuid:
|
|
46958
|
-
iat:
|
|
46959
|
-
protocol:
|
|
46960
|
-
isPublic:
|
|
46961
|
-
platformType:
|
|
47227
|
+
stateSessionSchema = import_lazy_zod77.z.object({
|
|
47228
|
+
id: import_lazy_zod77.z.string(),
|
|
47229
|
+
payload: import_lazy_zod77.z.object({
|
|
47230
|
+
nodeId: import_lazy_zod77.z.string(),
|
|
47231
|
+
authSig: import_lazy_zod77.z.string(),
|
|
47232
|
+
uuid: import_lazy_zod77.z.string().uuid(),
|
|
47233
|
+
iat: import_lazy_zod77.z.number(),
|
|
47234
|
+
protocol: import_lazy_zod77.z.enum(["legacy-sse", "sse", "streamable-http", "stateful-http", "stateless-http"]).optional(),
|
|
47235
|
+
isPublic: import_lazy_zod77.z.boolean().optional(),
|
|
47236
|
+
platformType: import_lazy_zod77.z.enum(["openai", "claude", "gemini", "cursor", "continue", "cody", "generic-mcp", "ext-apps", "unknown"]).optional()
|
|
46962
47237
|
}).optional()
|
|
46963
47238
|
});
|
|
46964
|
-
stateSchema21 =
|
|
46965
|
-
token:
|
|
47239
|
+
stateSchema21 = import_lazy_zod77.z.object({
|
|
47240
|
+
token: import_lazy_zod77.z.string(),
|
|
46966
47241
|
session: stateSessionSchema,
|
|
46967
|
-
requestType:
|
|
47242
|
+
requestType: import_lazy_zod77.z.enum(["initialize", "message", "elicitResult"]).optional()
|
|
46968
47243
|
});
|
|
46969
47244
|
name23 = "handle:legacy-sse";
|
|
46970
47245
|
({ Stage: Stage23 } = FlowHooksOf(name23));
|
|
@@ -47094,12 +47369,12 @@ var init_handle_sse_flow = __esm({
|
|
|
47094
47369
|
});
|
|
47095
47370
|
|
|
47096
47371
|
// libs/sdk/src/transport/flows/handle.stateless-http.flow.ts
|
|
47097
|
-
var
|
|
47372
|
+
var import_lazy_zod78, import_protocol55, plan24, stateSchema22, name24, Stage24, HandleStatelessHttpFlow;
|
|
47098
47373
|
var init_handle_stateless_http_flow = __esm({
|
|
47099
47374
|
"libs/sdk/src/transport/flows/handle.stateless-http.flow.ts"() {
|
|
47100
47375
|
"use strict";
|
|
47101
|
-
|
|
47102
|
-
|
|
47376
|
+
import_lazy_zod78 = require("@frontmcp/lazy-zod");
|
|
47377
|
+
import_protocol55 = require("@frontmcp/protocol");
|
|
47103
47378
|
init_common();
|
|
47104
47379
|
init_errors();
|
|
47105
47380
|
init_ha_headers();
|
|
@@ -47110,10 +47385,10 @@ var init_handle_stateless_http_flow = __esm({
|
|
|
47110
47385
|
post: [],
|
|
47111
47386
|
finalize: ["cleanup"]
|
|
47112
47387
|
};
|
|
47113
|
-
stateSchema22 =
|
|
47114
|
-
token:
|
|
47115
|
-
isAuthenticated:
|
|
47116
|
-
requestType:
|
|
47388
|
+
stateSchema22 = import_lazy_zod78.z.object({
|
|
47389
|
+
token: import_lazy_zod78.z.string().optional(),
|
|
47390
|
+
isAuthenticated: import_lazy_zod78.z.boolean(),
|
|
47391
|
+
requestType: import_lazy_zod78.z.enum(["initialize", "message"]).optional()
|
|
47117
47392
|
});
|
|
47118
47393
|
name24 = "handle:stateless-http";
|
|
47119
47394
|
({ Stage: Stage24 } = FlowHooksOf(name24));
|
|
@@ -47144,7 +47419,7 @@ var init_handle_stateless_http_flow = __esm({
|
|
|
47144
47419
|
if (method === "initialize") {
|
|
47145
47420
|
this.state.set("requestType", "initialize");
|
|
47146
47421
|
logger.verbose("router: requestType=initialize, method=POST");
|
|
47147
|
-
} else if (method &&
|
|
47422
|
+
} else if (method && import_protocol55.RequestSchema.safeParse(request.body).success) {
|
|
47148
47423
|
this.state.set("requestType", "message");
|
|
47149
47424
|
logger.verbose(`router: requestType=message, method=${method}`);
|
|
47150
47425
|
} else {
|
|
@@ -47674,10 +47949,10 @@ function classifyStreamableHttpRequest(params) {
|
|
|
47674
47949
|
if (typeof jsonRpcMethod === "string" && (jsonRpcMethod.startsWith("ui/") || jsonRpcMethod === "notifications/message")) {
|
|
47675
47950
|
return { requestType: "extApps" };
|
|
47676
47951
|
}
|
|
47677
|
-
if (
|
|
47952
|
+
if (import_protocol56.ElicitResultSchema.safeParse(body?.result).success) {
|
|
47678
47953
|
return { requestType: "elicitResult" };
|
|
47679
47954
|
}
|
|
47680
|
-
if (jsonRpcMethod &&
|
|
47955
|
+
if (jsonRpcMethod && import_protocol56.RequestSchema.safeParse(body).success) {
|
|
47681
47956
|
return { requestType: "message" };
|
|
47682
47957
|
}
|
|
47683
47958
|
return { error: "Invalid Request" };
|
|
@@ -47731,12 +48006,12 @@ async function lookupStreamableHttpTransport(params) {
|
|
|
47731
48006
|
}
|
|
47732
48007
|
return { kind: "session-not-initialized", recreationError };
|
|
47733
48008
|
}
|
|
47734
|
-
var
|
|
48009
|
+
var import_lazy_zod79, import_protocol56, plan25, stateSessionSchema2, stateSchema23, name25, Stage25, HandleStreamableHttpFlow;
|
|
47735
48010
|
var init_handle_streamable_http_flow = __esm({
|
|
47736
48011
|
"libs/sdk/src/transport/flows/handle.streamable-http.flow.ts"() {
|
|
47737
48012
|
"use strict";
|
|
47738
|
-
|
|
47739
|
-
|
|
48013
|
+
import_lazy_zod79 = require("@frontmcp/lazy-zod");
|
|
48014
|
+
import_protocol56 = require("@frontmcp/protocol");
|
|
47740
48015
|
init_session_id_utils();
|
|
47741
48016
|
init_common();
|
|
47742
48017
|
init_errors();
|
|
@@ -47750,22 +48025,22 @@ var init_handle_streamable_http_flow = __esm({
|
|
|
47750
48025
|
post: [],
|
|
47751
48026
|
finalize: ["cleanup"]
|
|
47752
48027
|
};
|
|
47753
|
-
stateSessionSchema2 =
|
|
47754
|
-
id:
|
|
47755
|
-
payload:
|
|
47756
|
-
nodeId:
|
|
47757
|
-
authSig:
|
|
47758
|
-
uuid:
|
|
47759
|
-
iat:
|
|
47760
|
-
protocol:
|
|
47761
|
-
isPublic:
|
|
47762
|
-
platformType:
|
|
48028
|
+
stateSessionSchema2 = import_lazy_zod79.z.object({
|
|
48029
|
+
id: import_lazy_zod79.z.string(),
|
|
48030
|
+
payload: import_lazy_zod79.z.object({
|
|
48031
|
+
nodeId: import_lazy_zod79.z.string(),
|
|
48032
|
+
authSig: import_lazy_zod79.z.string(),
|
|
48033
|
+
uuid: import_lazy_zod79.z.string().uuid(),
|
|
48034
|
+
iat: import_lazy_zod79.z.number(),
|
|
48035
|
+
protocol: import_lazy_zod79.z.enum(["legacy-sse", "sse", "streamable-http", "stateful-http", "stateless-http"]).optional(),
|
|
48036
|
+
isPublic: import_lazy_zod79.z.boolean().optional(),
|
|
48037
|
+
platformType: import_lazy_zod79.z.enum(["openai", "claude", "gemini", "cursor", "continue", "cody", "generic-mcp", "ext-apps", "unknown"]).optional()
|
|
47763
48038
|
}).optional()
|
|
47764
48039
|
});
|
|
47765
|
-
stateSchema23 =
|
|
47766
|
-
token:
|
|
48040
|
+
stateSchema23 = import_lazy_zod79.z.object({
|
|
48041
|
+
token: import_lazy_zod79.z.string(),
|
|
47767
48042
|
session: stateSessionSchema2,
|
|
47768
|
-
requestType:
|
|
48043
|
+
requestType: import_lazy_zod79.z.enum(["initialize", "message", "elicitResult", "sseListener", "extApps"]).optional()
|
|
47769
48044
|
});
|
|
47770
48045
|
name25 = "handle:streamable-http";
|
|
47771
48046
|
({ Stage: Stage25 } = FlowHooksOf(name25));
|
|
@@ -48161,7 +48436,7 @@ var init_handle_streamable_http_flow = __esm({
|
|
|
48161
48436
|
_skipUI: true
|
|
48162
48437
|
}
|
|
48163
48438
|
});
|
|
48164
|
-
const parsed =
|
|
48439
|
+
const parsed = import_protocol56.CallToolResultSchema.safeParse(result);
|
|
48165
48440
|
if (parsed.success) {
|
|
48166
48441
|
return parsed.data;
|
|
48167
48442
|
}
|
|
@@ -48570,264 +48845,6 @@ var init_relay_http = __esm({
|
|
|
48570
48845
|
}
|
|
48571
48846
|
});
|
|
48572
48847
|
|
|
48573
|
-
// libs/sdk/src/transport/adapters/polyfills/browser-sse-transport.ts
|
|
48574
|
-
var SSEServerTransport;
|
|
48575
|
-
var init_browser_sse_transport = __esm({
|
|
48576
|
-
"libs/sdk/src/transport/adapters/polyfills/browser-sse-transport.ts"() {
|
|
48577
|
-
"use strict";
|
|
48578
|
-
SSEServerTransport = class {
|
|
48579
|
-
constructor(_endpoint, _res, _options) {
|
|
48580
|
-
throw new Error("SSEServerTransport is not available in browser environments");
|
|
48581
|
-
}
|
|
48582
|
-
};
|
|
48583
|
-
}
|
|
48584
|
-
});
|
|
48585
|
-
|
|
48586
|
-
// libs/sdk/src/transport/adapters/sse-transport.ts
|
|
48587
|
-
var RecreateableSSEServerTransport;
|
|
48588
|
-
var init_sse_transport = __esm({
|
|
48589
|
-
"libs/sdk/src/transport/adapters/sse-transport.ts"() {
|
|
48590
|
-
"use strict";
|
|
48591
|
-
init_browser_sse_transport();
|
|
48592
|
-
RecreateableSSEServerTransport = class extends SSEServerTransport {
|
|
48593
|
-
_isRecreatedSession = false;
|
|
48594
|
-
constructor(endpoint, res, options) {
|
|
48595
|
-
super(endpoint, res, options);
|
|
48596
|
-
if (options?.initialEventId !== void 0 && this.isValidEventId(options.initialEventId)) {
|
|
48597
|
-
this.setEventIdCounter(options.initialEventId);
|
|
48598
|
-
this._isRecreatedSession = true;
|
|
48599
|
-
}
|
|
48600
|
-
}
|
|
48601
|
-
/**
|
|
48602
|
-
* Validates that an event ID is a valid non-negative integer.
|
|
48603
|
-
* Protects against negative values, NaN, Infinity, and non-integer values.
|
|
48604
|
-
*/
|
|
48605
|
-
isValidEventId(eventId) {
|
|
48606
|
-
return Number.isInteger(eventId) && eventId >= 0 && eventId <= Number.MAX_SAFE_INTEGER;
|
|
48607
|
-
}
|
|
48608
|
-
/**
|
|
48609
|
-
* Returns whether this is a recreated session.
|
|
48610
|
-
*/
|
|
48611
|
-
get isRecreatedSession() {
|
|
48612
|
-
return this._isRecreatedSession;
|
|
48613
|
-
}
|
|
48614
|
-
/**
|
|
48615
|
-
* Returns the current event ID counter value.
|
|
48616
|
-
* Alias for lastEventId for consistency with the recreation API.
|
|
48617
|
-
*/
|
|
48618
|
-
get eventIdCounter() {
|
|
48619
|
-
return this.lastEventId;
|
|
48620
|
-
}
|
|
48621
|
-
/**
|
|
48622
|
-
* Sets the event ID counter for session recreation.
|
|
48623
|
-
* Use this when recreating a session from stored state to maintain
|
|
48624
|
-
* event ID continuity for SSE reconnection support.
|
|
48625
|
-
*
|
|
48626
|
-
* @param eventId - The event ID to restore (must be a non-negative integer)
|
|
48627
|
-
*/
|
|
48628
|
-
setEventIdCounter(eventId) {
|
|
48629
|
-
if (!this.isValidEventId(eventId)) {
|
|
48630
|
-
console.warn(
|
|
48631
|
-
`[RecreateableSSEServerTransport] Invalid eventId: ${eventId}. Must be a non-negative integer. Ignoring.`
|
|
48632
|
-
);
|
|
48633
|
-
return;
|
|
48634
|
-
}
|
|
48635
|
-
super.setEventIdCounter(eventId);
|
|
48636
|
-
}
|
|
48637
|
-
/**
|
|
48638
|
-
* Sets the transport to a recreated session state.
|
|
48639
|
-
* Use this when recreating a transport from a stored session.
|
|
48640
|
-
*
|
|
48641
|
-
* @param sessionId - The session ID (for verification, should match constructor)
|
|
48642
|
-
* @param lastEventId - The last event ID that was sent to the client
|
|
48643
|
-
*/
|
|
48644
|
-
setSessionState(sessionId, lastEventId) {
|
|
48645
|
-
if (this.sessionId !== sessionId) {
|
|
48646
|
-
const redact = (id) => `${id.slice(0, 8)}\u2026`;
|
|
48647
|
-
console.warn(
|
|
48648
|
-
`RecreateableSSEServerTransport: session ID mismatch. Expected ${redact(this.sessionId)}, got ${redact(sessionId)}. Using constructor value.`
|
|
48649
|
-
);
|
|
48650
|
-
}
|
|
48651
|
-
if (lastEventId !== void 0) {
|
|
48652
|
-
this.setEventIdCounter(lastEventId);
|
|
48653
|
-
}
|
|
48654
|
-
this._isRecreatedSession = true;
|
|
48655
|
-
}
|
|
48656
|
-
};
|
|
48657
|
-
}
|
|
48658
|
-
});
|
|
48659
|
-
|
|
48660
|
-
// libs/sdk/src/transport/adapters/transport.sse.adapter.ts
|
|
48661
|
-
var import_lazy_zod79, TransportSSEAdapter;
|
|
48662
|
-
var init_transport_sse_adapter = __esm({
|
|
48663
|
-
"libs/sdk/src/transport/adapters/transport.sse.adapter.ts"() {
|
|
48664
|
-
"use strict";
|
|
48665
|
-
import_lazy_zod79 = require("@frontmcp/lazy-zod");
|
|
48666
|
-
init_elicitation_types();
|
|
48667
|
-
init_errors();
|
|
48668
|
-
init_transport_error();
|
|
48669
|
-
init_sse_transport();
|
|
48670
|
-
init_transport_local_adapter();
|
|
48671
|
-
TransportSSEAdapter = class extends LocalTransportAdapter {
|
|
48672
|
-
sessionId;
|
|
48673
|
-
/**
|
|
48674
|
-
* Configures common error and close handlers for SSE transports.
|
|
48675
|
-
*/
|
|
48676
|
-
configureTransportHandlers(transport) {
|
|
48677
|
-
transport.onerror = (error) => {
|
|
48678
|
-
console.error("SSE error:", error instanceof Error ? error.message : "Unknown error");
|
|
48679
|
-
};
|
|
48680
|
-
transport.onclose = this.destroy.bind(this);
|
|
48681
|
-
}
|
|
48682
|
-
createTransport(sessionId, res) {
|
|
48683
|
-
this.sessionId = sessionId;
|
|
48684
|
-
this.logger.info(`new transport session: ${sessionId.slice(0, 40)}`);
|
|
48685
|
-
const transport = new RecreateableSSEServerTransport(`${this.scope.fullPath}/message`, res, {
|
|
48686
|
-
sessionId
|
|
48687
|
-
});
|
|
48688
|
-
this.configureTransportHandlers(transport);
|
|
48689
|
-
return transport;
|
|
48690
|
-
}
|
|
48691
|
-
/**
|
|
48692
|
-
* Recreates a transport with preserved session state.
|
|
48693
|
-
* Use this when restoring a session from Redis or other storage.
|
|
48694
|
-
*
|
|
48695
|
-
* @param sessionId - The session ID to restore
|
|
48696
|
-
* @param res - The new response stream for SSE
|
|
48697
|
-
* @param lastEventId - The last event ID that was sent (for reconnection support)
|
|
48698
|
-
*/
|
|
48699
|
-
createTransportFromSession(sessionId, res, lastEventId) {
|
|
48700
|
-
this.sessionId = sessionId;
|
|
48701
|
-
this.logger.info(`recreating transport session: ${sessionId.slice(0, 40)}, lastEventId: ${lastEventId ?? "none"}`);
|
|
48702
|
-
const transport = new RecreateableSSEServerTransport(`${this.scope.fullPath}/message`, res, {
|
|
48703
|
-
sessionId,
|
|
48704
|
-
initialEventId: lastEventId
|
|
48705
|
-
});
|
|
48706
|
-
this.configureTransportHandlers(transport);
|
|
48707
|
-
return transport;
|
|
48708
|
-
}
|
|
48709
|
-
initialize(req, res) {
|
|
48710
|
-
this.logger.verbose(`[${this.sessionId}] handle initialize request`);
|
|
48711
|
-
this.ensureAuthInfo(req, this);
|
|
48712
|
-
return Promise.resolve();
|
|
48713
|
-
}
|
|
48714
|
-
async handleRequest(req, res) {
|
|
48715
|
-
await this.ready;
|
|
48716
|
-
const authInfo = this.ensureAuthInfo(req, this);
|
|
48717
|
-
if (this.handleIfElicitResult(req)) {
|
|
48718
|
-
this.logger.verbose(`[${this.sessionId}] handled elicitation result`);
|
|
48719
|
-
res.writeHead(202, { "Content-Type": "application/json" });
|
|
48720
|
-
res.end(JSON.stringify({ jsonrpc: "2.0", id: null, result: {} }));
|
|
48721
|
-
return;
|
|
48722
|
-
}
|
|
48723
|
-
if (req.method === "GET") {
|
|
48724
|
-
this.logger.verbose(`[${this.sessionId}] handle get request`);
|
|
48725
|
-
return this.transport.handleMessage(req.body, {
|
|
48726
|
-
requestInfo: {
|
|
48727
|
-
headers: req.headers
|
|
48728
|
-
},
|
|
48729
|
-
authInfo
|
|
48730
|
-
});
|
|
48731
|
-
} else {
|
|
48732
|
-
this.logger.verbose(`[${this.sessionId}] handle post request`);
|
|
48733
|
-
return this.transport.handlePostMessage(req, res, req.body);
|
|
48734
|
-
}
|
|
48735
|
-
}
|
|
48736
|
-
/**
|
|
48737
|
-
* Send an elicitation request to the client.
|
|
48738
|
-
*
|
|
48739
|
-
* Only one elicit per session is allowed. A new elicit will cancel any pending one.
|
|
48740
|
-
* On timeout, an ElicitationTimeoutError is thrown to kill tool execution.
|
|
48741
|
-
*
|
|
48742
|
-
* In distributed mode, the pending elicitation is stored in Redis and results
|
|
48743
|
-
* are routed via pub/sub, allowing the response to be received by any node.
|
|
48744
|
-
*/
|
|
48745
|
-
async sendElicitRequest(relatedRequestId, message, requestedSchema, options) {
|
|
48746
|
-
const { mode = "form", ttl = DEFAULT_ELICIT_TTL, elicitationId, url } = options ?? {};
|
|
48747
|
-
if (mode === "url" && !url) {
|
|
48748
|
-
throw new InvalidInputError('url is required when mode is "url"');
|
|
48749
|
-
}
|
|
48750
|
-
await this.cancelPendingElicit();
|
|
48751
|
-
const elicitId = elicitationId || `elicit-${this.newRequestId}`;
|
|
48752
|
-
const sessionId = this.key.sessionId;
|
|
48753
|
-
const expiresAt = Date.now() + ttl;
|
|
48754
|
-
const store = this.requireElicitStore();
|
|
48755
|
-
await store.setPending({
|
|
48756
|
-
elicitId,
|
|
48757
|
-
sessionId,
|
|
48758
|
-
createdAt: Date.now(),
|
|
48759
|
-
expiresAt,
|
|
48760
|
-
message,
|
|
48761
|
-
mode
|
|
48762
|
-
});
|
|
48763
|
-
const params = {
|
|
48764
|
-
mode,
|
|
48765
|
-
message,
|
|
48766
|
-
requestedSchema: (0, import_lazy_zod79.toJSONSchema)(requestedSchema)
|
|
48767
|
-
};
|
|
48768
|
-
if (mode === "url") {
|
|
48769
|
-
params["elicitationId"] = elicitId;
|
|
48770
|
-
params["url"] = url;
|
|
48771
|
-
}
|
|
48772
|
-
this.logger.info("sendElicitRequest", { relatedRequestId, elicitId, mode, ttl });
|
|
48773
|
-
await this.transport.send(rpcRequest(this.newRequestId, "elicitation/create", params));
|
|
48774
|
-
return new Promise((resolve, reject) => {
|
|
48775
|
-
let settled = false;
|
|
48776
|
-
let unsubscribe;
|
|
48777
|
-
const cleanup = () => {
|
|
48778
|
-
clearTimeout(timeoutHandle);
|
|
48779
|
-
this.pendingElicit = void 0;
|
|
48780
|
-
void unsubscribe?.();
|
|
48781
|
-
};
|
|
48782
|
-
const safeResolve = (result) => {
|
|
48783
|
-
if (settled) return;
|
|
48784
|
-
settled = true;
|
|
48785
|
-
cleanup();
|
|
48786
|
-
resolve(result);
|
|
48787
|
-
};
|
|
48788
|
-
const safeReject = (err) => {
|
|
48789
|
-
if (settled) return;
|
|
48790
|
-
settled = true;
|
|
48791
|
-
cleanup();
|
|
48792
|
-
reject(err);
|
|
48793
|
-
};
|
|
48794
|
-
const timeoutHandle = setTimeout(async () => {
|
|
48795
|
-
if (settled) return;
|
|
48796
|
-
settled = true;
|
|
48797
|
-
this.pendingElicit = void 0;
|
|
48798
|
-
await unsubscribe?.();
|
|
48799
|
-
await store.deletePending(sessionId);
|
|
48800
|
-
reject(new ElicitationTimeoutError(elicitId, ttl));
|
|
48801
|
-
}, ttl);
|
|
48802
|
-
store.subscribeResult(
|
|
48803
|
-
elicitId,
|
|
48804
|
-
(result) => {
|
|
48805
|
-
safeResolve(result);
|
|
48806
|
-
},
|
|
48807
|
-
sessionId
|
|
48808
|
-
).then((unsub) => {
|
|
48809
|
-
unsubscribe = unsub;
|
|
48810
|
-
}).catch(async (err) => {
|
|
48811
|
-
if (settled) return;
|
|
48812
|
-
settled = true;
|
|
48813
|
-
clearTimeout(timeoutHandle);
|
|
48814
|
-
this.pendingElicit = void 0;
|
|
48815
|
-
await unsubscribe?.();
|
|
48816
|
-
await store.deletePending(sessionId);
|
|
48817
|
-
reject(err);
|
|
48818
|
-
});
|
|
48819
|
-
this.pendingElicit = {
|
|
48820
|
-
elicitId,
|
|
48821
|
-
timeoutHandle,
|
|
48822
|
-
resolve: safeResolve,
|
|
48823
|
-
reject: safeReject
|
|
48824
|
-
};
|
|
48825
|
-
});
|
|
48826
|
-
}
|
|
48827
|
-
};
|
|
48828
|
-
}
|
|
48829
|
-
});
|
|
48830
|
-
|
|
48831
48848
|
// libs/sdk/src/transport/transport.local.ts
|
|
48832
48849
|
var LocalTransporter;
|
|
48833
48850
|
var init_transport_local = __esm({
|
|
@@ -48983,6 +49000,7 @@ var init_transport_registry = __esm({
|
|
|
48983
49000
|
init_session_id_utils();
|
|
48984
49001
|
init_auth_info_utils();
|
|
48985
49002
|
init_transport_errors();
|
|
49003
|
+
init_transport_sse_adapter();
|
|
48986
49004
|
init_transport_streamable_http_adapter();
|
|
48987
49005
|
init_handle_mcp_20260728_flow();
|
|
48988
49006
|
init_handle_sse_flow();
|
|
@@ -49049,10 +49067,12 @@ var init_transport_registry = __esm({
|
|
|
49049
49067
|
* Key: JSON-encoded {t: type, h: tokenHash, s: sessionId}, Value: Promise that resolves when creation completes
|
|
49050
49068
|
*/
|
|
49051
49069
|
creationMutex = /* @__PURE__ */ new Map();
|
|
49052
|
-
//
|
|
49070
|
+
// Each transport class loads with the first session that uses it, so a stdio server loads neither.
|
|
49053
49071
|
async newLocalTransporter(key, res, onDispose) {
|
|
49054
49072
|
if (key.type === "streamable-http" || key.type === "stateless-http") {
|
|
49055
49073
|
await loadStreamableHttpTransport();
|
|
49074
|
+
} else if (key.type === "sse") {
|
|
49075
|
+
await loadSseTransport();
|
|
49056
49076
|
}
|
|
49057
49077
|
return new LocalTransporter(this.scope, key, res, onDispose);
|
|
49058
49078
|
}
|
|
@@ -53623,20 +53643,20 @@ var init_execute_task_flag = __esm({
|
|
|
53623
53643
|
});
|
|
53624
53644
|
|
|
53625
53645
|
// libs/sdk/src/task/flows/tasks-get.flow.ts
|
|
53626
|
-
var import_lazy_zod80,
|
|
53646
|
+
var import_lazy_zod80, import_protocol57, inputSchema20, outputSchema19, stateSchema24, plan26, name26, Stage26, TasksGetFlow;
|
|
53627
53647
|
var init_tasks_get_flow = __esm({
|
|
53628
53648
|
"libs/sdk/src/task/flows/tasks-get.flow.ts"() {
|
|
53629
53649
|
"use strict";
|
|
53630
53650
|
import_lazy_zod80 = require("@frontmcp/lazy-zod");
|
|
53631
|
-
|
|
53651
|
+
import_protocol57 = require("@frontmcp/protocol");
|
|
53632
53652
|
init_common();
|
|
53633
53653
|
init_errors();
|
|
53634
53654
|
init_task_types();
|
|
53635
53655
|
inputSchema20 = import_lazy_zod80.z.object({
|
|
53636
|
-
request:
|
|
53656
|
+
request: import_protocol57.GetTaskRequestSchema,
|
|
53637
53657
|
ctx: import_lazy_zod80.z.any()
|
|
53638
53658
|
});
|
|
53639
|
-
outputSchema19 =
|
|
53659
|
+
outputSchema19 = import_protocol57.GetTaskResultSchema;
|
|
53640
53660
|
stateSchema24 = import_lazy_zod80.z.object({
|
|
53641
53661
|
taskId: import_lazy_zod80.z.string(),
|
|
53642
53662
|
sessionId: import_lazy_zod80.z.string(),
|
|
@@ -53699,20 +53719,20 @@ var init_tasks_get_flow = __esm({
|
|
|
53699
53719
|
});
|
|
53700
53720
|
|
|
53701
53721
|
// libs/sdk/src/task/flows/tasks-result.flow.ts
|
|
53702
|
-
var import_lazy_zod81,
|
|
53722
|
+
var import_lazy_zod81, import_protocol58, inputSchema21, outputSchema20, stateSchema25, plan27, name27, Stage27, TasksResultFlow, JsonRpcReplayError;
|
|
53703
53723
|
var init_tasks_result_flow = __esm({
|
|
53704
53724
|
"libs/sdk/src/task/flows/tasks-result.flow.ts"() {
|
|
53705
53725
|
"use strict";
|
|
53706
53726
|
import_lazy_zod81 = require("@frontmcp/lazy-zod");
|
|
53707
|
-
|
|
53727
|
+
import_protocol58 = require("@frontmcp/protocol");
|
|
53708
53728
|
init_common();
|
|
53709
53729
|
init_errors();
|
|
53710
53730
|
init_task_types();
|
|
53711
53731
|
inputSchema21 = import_lazy_zod81.z.object({
|
|
53712
|
-
request:
|
|
53732
|
+
request: import_protocol58.GetTaskPayloadRequestSchema,
|
|
53713
53733
|
ctx: import_lazy_zod81.z.any()
|
|
53714
53734
|
});
|
|
53715
|
-
outputSchema20 =
|
|
53735
|
+
outputSchema20 = import_protocol58.GetTaskPayloadResultSchema;
|
|
53716
53736
|
stateSchema25 = import_lazy_zod81.z.object({
|
|
53717
53737
|
taskId: import_lazy_zod81.z.string(),
|
|
53718
53738
|
sessionId: import_lazy_zod81.z.string(),
|
|
@@ -53875,20 +53895,20 @@ var init_tasks_result_flow = __esm({
|
|
|
53875
53895
|
});
|
|
53876
53896
|
|
|
53877
53897
|
// libs/sdk/src/task/flows/tasks-cancel.flow.ts
|
|
53878
|
-
var import_lazy_zod82,
|
|
53898
|
+
var import_lazy_zod82, import_protocol59, inputSchema22, outputSchema21, stateSchema26, plan28, name28, Stage28, TasksCancelFlow;
|
|
53879
53899
|
var init_tasks_cancel_flow = __esm({
|
|
53880
53900
|
"libs/sdk/src/task/flows/tasks-cancel.flow.ts"() {
|
|
53881
53901
|
"use strict";
|
|
53882
53902
|
import_lazy_zod82 = require("@frontmcp/lazy-zod");
|
|
53883
|
-
|
|
53903
|
+
import_protocol59 = require("@frontmcp/protocol");
|
|
53884
53904
|
init_common();
|
|
53885
53905
|
init_errors();
|
|
53886
53906
|
init_task_types();
|
|
53887
53907
|
inputSchema22 = import_lazy_zod82.z.object({
|
|
53888
|
-
request:
|
|
53908
|
+
request: import_protocol59.CancelTaskRequestSchema,
|
|
53889
53909
|
ctx: import_lazy_zod82.z.any()
|
|
53890
53910
|
});
|
|
53891
|
-
outputSchema21 =
|
|
53911
|
+
outputSchema21 = import_protocol59.CancelTaskResultSchema;
|
|
53892
53912
|
stateSchema26 = import_lazy_zod82.z.object({
|
|
53893
53913
|
taskId: import_lazy_zod82.z.string(),
|
|
53894
53914
|
sessionId: import_lazy_zod82.z.string(),
|
|
@@ -53985,20 +54005,20 @@ var init_tasks_cancel_flow = __esm({
|
|
|
53985
54005
|
});
|
|
53986
54006
|
|
|
53987
54007
|
// libs/sdk/src/task/flows/tasks-list.flow.ts
|
|
53988
|
-
var import_lazy_zod83,
|
|
54008
|
+
var import_lazy_zod83, import_protocol60, inputSchema23, outputSchema22, stateSchema27, plan29, name29, Stage29, TasksListFlow;
|
|
53989
54009
|
var init_tasks_list_flow = __esm({
|
|
53990
54010
|
"libs/sdk/src/task/flows/tasks-list.flow.ts"() {
|
|
53991
54011
|
"use strict";
|
|
53992
54012
|
import_lazy_zod83 = require("@frontmcp/lazy-zod");
|
|
53993
|
-
|
|
54013
|
+
import_protocol60 = require("@frontmcp/protocol");
|
|
53994
54014
|
init_common();
|
|
53995
54015
|
init_errors();
|
|
53996
54016
|
init_task_types();
|
|
53997
54017
|
inputSchema23 = import_lazy_zod83.z.object({
|
|
53998
|
-
request:
|
|
54018
|
+
request: import_protocol60.ListTasksRequestSchema,
|
|
53999
54019
|
ctx: import_lazy_zod83.z.any()
|
|
54000
54020
|
});
|
|
54001
|
-
outputSchema22 =
|
|
54021
|
+
outputSchema22 = import_protocol60.ListTasksResultSchema;
|
|
54002
54022
|
stateSchema27 = import_lazy_zod83.z.object({
|
|
54003
54023
|
sessionId: import_lazy_zod83.z.string(),
|
|
54004
54024
|
cursor: import_lazy_zod83.z.string().optional(),
|
|
@@ -54133,9 +54153,9 @@ function bundledOptionalModules() {
|
|
|
54133
54153
|
function registerOptionalModule(moduleName, moduleExports) {
|
|
54134
54154
|
bundledOptionalModules().set(moduleName, moduleExports);
|
|
54135
54155
|
}
|
|
54136
|
-
function requireOptionalModule(moduleName,
|
|
54156
|
+
function requireOptionalModule(moduleName, load2) {
|
|
54137
54157
|
const registry = bundledOptionalModules();
|
|
54138
|
-
return registry.has(moduleName) ? registry.get(moduleName) :
|
|
54158
|
+
return registry.has(moduleName) ? registry.get(moduleName) : load2();
|
|
54139
54159
|
}
|
|
54140
54160
|
var BUNDLED_OPTIONAL_MODULES;
|
|
54141
54161
|
var init_optional_dependency_util = __esm({
|
|
@@ -60805,6 +60825,15 @@ var init_auth_ui_registry = __esm({
|
|
|
60805
60825
|
}
|
|
60806
60826
|
});
|
|
60807
60827
|
|
|
60828
|
+
// libs/sdk/src/third-party/uipack-render.ts
|
|
60829
|
+
var import_uipack;
|
|
60830
|
+
var init_uipack_render = __esm({
|
|
60831
|
+
"libs/sdk/src/third-party/uipack-render.ts"() {
|
|
60832
|
+
"use strict";
|
|
60833
|
+
import_uipack = require("@frontmcp/uipack");
|
|
60834
|
+
}
|
|
60835
|
+
});
|
|
60836
|
+
|
|
60808
60837
|
// libs/sdk/src/auth/auth-ui/auth-ui.render.ts
|
|
60809
60838
|
function authUiExtraPath(fullPath) {
|
|
60810
60839
|
return `${fullPath.replace(/\/+$/, "")}/oauth/ui/extra`;
|
|
@@ -60915,11 +60944,11 @@ function defaultTitle(slot) {
|
|
|
60915
60944
|
return "Authorization";
|
|
60916
60945
|
}
|
|
60917
60946
|
}
|
|
60918
|
-
var
|
|
60947
|
+
var UNSAFE_FORM_TARGET_SCHEMES, AUTH_UI_CSP;
|
|
60919
60948
|
var init_auth_ui_render = __esm({
|
|
60920
60949
|
"libs/sdk/src/auth/auth-ui/auth-ui.render.ts"() {
|
|
60921
60950
|
"use strict";
|
|
60922
|
-
|
|
60951
|
+
init_uipack_render();
|
|
60923
60952
|
init_auth_ui_contract();
|
|
60924
60953
|
UNSAFE_FORM_TARGET_SCHEMES = /* @__PURE__ */ new Set(["javascript:", "data:", "blob:", "filesystem:", "about:", "file:"]);
|
|
60925
60954
|
AUTH_UI_CSP = authUiCsp();
|
|
@@ -71918,11 +71947,11 @@ function isAsyncIterable(stream) {
|
|
|
71918
71947
|
function internalError(id) {
|
|
71919
71948
|
return { jsonrpc: "2.0", id, error: { code: -32603, message: "Internal error" } };
|
|
71920
71949
|
}
|
|
71921
|
-
var
|
|
71950
|
+
var import_protocol61, EVENT_SEPARATOR, EVENT_DATA_FIELD, StdioRevisionRouter;
|
|
71922
71951
|
var init_stdio_revision_router = __esm({
|
|
71923
71952
|
"libs/sdk/src/transport/stdio-revision-router.ts"() {
|
|
71924
71953
|
"use strict";
|
|
71925
|
-
|
|
71954
|
+
import_protocol61 = require("@frontmcp/protocol");
|
|
71926
71955
|
init_common();
|
|
71927
71956
|
init_flow_error_output();
|
|
71928
71957
|
init_mcp_20260728();
|
|
@@ -71951,7 +71980,7 @@ var init_stdio_revision_router = __esm({
|
|
|
71951
71980
|
await this.inner.start();
|
|
71952
71981
|
}
|
|
71953
71982
|
async send(message, options) {
|
|
71954
|
-
if (this.era === "modern" && (0,
|
|
71983
|
+
if (this.era === "modern" && (0, import_protocol61.isJSONRPCNotification)(message)) return;
|
|
71955
71984
|
await this.inner.send(message, options);
|
|
71956
71985
|
}
|
|
71957
71986
|
async close() {
|
|
@@ -71960,12 +71989,12 @@ var init_stdio_revision_router = __esm({
|
|
|
71960
71989
|
}
|
|
71961
71990
|
route(message, extra) {
|
|
71962
71991
|
if (this.cancelsModernRequest(message)) return;
|
|
71963
|
-
if (((0,
|
|
71992
|
+
if (((0, import_protocol61.isJSONRPCRequest)(message) || (0, import_protocol61.isJSONRPCNotification)(message)) && this.servesModern(message)) {
|
|
71964
71993
|
if (this.era === "unknown") this.era = "modern";
|
|
71965
71994
|
void this.serveModern(message);
|
|
71966
71995
|
return;
|
|
71967
71996
|
}
|
|
71968
|
-
if ((0,
|
|
71997
|
+
if ((0, import_protocol61.isJSONRPCRequest)(message) && message.method === "initialize") this.era = "legacy";
|
|
71969
71998
|
this.onmessage?.(message, extra);
|
|
71970
71999
|
}
|
|
71971
72000
|
servesModern(message) {
|
|
@@ -71977,7 +72006,7 @@ var init_stdio_revision_router = __esm({
|
|
|
71977
72006
|
});
|
|
71978
72007
|
}
|
|
71979
72008
|
cancelsModernRequest(message) {
|
|
71980
|
-
if (!(0,
|
|
72009
|
+
if (!(0, import_protocol61.isJSONRPCNotification)(message) || message.method !== "notifications/cancelled") return false;
|
|
71981
72010
|
const requestId = message.params?.["requestId"];
|
|
71982
72011
|
if (typeof requestId !== "string" && typeof requestId !== "number") return false;
|
|
71983
72012
|
const controller = this.inFlight.get(requestId);
|
|
@@ -71987,7 +72016,7 @@ var init_stdio_revision_router = __esm({
|
|
|
71987
72016
|
return true;
|
|
71988
72017
|
}
|
|
71989
72018
|
async serveModern(message) {
|
|
71990
|
-
const id = (0,
|
|
72019
|
+
const id = (0, import_protocol61.isJSONRPCRequest)(message) ? message.id : void 0;
|
|
71991
72020
|
const controller = new AbortController();
|
|
71992
72021
|
if (id !== void 0) this.inFlight.set(id, controller);
|
|
71993
72022
|
try {
|
|
@@ -72029,7 +72058,7 @@ var init_stdio_revision_router = __esm({
|
|
|
72029
72058
|
}
|
|
72030
72059
|
if (signal.aborted) return;
|
|
72031
72060
|
const body = output?.kind === "json" ? output.body : void 0;
|
|
72032
|
-
const isReply = (0,
|
|
72061
|
+
const isReply = (0, import_protocol61.isJSONRPCResultResponse)(body) || (0, import_protocol61.isJSONRPCErrorResponse)(body);
|
|
72033
72062
|
await this.inner.send(isReply ? body : internalError(id));
|
|
72034
72063
|
}
|
|
72035
72064
|
cancelAll() {
|
|
@@ -72055,11 +72084,11 @@ function resolveConfigInput(optionsOrClass) {
|
|
|
72055
72084
|
}
|
|
72056
72085
|
return optionsOrClass;
|
|
72057
72086
|
}
|
|
72058
|
-
var
|
|
72087
|
+
var import_protocol62, import_utils136, stdioServing, FrontMcpInstance;
|
|
72059
72088
|
var init_front_mcp = __esm({
|
|
72060
72089
|
"libs/sdk/src/front-mcp/front-mcp.ts"() {
|
|
72061
72090
|
"use strict";
|
|
72062
|
-
|
|
72091
|
+
import_protocol62 = require("@frontmcp/protocol");
|
|
72063
72092
|
import_utils136 = require("@frontmcp/utils");
|
|
72064
72093
|
init_common();
|
|
72065
72094
|
init_direct();
|
|
@@ -72669,7 +72698,7 @@ var init_front_mcp = __esm({
|
|
|
72669
72698
|
},
|
|
72670
72699
|
serverInfo: scope.metadata.info
|
|
72671
72700
|
};
|
|
72672
|
-
const mcpServer = new
|
|
72701
|
+
const mcpServer = new import_protocol62.McpServer(scope.metadata.info, serverOptions);
|
|
72673
72702
|
startupCleanups.push(() => mcpServer.close());
|
|
72674
72703
|
const sessionId = `stdio:${(0, import_utils136.randomUUID)()}`;
|
|
72675
72704
|
const handlers = createMcpHandlers2({ scope, serverOptions, composeInstructions });
|
|
@@ -72687,7 +72716,7 @@ var init_front_mcp = __esm({
|
|
|
72687
72716
|
}
|
|
72688
72717
|
const { IpcServerTransport: IpcServerTransport2, isIpcStdioRequested: isIpcStdioRequested2 } = await Promise.resolve().then(() => (init_ipc_server_transport(), ipc_server_transport_exports));
|
|
72689
72718
|
const { StdioRevisionRouter: StdioRevisionRouter2 } = await Promise.resolve().then(() => (init_stdio_revision_router(), stdio_revision_router_exports));
|
|
72690
|
-
const stdioTransport = isIpcStdioRequested2() ? new IpcServerTransport2() : new
|
|
72719
|
+
const stdioTransport = isIpcStdioRequested2() ? new IpcServerTransport2() : new import_protocol62.StdioServerTransport();
|
|
72691
72720
|
const transport = new StdioRevisionRouter2(stdioTransport, { scope, principal: sessionId });
|
|
72692
72721
|
startupCleanups.push(() => transport.close());
|
|
72693
72722
|
await mcpServer.connect(transport);
|
|
@@ -74926,7 +74955,7 @@ __export(index_exports, {
|
|
|
74926
74955
|
OrchestratorJwksNotAvailableError: () => import_auth15.OrchestratorJwksNotAvailableError,
|
|
74927
74956
|
PLATFORM_CLIENT_INFO: () => PLATFORM_CLIENT_INFO,
|
|
74928
74957
|
PRIMITIVE_FILTER_KEYS: () => PRIMITIVE_FILTER_KEYS,
|
|
74929
|
-
PROTOCOL_2026_07_28: () =>
|
|
74958
|
+
PROTOCOL_2026_07_28: () => import_protocol63.PROTOCOL_2026_07_28,
|
|
74930
74959
|
PROTOCOL_PRESETS: () => PROTOCOL_PRESETS,
|
|
74931
74960
|
PayloadTooLargeError: () => PayloadTooLargeError,
|
|
74932
74961
|
Plugin: () => FrontMcpPlugin,
|
|
@@ -76296,7 +76325,7 @@ init_mcp_20260728();
|
|
|
76296
76325
|
init_mcp_20260728();
|
|
76297
76326
|
init_mcp_20260728();
|
|
76298
76327
|
init_mcp_stateless_client_adapter();
|
|
76299
|
-
var
|
|
76328
|
+
var import_protocol63 = require("@frontmcp/protocol");
|
|
76300
76329
|
init_web_standard_mcp();
|
|
76301
76330
|
init_transport_types();
|
|
76302
76331
|
init_ext_apps2();
|