@frontmcp/sdk 0.11.2 → 0.11.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/adapter/adapter.registry.d.ts.map +1 -1
- package/agent/flows/call-agent.flow.d.ts.map +1 -1
- package/app/app.registry.d.ts +1 -0
- package/app/app.registry.d.ts.map +1 -1
- package/app/instances/app.local.instance.d.ts +1 -0
- package/app/instances/app.local.instance.d.ts.map +1 -1
- package/app/instances/app.remote.instance.d.ts.map +1 -1
- package/auth/flows/session.verify.flow.d.ts +2 -0
- package/auth/flows/session.verify.flow.d.ts.map +1 -1
- package/common/decorators/skill.decorator.d.ts +13 -1
- package/common/decorators/skill.decorator.d.ts.map +1 -1
- package/common/entries/skill.entry.d.ts +21 -1
- package/common/entries/skill.entry.d.ts.map +1 -1
- package/common/interfaces/internal/registry.interface.d.ts +1 -0
- package/common/interfaces/internal/registry.interface.d.ts.map +1 -1
- package/common/interfaces/skill.interface.d.ts +21 -1
- package/common/interfaces/skill.interface.d.ts.map +1 -1
- package/common/metadata/skill.metadata.d.ts +56 -0
- package/common/metadata/skill.metadata.d.ts.map +1 -1
- package/common/tokens/skill.tokens.d.ts +5 -0
- package/common/tokens/skill.tokens.d.ts.map +1 -1
- package/esm/index.mjs +393 -70
- package/esm/package.json +6 -6
- package/flows/flow.instance.d.ts +1 -0
- package/flows/flow.instance.d.ts.map +1 -1
- package/front-mcp/front-mcp.d.ts +1 -0
- package/front-mcp/front-mcp.d.ts.map +1 -1
- package/index.js +522 -198
- package/package.json +6 -6
- package/plugin/plugin.registry.d.ts +7 -0
- package/plugin/plugin.registry.d.ts.map +1 -1
- package/scope/scope.instance.d.ts +1 -0
- package/scope/scope.instance.d.ts.map +1 -1
- package/scope/scope.registry.d.ts +1 -0
- package/scope/scope.registry.d.ts.map +1 -1
- package/skill/index.d.ts +16 -0
- package/skill/index.d.ts.map +1 -1
- package/skill/skill-directory-loader.d.ts +51 -0
- package/skill/skill-directory-loader.d.ts.map +1 -0
- package/skill/skill-http.utils.d.ts +6 -1
- package/skill/skill-http.utils.d.ts.map +1 -1
- package/skill/skill-md-parser.d.ts +60 -0
- package/skill/skill-md-parser.d.ts.map +1 -0
- package/skill/skill.instance.d.ts.map +1 -1
- package/skill/skill.utils.d.ts.map +1 -1
- package/tool/flows/call-tool.flow.d.ts.map +1 -1
- package/transport/flows/handle.stateless-http.flow.d.ts.map +1 -1
- package/transport/flows/handle.streamable-http.flow.d.ts.map +1 -1
- package/transport/mcp-handlers/call-tool-request.handler.d.ts.map +1 -1
- package/transport/mcp-handlers/complete-request.handler.d.ts.map +1 -1
- package/transport/mcp-handlers/get-prompt-request.handler.d.ts.map +1 -1
- package/transport/mcp-handlers/list-prompts-request.handler.d.ts.map +1 -1
- package/transport/mcp-handlers/list-resource-templates-request.handler.d.ts.map +1 -1
- package/transport/mcp-handlers/list-resources-request.handler.d.ts.map +1 -1
- package/transport/mcp-handlers/list-tools-request.handler.d.ts.map +1 -1
- package/transport/mcp-handlers/read-resource-request.handler.d.ts.map +1 -1
- package/transport/mcp-handlers/unsubscribe-request.handler.d.ts.map +1 -1
package/index.js
CHANGED
|
@@ -411,6 +411,11 @@ var init_skill_tokens = __esm({
|
|
|
411
411
|
hideFromDiscovery: tokenFactory.meta("skill:hideFromDiscovery"),
|
|
412
412
|
toolValidation: tokenFactory.meta("skill:toolValidation"),
|
|
413
413
|
visibility: tokenFactory.meta("skill:visibility"),
|
|
414
|
+
license: tokenFactory.meta("skill:license"),
|
|
415
|
+
compatibility: tokenFactory.meta("skill:compatibility"),
|
|
416
|
+
specMetadata: tokenFactory.meta("skill:specMetadata"),
|
|
417
|
+
allowedTools: tokenFactory.meta("skill:allowedTools"),
|
|
418
|
+
resources: tokenFactory.meta("skill:resources"),
|
|
414
419
|
metadata: tokenFactory.meta("skill:metadata")
|
|
415
420
|
// used in skill({}) construction
|
|
416
421
|
};
|
|
@@ -2623,7 +2628,7 @@ function isFileInstructions(source) {
|
|
|
2623
2628
|
function isUrlInstructions(source) {
|
|
2624
2629
|
return typeof source === "object" && "url" in source;
|
|
2625
2630
|
}
|
|
2626
|
-
var import_zod29, import_di3, import_utils5, skillToolRefSchema, skillToolRefWithClassSchema, skillToolInputSchema, skillParameterSchema, skillExampleSchema, skillInstructionSourceSchema, skillMetadataSchema;
|
|
2631
|
+
var import_zod29, import_di3, import_utils5, skillToolRefSchema, skillToolRefWithClassSchema, skillToolInputSchema, skillParameterSchema, skillExampleSchema, skillInstructionSourceSchema, skillResourcesSchema, skillMetadataSchema;
|
|
2627
2632
|
var init_skill_metadata = __esm({
|
|
2628
2633
|
"libs/sdk/src/common/metadata/skill.metadata.ts"() {
|
|
2629
2634
|
"use strict";
|
|
@@ -2677,10 +2682,21 @@ var init_skill_metadata = __esm({
|
|
|
2677
2682
|
}).strict()
|
|
2678
2683
|
// URL
|
|
2679
2684
|
]);
|
|
2685
|
+
skillResourcesSchema = import_zod29.z.object({
|
|
2686
|
+
scripts: import_zod29.z.string().optional(),
|
|
2687
|
+
references: import_zod29.z.string().optional(),
|
|
2688
|
+
assets: import_zod29.z.string().optional()
|
|
2689
|
+
});
|
|
2680
2690
|
skillMetadataSchema = import_zod29.z.object({
|
|
2681
2691
|
id: import_zod29.z.string().optional(),
|
|
2682
|
-
name: import_zod29.z.string().min(1)
|
|
2683
|
-
|
|
2692
|
+
name: import_zod29.z.string().min(1).max(64).regex(/^[a-z0-9]([a-z0-9-]*[a-z0-9])?$/, {
|
|
2693
|
+
message: "Skill name must be kebab-case: lowercase letters, numbers, and hyphens only. Must not start/end with a hyphen."
|
|
2694
|
+
}).refine((n) => !n.includes("--"), {
|
|
2695
|
+
message: "Skill name must not contain consecutive hyphens."
|
|
2696
|
+
}),
|
|
2697
|
+
description: import_zod29.z.string().min(1).max(1024).refine((d) => !/<[a-zA-Z][^>]*>/.test(d), {
|
|
2698
|
+
message: "Skill description must not contain XML/HTML tags (per Agent Skills spec)."
|
|
2699
|
+
}),
|
|
2684
2700
|
instructions: skillInstructionSourceSchema,
|
|
2685
2701
|
tools: import_zod29.z.array(skillToolInputSchema).optional(),
|
|
2686
2702
|
tags: import_zod29.z.array(import_zod29.z.string().min(1)).optional(),
|
|
@@ -2689,7 +2705,12 @@ var init_skill_metadata = __esm({
|
|
|
2689
2705
|
priority: import_zod29.z.number().optional().default(0),
|
|
2690
2706
|
hideFromDiscovery: import_zod29.z.boolean().optional().default(false),
|
|
2691
2707
|
toolValidation: import_zod29.z.enum(["strict", "warn", "ignore"]).optional().default("warn"),
|
|
2692
|
-
visibility: import_zod29.z.enum(["mcp", "http", "both"]).optional().default("both")
|
|
2708
|
+
visibility: import_zod29.z.enum(["mcp", "http", "both"]).optional().default("both"),
|
|
2709
|
+
license: import_zod29.z.string().optional(),
|
|
2710
|
+
compatibility: import_zod29.z.string().max(500).optional(),
|
|
2711
|
+
specMetadata: import_zod29.z.record(import_zod29.z.string(), import_zod29.z.string()).optional(),
|
|
2712
|
+
allowedTools: import_zod29.z.string().optional(),
|
|
2713
|
+
resources: skillResourcesSchema.optional()
|
|
2693
2714
|
}).passthrough();
|
|
2694
2715
|
}
|
|
2695
2716
|
});
|
|
@@ -9283,7 +9304,11 @@ ${JSON.stringify(error.schema, null, 2)}
|
|
|
9283
9304
|
this.logger.info("finalize: sending response", {
|
|
9284
9305
|
tool: tool.metadata.name,
|
|
9285
9306
|
hasContent: Array.isArray(result.content) && result.content.length > 0,
|
|
9286
|
-
|
|
9307
|
+
contentParts: Array.isArray(result.content) ? result.content.length : 0,
|
|
9308
|
+
contentBytes: Array.isArray(result.content) ? result.content.reduce((sum, part) => {
|
|
9309
|
+
const str = JSON.stringify(part);
|
|
9310
|
+
return sum + (typeof Buffer !== "undefined" ? Buffer.byteLength(str, "utf8") : new TextEncoder().encode(str).byteLength);
|
|
9311
|
+
}, 0) : 0,
|
|
9287
9312
|
hasStructuredContent: result.structuredContent !== void 0,
|
|
9288
9313
|
hasMeta: result._meta !== void 0,
|
|
9289
9314
|
metaKeys: result._meta ? Object.keys(result._meta) : [],
|
|
@@ -13028,9 +13053,10 @@ var init_adapter_registry = __esm({
|
|
|
13028
13053
|
const instance = new AdapterInstance(rec, deps, this.providers);
|
|
13029
13054
|
this.instances.set(token, instance);
|
|
13030
13055
|
readyArr.push(instance.ready);
|
|
13056
|
+
this.logger?.verbose(`AdapterRegistry: initialized adapter '${rec.metadata.name}'`);
|
|
13031
13057
|
}
|
|
13032
13058
|
await Promise.all(readyArr);
|
|
13033
|
-
this.logger?.
|
|
13059
|
+
this.logger?.verbose(`AdapterRegistry: initialization complete (${this.instances.size} adapter(s))`);
|
|
13034
13060
|
}
|
|
13035
13061
|
getAdapters() {
|
|
13036
13062
|
return [...this.instances.values()];
|
|
@@ -13168,6 +13194,44 @@ var init_skill_events = __esm({
|
|
|
13168
13194
|
}
|
|
13169
13195
|
});
|
|
13170
13196
|
|
|
13197
|
+
// libs/sdk/src/skill/skill-md-parser.ts
|
|
13198
|
+
function parseSkillMdFrontmatter(content) {
|
|
13199
|
+
const trimmed = content.trimStart();
|
|
13200
|
+
if (!trimmed.startsWith("---")) {
|
|
13201
|
+
return { frontmatter: {}, body: content };
|
|
13202
|
+
}
|
|
13203
|
+
const closingIndex = trimmed.indexOf("\n---", 3);
|
|
13204
|
+
if (closingIndex === -1) {
|
|
13205
|
+
return { frontmatter: {}, body: content };
|
|
13206
|
+
}
|
|
13207
|
+
const yamlBlock = trimmed.substring(3, closingIndex).trim();
|
|
13208
|
+
const afterClose = closingIndex + 4;
|
|
13209
|
+
const bodyStart = trimmed[afterClose] === "\n" ? afterClose + 1 : afterClose;
|
|
13210
|
+
const body = trimmed.substring(bodyStart);
|
|
13211
|
+
let frontmatter = {};
|
|
13212
|
+
try {
|
|
13213
|
+
const parsed = yaml.load(yamlBlock);
|
|
13214
|
+
if (typeof parsed === "object" && parsed !== null && !Array.isArray(parsed)) {
|
|
13215
|
+
frontmatter = parsed;
|
|
13216
|
+
}
|
|
13217
|
+
} catch {
|
|
13218
|
+
return { frontmatter: {}, body: content };
|
|
13219
|
+
}
|
|
13220
|
+
return { frontmatter, body };
|
|
13221
|
+
}
|
|
13222
|
+
function stripFrontmatter(content) {
|
|
13223
|
+
const { body } = parseSkillMdFrontmatter(content);
|
|
13224
|
+
return body;
|
|
13225
|
+
}
|
|
13226
|
+
var yaml, import_utils21;
|
|
13227
|
+
var init_skill_md_parser = __esm({
|
|
13228
|
+
"libs/sdk/src/skill/skill-md-parser.ts"() {
|
|
13229
|
+
"use strict";
|
|
13230
|
+
yaml = __toESM(require("js-yaml"));
|
|
13231
|
+
import_utils21 = require("@frontmcp/utils");
|
|
13232
|
+
}
|
|
13233
|
+
});
|
|
13234
|
+
|
|
13171
13235
|
// libs/sdk/src/skill/skill.utils.ts
|
|
13172
13236
|
function collectSkillMetadata(cls) {
|
|
13173
13237
|
const extended = (0, import_di18.getMetadata)(extendedSkillMetadata, cls);
|
|
@@ -13234,7 +13298,8 @@ async function loadInstructions(source, basePath) {
|
|
|
13234
13298
|
}
|
|
13235
13299
|
if (isFileInstructions(source)) {
|
|
13236
13300
|
const filePath = basePath ? `${basePath}/${source.file}` : source.file;
|
|
13237
|
-
|
|
13301
|
+
const content = await (0, import_utils22.readFile)(filePath, "utf-8");
|
|
13302
|
+
return stripFrontmatter(content);
|
|
13238
13303
|
}
|
|
13239
13304
|
if (isUrlInstructions(source)) {
|
|
13240
13305
|
const response = await fetch(source.url);
|
|
@@ -13253,7 +13318,12 @@ function buildSkillContent(metadata, instructions) {
|
|
|
13253
13318
|
instructions,
|
|
13254
13319
|
tools: normalizeToolRefs(metadata.tools),
|
|
13255
13320
|
parameters: metadata.parameters,
|
|
13256
|
-
examples: metadata.examples
|
|
13321
|
+
examples: metadata.examples,
|
|
13322
|
+
license: metadata.license,
|
|
13323
|
+
compatibility: metadata.compatibility,
|
|
13324
|
+
specMetadata: metadata.specMetadata,
|
|
13325
|
+
allowedTools: metadata.allowedTools,
|
|
13326
|
+
resources: metadata.resources
|
|
13257
13327
|
};
|
|
13258
13328
|
}
|
|
13259
13329
|
function normalizeToolRefs(tools) {
|
|
@@ -13287,6 +13357,14 @@ function formatSkillForLLM(skill, availableTools, missingTools) {
|
|
|
13287
13357
|
parts.push("");
|
|
13288
13358
|
parts.push(skill.description);
|
|
13289
13359
|
parts.push("");
|
|
13360
|
+
if (skill.license) {
|
|
13361
|
+
parts.push(`**License:** ${skill.license}`);
|
|
13362
|
+
parts.push("");
|
|
13363
|
+
}
|
|
13364
|
+
if (skill.compatibility) {
|
|
13365
|
+
parts.push(`**Compatibility:** ${skill.compatibility}`);
|
|
13366
|
+
parts.push("");
|
|
13367
|
+
}
|
|
13290
13368
|
if (missingTools.length > 0) {
|
|
13291
13369
|
parts.push("> **Warning:** Some tools referenced by this skill are not available:");
|
|
13292
13370
|
parts.push(`> Missing: ${missingTools.join(", ")}`);
|
|
@@ -13356,14 +13434,15 @@ function generateSearchGuidance(skills, query) {
|
|
|
13356
13434
|
}
|
|
13357
13435
|
return `Found ${skills.length} skill(s), but some tools are missing. Try loadSkills({ skillIds: ["${topSkill.name}"] }) to see which tools are available. You may be able to partially execute the workflow.`;
|
|
13358
13436
|
}
|
|
13359
|
-
var import_di18,
|
|
13437
|
+
var import_di18, import_utils22;
|
|
13360
13438
|
var init_skill_utils = __esm({
|
|
13361
13439
|
"libs/sdk/src/skill/skill.utils.ts"() {
|
|
13362
13440
|
"use strict";
|
|
13363
13441
|
import_di18 = require("@frontmcp/di");
|
|
13364
13442
|
init_common();
|
|
13365
|
-
|
|
13443
|
+
import_utils22 = require("@frontmcp/utils");
|
|
13366
13444
|
init_errors();
|
|
13445
|
+
init_skill_md_parser();
|
|
13367
13446
|
}
|
|
13368
13447
|
});
|
|
13369
13448
|
|
|
@@ -14649,6 +14728,7 @@ var init_plugin_registry = __esm({
|
|
|
14649
14728
|
init_hooks_utils();
|
|
14650
14729
|
init_errors();
|
|
14651
14730
|
init_context();
|
|
14731
|
+
init_common();
|
|
14652
14732
|
PluginRegistry = class _PluginRegistry extends RegistryAbstract {
|
|
14653
14733
|
/** providers by token */
|
|
14654
14734
|
pProviders = /* @__PURE__ */ new Map();
|
|
@@ -14667,15 +14747,29 @@ var init_plugin_registry = __esm({
|
|
|
14667
14747
|
scope;
|
|
14668
14748
|
scopeInfo;
|
|
14669
14749
|
owner;
|
|
14750
|
+
logger;
|
|
14670
14751
|
constructor(providers, list, owner, scopeInfo) {
|
|
14671
14752
|
super("PluginRegistry", providers, list);
|
|
14672
14753
|
this.scope = providers.getActiveScope();
|
|
14673
14754
|
this.scopeInfo = scopeInfo;
|
|
14674
14755
|
this.owner = owner;
|
|
14756
|
+
try {
|
|
14757
|
+
this.logger = providers.get(FrontMcpLogger)?.child("PluginRegistry");
|
|
14758
|
+
} catch (e) {
|
|
14759
|
+
console.debug("PluginRegistry: logger initialization failed", e);
|
|
14760
|
+
}
|
|
14675
14761
|
}
|
|
14676
14762
|
getPlugins() {
|
|
14677
14763
|
return [...this.instances.values()];
|
|
14678
14764
|
}
|
|
14765
|
+
/**
|
|
14766
|
+
* Returns the names of all registered plugins from their definition records.
|
|
14767
|
+
* Unlike getPlugins().map(p => p.metadata.name), this is safe because
|
|
14768
|
+
* raw plugin instances (e.g. DynamicPlugin subclasses) may not carry a .metadata property.
|
|
14769
|
+
*/
|
|
14770
|
+
getPluginNames() {
|
|
14771
|
+
return [...this.defs.values()].map((rec) => rec.metadata.name);
|
|
14772
|
+
}
|
|
14679
14773
|
buildMap(list) {
|
|
14680
14774
|
const tokens = /* @__PURE__ */ new Set();
|
|
14681
14775
|
const defs = /* @__PURE__ */ new Map();
|
|
@@ -14702,6 +14796,7 @@ var init_plugin_registry = __esm({
|
|
|
14702
14796
|
}
|
|
14703
14797
|
}
|
|
14704
14798
|
async initialize() {
|
|
14799
|
+
this.logger?.verbose(`PluginRegistry: initializing ${this.tokens.size} plugin(s)`);
|
|
14705
14800
|
for (const token of this.tokens) {
|
|
14706
14801
|
const rec = this.defs.get(token);
|
|
14707
14802
|
const deps = this.graph.get(token);
|
|
@@ -14809,6 +14904,9 @@ var init_plugin_registry = __esm({
|
|
|
14809
14904
|
}
|
|
14810
14905
|
}
|
|
14811
14906
|
this.instances.set(token, pluginInstance);
|
|
14907
|
+
this.logger?.verbose(
|
|
14908
|
+
`PluginRegistry: registered plugin '${rec.metadata.name}' (${hooks.length} hook(s), ${contextExtensions?.length ?? 0} context extension(s))`
|
|
14909
|
+
);
|
|
14812
14910
|
}
|
|
14813
14911
|
}
|
|
14814
14912
|
};
|
|
@@ -15972,13 +16070,13 @@ function parseEnvContent(content) {
|
|
|
15972
16070
|
async function loadEnvFiles(basePath = process.cwd(), envPath = ".env", localEnvPath = ".env.local") {
|
|
15973
16071
|
const result = {};
|
|
15974
16072
|
const envFile = path.resolve(basePath, envPath);
|
|
15975
|
-
if (await (0,
|
|
15976
|
-
const content = await (0,
|
|
16073
|
+
if (await (0, import_utils23.fileExists)(envFile)) {
|
|
16074
|
+
const content = await (0, import_utils23.readFile)(envFile);
|
|
15977
16075
|
Object.assign(result, parseEnvContent(content));
|
|
15978
16076
|
}
|
|
15979
16077
|
const localFile = path.resolve(basePath, localEnvPath);
|
|
15980
|
-
if (await (0,
|
|
15981
|
-
const content = await (0,
|
|
16078
|
+
if (await (0, import_utils23.fileExists)(localFile)) {
|
|
16079
|
+
const content = await (0, import_utils23.readFile)(localFile);
|
|
15982
16080
|
Object.assign(result, parseEnvContent(content));
|
|
15983
16081
|
}
|
|
15984
16082
|
return result;
|
|
@@ -16088,11 +16186,11 @@ function mapEnvToNestedConfig(env, paths) {
|
|
|
16088
16186
|
}
|
|
16089
16187
|
return result;
|
|
16090
16188
|
}
|
|
16091
|
-
var
|
|
16189
|
+
var import_utils23, path, UNSAFE_KEYS;
|
|
16092
16190
|
var init_env_loader = __esm({
|
|
16093
16191
|
"libs/sdk/src/builtin/config/providers/env-loader.ts"() {
|
|
16094
16192
|
"use strict";
|
|
16095
|
-
|
|
16193
|
+
import_utils23 = require("@frontmcp/utils");
|
|
16096
16194
|
path = __toESM(require("path"));
|
|
16097
16195
|
UNSAFE_KEYS = /* @__PURE__ */ new Set(["__proto__", "constructor", "prototype"]);
|
|
16098
16196
|
}
|
|
@@ -16140,9 +16238,9 @@ async function loadYamlConfig(basePath, configPath) {
|
|
|
16140
16238
|
const baseName = configPath.replace(/\.(ya?ml)$/, "");
|
|
16141
16239
|
for (const ext of extensions) {
|
|
16142
16240
|
const fullPath = path2.resolve(basePath, baseName + ext);
|
|
16143
|
-
if (await (0,
|
|
16144
|
-
const content = await (0,
|
|
16145
|
-
const parsed =
|
|
16241
|
+
if (await (0, import_utils24.fileExists)(fullPath)) {
|
|
16242
|
+
const content = await (0, import_utils24.readFile)(fullPath);
|
|
16243
|
+
const parsed = yaml2.load(content);
|
|
16146
16244
|
if (parsed && typeof parsed === "object") {
|
|
16147
16245
|
return parsed;
|
|
16148
16246
|
}
|
|
@@ -16166,13 +16264,13 @@ function deepMerge(target, source) {
|
|
|
16166
16264
|
}
|
|
16167
16265
|
return result;
|
|
16168
16266
|
}
|
|
16169
|
-
var
|
|
16267
|
+
var yaml2, path2, import_utils24;
|
|
16170
16268
|
var init_config_loader = __esm({
|
|
16171
16269
|
"libs/sdk/src/builtin/config/providers/config-loader.ts"() {
|
|
16172
16270
|
"use strict";
|
|
16173
|
-
|
|
16271
|
+
yaml2 = __toESM(require("js-yaml"));
|
|
16174
16272
|
path2 = __toESM(require("path"));
|
|
16175
|
-
|
|
16273
|
+
import_utils24 = require("@frontmcp/utils");
|
|
16176
16274
|
init_env_loader();
|
|
16177
16275
|
init_config_service();
|
|
16178
16276
|
}
|
|
@@ -16592,7 +16690,7 @@ function parseTypedKey(k) {
|
|
|
16592
16690
|
return { base: k.slice(6, 7).toLowerCase() + k.slice(7), type: "around" };
|
|
16593
16691
|
return { base: k };
|
|
16594
16692
|
}
|
|
16595
|
-
var import_reflect_metadata11,
|
|
16693
|
+
var import_reflect_metadata11, import_utils25, CAP, WILL, DID, AROUND, FlowInstance;
|
|
16596
16694
|
var init_flow_instance = __esm({
|
|
16597
16695
|
"libs/sdk/src/flows/flow.instance.ts"() {
|
|
16598
16696
|
"use strict";
|
|
@@ -16602,7 +16700,7 @@ var init_flow_instance = __esm({
|
|
|
16602
16700
|
init_server_validation();
|
|
16603
16701
|
init_context();
|
|
16604
16702
|
init_errors();
|
|
16605
|
-
|
|
16703
|
+
import_utils25 = require("@frontmcp/utils");
|
|
16606
16704
|
CAP = (s) => s ? s[0].toUpperCase() + s.slice(1) : s;
|
|
16607
16705
|
WILL = (s) => `will${CAP(s)}`;
|
|
16608
16706
|
DID = (s) => `did${CAP(s)}`;
|
|
@@ -16614,6 +16712,7 @@ var init_flow_instance = __esm({
|
|
|
16614
16712
|
FlowClass;
|
|
16615
16713
|
stages;
|
|
16616
16714
|
hooks;
|
|
16715
|
+
logger;
|
|
16617
16716
|
constructor(scope, record, deps, globalProviders) {
|
|
16618
16717
|
super(scope, record);
|
|
16619
16718
|
this.deps = [...deps];
|
|
@@ -16622,6 +16721,7 @@ var init_flow_instance = __esm({
|
|
|
16622
16721
|
this.ready = this.initialize();
|
|
16623
16722
|
this.plan = this.record.metadata.plan;
|
|
16624
16723
|
this.hooks = scope.providers.getHooksRegistry();
|
|
16724
|
+
this.logger = scope.logger.child("FlowInstance");
|
|
16625
16725
|
}
|
|
16626
16726
|
async initialize() {
|
|
16627
16727
|
const server = this.globalProviders.getActiveServer();
|
|
@@ -16656,7 +16756,8 @@ var init_flow_instance = __esm({
|
|
|
16656
16756
|
return writeHttpResponse(response, e.output);
|
|
16657
16757
|
}
|
|
16658
16758
|
}
|
|
16659
|
-
|
|
16759
|
+
this.logger.error("Unhandled error in flow", {
|
|
16760
|
+
flow: this.name,
|
|
16660
16761
|
name: e instanceof Error ? e.name : "UnknownError",
|
|
16661
16762
|
message: e instanceof Error ? e.message : String(e)
|
|
16662
16763
|
});
|
|
@@ -16689,6 +16790,7 @@ var init_flow_instance = __esm({
|
|
|
16689
16790
|
try {
|
|
16690
16791
|
return this.globalProviders.get(FrontMcpContextStorage);
|
|
16691
16792
|
} catch {
|
|
16793
|
+
this.logger.verbose("getContextStorage: FrontMcpContextStorage not available");
|
|
16692
16794
|
return void 0;
|
|
16693
16795
|
}
|
|
16694
16796
|
}
|
|
@@ -16708,7 +16810,7 @@ var init_flow_instance = __esm({
|
|
|
16708
16810
|
}
|
|
16709
16811
|
const headers = request.headers ?? {};
|
|
16710
16812
|
const headerSessionId = typeof headers["mcp-session-id"] === "string" ? headers["mcp-session-id"].trim() : "";
|
|
16711
|
-
const sessionId = headerSessionId.length > 0 ? headerSessionId : `anon:${(0,
|
|
16813
|
+
const sessionId = headerSessionId.length > 0 ? headerSessionId : `anon:${(0, import_utils25.randomUUID)()}`;
|
|
16712
16814
|
const scope = this.globalProviders.getActiveScope();
|
|
16713
16815
|
return storage.runFromHeaders(
|
|
16714
16816
|
headers,
|
|
@@ -16722,6 +16824,7 @@ var init_flow_instance = __esm({
|
|
|
16722
16824
|
);
|
|
16723
16825
|
}
|
|
16724
16826
|
async run(input, deps) {
|
|
16827
|
+
this.logger.verbose(`run: starting flow '${this.name}'`);
|
|
16725
16828
|
const scope = this.globalProviders.getActiveScope();
|
|
16726
16829
|
const { FlowClass, plan: plan32, name: name33 } = this;
|
|
16727
16830
|
const contextStorage = this.getContextStorage();
|
|
@@ -16757,10 +16860,10 @@ var init_flow_instance = __esm({
|
|
|
16757
16860
|
try {
|
|
16758
16861
|
metas.push(h2.metadata);
|
|
16759
16862
|
} catch (e) {
|
|
16760
|
-
|
|
16761
|
-
|
|
16762
|
-
e instanceof Error ? e.message : "Unknown error"
|
|
16763
|
-
);
|
|
16863
|
+
this.logger.warn("Ignoring injected hook that failed to materialize", {
|
|
16864
|
+
flow: this.name,
|
|
16865
|
+
error: e instanceof Error ? e.message : "Unknown error"
|
|
16866
|
+
});
|
|
16764
16867
|
}
|
|
16765
16868
|
}
|
|
16766
16869
|
if (metas.length) {
|
|
@@ -16868,6 +16971,7 @@ var init_flow_instance = __esm({
|
|
|
16868
16971
|
};
|
|
16869
16972
|
{
|
|
16870
16973
|
const pre = await runStageGroup(plan32.pre, true);
|
|
16974
|
+
this.logger.verbose(`run: PRE completed, outcome=${pre.outcome}`);
|
|
16871
16975
|
if (pre.outcome === "respond") {
|
|
16872
16976
|
const post = await runStageGroup(plan32.post, false);
|
|
16873
16977
|
if (post.outcome === "unknown_error" || post.outcome === "fail") {
|
|
@@ -16906,6 +17010,7 @@ var init_flow_instance = __esm({
|
|
|
16906
17010
|
}
|
|
16907
17011
|
if (!responded) {
|
|
16908
17012
|
const exec = await runStageGroup(plan32.execute, true);
|
|
17013
|
+
this.logger.verbose(`run: EXECUTE completed, outcome=${exec.outcome}`);
|
|
16909
17014
|
if (exec.outcome === "respond") {
|
|
16910
17015
|
} else if (exec.outcome === "unknown_error" || exec.outcome === "fail") {
|
|
16911
17016
|
try {
|
|
@@ -16924,6 +17029,7 @@ var init_flow_instance = __esm({
|
|
|
16924
17029
|
}
|
|
16925
17030
|
{
|
|
16926
17031
|
const post = await runStageGroup(plan32.post, false);
|
|
17032
|
+
this.logger.verbose(`run: POST completed, outcome=${post.outcome}`);
|
|
16927
17033
|
if (post.outcome === "unknown_error" || post.outcome === "fail") {
|
|
16928
17034
|
try {
|
|
16929
17035
|
await runErrorStage();
|
|
@@ -16948,7 +17054,7 @@ var init_flow_instance = __esm({
|
|
|
16948
17054
|
});
|
|
16949
17055
|
|
|
16950
17056
|
// libs/sdk/src/flows/flow.registry.ts
|
|
16951
|
-
var import_di22,
|
|
17057
|
+
var import_di22, import_utils26, FlowRegistry;
|
|
16952
17058
|
var init_flow_registry = __esm({
|
|
16953
17059
|
"libs/sdk/src/flows/flow.registry.ts"() {
|
|
16954
17060
|
"use strict";
|
|
@@ -16958,7 +17064,7 @@ var init_flow_registry = __esm({
|
|
|
16958
17064
|
init_flow_utils2();
|
|
16959
17065
|
init_flow_instance();
|
|
16960
17066
|
init_context();
|
|
16961
|
-
|
|
17067
|
+
import_utils26 = require("@frontmcp/utils");
|
|
16962
17068
|
init_errors();
|
|
16963
17069
|
FlowRegistry = class extends RegistryAbstract {
|
|
16964
17070
|
constructor(providers, list) {
|
|
@@ -17037,7 +17143,7 @@ var init_flow_registry = __esm({
|
|
|
17037
17143
|
const mcpCtx = input?.ctx;
|
|
17038
17144
|
const authInfo = mcpCtx?.authInfo;
|
|
17039
17145
|
const rawSessionId = authInfo?.sessionId;
|
|
17040
|
-
const sessionId = typeof rawSessionId === "string" && rawSessionId.trim().length > 0 ? rawSessionId.trim() : `anon:${(0,
|
|
17146
|
+
const sessionId = typeof rawSessionId === "string" && rawSessionId.trim().length > 0 ? rawSessionId.trim() : `anon:${(0, import_utils26.randomUUID)()}`;
|
|
17041
17147
|
const scope = this.providers.getActiveScope();
|
|
17042
17148
|
return Promise.resolve(
|
|
17043
17149
|
contextStorage.run(
|
|
@@ -18388,12 +18494,12 @@ var init_agent_registry = __esm({
|
|
|
18388
18494
|
});
|
|
18389
18495
|
|
|
18390
18496
|
// libs/sdk/src/app/instances/app.local.instance.ts
|
|
18391
|
-
var
|
|
18497
|
+
var import_utils27, AppLocalInstance;
|
|
18392
18498
|
var init_app_local_instance = __esm({
|
|
18393
18499
|
"libs/sdk/src/app/instances/app.local.instance.ts"() {
|
|
18394
18500
|
"use strict";
|
|
18395
18501
|
init_common();
|
|
18396
|
-
|
|
18502
|
+
import_utils27 = require("@frontmcp/utils");
|
|
18397
18503
|
init_provider_registry();
|
|
18398
18504
|
init_tool_registry();
|
|
18399
18505
|
init_resource_registry();
|
|
@@ -18413,13 +18519,19 @@ var init_app_local_instance = __esm({
|
|
|
18413
18519
|
appPrompts;
|
|
18414
18520
|
appAgents;
|
|
18415
18521
|
appSkills;
|
|
18522
|
+
logger;
|
|
18416
18523
|
constructor(record, scopeProviders) {
|
|
18417
18524
|
super(record);
|
|
18418
18525
|
this.scopeProviders = scopeProviders;
|
|
18419
|
-
this.id = this.metadata.id ?? (0,
|
|
18526
|
+
this.id = this.metadata.id ?? (0, import_utils27.idFromString)(this.metadata.name);
|
|
18527
|
+
try {
|
|
18528
|
+
this.logger = scopeProviders.get(FrontMcpLogger)?.child("AppLocalInstance");
|
|
18529
|
+
} catch {
|
|
18530
|
+
}
|
|
18420
18531
|
this.ready = this.initialize();
|
|
18421
18532
|
}
|
|
18422
18533
|
async initialize() {
|
|
18534
|
+
this.logger?.verbose(`Initializing app: ${this.metadata.name} (id: ${this.id})`);
|
|
18423
18535
|
this.appProviders = new ProviderRegistry(this.metadata.providers ?? [], this.scopeProviders);
|
|
18424
18536
|
await this.appProviders.ready;
|
|
18425
18537
|
const appOwner = {
|
|
@@ -18435,15 +18547,37 @@ var init_app_local_instance = __esm({
|
|
|
18435
18547
|
};
|
|
18436
18548
|
this.appPlugins = new PluginRegistry(this.appProviders, this.metadata.plugins ?? [], appOwner, scopeInfo);
|
|
18437
18549
|
await this.appPlugins.ready;
|
|
18550
|
+
this.logger?.verbose(`App ${this.metadata.name}: ${this.appPlugins.getPlugins().length} plugin(s) registered`);
|
|
18438
18551
|
this.appAdapters = new AdapterRegistry(this.appProviders, this.metadata.adapters ?? []);
|
|
18439
18552
|
await this.appAdapters.ready;
|
|
18553
|
+
this.logger?.verbose(`App ${this.metadata.name}: ${this.appAdapters.getAdapters().length} adapter(s) found`);
|
|
18440
18554
|
this.appTools = new ToolRegistry(this.appProviders, this.metadata.tools ?? [], appOwner);
|
|
18441
18555
|
await this.appTools.ready;
|
|
18556
|
+
const toolNames = this.appTools.getTools(true).map((t) => t.metadata.name);
|
|
18557
|
+
this.logger?.verbose(
|
|
18558
|
+
`App ${this.metadata.name}: ${toolNames.length} tool(s) registered: [${toolNames.join(", ")}]`
|
|
18559
|
+
);
|
|
18442
18560
|
this.appResources = new ResourceRegistry(this.appProviders, this.metadata.resources ?? [], appOwner);
|
|
18443
18561
|
this.appPrompts = new PromptRegistry(this.appProviders, this.metadata.prompts ?? [], appOwner);
|
|
18444
18562
|
this.appAgents = new AgentRegistry(this.appProviders, this.metadata.agents ?? [], appOwner);
|
|
18445
18563
|
this.appSkills = new SkillRegistry(this.appProviders, this.metadata.skills ?? [], appOwner);
|
|
18446
18564
|
await Promise.all([this.appResources.ready, this.appPrompts.ready, this.appAgents.ready, this.appSkills.ready]);
|
|
18565
|
+
this.logger?.verbose(
|
|
18566
|
+
`App ${this.metadata.name}: ${this.appResources.getResources().length} resource(s) registered`
|
|
18567
|
+
);
|
|
18568
|
+
this.logger?.verbose(`App ${this.metadata.name}: ${this.appPrompts.getPrompts().length} prompt(s) registered`);
|
|
18569
|
+
const parts = [];
|
|
18570
|
+
const toolCount = this.appTools.getTools(true).length;
|
|
18571
|
+
const resourceCount = this.appResources.getResources().length;
|
|
18572
|
+
const promptCount = this.appPrompts.getPrompts().length;
|
|
18573
|
+
const adapterCount = this.appAdapters.getAdapters().length;
|
|
18574
|
+
const pluginCount = this.appPlugins.getPlugins().length;
|
|
18575
|
+
if (toolCount > 0) parts.push(`${toolCount} tool${toolCount !== 1 ? "s" : ""}`);
|
|
18576
|
+
if (resourceCount > 0) parts.push(`${resourceCount} resource${resourceCount !== 1 ? "s" : ""}`);
|
|
18577
|
+
if (promptCount > 0) parts.push(`${promptCount} prompt${promptCount !== 1 ? "s" : ""}`);
|
|
18578
|
+
if (adapterCount > 0) parts.push(`${adapterCount} adapter${adapterCount !== 1 ? "s" : ""}`);
|
|
18579
|
+
if (pluginCount > 0) parts.push(`${pluginCount} plugin${pluginCount !== 1 ? "s" : ""}`);
|
|
18580
|
+
this.logger?.info(`${this.metadata.name}: ${parts.length > 0 ? parts.join(", ") : "no entries"}`);
|
|
18447
18581
|
}
|
|
18448
18582
|
get providers() {
|
|
18449
18583
|
return this.appProviders;
|
|
@@ -20093,12 +20227,12 @@ var init_remote_mcp = __esm({
|
|
|
20093
20227
|
});
|
|
20094
20228
|
|
|
20095
20229
|
// libs/sdk/src/app/instances/app.remote.instance.ts
|
|
20096
|
-
var
|
|
20230
|
+
var import_utils28, EmptyPluginRegistry, EmptyAdapterRegistry, EmptySkillRegistry, AppRemoteInstance;
|
|
20097
20231
|
var init_app_remote_instance = __esm({
|
|
20098
20232
|
"libs/sdk/src/app/instances/app.remote.instance.ts"() {
|
|
20099
20233
|
"use strict";
|
|
20100
20234
|
init_common();
|
|
20101
|
-
|
|
20235
|
+
import_utils28 = require("@frontmcp/utils");
|
|
20102
20236
|
init_tool_registry();
|
|
20103
20237
|
init_resource_registry();
|
|
20104
20238
|
init_prompt_registry();
|
|
@@ -20109,6 +20243,9 @@ var init_app_remote_instance = __esm({
|
|
|
20109
20243
|
getPlugins() {
|
|
20110
20244
|
return [];
|
|
20111
20245
|
}
|
|
20246
|
+
getPluginNames() {
|
|
20247
|
+
return [];
|
|
20248
|
+
}
|
|
20112
20249
|
};
|
|
20113
20250
|
EmptyAdapterRegistry = class {
|
|
20114
20251
|
getAdapters() {
|
|
@@ -20196,7 +20333,7 @@ var init_app_remote_instance = __esm({
|
|
|
20196
20333
|
_unsubscribeCapability;
|
|
20197
20334
|
constructor(record, scopeProviders) {
|
|
20198
20335
|
super(record);
|
|
20199
|
-
this.id = this.metadata.id ?? (0,
|
|
20336
|
+
this.id = this.metadata.id ?? (0, import_utils28.idFromString)(this.metadata.name);
|
|
20200
20337
|
this.scopeProviders = scopeProviders;
|
|
20201
20338
|
this.appOwner = {
|
|
20202
20339
|
kind: "app",
|
|
@@ -20489,15 +20626,21 @@ var init_app_registry = __esm({
|
|
|
20489
20626
|
"use strict";
|
|
20490
20627
|
import_reflect_metadata13 = require("reflect-metadata");
|
|
20491
20628
|
import_di25 = require("@frontmcp/di");
|
|
20629
|
+
init_common();
|
|
20492
20630
|
init_app_utils();
|
|
20493
20631
|
init_regsitry();
|
|
20494
20632
|
init_instances();
|
|
20495
20633
|
init_errors();
|
|
20496
20634
|
AppRegistry = class extends RegistryAbstract {
|
|
20497
20635
|
owner;
|
|
20636
|
+
logger;
|
|
20498
20637
|
constructor(globalProviders, list, owner) {
|
|
20499
20638
|
super("AppRegistry", globalProviders, list);
|
|
20500
20639
|
this.owner = owner;
|
|
20640
|
+
try {
|
|
20641
|
+
this.logger = globalProviders.get(FrontMcpLogger)?.child("AppRegistry");
|
|
20642
|
+
} catch {
|
|
20643
|
+
}
|
|
20501
20644
|
}
|
|
20502
20645
|
buildMap(list) {
|
|
20503
20646
|
const tokens = /* @__PURE__ */ new Set();
|
|
@@ -20526,6 +20669,7 @@ var init_app_registry = __esm({
|
|
|
20526
20669
|
}
|
|
20527
20670
|
/** Instantiate adapters, run fetch/transform, and populate registries. */
|
|
20528
20671
|
async initialize() {
|
|
20672
|
+
this.logger?.verbose(`AppRegistry: initializing ${this.tokens.size} app(s)`);
|
|
20529
20673
|
const readyArr = [];
|
|
20530
20674
|
for (const token of this.tokens) {
|
|
20531
20675
|
const rec = this.defs.get(token);
|
|
@@ -20539,8 +20683,10 @@ var init_app_registry = __esm({
|
|
|
20539
20683
|
}
|
|
20540
20684
|
this.instances.set(token, app);
|
|
20541
20685
|
readyArr.push(app.ready);
|
|
20686
|
+
this.logger?.verbose(`AppRegistry: registered ${rec.kind} app '${rec.metadata.name}'`);
|
|
20542
20687
|
}
|
|
20543
20688
|
await Promise.all(readyArr);
|
|
20689
|
+
this.logger?.debug(`AppRegistry: initialization complete (${this.instances.size} app(s))`);
|
|
20544
20690
|
}
|
|
20545
20691
|
getApps() {
|
|
20546
20692
|
return [...this.instances.values()];
|
|
@@ -20994,7 +21140,7 @@ function createSessionId(protocol, token, options) {
|
|
|
20994
21140
|
const payload = {
|
|
20995
21141
|
nodeId: (0, import_auth14.getMachineId)(),
|
|
20996
21142
|
authSig,
|
|
20997
|
-
uuid: (0,
|
|
21143
|
+
uuid: (0, import_utils29.randomUUID)(),
|
|
20998
21144
|
iat: nowSec(),
|
|
20999
21145
|
protocol,
|
|
21000
21146
|
platformType,
|
|
@@ -21021,11 +21167,11 @@ function updateSessionPayload(sessionId, updates) {
|
|
|
21021
21167
|
}
|
|
21022
21168
|
return false;
|
|
21023
21169
|
}
|
|
21024
|
-
var
|
|
21170
|
+
var import_utils29, import_auth13, import_auth14, cache;
|
|
21025
21171
|
var init_session_id_utils = __esm({
|
|
21026
21172
|
"libs/sdk/src/auth/session/utils/session-id.utils.ts"() {
|
|
21027
21173
|
"use strict";
|
|
21028
|
-
|
|
21174
|
+
import_utils29 = require("@frontmcp/utils");
|
|
21029
21175
|
import_auth13 = require("@frontmcp/auth");
|
|
21030
21176
|
init_notification_service();
|
|
21031
21177
|
import_auth14 = require("@frontmcp/auth");
|
|
@@ -21034,7 +21180,7 @@ var init_session_id_utils = __esm({
|
|
|
21034
21180
|
});
|
|
21035
21181
|
|
|
21036
21182
|
// libs/sdk/src/auth/flows/session.verify.flow.ts
|
|
21037
|
-
var import_reflect_metadata17, import_zod48, import_auth15, import_auth16, import_auth17, import_auth18,
|
|
21183
|
+
var import_reflect_metadata17, import_zod48, import_auth15, import_auth16, import_auth17, import_auth18, import_utils30, inputSchema14, stateSchema12, UnauthorizedSchema, AuthorizedSchema, sessionVerifyOutputSchema, plan12, name13, Stage13, SessionVerifyFlow;
|
|
21038
21184
|
var init_session_verify_flow = __esm({
|
|
21039
21185
|
"libs/sdk/src/auth/flows/session.verify.flow.ts"() {
|
|
21040
21186
|
"use strict";
|
|
@@ -21046,7 +21192,7 @@ var init_session_verify_flow = __esm({
|
|
|
21046
21192
|
init_session_id_utils();
|
|
21047
21193
|
import_auth17 = require("@frontmcp/auth");
|
|
21048
21194
|
import_auth18 = require("@frontmcp/auth");
|
|
21049
|
-
|
|
21195
|
+
import_utils30 = require("@frontmcp/utils");
|
|
21050
21196
|
init_notification_service();
|
|
21051
21197
|
inputSchema14 = httpRequestInputSchema;
|
|
21052
21198
|
stateSchema12 = import_zod48.z.object({
|
|
@@ -21081,16 +21227,23 @@ var init_session_verify_flow = __esm({
|
|
|
21081
21227
|
name13 = "session:verify";
|
|
21082
21228
|
Stage13 = StageHookOf(name13);
|
|
21083
21229
|
SessionVerifyFlow = class extends FlowBase {
|
|
21230
|
+
logger = this.scopeLogger.child("SessionVerifyFlow");
|
|
21231
|
+
maskSub(sub) {
|
|
21232
|
+
if (!sub) return "***";
|
|
21233
|
+
if (sub.length <= 10) return "***" + sub.slice(-4);
|
|
21234
|
+
return sub.slice(0, 6) + "***" + sub.slice(-4);
|
|
21235
|
+
}
|
|
21084
21236
|
/**
|
|
21085
21237
|
* Create an anonymous session with consistent structure for both public and transparent-anon modes.
|
|
21086
21238
|
* Encapsulates the shared logic for session creation, payload encryption, and user derivation.
|
|
21087
21239
|
*/
|
|
21088
21240
|
createAnonymousSession(options) {
|
|
21089
21241
|
const { authMode, issuer, scopes = ["anonymous"], sessionIdHeader } = options;
|
|
21242
|
+
this.logger.verbose("createAnonymousSession", { authMode, hasExistingSession: !!sessionIdHeader });
|
|
21090
21243
|
const machineId = (0, import_auth18.getMachineId)();
|
|
21091
21244
|
if (sessionIdHeader) {
|
|
21092
21245
|
const existingPayload = decryptPublicSession(sessionIdHeader);
|
|
21093
|
-
const user2 = existingPayload ? { sub: `anon:${existingPayload.iat * 1e3}`, iss: issuer, name: "Anonymous", scope: scopes.join(" ") } : { sub: `anon:${(0,
|
|
21246
|
+
const user2 = existingPayload ? { sub: `anon:${existingPayload.iat * 1e3}`, iss: issuer, name: "Anonymous", scope: scopes.join(" ") } : { sub: `anon:${(0, import_utils30.randomUUID)()}`, iss: issuer, name: "Anonymous", scope: scopes.join(" ") };
|
|
21094
21247
|
const finalPayload = existingPayload && existingPayload.nodeId === machineId ? existingPayload : void 0;
|
|
21095
21248
|
this.respond({
|
|
21096
21249
|
kind: "authorized",
|
|
@@ -21107,12 +21260,12 @@ var init_session_verify_flow = __esm({
|
|
|
21107
21260
|
}
|
|
21108
21261
|
const now = Date.now();
|
|
21109
21262
|
const user = {
|
|
21110
|
-
sub: `anon:${(0,
|
|
21263
|
+
sub: `anon:${(0, import_utils30.randomUUID)()}`,
|
|
21111
21264
|
iss: issuer,
|
|
21112
21265
|
name: "Anonymous",
|
|
21113
21266
|
scope: scopes.join(" ")
|
|
21114
21267
|
};
|
|
21115
|
-
const uuid = (0,
|
|
21268
|
+
const uuid = (0, import_utils30.randomUUID)();
|
|
21116
21269
|
const platformDetectionConfig = this.scope.metadata.transport?.platformDetection;
|
|
21117
21270
|
const platformType = detectPlatformFromUserAgent(this.state.userAgent, platformDetectionConfig);
|
|
21118
21271
|
const payload = {
|
|
@@ -21149,6 +21302,12 @@ var init_session_verify_flow = __esm({
|
|
|
21149
21302
|
const userAgent = request.headers?.["user-agent"] ?? void 0;
|
|
21150
21303
|
const prmMetadataPath = `/.well-known/oauth-protected-resource${entryPath}${routeBase}`;
|
|
21151
21304
|
const prmMetadataHeader = `Bearer resource_metadata="${baseUrl}${prmMetadataPath}"`;
|
|
21305
|
+
this.logger.verbose("parseInput", {
|
|
21306
|
+
hasAuthHeader: !!authorizationHeader,
|
|
21307
|
+
hasToken: !!token,
|
|
21308
|
+
sessionProtocol,
|
|
21309
|
+
hasSessionId: !!sessionIdHeader
|
|
21310
|
+
});
|
|
21152
21311
|
this.state.set({
|
|
21153
21312
|
baseUrl,
|
|
21154
21313
|
authorizationHeader,
|
|
@@ -21168,6 +21327,7 @@ var init_session_verify_flow = __esm({
|
|
|
21168
21327
|
if (this.state.token) {
|
|
21169
21328
|
return;
|
|
21170
21329
|
}
|
|
21330
|
+
this.logger.info("handlePublicMode: allowing anonymous access (public mode)");
|
|
21171
21331
|
this.createAnonymousSession({
|
|
21172
21332
|
authMode: "public",
|
|
21173
21333
|
issuer: "public",
|
|
@@ -21176,6 +21336,7 @@ var init_session_verify_flow = __esm({
|
|
|
21176
21336
|
});
|
|
21177
21337
|
}
|
|
21178
21338
|
async handleAnonymousFallback() {
|
|
21339
|
+
this.logger.verbose("handleAnonymousFallback: creating anonymous session (transparent-anon)");
|
|
21179
21340
|
const authOptions = this.scope.auth?.options;
|
|
21180
21341
|
const scopes = authOptions?.anonymousScopes ?? ["anonymous"];
|
|
21181
21342
|
this.createAnonymousSession({
|
|
@@ -21186,6 +21347,7 @@ var init_session_verify_flow = __esm({
|
|
|
21186
21347
|
});
|
|
21187
21348
|
}
|
|
21188
21349
|
async requireAuthorizationOrChallenge() {
|
|
21350
|
+
this.logger.verbose("requireAuthorizationOrChallenge: returning 401");
|
|
21189
21351
|
this.respond({
|
|
21190
21352
|
kind: "unauthorized",
|
|
21191
21353
|
prmMetadataHeader: this.state.required.prmMetadataHeader
|
|
@@ -21195,6 +21357,7 @@ var init_session_verify_flow = __esm({
|
|
|
21195
21357
|
const jwks = this.get(import_auth16.JwksService);
|
|
21196
21358
|
const token = this.state.token;
|
|
21197
21359
|
if (!token) {
|
|
21360
|
+
this.logger.warn("verifyIfJwt: missing or empty bearer token, returning 401");
|
|
21198
21361
|
this.respond({
|
|
21199
21362
|
kind: "unauthorized",
|
|
21200
21363
|
prmMetadataHeader: this.state.required.prmMetadataHeader
|
|
@@ -21202,6 +21365,7 @@ var init_session_verify_flow = __esm({
|
|
|
21202
21365
|
return;
|
|
21203
21366
|
}
|
|
21204
21367
|
if (!(0, import_auth15.isJwt)(token)) {
|
|
21368
|
+
this.logger.warn("verifyIfJwt: token is not a JWT, returning 401");
|
|
21205
21369
|
this.respond({
|
|
21206
21370
|
kind: "unauthorized",
|
|
21207
21371
|
prmMetadataHeader: this.state.required.prmMetadataHeader
|
|
@@ -21210,6 +21374,7 @@ var init_session_verify_flow = __esm({
|
|
|
21210
21374
|
}
|
|
21211
21375
|
const auth = this.scope.auth;
|
|
21212
21376
|
if (!auth) {
|
|
21377
|
+
this.logger.warn("verifyIfJwt: auth registry not available, returning 401");
|
|
21213
21378
|
this.respond({
|
|
21214
21379
|
kind: "unauthorized",
|
|
21215
21380
|
prmMetadataHeader: this.state.required.prmMetadataHeader
|
|
@@ -21218,6 +21383,8 @@ var init_session_verify_flow = __esm({
|
|
|
21218
21383
|
}
|
|
21219
21384
|
let verify;
|
|
21220
21385
|
const authOptions = auth.options;
|
|
21386
|
+
const mode = (0, import_auth10.isTransparentMode)(authOptions) ? "transparent" : "gateway";
|
|
21387
|
+
this.logger.verbose(`verifyIfJwt: verifying using ${mode} mode`);
|
|
21221
21388
|
if ((0, import_auth10.isTransparentMode)(authOptions)) {
|
|
21222
21389
|
const primary = authOptions;
|
|
21223
21390
|
const issuer = auth.issuer;
|
|
@@ -21238,6 +21405,7 @@ var init_session_verify_flow = __esm({
|
|
|
21238
21405
|
this.state.set({ jwtPayload: result.payload });
|
|
21239
21406
|
return;
|
|
21240
21407
|
}
|
|
21408
|
+
this.logger.warn("verifyIfJwt: JWT verification failed", { error: result.error });
|
|
21241
21409
|
this.respond({
|
|
21242
21410
|
kind: "unauthorized",
|
|
21243
21411
|
prmMetadataHeader: this.state.required.prmMetadataHeader
|
|
@@ -21252,6 +21420,7 @@ var init_session_verify_flow = __esm({
|
|
|
21252
21420
|
required: { token }
|
|
21253
21421
|
} = this.state;
|
|
21254
21422
|
const session = parseSessionHeader(sessionIdHeader, token);
|
|
21423
|
+
this.logger.verbose("parseSessionHeader", { hasSessionId: !!sessionIdHeader, parsed: !!session });
|
|
21255
21424
|
if (session) {
|
|
21256
21425
|
this.state.set("session", session);
|
|
21257
21426
|
}
|
|
@@ -21261,6 +21430,10 @@ var init_session_verify_flow = __esm({
|
|
|
21261
21430
|
required: { token, user },
|
|
21262
21431
|
session
|
|
21263
21432
|
} = this.state;
|
|
21433
|
+
this.logger.info("Session verified successfully", {
|
|
21434
|
+
sub: this.maskSub(user.sub),
|
|
21435
|
+
hasSession: !!session
|
|
21436
|
+
});
|
|
21264
21437
|
this.respond({
|
|
21265
21438
|
kind: "authorized",
|
|
21266
21439
|
authorization: {
|
|
@@ -22169,13 +22342,13 @@ var init_oauth_authorize_flow = __esm({
|
|
|
22169
22342
|
});
|
|
22170
22343
|
|
|
22171
22344
|
// libs/sdk/src/auth/flows/oauth.register.flow.ts
|
|
22172
|
-
var import_zod50,
|
|
22345
|
+
var import_zod50, import_utils31, CLIENTS, inputSchema16, outputSchema14, registrationRequestSchema, stateSchema14, plan14, name15, Stage15, OauthRegisterFlow;
|
|
22173
22346
|
var init_oauth_register_flow = __esm({
|
|
22174
22347
|
"libs/sdk/src/auth/flows/oauth.register.flow.ts"() {
|
|
22175
22348
|
"use strict";
|
|
22176
22349
|
init_common();
|
|
22177
22350
|
import_zod50 = require("zod");
|
|
22178
|
-
|
|
22351
|
+
import_utils31 = require("@frontmcp/utils");
|
|
22179
22352
|
CLIENTS = /* @__PURE__ */ new Map();
|
|
22180
22353
|
inputSchema16 = httpInputSchema;
|
|
22181
22354
|
outputSchema14 = HttpJsonSchema;
|
|
@@ -22269,10 +22442,10 @@ var init_oauth_register_flow = __esm({
|
|
|
22269
22442
|
async registerClient() {
|
|
22270
22443
|
const now = Math.floor(Date.now() / 1e3);
|
|
22271
22444
|
const { token_endpoint_auth_method, grant_types, response_types, redirect_uris, client_name, scope } = this.state.required.body;
|
|
22272
|
-
const client_id = (0,
|
|
22445
|
+
const client_id = (0, import_utils31.randomUUID)();
|
|
22273
22446
|
let client_secret;
|
|
22274
22447
|
if (token_endpoint_auth_method === "client_secret_post" || token_endpoint_auth_method === "client_secret_basic") {
|
|
22275
|
-
client_secret = (0,
|
|
22448
|
+
client_secret = (0, import_utils31.base64urlEncode)((0, import_utils31.randomBytes)(24));
|
|
22276
22449
|
}
|
|
22277
22450
|
this.registered = {
|
|
22278
22451
|
client_id,
|
|
@@ -22341,13 +22514,13 @@ var init_oauth_register_flow = __esm({
|
|
|
22341
22514
|
});
|
|
22342
22515
|
|
|
22343
22516
|
// libs/sdk/src/auth/flows/oauth.token.flow.ts
|
|
22344
|
-
var import_zod51,
|
|
22517
|
+
var import_zod51, import_utils32, inputSchema17, pkceVerifierRegex, authorizationCodeGrant, refreshTokenGrant, anonymousGrant, tokenRequestSchema, stateSchema15, outputSchema15, plan15, name16, Stage16, OauthTokenFlow;
|
|
22345
22518
|
var init_oauth_token_flow = __esm({
|
|
22346
22519
|
"libs/sdk/src/auth/flows/oauth.token.flow.ts"() {
|
|
22347
22520
|
"use strict";
|
|
22348
22521
|
init_common();
|
|
22349
22522
|
import_zod51 = require("zod");
|
|
22350
|
-
|
|
22523
|
+
import_utils32 = require("@frontmcp/utils");
|
|
22351
22524
|
inputSchema17 = httpInputSchema;
|
|
22352
22525
|
pkceVerifierRegex = /^[A-Za-z0-9_.~-]{43,128}$/;
|
|
22353
22526
|
authorizationCodeGrant = import_zod51.z.object({
|
|
@@ -22454,7 +22627,7 @@ var init_oauth_token_flow = __esm({
|
|
|
22454
22627
|
access_token: accessToken,
|
|
22455
22628
|
token_type: "Bearer",
|
|
22456
22629
|
expires_in: 86400,
|
|
22457
|
-
refresh_token: (0,
|
|
22630
|
+
refresh_token: (0, import_utils32.randomUUID)()
|
|
22458
22631
|
});
|
|
22459
22632
|
return;
|
|
22460
22633
|
}
|
|
@@ -22491,7 +22664,7 @@ var init_oauth_token_flow = __esm({
|
|
|
22491
22664
|
access_token: accessToken,
|
|
22492
22665
|
token_type: "Bearer",
|
|
22493
22666
|
expires_in: 86400,
|
|
22494
|
-
refresh_token: (0,
|
|
22667
|
+
refresh_token: (0, import_utils32.randomUUID)()
|
|
22495
22668
|
});
|
|
22496
22669
|
return;
|
|
22497
22670
|
}
|
|
@@ -22525,7 +22698,7 @@ var init_oauth_token_flow = __esm({
|
|
|
22525
22698
|
access_token: accessToken,
|
|
22526
22699
|
token_type: "Bearer",
|
|
22527
22700
|
expires_in: 86400,
|
|
22528
|
-
refresh_token: (0,
|
|
22701
|
+
refresh_token: (0, import_utils32.randomUUID)()
|
|
22529
22702
|
});
|
|
22530
22703
|
}
|
|
22531
22704
|
async buildTokenResponse() {
|
|
@@ -22592,13 +22765,13 @@ var init_oauth_token_flow = __esm({
|
|
|
22592
22765
|
});
|
|
22593
22766
|
|
|
22594
22767
|
// libs/sdk/src/auth/flows/oauth.callback.flow.ts
|
|
22595
|
-
var import_zod52,
|
|
22768
|
+
var import_zod52, import_utils33, import_auth22, inputSchema18, stateSchema16, outputSchema16, plan16, name17, Stage17, OauthCallbackFlow;
|
|
22596
22769
|
var init_oauth_callback_flow = __esm({
|
|
22597
22770
|
"libs/sdk/src/auth/flows/oauth.callback.flow.ts"() {
|
|
22598
22771
|
"use strict";
|
|
22599
22772
|
init_common();
|
|
22600
22773
|
import_zod52 = require("zod");
|
|
22601
|
-
|
|
22774
|
+
import_utils33 = require("@frontmcp/utils");
|
|
22602
22775
|
import_auth22 = require("@frontmcp/auth");
|
|
22603
22776
|
inputSchema18 = httpInputSchema;
|
|
22604
22777
|
stateSchema16 = import_zod52.z.object({
|
|
@@ -22810,7 +22983,7 @@ var init_oauth_callback_flow = __esm({
|
|
|
22810
22983
|
return;
|
|
22811
22984
|
}
|
|
22812
22985
|
const federatedSession = (0, import_auth22.createFederatedAuthSession)({
|
|
22813
|
-
pendingAuthId: this.state.required.pendingAuthId || (0,
|
|
22986
|
+
pendingAuthId: this.state.required.pendingAuthId || (0, import_utils33.randomUUID)(),
|
|
22814
22987
|
clientId,
|
|
22815
22988
|
redirectUri,
|
|
22816
22989
|
scopes: scopes ?? [],
|
|
@@ -22830,14 +23003,14 @@ var init_oauth_callback_flow = __esm({
|
|
|
22830
23003
|
await sessionStore.store(federatedSession);
|
|
22831
23004
|
this.logger.info(`Created federated session: ${federatedSession.id}`);
|
|
22832
23005
|
const firstProviderId = selectedProviders[0];
|
|
22833
|
-
const verifier = (0,
|
|
22834
|
-
const challenge = (0,
|
|
23006
|
+
const verifier = (0, import_utils33.generateCodeVerifier)();
|
|
23007
|
+
const challenge = (0, import_utils33.sha256Base64url)(verifier);
|
|
22835
23008
|
const pkce = {
|
|
22836
23009
|
verifier,
|
|
22837
23010
|
challenge,
|
|
22838
23011
|
method: "S256"
|
|
22839
23012
|
};
|
|
22840
|
-
const providerState = `federated:${federatedSession.id}:${(0,
|
|
23013
|
+
const providerState = `federated:${federatedSession.id}:${(0, import_utils33.randomUUID)()}`;
|
|
22841
23014
|
(0, import_auth22.startNextProvider)(federatedSession, pkce, providerState);
|
|
22842
23015
|
await sessionStore.update(federatedSession);
|
|
22843
23016
|
const providerConfig = localAuth.getProviderConfig(firstProviderId);
|
|
@@ -22958,7 +23131,7 @@ var init_oauth_callback_flow = __esm({
|
|
|
22958
23131
|
* In production, this would be the user's ID from the database
|
|
22959
23132
|
*/
|
|
22960
23133
|
generateUserSub(email) {
|
|
22961
|
-
const hash = (0,
|
|
23134
|
+
const hash = (0, import_utils33.sha256Hex)(email.toLowerCase());
|
|
22962
23135
|
return `${hash.slice(0, 8)}-${hash.slice(8, 12)}-${hash.slice(12, 16)}-${hash.slice(16, 20)}-${hash.slice(20, 32)}`;
|
|
22963
23136
|
}
|
|
22964
23137
|
/**
|
|
@@ -23051,7 +23224,7 @@ var init_oauth_callback_flow = __esm({
|
|
|
23051
23224
|
});
|
|
23052
23225
|
|
|
23053
23226
|
// libs/sdk/src/auth/flows/oauth.provider-callback.flow.ts
|
|
23054
|
-
var import_zod53, import_auth23,
|
|
23227
|
+
var import_zod53, import_auth23, import_utils34, inputSchema19, stateSchema17, outputSchema17, plan17, name18, Stage18, OauthProviderCallbackFlow;
|
|
23055
23228
|
var init_oauth_provider_callback_flow = __esm({
|
|
23056
23229
|
"libs/sdk/src/auth/flows/oauth.provider-callback.flow.ts"() {
|
|
23057
23230
|
"use strict";
|
|
@@ -23059,7 +23232,7 @@ var init_oauth_provider_callback_flow = __esm({
|
|
|
23059
23232
|
import_zod53 = require("zod");
|
|
23060
23233
|
init_instance_local_primary_auth();
|
|
23061
23234
|
import_auth23 = require("@frontmcp/auth");
|
|
23062
|
-
|
|
23235
|
+
import_utils34 = require("@frontmcp/utils");
|
|
23063
23236
|
init_errors();
|
|
23064
23237
|
inputSchema19 = httpInputSchema;
|
|
23065
23238
|
stateSchema17 = import_zod53.z.object({
|
|
@@ -23315,14 +23488,14 @@ var init_oauth_provider_callback_flow = __esm({
|
|
|
23315
23488
|
if (!nextProviderId) {
|
|
23316
23489
|
return this.completeFederatedAuth(session);
|
|
23317
23490
|
}
|
|
23318
|
-
const verifier = (0,
|
|
23319
|
-
const challenge = (0,
|
|
23491
|
+
const verifier = (0, import_utils34.generateCodeVerifier)();
|
|
23492
|
+
const challenge = (0, import_utils34.sha256Base64url)(verifier);
|
|
23320
23493
|
const pkce = {
|
|
23321
23494
|
verifier,
|
|
23322
23495
|
challenge,
|
|
23323
23496
|
method: "S256"
|
|
23324
23497
|
};
|
|
23325
|
-
const providerState = `federated:${session.id}:${(0,
|
|
23498
|
+
const providerState = `federated:${session.id}:${(0, import_utils34.randomUUID)()}`;
|
|
23326
23499
|
(0, import_auth23.startNextProvider)(session, pkce, providerState);
|
|
23327
23500
|
const sessionStore = localAuth.federatedSessionStore;
|
|
23328
23501
|
if (sessionStore) {
|
|
@@ -23389,9 +23562,9 @@ var init_oauth_provider_callback_flow = __esm({
|
|
|
23389
23562
|
*/
|
|
23390
23563
|
generateUserSub(email) {
|
|
23391
23564
|
if (!email) {
|
|
23392
|
-
return `anon:${(0,
|
|
23565
|
+
return `anon:${(0, import_utils34.randomUUID)()}`;
|
|
23393
23566
|
}
|
|
23394
|
-
const hash = (0,
|
|
23567
|
+
const hash = (0, import_utils34.sha256Base64url)(email.toLowerCase());
|
|
23395
23568
|
return `user:${hash.substring(0, 16)}`;
|
|
23396
23569
|
}
|
|
23397
23570
|
/**
|
|
@@ -23491,13 +23664,13 @@ var init_oauth_provider_callback_flow = __esm({
|
|
|
23491
23664
|
});
|
|
23492
23665
|
|
|
23493
23666
|
// libs/sdk/src/auth/instances/instance.local-primary-auth.ts
|
|
23494
|
-
var import_jose, import_url,
|
|
23667
|
+
var import_jose, import_url, import_utils35, import_auth25, import_auth26, DEFAULT_NO_AUTH_SECRET, LocalPrimaryAuth;
|
|
23495
23668
|
var init_instance_local_primary_auth = __esm({
|
|
23496
23669
|
"libs/sdk/src/auth/instances/instance.local-primary-auth.ts"() {
|
|
23497
23670
|
"use strict";
|
|
23498
23671
|
import_jose = require("jose");
|
|
23499
23672
|
import_url = require("url");
|
|
23500
|
-
|
|
23673
|
+
import_utils35 = require("@frontmcp/utils");
|
|
23501
23674
|
init_common();
|
|
23502
23675
|
init_auth2();
|
|
23503
23676
|
init_well_known_prm_flow();
|
|
@@ -23513,7 +23686,7 @@ var init_instance_local_primary_auth = __esm({
|
|
|
23513
23686
|
import_auth26 = require("@frontmcp/auth");
|
|
23514
23687
|
init_oauth_provider_callback_flow();
|
|
23515
23688
|
init_auth_internal_errors();
|
|
23516
|
-
DEFAULT_NO_AUTH_SECRET = (0,
|
|
23689
|
+
DEFAULT_NO_AUTH_SECRET = (0, import_utils35.randomBytes)(32);
|
|
23517
23690
|
LocalPrimaryAuth = class extends FrontMcpAuth {
|
|
23518
23691
|
constructor(scope, providers, options) {
|
|
23519
23692
|
super(options);
|
|
@@ -23588,7 +23761,7 @@ var init_instance_local_primary_auth = __esm({
|
|
|
23588
23761
|
return basePath;
|
|
23589
23762
|
}
|
|
23590
23763
|
async signAnonymousJwt() {
|
|
23591
|
-
const sub = (0,
|
|
23764
|
+
const sub = (0, import_utils35.randomUUID)();
|
|
23592
23765
|
return new import_jose.SignJWT({ sub, role: "user", anonymous: true }).setProtectedHeader({ alg: "HS256", typ: "JWT" }).setIssuedAt().setIssuer(this.issuer).setExpirationTime("1d").sign(this.secret);
|
|
23593
23766
|
}
|
|
23594
23767
|
/**
|
|
@@ -23618,7 +23791,7 @@ var init_instance_local_primary_auth = __esm({
|
|
|
23618
23791
|
};
|
|
23619
23792
|
}
|
|
23620
23793
|
}
|
|
23621
|
-
const jwt = new import_jose.SignJWT(claims).setProtectedHeader({ alg: "HS256", typ: "JWT" }).setIssuedAt().setIssuer(this.issuer).setExpirationTime(`${this.accessTokenTtlSeconds}s`).setJti((0,
|
|
23794
|
+
const jwt = new import_jose.SignJWT(claims).setProtectedHeader({ alg: "HS256", typ: "JWT" }).setIssuedAt().setIssuer(this.issuer).setExpirationTime(`${this.accessTokenTtlSeconds}s`).setJti((0, import_utils35.randomUUID)());
|
|
23622
23795
|
if (audience) {
|
|
23623
23796
|
jwt.setAudience(audience);
|
|
23624
23797
|
}
|
|
@@ -23684,7 +23857,7 @@ var init_instance_local_primary_auth = __esm({
|
|
|
23684
23857
|
const pendingAuthId = `pending:${codeRecord.pendingAuthId}`;
|
|
23685
23858
|
const parts = accessToken.split(".");
|
|
23686
23859
|
const signature = parts[2] || accessToken;
|
|
23687
|
-
const newAuthId = (0,
|
|
23860
|
+
const newAuthId = (0, import_utils35.sha256Hex)(signature).substring(0, 16);
|
|
23688
23861
|
await this.orchestratedTokenStore.migrateTokens(pendingAuthId, newAuthId);
|
|
23689
23862
|
this.logger.info(`Migrated tokens from ${pendingAuthId} to ${newAuthId}`);
|
|
23690
23863
|
} catch (err) {
|
|
@@ -24219,14 +24392,14 @@ var init_auth_registry = __esm({
|
|
|
24219
24392
|
});
|
|
24220
24393
|
|
|
24221
24394
|
// libs/sdk/src/scope/flows/http.request.flow.ts
|
|
24222
|
-
var import_zod54,
|
|
24395
|
+
var import_zod54, import_utils36, plan18, httpRequestStateSchema, name19, Stage19, HttpRequestFlow;
|
|
24223
24396
|
var init_http_request_flow = __esm({
|
|
24224
24397
|
"libs/sdk/src/scope/flows/http.request.flow.ts"() {
|
|
24225
24398
|
"use strict";
|
|
24226
24399
|
init_common();
|
|
24227
24400
|
import_zod54 = require("zod");
|
|
24228
24401
|
init_session_verify_flow();
|
|
24229
|
-
|
|
24402
|
+
import_utils36 = require("@frontmcp/utils");
|
|
24230
24403
|
init_errors();
|
|
24231
24404
|
plan18 = {
|
|
24232
24405
|
pre: [
|
|
@@ -24282,7 +24455,7 @@ var init_http_request_flow = __esm({
|
|
|
24282
24455
|
const { request } = this.rawInput;
|
|
24283
24456
|
this.requestStartTime = Date.now();
|
|
24284
24457
|
const ctx = this.tryGetContext();
|
|
24285
|
-
this.requestId = ctx?.requestId ?? `req-${(0,
|
|
24458
|
+
this.requestId = ctx?.requestId ?? `req-${(0, import_utils36.randomUUID)()}`;
|
|
24286
24459
|
const headers = request.headers ?? {};
|
|
24287
24460
|
const body = request.body;
|
|
24288
24461
|
const userAgent = headers["user-agent"];
|
|
@@ -24712,11 +24885,11 @@ var init_transport_remote = __esm({
|
|
|
24712
24885
|
});
|
|
24713
24886
|
|
|
24714
24887
|
// libs/sdk/src/transport/legacy/legacy.sse.tranporter.ts
|
|
24715
|
-
var
|
|
24888
|
+
var import_utils37, import_raw_body, import_content_type, import_url2, import_types19, MAXIMUM_MESSAGE_SIZE, SSEServerTransport;
|
|
24716
24889
|
var init_legacy_sse_tranporter = __esm({
|
|
24717
24890
|
"libs/sdk/src/transport/legacy/legacy.sse.tranporter.ts"() {
|
|
24718
24891
|
"use strict";
|
|
24719
|
-
|
|
24892
|
+
import_utils37 = require("@frontmcp/utils");
|
|
24720
24893
|
import_raw_body = __toESM(require("raw-body"));
|
|
24721
24894
|
import_content_type = __toESM(require("content-type"));
|
|
24722
24895
|
import_url2 = require("url");
|
|
@@ -24730,7 +24903,7 @@ var init_legacy_sse_tranporter = __esm({
|
|
|
24730
24903
|
constructor(_endpoint, res, options) {
|
|
24731
24904
|
this._endpoint = _endpoint;
|
|
24732
24905
|
this.res = res;
|
|
24733
|
-
this._sessionId = options?.sessionId ?? (0,
|
|
24906
|
+
this._sessionId = options?.sessionId ?? (0, import_utils37.randomUUID)();
|
|
24734
24907
|
this._options = options || { enableDnsRebindingProtection: false };
|
|
24735
24908
|
}
|
|
24736
24909
|
_sseResponse;
|
|
@@ -25095,9 +25268,12 @@ function listToolsRequestHandler({
|
|
|
25095
25268
|
return {
|
|
25096
25269
|
requestSchema: import_types23.ListToolsRequestSchema,
|
|
25097
25270
|
handler: async (request, ctx) => {
|
|
25098
|
-
logger.verbose("tools/list
|
|
25271
|
+
logger.verbose("tools/list requested");
|
|
25272
|
+
const start = Date.now();
|
|
25099
25273
|
try {
|
|
25100
|
-
|
|
25274
|
+
const result = await scope.runFlowForOutput("tools:list-tools", { request, ctx });
|
|
25275
|
+
logger.verbose("tools/list completed", { durationMs: Date.now() - start });
|
|
25276
|
+
return result;
|
|
25101
25277
|
} catch (e) {
|
|
25102
25278
|
logger.error("tools/list failed", {
|
|
25103
25279
|
error: e instanceof Error ? { name: e.name, message: e.message, stack: e.stack } : e
|
|
@@ -25124,9 +25300,12 @@ function callToolRequestHandler({
|
|
|
25124
25300
|
requestSchema: import_types24.CallToolRequestSchema,
|
|
25125
25301
|
handler: async (request, ctx) => {
|
|
25126
25302
|
const toolName = request.params?.name || "unknown";
|
|
25127
|
-
logger.
|
|
25303
|
+
logger.info(`tools/call: ${toolName}`);
|
|
25304
|
+
const start = Date.now();
|
|
25128
25305
|
try {
|
|
25129
|
-
|
|
25306
|
+
const result = await scope.runFlowForOutput("tools:call-tool", { request, ctx });
|
|
25307
|
+
logger.verbose("tools/call completed", { tool: toolName, durationMs: Date.now() - start });
|
|
25308
|
+
return result;
|
|
25130
25309
|
} catch (e) {
|
|
25131
25310
|
if (e instanceof FlowControl) {
|
|
25132
25311
|
if (e.type === "respond") {
|
|
@@ -25170,9 +25349,12 @@ function listResourcesRequestHandler({
|
|
|
25170
25349
|
return {
|
|
25171
25350
|
requestSchema: import_types25.ListResourcesRequestSchema,
|
|
25172
25351
|
handler: async (request, ctx) => {
|
|
25173
|
-
logger.verbose("resources/list
|
|
25352
|
+
logger.verbose("resources/list requested");
|
|
25353
|
+
const start = Date.now();
|
|
25174
25354
|
try {
|
|
25175
|
-
|
|
25355
|
+
const result = await scope.runFlowForOutput("resources:list-resources", { request, ctx });
|
|
25356
|
+
logger.verbose("resources/list completed", { durationMs: Date.now() - start });
|
|
25357
|
+
return result;
|
|
25176
25358
|
} catch (e) {
|
|
25177
25359
|
logger.error("resources/list failed", {
|
|
25178
25360
|
error: e instanceof Error ? { name: e.name, message: e.message, stack: e.stack } : e
|
|
@@ -25198,9 +25380,12 @@ function listResourceTemplatesRequestHandler({
|
|
|
25198
25380
|
return {
|
|
25199
25381
|
requestSchema: import_types26.ListResourceTemplatesRequestSchema,
|
|
25200
25382
|
handler: async (request, ctx) => {
|
|
25201
|
-
logger.verbose("resources/listTemplates
|
|
25383
|
+
logger.verbose("resources/listTemplates requested");
|
|
25384
|
+
const start = Date.now();
|
|
25202
25385
|
try {
|
|
25203
|
-
|
|
25386
|
+
const result = await scope.runFlowForOutput("resources:list-resource-templates", { request, ctx });
|
|
25387
|
+
logger.verbose("resources/listTemplates completed", { durationMs: Date.now() - start });
|
|
25388
|
+
return result;
|
|
25204
25389
|
} catch (e) {
|
|
25205
25390
|
logger.error("resources/listTemplates failed", {
|
|
25206
25391
|
error: e instanceof Error ? { name: e.name, message: e.message, stack: e.stack } : e
|
|
@@ -25227,9 +25412,12 @@ function readResourceRequestHandler({
|
|
|
25227
25412
|
requestSchema: import_types27.ReadResourceRequestSchema,
|
|
25228
25413
|
handler: async (request, ctx) => {
|
|
25229
25414
|
const uri = request.params?.uri || "unknown";
|
|
25230
|
-
logger.
|
|
25415
|
+
logger.info(`resources/read: ${uri}`);
|
|
25416
|
+
const start = Date.now();
|
|
25231
25417
|
try {
|
|
25232
|
-
|
|
25418
|
+
const result = await scope.runFlowForOutput("resources:read-resource", { request, ctx });
|
|
25419
|
+
logger.verbose("resources/read completed", { uri, durationMs: Date.now() - start });
|
|
25420
|
+
return result;
|
|
25233
25421
|
} catch (e) {
|
|
25234
25422
|
logger.error("resources/read failed", {
|
|
25235
25423
|
uri,
|
|
@@ -25261,9 +25449,9 @@ function SubscribeRequestHandler({ scope }) {
|
|
|
25261
25449
|
}
|
|
25262
25450
|
const isNew = scope.notifications.subscribeResource(sessionId, uri);
|
|
25263
25451
|
if (isNew) {
|
|
25264
|
-
scope.logger.
|
|
25452
|
+
scope.logger.info(`resources/subscribe: Session ${sessionId.slice(0, 20)}... subscribed to ${uri}`);
|
|
25265
25453
|
} else {
|
|
25266
|
-
scope.logger.
|
|
25454
|
+
scope.logger.debug(`resources/subscribe: Session ${sessionId.slice(0, 20)}... already subscribed to ${uri}`);
|
|
25267
25455
|
}
|
|
25268
25456
|
return {};
|
|
25269
25457
|
}
|
|
@@ -25290,11 +25478,9 @@ function UnsubscribeRequestHandler({ scope }) {
|
|
|
25290
25478
|
}
|
|
25291
25479
|
const wasSubscribed = scope.notifications.unsubscribeResource(sessionId, uri);
|
|
25292
25480
|
if (wasSubscribed) {
|
|
25293
|
-
scope.logger.
|
|
25481
|
+
scope.logger.info(`resources/unsubscribe: Session ${sessionId.slice(0, 20)}... unsubscribed from ${uri}`);
|
|
25294
25482
|
} else {
|
|
25295
|
-
scope.logger.
|
|
25296
|
-
`resources/unsubscribe: Session ${sessionId.slice(0, 20)}... was not subscribed to ${uri}`
|
|
25297
|
-
);
|
|
25483
|
+
scope.logger.debug(`resources/unsubscribe: Session ${sessionId.slice(0, 20)}... was not subscribed to ${uri}`);
|
|
25298
25484
|
}
|
|
25299
25485
|
return {};
|
|
25300
25486
|
}
|
|
@@ -25316,9 +25502,12 @@ function listPromptsRequestHandler({
|
|
|
25316
25502
|
return {
|
|
25317
25503
|
requestSchema: import_types30.ListPromptsRequestSchema,
|
|
25318
25504
|
handler: async (request, ctx) => {
|
|
25319
|
-
logger.verbose("prompts/list
|
|
25505
|
+
logger.verbose("prompts/list requested");
|
|
25506
|
+
const start = Date.now();
|
|
25320
25507
|
try {
|
|
25321
|
-
|
|
25508
|
+
const result = await scope.runFlowForOutput("prompts:list-prompts", { request, ctx });
|
|
25509
|
+
logger.verbose("prompts/list completed", { durationMs: Date.now() - start });
|
|
25510
|
+
return result;
|
|
25322
25511
|
} catch (e) {
|
|
25323
25512
|
logger.error("prompts/list failed", {
|
|
25324
25513
|
error: e instanceof Error ? { name: e.name, message: e.message, stack: e.stack } : e
|
|
@@ -25345,9 +25534,12 @@ function getPromptRequestHandler({
|
|
|
25345
25534
|
requestSchema: import_types31.GetPromptRequestSchema,
|
|
25346
25535
|
handler: async (request, ctx) => {
|
|
25347
25536
|
const promptName = request.params?.name || "unknown";
|
|
25348
|
-
logger.
|
|
25537
|
+
logger.info(`prompts/get: ${promptName}`);
|
|
25538
|
+
const start = Date.now();
|
|
25349
25539
|
try {
|
|
25350
|
-
|
|
25540
|
+
const result = await scope.runFlowForOutput("prompts:get-prompt", { request, ctx });
|
|
25541
|
+
logger.verbose("prompts/get completed", { prompt: promptName, durationMs: Date.now() - start });
|
|
25542
|
+
return result;
|
|
25351
25543
|
} catch (e) {
|
|
25352
25544
|
logger.error("prompts/get failed", {
|
|
25353
25545
|
prompt: promptName,
|
|
@@ -25374,9 +25566,12 @@ function completeRequestHandler({
|
|
|
25374
25566
|
return {
|
|
25375
25567
|
requestSchema: import_types32.CompleteRequestSchema,
|
|
25376
25568
|
handler: async (request, ctx) => {
|
|
25377
|
-
logger.verbose("completion/complete
|
|
25569
|
+
logger.verbose("completion/complete requested");
|
|
25570
|
+
const start = Date.now();
|
|
25378
25571
|
try {
|
|
25379
|
-
|
|
25572
|
+
const result = await scope.runFlowForOutput("completion:complete", { request, ctx });
|
|
25573
|
+
logger.verbose("completion/complete completed", { durationMs: Date.now() - start });
|
|
25574
|
+
return result;
|
|
25380
25575
|
} catch (e) {
|
|
25381
25576
|
logger.error("completion/complete failed", {
|
|
25382
25577
|
error: e instanceof Error ? { name: e.name, message: e.message, stack: e.stack } : e
|
|
@@ -25631,6 +25826,9 @@ function formatSkillsForLlmCompact(skills) {
|
|
|
25631
25826
|
if (tags && tags.length > 0) {
|
|
25632
25827
|
lines.push(`Tags: ${tags.join(", ")}`);
|
|
25633
25828
|
}
|
|
25829
|
+
if (skill.metadata.license) {
|
|
25830
|
+
lines.push(`License: ${skill.metadata.license}`);
|
|
25831
|
+
}
|
|
25634
25832
|
parts.push(lines.join("\n"));
|
|
25635
25833
|
}
|
|
25636
25834
|
return parts.join("\n\n---\n\n");
|
|
@@ -25657,6 +25855,14 @@ function formatSkillForLLMWithSchemas(skill, availableTools, missingTools, toolR
|
|
|
25657
25855
|
parts.push("");
|
|
25658
25856
|
parts.push(skill.description);
|
|
25659
25857
|
parts.push("");
|
|
25858
|
+
if (skill.license) {
|
|
25859
|
+
parts.push(`**License:** ${skill.license}`);
|
|
25860
|
+
parts.push("");
|
|
25861
|
+
}
|
|
25862
|
+
if (skill.compatibility) {
|
|
25863
|
+
parts.push(`**Compatibility:** ${skill.compatibility}`);
|
|
25864
|
+
parts.push("");
|
|
25865
|
+
}
|
|
25660
25866
|
if (missingTools.length > 0) {
|
|
25661
25867
|
parts.push("> **Warning:** Some tools are not available:");
|
|
25662
25868
|
parts.push(`> Missing: ${missingTools.join(", ")}`);
|
|
@@ -25741,7 +25947,12 @@ function skillToApiResponse(skill, loadResult) {
|
|
|
25741
25947
|
type: p.type ?? "string"
|
|
25742
25948
|
})),
|
|
25743
25949
|
priority: skill.metadata.priority ?? 0,
|
|
25744
|
-
visibility: skill.metadata.visibility ?? "both"
|
|
25950
|
+
visibility: skill.metadata.visibility ?? "both",
|
|
25951
|
+
license: skill.metadata.license,
|
|
25952
|
+
compatibility: skill.metadata.compatibility,
|
|
25953
|
+
specMetadata: skill.metadata.specMetadata,
|
|
25954
|
+
allowedTools: skill.metadata.allowedTools,
|
|
25955
|
+
resources: skill.metadata.resources
|
|
25745
25956
|
};
|
|
25746
25957
|
if (loadResult) {
|
|
25747
25958
|
result.availableTools = loadResult.availableTools;
|
|
@@ -26219,21 +26430,21 @@ var init_transport_local_adapter = __esm({
|
|
|
26219
26430
|
});
|
|
26220
26431
|
|
|
26221
26432
|
// libs/sdk/src/transport/transport.error.ts
|
|
26222
|
-
var
|
|
26433
|
+
var import_utils38, JSON_RPC2, rpcError, rpcRequest;
|
|
26223
26434
|
var init_transport_error = __esm({
|
|
26224
26435
|
"libs/sdk/src/transport/transport.error.ts"() {
|
|
26225
26436
|
"use strict";
|
|
26226
|
-
|
|
26437
|
+
import_utils38 = require("@frontmcp/utils");
|
|
26227
26438
|
JSON_RPC2 = "2.0";
|
|
26228
26439
|
rpcError = (message, requestId) => ({
|
|
26229
26440
|
jsonrpc: JSON_RPC2,
|
|
26230
26441
|
error: { code: -32e3, message },
|
|
26231
|
-
id: requestId ?? (0,
|
|
26442
|
+
id: requestId ?? (0, import_utils38.randomUUID)()
|
|
26232
26443
|
// change it to request id + random
|
|
26233
26444
|
});
|
|
26234
26445
|
rpcRequest = (requestId, method, params) => ({
|
|
26235
26446
|
jsonrpc: JSON_RPC2,
|
|
26236
|
-
id: requestId ?? (0,
|
|
26447
|
+
id: requestId ?? (0, import_utils38.randomUUID)(),
|
|
26237
26448
|
method,
|
|
26238
26449
|
params
|
|
26239
26450
|
});
|
|
@@ -26241,12 +26452,12 @@ var init_transport_error = __esm({
|
|
|
26241
26452
|
});
|
|
26242
26453
|
|
|
26243
26454
|
// libs/sdk/src/elicitation/store/storage-elicitation.store.ts
|
|
26244
|
-
var
|
|
26455
|
+
var import_utils39, import_utils40, RESOLVED_RESULT_TTL_SECONDS, RESULT_CHANNEL_PREFIX, FALLBACK_RESULT_CHANNEL_PREFIX, StorageElicitationStore;
|
|
26245
26456
|
var init_storage_elicitation_store = __esm({
|
|
26246
26457
|
"libs/sdk/src/elicitation/store/storage-elicitation.store.ts"() {
|
|
26247
26458
|
"use strict";
|
|
26248
|
-
import_utils38 = require("@frontmcp/utils");
|
|
26249
26459
|
import_utils39 = require("@frontmcp/utils");
|
|
26460
|
+
import_utils40 = require("@frontmcp/utils");
|
|
26250
26461
|
RESOLVED_RESULT_TTL_SECONDS = 300;
|
|
26251
26462
|
RESULT_CHANNEL_PREFIX = "result:";
|
|
26252
26463
|
FALLBACK_RESULT_CHANNEL_PREFIX = "fallback-result:";
|
|
@@ -26271,9 +26482,9 @@ var init_storage_elicitation_store = __esm({
|
|
|
26271
26482
|
constructor(storage, logger) {
|
|
26272
26483
|
this.storage = storage;
|
|
26273
26484
|
this.logger = logger;
|
|
26274
|
-
this.pending = new
|
|
26275
|
-
this.fallback = new
|
|
26276
|
-
this.resolved = new
|
|
26485
|
+
this.pending = new import_utils39.TypedStorage(storage.namespace("pending"));
|
|
26486
|
+
this.fallback = new import_utils39.TypedStorage(storage.namespace("fallback"));
|
|
26487
|
+
this.resolved = new import_utils39.TypedStorage(storage.namespace("resolved"));
|
|
26277
26488
|
}
|
|
26278
26489
|
// ============================================
|
|
26279
26490
|
// Pending Elicitation Methods
|
|
@@ -26283,7 +26494,7 @@ var init_storage_elicitation_store = __esm({
|
|
|
26283
26494
|
*/
|
|
26284
26495
|
async setPending(record) {
|
|
26285
26496
|
const { sessionId, expiresAt } = record;
|
|
26286
|
-
const ttlSeconds = (0,
|
|
26497
|
+
const ttlSeconds = (0, import_utils40.expiresAtToTTL)(expiresAt);
|
|
26287
26498
|
if (ttlSeconds <= 0) {
|
|
26288
26499
|
this.logger?.warn("[StorageElicitationStore] Record already expired, not storing", {
|
|
26289
26500
|
sessionId,
|
|
@@ -26461,7 +26672,7 @@ var init_storage_elicitation_store = __esm({
|
|
|
26461
26672
|
*/
|
|
26462
26673
|
async setPendingFallback(record) {
|
|
26463
26674
|
const { elicitId, expiresAt } = record;
|
|
26464
|
-
const ttlSeconds = (0,
|
|
26675
|
+
const ttlSeconds = (0, import_utils40.expiresAtToTTL)(expiresAt);
|
|
26465
26676
|
if (ttlSeconds <= 0) {
|
|
26466
26677
|
this.logger?.warn("[StorageElicitationStore] Fallback record already expired, not storing", { elicitId });
|
|
26467
26678
|
return;
|
|
@@ -26729,27 +26940,27 @@ async function deriveElicitationKey(sessionId, secret) {
|
|
|
26729
26940
|
const ikm = textEncoder.encode(serverSecret + sessionId);
|
|
26730
26941
|
const salt = textEncoder.encode(ELICITATION_SALT);
|
|
26731
26942
|
const info = textEncoder.encode(`elicit:${sessionId}`);
|
|
26732
|
-
return (0,
|
|
26943
|
+
return (0, import_utils41.hkdfSha256)(ikm, salt, info, 32);
|
|
26733
26944
|
}
|
|
26734
26945
|
async function encryptElicitationData(data, sessionId, secret) {
|
|
26735
26946
|
const key = await deriveElicitationKey(sessionId, secret);
|
|
26736
26947
|
const plaintext = textEncoder.encode(JSON.stringify(data));
|
|
26737
|
-
const iv = (0,
|
|
26738
|
-
const { ciphertext, tag } = (0,
|
|
26948
|
+
const iv = (0, import_utils41.randomBytes)(12);
|
|
26949
|
+
const { ciphertext, tag } = (0, import_utils41.encryptAesGcm)(key, plaintext, iv);
|
|
26739
26950
|
return {
|
|
26740
26951
|
alg: "A256GCM",
|
|
26741
|
-
iv: (0,
|
|
26742
|
-
tag: (0,
|
|
26743
|
-
data: (0,
|
|
26952
|
+
iv: (0, import_utils41.base64urlEncode)(iv),
|
|
26953
|
+
tag: (0, import_utils41.base64urlEncode)(tag),
|
|
26954
|
+
data: (0, import_utils41.base64urlEncode)(ciphertext)
|
|
26744
26955
|
};
|
|
26745
26956
|
}
|
|
26746
26957
|
async function decryptElicitationData(blob, sessionId, secret) {
|
|
26747
26958
|
try {
|
|
26748
26959
|
const key = await deriveElicitationKey(sessionId, secret);
|
|
26749
|
-
const iv = (0,
|
|
26750
|
-
const tag = (0,
|
|
26751
|
-
const ciphertext = (0,
|
|
26752
|
-
const decrypted = (0,
|
|
26960
|
+
const iv = (0, import_utils41.base64urlDecode)(blob.iv);
|
|
26961
|
+
const tag = (0, import_utils41.base64urlDecode)(blob.tag);
|
|
26962
|
+
const ciphertext = (0, import_utils41.base64urlDecode)(blob.data);
|
|
26963
|
+
const decrypted = (0, import_utils41.decryptAesGcm)(key, ciphertext, iv, tag);
|
|
26753
26964
|
return JSON.parse(textDecoder.decode(decrypted));
|
|
26754
26965
|
} catch {
|
|
26755
26966
|
return null;
|
|
@@ -26789,11 +27000,11 @@ async function tryDecryptStoredValue(value, sessionId, secret) {
|
|
|
26789
27000
|
}
|
|
26790
27001
|
return decryptElicitationData(value, sessionId, secret);
|
|
26791
27002
|
}
|
|
26792
|
-
var
|
|
27003
|
+
var import_utils41, ELICITATION_SALT, textEncoder, textDecoder;
|
|
26793
27004
|
var init_elicitation_encryption = __esm({
|
|
26794
27005
|
"libs/sdk/src/elicitation/store/elicitation-encryption.ts"() {
|
|
26795
27006
|
"use strict";
|
|
26796
|
-
|
|
27007
|
+
import_utils41 = require("@frontmcp/utils");
|
|
26797
27008
|
init_auth_internal_errors();
|
|
26798
27009
|
ELICITATION_SALT = "elicitation-store-v1";
|
|
26799
27010
|
textEncoder = new TextEncoder();
|
|
@@ -27262,7 +27473,7 @@ async function createElicitationStore(options = {}) {
|
|
|
27262
27473
|
"Elicitation requires distributed storage when running on Edge runtime. Edge functions are stateless and cannot use in-memory elicitation. Configure Redis or Upstash storage."
|
|
27263
27474
|
);
|
|
27264
27475
|
}
|
|
27265
|
-
const storage = await (0,
|
|
27476
|
+
const storage = await (0, import_utils42.createStorage)({
|
|
27266
27477
|
...finalStorageConfig,
|
|
27267
27478
|
prefix: keyPrefix,
|
|
27268
27479
|
fallback: isEdgeRuntime ? "error" : "memory"
|
|
@@ -27300,7 +27511,7 @@ async function createElicitationStore(options = {}) {
|
|
|
27300
27511
|
}
|
|
27301
27512
|
function createMemoryElicitationStore(options = {}) {
|
|
27302
27513
|
const { keyPrefix = "mcp:elicit:", logger, encryption } = options;
|
|
27303
|
-
const storage = (0,
|
|
27514
|
+
const storage = (0, import_utils42.createMemoryStorage)({ prefix: keyPrefix });
|
|
27304
27515
|
let store = new StorageElicitationStore(storage, logger);
|
|
27305
27516
|
const encryptionEnabled = encryption?.enabled ?? "auto";
|
|
27306
27517
|
const encryptionSecret = encryption?.secret;
|
|
@@ -27344,11 +27555,11 @@ function createElicitationStoreFromStorage(storage, options = {}) {
|
|
|
27344
27555
|
});
|
|
27345
27556
|
return { store, type, storage, encrypted };
|
|
27346
27557
|
}
|
|
27347
|
-
var
|
|
27558
|
+
var import_utils42;
|
|
27348
27559
|
var init_elicitation_store_factory = __esm({
|
|
27349
27560
|
"libs/sdk/src/elicitation/store/elicitation-store.factory.ts"() {
|
|
27350
27561
|
"use strict";
|
|
27351
|
-
|
|
27562
|
+
import_utils42 = require("@frontmcp/utils");
|
|
27352
27563
|
init_storage_elicitation_store();
|
|
27353
27564
|
init_encrypted_elicitation_store();
|
|
27354
27565
|
init_elicitation_encryption();
|
|
@@ -28352,10 +28563,12 @@ var init_handle_streamable_http_flow = __esm({
|
|
|
28352
28563
|
const { request } = this.rawInput;
|
|
28353
28564
|
const authorization = request[ServerRequestTokens.auth];
|
|
28354
28565
|
const { token } = authorization;
|
|
28566
|
+
const logger = this.scopeLogger.child("handle:streamable-http:parseInput");
|
|
28355
28567
|
const raw = request.headers?.["mcp-session-id"];
|
|
28356
28568
|
const rawMcpSessionHeader = typeof raw === "string" ? raw : void 0;
|
|
28357
28569
|
const mcpSessionHeader = validateMcpSessionHeader(rawMcpSessionHeader);
|
|
28358
28570
|
if (raw !== void 0 && !mcpSessionHeader) {
|
|
28571
|
+
logger.warn("parseInput: invalid mcp-session-id header");
|
|
28359
28572
|
this.respond(httpRespond.sessionNotFound("invalid session id"));
|
|
28360
28573
|
return;
|
|
28361
28574
|
}
|
|
@@ -28378,24 +28591,32 @@ var init_handle_streamable_http_flow = __esm({
|
|
|
28378
28591
|
});
|
|
28379
28592
|
}
|
|
28380
28593
|
this.state.set(stateSchema18.parse({ token, session }));
|
|
28594
|
+
logger.info("parseInput: session resolved", { sessionId: session.id?.slice(0, 20) });
|
|
28381
28595
|
}
|
|
28382
28596
|
async router() {
|
|
28383
28597
|
const { request } = this.rawInput;
|
|
28598
|
+
const logger = this.scopeLogger.child("handle:streamable-http:router");
|
|
28384
28599
|
if (request.method.toUpperCase() === "GET") {
|
|
28385
28600
|
this.state.set("requestType", "sseListener");
|
|
28601
|
+
logger.info("router: requestType=sseListener, method=GET");
|
|
28386
28602
|
return;
|
|
28387
28603
|
}
|
|
28388
28604
|
const body = request.body;
|
|
28389
28605
|
const method = body?.method;
|
|
28390
28606
|
if (method === "initialize") {
|
|
28391
28607
|
this.state.set("requestType", "initialize");
|
|
28608
|
+
logger.info("router: requestType=initialize, method=POST");
|
|
28392
28609
|
} else if (typeof method === "string" && method.startsWith("ui/")) {
|
|
28393
28610
|
this.state.set("requestType", "extApps");
|
|
28611
|
+
logger.info(`router: requestType=extApps, method=${method}`);
|
|
28394
28612
|
} else if (import_types36.ElicitResultSchema.safeParse(request.body?.result).success) {
|
|
28395
28613
|
this.state.set("requestType", "elicitResult");
|
|
28614
|
+
logger.info("router: requestType=elicitResult, method=POST");
|
|
28396
28615
|
} else if (method && import_types36.RequestSchema.safeParse(request.body).success) {
|
|
28397
28616
|
this.state.set("requestType", "message");
|
|
28617
|
+
logger.info(`router: requestType=message, method=${method}`);
|
|
28398
28618
|
} else {
|
|
28619
|
+
logger.warn("router: invalid request, no valid method");
|
|
28399
28620
|
this.respond(httpRespond.rpcError("Invalid Request"));
|
|
28400
28621
|
}
|
|
28401
28622
|
}
|
|
@@ -28405,7 +28626,7 @@ var init_handle_streamable_http_flow = __esm({
|
|
|
28405
28626
|
const { request, response } = this.rawInput;
|
|
28406
28627
|
const { token, session } = this.state.required;
|
|
28407
28628
|
logger.info("onInitialize: creating transport", {
|
|
28408
|
-
sessionId: session.id
|
|
28629
|
+
sessionId: session.id?.slice(0, 20),
|
|
28409
28630
|
hasToken: !!token,
|
|
28410
28631
|
tokenPrefix: token?.slice(0, 10)
|
|
28411
28632
|
});
|
|
@@ -28438,12 +28659,12 @@ var init_handle_streamable_http_flow = __esm({
|
|
|
28438
28659
|
let transport = await transportService.getTransporter("streamable-http", token, session.id);
|
|
28439
28660
|
if (!transport) {
|
|
28440
28661
|
try {
|
|
28441
|
-
logger.
|
|
28662
|
+
logger.verbose("onElicitResult: transport not in memory, checking stored session", {
|
|
28442
28663
|
sessionId: session.id?.slice(0, 20)
|
|
28443
28664
|
});
|
|
28444
28665
|
const storedSession = await transportService.getStoredSession("streamable-http", token, session.id);
|
|
28445
28666
|
if (storedSession) {
|
|
28446
|
-
logger.
|
|
28667
|
+
logger.verbose("onElicitResult: recreating transport from stored session", {
|
|
28447
28668
|
sessionId: session.id?.slice(0, 20),
|
|
28448
28669
|
createdAt: storedSession.createdAt,
|
|
28449
28670
|
initialized: storedSession.initialized
|
|
@@ -28486,19 +28707,19 @@ var init_handle_streamable_http_flow = __esm({
|
|
|
28486
28707
|
hasToken: !!token
|
|
28487
28708
|
});
|
|
28488
28709
|
let transport = await transportService.getTransporter("streamable-http", token, session.id);
|
|
28489
|
-
logger.
|
|
28710
|
+
logger.verbose("onMessage: getTransporter result", { found: !!transport });
|
|
28490
28711
|
if (!transport) {
|
|
28491
28712
|
try {
|
|
28492
|
-
logger.
|
|
28713
|
+
logger.verbose("onMessage: transport not in memory, checking Redis", {
|
|
28493
28714
|
sessionId: session.id?.slice(0, 20)
|
|
28494
28715
|
});
|
|
28495
28716
|
const storedSession = await transportService.getStoredSession("streamable-http", token, session.id);
|
|
28496
|
-
logger.
|
|
28717
|
+
logger.verbose("onMessage: getStoredSession result", {
|
|
28497
28718
|
found: !!storedSession,
|
|
28498
28719
|
initialized: storedSession?.initialized
|
|
28499
28720
|
});
|
|
28500
28721
|
if (storedSession) {
|
|
28501
|
-
logger.
|
|
28722
|
+
logger.verbose("onMessage: recreating transport from stored session", {
|
|
28502
28723
|
sessionId: session.id?.slice(0, 20),
|
|
28503
28724
|
createdAt: storedSession.createdAt,
|
|
28504
28725
|
initialized: storedSession.initialized
|
|
@@ -28510,7 +28731,7 @@ var init_handle_streamable_http_flow = __esm({
|
|
|
28510
28731
|
storedSession,
|
|
28511
28732
|
response
|
|
28512
28733
|
);
|
|
28513
|
-
logger.
|
|
28734
|
+
logger.verbose("onMessage: transport recreated successfully");
|
|
28514
28735
|
}
|
|
28515
28736
|
} catch (error) {
|
|
28516
28737
|
logger.warn("Failed to recreate transport from stored session", {
|
|
@@ -28590,6 +28811,7 @@ var init_handle_streamable_http_flow = __esm({
|
|
|
28590
28811
|
}
|
|
28591
28812
|
}
|
|
28592
28813
|
if (!transport) {
|
|
28814
|
+
logger.warn("onSseListener: transport not found", { sessionId: session.id?.slice(0, 20) });
|
|
28593
28815
|
this.respond(httpRespond.notFound("Session not found"));
|
|
28594
28816
|
return;
|
|
28595
28817
|
}
|
|
@@ -28608,12 +28830,12 @@ var init_handle_streamable_http_flow = __esm({
|
|
|
28608
28830
|
let transport = await transportService.getTransporter("streamable-http", token, session.id);
|
|
28609
28831
|
if (!transport) {
|
|
28610
28832
|
try {
|
|
28611
|
-
logger.
|
|
28833
|
+
logger.verbose("onExtApps: transport not in memory, checking stored session", {
|
|
28612
28834
|
sessionId: session.id?.slice(0, 20)
|
|
28613
28835
|
});
|
|
28614
28836
|
const storedSession = await transportService.getStoredSession("streamable-http", token, session.id);
|
|
28615
28837
|
if (storedSession) {
|
|
28616
|
-
logger.
|
|
28838
|
+
logger.verbose("onExtApps: recreating transport from stored session", {
|
|
28617
28839
|
sessionId: session.id?.slice(0, 20),
|
|
28618
28840
|
createdAt: storedSession.createdAt,
|
|
28619
28841
|
initialized: storedSession.initialized
|
|
@@ -28636,8 +28858,14 @@ var init_handle_streamable_http_flow = __esm({
|
|
|
28636
28858
|
if (!transport) {
|
|
28637
28859
|
const wasCreated = await transportService.wasSessionCreatedAsync("streamable-http", token, session.id);
|
|
28638
28860
|
if (wasCreated) {
|
|
28861
|
+
logger.info("onExtApps: session expired - client should re-initialize", {
|
|
28862
|
+
sessionId: session.id?.slice(0, 20)
|
|
28863
|
+
});
|
|
28639
28864
|
this.respond(httpRespond.sessionExpired("session expired"));
|
|
28640
28865
|
} else {
|
|
28866
|
+
logger.warn("onExtApps: session not initialized - client attempted request without initializing", {
|
|
28867
|
+
sessionId: session.id?.slice(0, 20)
|
|
28868
|
+
});
|
|
28641
28869
|
this.respond(httpRespond.sessionNotFound("session not initialized"));
|
|
28642
28870
|
}
|
|
28643
28871
|
return;
|
|
@@ -28922,9 +29150,11 @@ var init_handle_stateless_http_flow = __esm({
|
|
|
28922
29150
|
name = name22;
|
|
28923
29151
|
async parseInput() {
|
|
28924
29152
|
const { request } = this.rawInput;
|
|
29153
|
+
const logger = this.scope.logger.child("HandleStatelessHttpFlow");
|
|
28925
29154
|
const auth = request[ServerRequestTokens.auth];
|
|
28926
29155
|
const token = auth?.token;
|
|
28927
29156
|
const isAuthenticated = !!token && token.length > 0;
|
|
29157
|
+
logger.verbose("parseInput", { isAuthenticated, hasToken: !!token });
|
|
28928
29158
|
this.state.set(
|
|
28929
29159
|
stateSchema20.parse({
|
|
28930
29160
|
token: token || void 0,
|
|
@@ -28934,28 +29164,44 @@ var init_handle_stateless_http_flow = __esm({
|
|
|
28934
29164
|
}
|
|
28935
29165
|
async router() {
|
|
28936
29166
|
const { request } = this.rawInput;
|
|
29167
|
+
const logger = this.scope.logger.child("HandleStatelessHttpFlow");
|
|
28937
29168
|
const body = request.body;
|
|
28938
29169
|
const method = body?.method;
|
|
28939
29170
|
if (method === "initialize") {
|
|
28940
29171
|
this.state.set("requestType", "initialize");
|
|
29172
|
+
logger.info("router: requestType=initialize, method=POST");
|
|
28941
29173
|
} else if (method && import_types37.RequestSchema.safeParse(request.body).success) {
|
|
28942
29174
|
this.state.set("requestType", "message");
|
|
29175
|
+
logger.info(`router: requestType=message, method=${method}`);
|
|
28943
29176
|
} else {
|
|
29177
|
+
logger.warn("router: invalid request, no valid method");
|
|
28944
29178
|
this.respond(httpRespond.rpcError("Invalid Request"));
|
|
28945
29179
|
}
|
|
28946
29180
|
}
|
|
28947
29181
|
async handleRequest() {
|
|
28948
29182
|
const transportService = this.scope.transportService;
|
|
29183
|
+
const logger = this.scope.logger.child("HandleStatelessHttpFlow");
|
|
28949
29184
|
const { request, response } = this.rawInput;
|
|
28950
29185
|
const { token, isAuthenticated, requestType } = this.state;
|
|
29186
|
+
logger.info(`handleRequest: using ${isAuthenticated ? "authenticated" : "anonymous"} stateless transport`);
|
|
28951
29187
|
const transport = isAuthenticated && token ? await transportService.getOrCreateAuthenticatedStatelessTransport("stateless-http", token, response) : await transportService.getOrCreateAnonymousStatelessTransport("stateless-http", response);
|
|
28952
29188
|
if (!request.headers["mcp-session-id"]) {
|
|
28953
29189
|
request.headers["mcp-session-id"] = "__stateless__";
|
|
29190
|
+
logger.verbose("handleRequest: injected __stateless__ session ID");
|
|
28954
29191
|
}
|
|
28955
|
-
|
|
28956
|
-
|
|
28957
|
-
|
|
28958
|
-
|
|
29192
|
+
logger.verbose(`handleRequest: requestType=${requestType}, forwarding to transport`);
|
|
29193
|
+
try {
|
|
29194
|
+
if (requestType === "initialize") {
|
|
29195
|
+
await transport.initialize(request, response);
|
|
29196
|
+
} else {
|
|
29197
|
+
await transport.handleRequest(request, response);
|
|
29198
|
+
}
|
|
29199
|
+
} catch (error) {
|
|
29200
|
+
logger.error("handleRequest: transport failed", {
|
|
29201
|
+
requestType,
|
|
29202
|
+
error: error instanceof Error ? { name: error.name, message: error.message } : String(error)
|
|
29203
|
+
});
|
|
29204
|
+
throw error;
|
|
28959
29205
|
}
|
|
28960
29206
|
this.handled();
|
|
28961
29207
|
}
|
|
@@ -29021,21 +29267,21 @@ async function createVercelKvSessionStore(options, logger) {
|
|
|
29021
29267
|
await store.connect();
|
|
29022
29268
|
return store;
|
|
29023
29269
|
}
|
|
29024
|
-
var
|
|
29270
|
+
var import_utils43;
|
|
29025
29271
|
var init_session_store_factory = __esm({
|
|
29026
29272
|
"libs/sdk/src/auth/session/session-store.factory.ts"() {
|
|
29027
29273
|
"use strict";
|
|
29028
|
-
|
|
29274
|
+
import_utils43 = require("@frontmcp/utils");
|
|
29029
29275
|
init_common();
|
|
29030
29276
|
}
|
|
29031
29277
|
});
|
|
29032
29278
|
|
|
29033
29279
|
// libs/sdk/src/transport/transport.registry.ts
|
|
29034
|
-
var
|
|
29280
|
+
var import_utils44, import_auth30, TransportService;
|
|
29035
29281
|
var init_transport_registry = __esm({
|
|
29036
29282
|
"libs/sdk/src/transport/transport.registry.ts"() {
|
|
29037
29283
|
"use strict";
|
|
29038
|
-
|
|
29284
|
+
import_utils44 = require("@frontmcp/utils");
|
|
29039
29285
|
init_transport_remote();
|
|
29040
29286
|
init_transport_local();
|
|
29041
29287
|
init_transport_errors();
|
|
@@ -29443,7 +29689,7 @@ var init_transport_registry = __esm({
|
|
|
29443
29689
|
}
|
|
29444
29690
|
/* --------------------------------- internals -------------------------------- */
|
|
29445
29691
|
sha256(value) {
|
|
29446
|
-
return (0,
|
|
29692
|
+
return (0, import_utils44.sha256Hex)(value);
|
|
29447
29693
|
}
|
|
29448
29694
|
/**
|
|
29449
29695
|
* Create a history key from components.
|
|
@@ -30008,11 +30254,11 @@ function createSkillHttpAuthValidator(skillsConfig, logger) {
|
|
|
30008
30254
|
}
|
|
30009
30255
|
return new SkillHttpAuthValidator({ skillsConfig, logger });
|
|
30010
30256
|
}
|
|
30011
|
-
var
|
|
30257
|
+
var import_utils45, SkillHttpAuthValidator;
|
|
30012
30258
|
var init_skill_http_auth = __esm({
|
|
30013
30259
|
"libs/sdk/src/skill/auth/skill-http-auth.ts"() {
|
|
30014
30260
|
"use strict";
|
|
30015
|
-
|
|
30261
|
+
import_utils45 = require("@frontmcp/utils");
|
|
30016
30262
|
SkillHttpAuthValidator = class {
|
|
30017
30263
|
skillsConfig;
|
|
30018
30264
|
logger;
|
|
@@ -30089,7 +30335,7 @@ var init_skill_http_auth = __esm({
|
|
|
30089
30335
|
const keyBytes = encoder.encode(key);
|
|
30090
30336
|
if (keyBytes.length === candidateBytes.length) {
|
|
30091
30337
|
try {
|
|
30092
|
-
if ((0,
|
|
30338
|
+
if ((0, import_utils45.timingSafeEqual)(keyBytes, candidateBytes)) {
|
|
30093
30339
|
found = true;
|
|
30094
30340
|
}
|
|
30095
30341
|
} catch {
|
|
@@ -32795,7 +33041,11 @@ var init_call_agent_flow = __esm({
|
|
|
32795
33041
|
this.logger.info("finalize: sending response", {
|
|
32796
33042
|
agent: agent.metadata.name,
|
|
32797
33043
|
hasContent: Array.isArray(result.content) && result.content.length > 0,
|
|
32798
|
-
|
|
33044
|
+
contentParts: Array.isArray(result.content) ? result.content.length : 0,
|
|
33045
|
+
contentBytes: Array.isArray(result.content) ? result.content.reduce((sum, part) => {
|
|
33046
|
+
const str = JSON.stringify(part);
|
|
33047
|
+
return sum + (typeof Buffer !== "undefined" ? Buffer.byteLength(str, "utf8") : new TextEncoder().encode(str).byteLength);
|
|
33048
|
+
}, 0) : 0,
|
|
32799
33049
|
hasStructuredContent: result.structuredContent !== void 0,
|
|
32800
33050
|
hasMeta: result._meta !== void 0,
|
|
32801
33051
|
metaKeys: result._meta ? Object.keys(result._meta) : [],
|
|
@@ -32854,13 +33104,13 @@ var init_call_agent_flow = __esm({
|
|
|
32854
33104
|
});
|
|
32855
33105
|
|
|
32856
33106
|
// libs/sdk/src/elicitation/flows/elicitation-request.flow.ts
|
|
32857
|
-
var import_zod69,
|
|
33107
|
+
var import_zod69, import_utils46, inputSchema30, outputSchema28, stateSchema29, plan30, name31, Stage31, ElicitationRequestFlow;
|
|
32858
33108
|
var init_elicitation_request_flow = __esm({
|
|
32859
33109
|
"libs/sdk/src/elicitation/flows/elicitation-request.flow.ts"() {
|
|
32860
33110
|
"use strict";
|
|
32861
33111
|
init_common();
|
|
32862
33112
|
import_zod69 = require("zod");
|
|
32863
|
-
|
|
33113
|
+
import_utils46 = require("@frontmcp/utils");
|
|
32864
33114
|
init_errors();
|
|
32865
33115
|
init_elicitation_types();
|
|
32866
33116
|
inputSchema30 = import_zod69.z.object({
|
|
@@ -32942,7 +33192,7 @@ var init_elicitation_request_flow = __esm({
|
|
|
32942
33192
|
async generateElicitId() {
|
|
32943
33193
|
this.logger.verbose("generateElicitId:start");
|
|
32944
33194
|
const { elicitationId, ttl } = this.state;
|
|
32945
|
-
const elicitId = elicitationId ?? `elicit-${(0,
|
|
33195
|
+
const elicitId = elicitationId ?? `elicit-${(0, import_utils46.randomUUID)()}`;
|
|
32946
33196
|
const expiresAt = Date.now() + (ttl ?? DEFAULT_ELICIT_TTL);
|
|
32947
33197
|
this.state.set({ elicitId, expiresAt });
|
|
32948
33198
|
this.logger.verbose("generateElicitId:done", { elicitId });
|
|
@@ -33244,30 +33494,30 @@ var require_dist = __commonJS({
|
|
|
33244
33494
|
sqliteStorageOptionsSchema: () => sqliteStorageOptionsSchema
|
|
33245
33495
|
});
|
|
33246
33496
|
module2.exports = __toCommonJS2(index_exports2);
|
|
33247
|
-
var
|
|
33497
|
+
var import_utils56 = require("@frontmcp/utils");
|
|
33248
33498
|
var HKDF_SALT = new TextEncoder().encode("frontmcp-sqlite-storage-v1");
|
|
33249
33499
|
var HKDF_INFO = new TextEncoder().encode("aes-256-gcm-value-encryption");
|
|
33250
33500
|
var KEY_LENGTH = 32;
|
|
33251
33501
|
function deriveEncryptionKey(secret) {
|
|
33252
33502
|
const ikm = new TextEncoder().encode(secret);
|
|
33253
|
-
return (0,
|
|
33503
|
+
return (0, import_utils56.hkdfSha256)(ikm, HKDF_SALT, HKDF_INFO, KEY_LENGTH);
|
|
33254
33504
|
}
|
|
33255
33505
|
var SEPARATOR = ":";
|
|
33256
33506
|
function encryptValue(key, plaintext) {
|
|
33257
|
-
const iv = (0,
|
|
33507
|
+
const iv = (0, import_utils56.randomBytes)(12);
|
|
33258
33508
|
const plaintextBytes = new TextEncoder().encode(plaintext);
|
|
33259
|
-
const { ciphertext, tag } = (0,
|
|
33260
|
-
return [(0,
|
|
33509
|
+
const { ciphertext, tag } = (0, import_utils56.encryptAesGcm)(key, plaintextBytes, iv);
|
|
33510
|
+
return [(0, import_utils56.base64urlEncode)(iv), (0, import_utils56.base64urlEncode)(tag), (0, import_utils56.base64urlEncode)(ciphertext)].join(SEPARATOR);
|
|
33261
33511
|
}
|
|
33262
33512
|
function decryptValue(key, encrypted) {
|
|
33263
33513
|
const parts = encrypted.split(SEPARATOR);
|
|
33264
33514
|
if (parts.length !== 3) {
|
|
33265
33515
|
throw new Error("Invalid encrypted value format");
|
|
33266
33516
|
}
|
|
33267
|
-
const iv = (0,
|
|
33268
|
-
const tag = (0,
|
|
33269
|
-
const ciphertext = (0,
|
|
33270
|
-
const plaintext = (0,
|
|
33517
|
+
const iv = (0, import_utils56.base64urlDecode)(parts[0]);
|
|
33518
|
+
const tag = (0, import_utils56.base64urlDecode)(parts[1]);
|
|
33519
|
+
const ciphertext = (0, import_utils56.base64urlDecode)(parts[2]);
|
|
33520
|
+
const plaintext = (0, import_utils56.decryptAesGcm)(key, ciphertext, iv, tag);
|
|
33271
33521
|
return new TextDecoder().decode(plaintext);
|
|
33272
33522
|
}
|
|
33273
33523
|
var SqliteKvStore = class {
|
|
@@ -34145,10 +34395,13 @@ var init_scope_instance = __esm({
|
|
|
34145
34395
|
const scopeProviders = this.scopeProviders;
|
|
34146
34396
|
this.scopeHooks = new HookRegistry(scopeProviders, []);
|
|
34147
34397
|
await this.scopeHooks.ready;
|
|
34398
|
+
this.logger.verbose("HookRegistry initialized");
|
|
34148
34399
|
this.scopeFlows = new FlowRegistry(scopeProviders, [HttpRequestFlow]);
|
|
34149
34400
|
await this.scopeFlows.ready;
|
|
34401
|
+
this.logger.verbose("FlowRegistry initialized");
|
|
34150
34402
|
const transportConfig = this.metadata.transport;
|
|
34151
34403
|
this.transportService = new TransportService(this, transportConfig?.persistence);
|
|
34404
|
+
this.logger.verbose("TransportService initialized");
|
|
34152
34405
|
const eventStoreConfig = transportConfig?.eventStore;
|
|
34153
34406
|
if (eventStoreConfig?.enabled) {
|
|
34154
34407
|
const { eventStore } = createEventStore(eventStoreConfig, this.logger);
|
|
@@ -34170,7 +34423,10 @@ var init_scope_instance = __esm({
|
|
|
34170
34423
|
}
|
|
34171
34424
|
this.scopeAuth = new AuthRegistry(this, scopeProviders, [], scopeRef, this.metadata.auth);
|
|
34172
34425
|
await this.scopeAuth.ready;
|
|
34426
|
+
this.logger.verbose("AuthRegistry initialized");
|
|
34173
34427
|
this.scopeApps = new AppRegistry(this.scopeProviders, this.metadata.apps, scopeRef);
|
|
34428
|
+
const appCount = this.metadata.apps.length;
|
|
34429
|
+
this.logger.info(`Initializing ${appCount} app(s)...`);
|
|
34174
34430
|
await this.scopeApps.ready;
|
|
34175
34431
|
const serverPlugins = this.metadata.plugins ?? [];
|
|
34176
34432
|
if (serverPlugins.length > 0) {
|
|
@@ -34182,15 +34438,20 @@ var init_scope_instance = __esm({
|
|
|
34182
34438
|
};
|
|
34183
34439
|
this.scopePlugins = new PluginRegistry(this.scopeProviders, serverPlugins, scopeRef, serverPluginScopeInfo);
|
|
34184
34440
|
await this.scopePlugins.ready;
|
|
34441
|
+
const pluginNames = this.scopePlugins.getPluginNames();
|
|
34442
|
+
this.logger.verbose(`PluginRegistry initialized (${pluginNames.length} plugin(s): [${pluginNames.join(", ")}])`);
|
|
34185
34443
|
}
|
|
34186
34444
|
this.scopeTools = new ToolRegistry(this.scopeProviders, [], scopeRef);
|
|
34187
34445
|
await this.scopeTools.ready;
|
|
34446
|
+
const toolNames = this.scopeTools.getTools(true).map((t) => t.metadata.name);
|
|
34447
|
+
this.logger.verbose(`ToolRegistry initialized with initial ${toolNames.length} tool(s): [${toolNames.join(", ")}]`);
|
|
34188
34448
|
if (elicitationEnabled) {
|
|
34189
34449
|
this.registerSendElicitationResultTool(scopeRef);
|
|
34190
34450
|
}
|
|
34191
34451
|
this.toolUIRegistry = new import_registry3.ToolUIRegistry();
|
|
34192
34452
|
this.scopeResources = new ResourceRegistry(this.scopeProviders, [], scopeRef);
|
|
34193
34453
|
await this.scopeResources.ready;
|
|
34454
|
+
this.logger.verbose(`ResourceRegistry initialized (${this.scopeResources.getResources().length} resource(s))`);
|
|
34194
34455
|
const toolsWithUI = this.scopeTools.getTools(true).filter((t) => (0, import_registry3.hasUIConfig)(t.metadata));
|
|
34195
34456
|
if (toolsWithUI.length > 0) {
|
|
34196
34457
|
this.scopeResources.registerDynamicResource(StaticWidgetResourceTemplate);
|
|
@@ -34296,10 +34557,13 @@ var init_scope_instance = __esm({
|
|
|
34296
34557
|
}
|
|
34297
34558
|
this.scopePrompts = new PromptRegistry(this.scopeProviders, [], scopeRef);
|
|
34298
34559
|
await this.scopePrompts.ready;
|
|
34560
|
+
this.logger.verbose(`PromptRegistry initialized (${this.scopePrompts.getPrompts().length} prompt(s))`);
|
|
34299
34561
|
this.scopeAgents = new AgentRegistry(this.scopeProviders, [], scopeRef);
|
|
34300
34562
|
await this.scopeAgents.ready;
|
|
34563
|
+
this.logger.verbose(`AgentRegistry initialized (${this.scopeAgents.getAgents().length} agent(s))`);
|
|
34301
34564
|
this.scopeSkills = new SkillRegistry(this.scopeProviders, this.metadata.skills ?? [], scopeRef);
|
|
34302
34565
|
await this.scopeSkills.ready;
|
|
34566
|
+
this.logger.verbose(`SkillRegistry initialized (${this.scopeSkills.getSkills().length} skill(s))`);
|
|
34303
34567
|
if (this.scopeSkills.hasAny()) {
|
|
34304
34568
|
const store = createSkillSessionStore({ type: "memory" });
|
|
34305
34569
|
this._skillSession = new SkillSessionManager(
|
|
@@ -34356,6 +34620,7 @@ var init_scope_instance = __esm({
|
|
|
34356
34620
|
});
|
|
34357
34621
|
this.notificationService = new NotificationService(this);
|
|
34358
34622
|
await this.notificationService.initialize();
|
|
34623
|
+
this.logger.verbose("NotificationService initialized");
|
|
34359
34624
|
await this.scopeFlows.registryFlows([
|
|
34360
34625
|
SetLevelFlow,
|
|
34361
34626
|
CompleteFlow,
|
|
@@ -34364,7 +34629,20 @@ var init_scope_instance = __esm({
|
|
|
34364
34629
|
ElicitationResultFlow
|
|
34365
34630
|
]);
|
|
34366
34631
|
await this.auth.ready;
|
|
34367
|
-
this.logger.info(
|
|
34632
|
+
this.logger.info(`Scope ready \u2014 ${this.formatScopeSummary()}`);
|
|
34633
|
+
}
|
|
34634
|
+
formatScopeSummary() {
|
|
34635
|
+
const entries = [];
|
|
34636
|
+
const add = (count, label) => {
|
|
34637
|
+
if (count > 0) entries.push(`${count} ${label}${count !== 1 ? "s" : ""}`);
|
|
34638
|
+
};
|
|
34639
|
+
add(this.scopeApps.getApps().length, "app");
|
|
34640
|
+
add(this.scopeTools.getTools(true).length, "tool");
|
|
34641
|
+
add(this.scopeResources.getResources().length, "resource");
|
|
34642
|
+
add(this.scopePrompts.getPrompts().length, "prompt");
|
|
34643
|
+
add(this.scopeAgents.getAgents().length, "agent");
|
|
34644
|
+
add(this.scopeSkills.getSkills().length, "skill");
|
|
34645
|
+
return entries.length > 0 ? entries.join(", ") : "empty";
|
|
34368
34646
|
}
|
|
34369
34647
|
get defaultScopeProviders() {
|
|
34370
34648
|
return [
|
|
@@ -34604,6 +34882,7 @@ var init_scope_registry = __esm({
|
|
|
34604
34882
|
"use strict";
|
|
34605
34883
|
import_reflect_metadata20 = require("reflect-metadata");
|
|
34606
34884
|
import_di29 = require("@frontmcp/di");
|
|
34885
|
+
init_common();
|
|
34607
34886
|
init_regsitry();
|
|
34608
34887
|
init_front_mcp_tokens2();
|
|
34609
34888
|
init_app_utils();
|
|
@@ -34611,9 +34890,11 @@ var init_scope_registry = __esm({
|
|
|
34611
34890
|
init_scope_instance();
|
|
34612
34891
|
init_errors();
|
|
34613
34892
|
ScopeRegistry = class extends RegistryAbstract {
|
|
34893
|
+
logger;
|
|
34614
34894
|
constructor(globalProviders) {
|
|
34615
34895
|
const metadata = globalProviders.get(FrontMcpConfig);
|
|
34616
34896
|
super("ScopeRegistry", globalProviders, metadata);
|
|
34897
|
+
this.logger = globalProviders.get(FrontMcpLogger)?.child("ScopeRegistry");
|
|
34617
34898
|
}
|
|
34618
34899
|
buildMap(metadata) {
|
|
34619
34900
|
const tokens = /* @__PURE__ */ new Set();
|
|
@@ -34670,6 +34951,7 @@ var init_scope_registry = __esm({
|
|
|
34670
34951
|
}
|
|
34671
34952
|
}
|
|
34672
34953
|
async initialize() {
|
|
34954
|
+
this.logger?.verbose(`ScopeRegistry: initializing ${this.tokens.size} scope(s)`);
|
|
34673
34955
|
for (const token of this.tokens) {
|
|
34674
34956
|
const rec = this.defs.get(token);
|
|
34675
34957
|
let scope;
|
|
@@ -34685,7 +34967,9 @@ var init_scope_registry = __esm({
|
|
|
34685
34967
|
}
|
|
34686
34968
|
await scope.ready;
|
|
34687
34969
|
this.instances.set(token, scope);
|
|
34970
|
+
this.logger?.verbose(`ScopeRegistry: initialized scope '${(0, import_di29.tokenName)(token)}'`);
|
|
34688
34971
|
}
|
|
34972
|
+
this.logger?.verbose(`ScopeRegistry: initialization complete (${this.instances.size} scope(s))`);
|
|
34689
34973
|
}
|
|
34690
34974
|
/**
|
|
34691
34975
|
* Get all initialized scope instances.
|
|
@@ -34710,7 +34994,7 @@ var init_base_host_adapter = __esm({
|
|
|
34710
34994
|
});
|
|
34711
34995
|
|
|
34712
34996
|
// libs/sdk/src/server/adapters/express.host.adapter.ts
|
|
34713
|
-
var http, import_express, import_cors,
|
|
34997
|
+
var http, import_express, import_cors, import_utils47, ExpressHostAdapter;
|
|
34714
34998
|
var init_express_host_adapter = __esm({
|
|
34715
34999
|
"libs/sdk/src/server/adapters/express.host.adapter.ts"() {
|
|
34716
35000
|
"use strict";
|
|
@@ -34718,7 +35002,7 @@ var init_express_host_adapter = __esm({
|
|
|
34718
35002
|
import_express = __toESM(require("express"));
|
|
34719
35003
|
import_cors = __toESM(require("cors"));
|
|
34720
35004
|
init_base_host_adapter();
|
|
34721
|
-
|
|
35005
|
+
import_utils47 = require("@frontmcp/utils");
|
|
34722
35006
|
ExpressHostAdapter = class extends HostServerAdapter {
|
|
34723
35007
|
app = (0, import_express.default)();
|
|
34724
35008
|
router = import_express.default.Router();
|
|
@@ -34810,8 +35094,8 @@ var init_express_host_adapter = __esm({
|
|
|
34810
35094
|
}
|
|
34811
35095
|
async cleanupStaleSocket(socketPath) {
|
|
34812
35096
|
try {
|
|
34813
|
-
if (await (0,
|
|
34814
|
-
await (0,
|
|
35097
|
+
if (await (0, import_utils47.fileExists)(socketPath)) {
|
|
35098
|
+
await (0, import_utils47.unlink)(socketPath);
|
|
34815
35099
|
}
|
|
34816
35100
|
} catch {
|
|
34817
35101
|
}
|
|
@@ -35376,7 +35660,7 @@ async function createInMemoryServer(scope, options) {
|
|
|
35376
35660
|
const { InMemoryTransport } = await import("@modelcontextprotocol/sdk/inMemory.js");
|
|
35377
35661
|
const { Server: McpServer2 } = await import("@modelcontextprotocol/sdk/server/index.js");
|
|
35378
35662
|
const { createMcpHandlers: createMcpHandlers2 } = await Promise.resolve().then(() => (init_mcp_handlers(), mcp_handlers_exports));
|
|
35379
|
-
const sessionId = options?.sessionId ?? `in-memory:${(0,
|
|
35663
|
+
const sessionId = options?.sessionId ?? `in-memory:${(0, import_utils48.randomUUID)()}`;
|
|
35380
35664
|
const [clientTransport, serverTransport] = InMemoryTransport.createLinkedPair();
|
|
35381
35665
|
let currentAuthInfo = options?.authInfo ?? {};
|
|
35382
35666
|
const hasRemoteApps = scope.apps?.getApps().some((app) => app.isRemote) ?? false;
|
|
@@ -35430,11 +35714,11 @@ async function createInMemoryServer(scope, options) {
|
|
|
35430
35714
|
}
|
|
35431
35715
|
};
|
|
35432
35716
|
}
|
|
35433
|
-
var
|
|
35717
|
+
var import_utils48;
|
|
35434
35718
|
var init_in_memory_server = __esm({
|
|
35435
35719
|
"libs/sdk/src/transport/in-memory-server.ts"() {
|
|
35436
35720
|
"use strict";
|
|
35437
|
-
|
|
35721
|
+
import_utils48 = require("@frontmcp/utils");
|
|
35438
35722
|
}
|
|
35439
35723
|
});
|
|
35440
35724
|
|
|
@@ -35443,13 +35727,13 @@ var direct_client_exports = {};
|
|
|
35443
35727
|
__export(direct_client_exports, {
|
|
35444
35728
|
DirectClientImpl: () => DirectClientImpl
|
|
35445
35729
|
});
|
|
35446
|
-
var
|
|
35730
|
+
var import_utils49, import_client2, DirectClientImpl;
|
|
35447
35731
|
var init_direct_client = __esm({
|
|
35448
35732
|
"libs/sdk/src/direct/direct-client.ts"() {
|
|
35449
35733
|
"use strict";
|
|
35450
35734
|
init_llm_platform();
|
|
35451
35735
|
init_errors();
|
|
35452
|
-
|
|
35736
|
+
import_utils49 = require("@frontmcp/utils");
|
|
35453
35737
|
import_client2 = require("@modelcontextprotocol/sdk/client/index.js");
|
|
35454
35738
|
DirectClientImpl = class _DirectClientImpl {
|
|
35455
35739
|
// Use a flexible type to handle dynamic import type differences between ESM/CJS
|
|
@@ -35484,7 +35768,7 @@ var init_direct_client = __esm({
|
|
|
35484
35768
|
*/
|
|
35485
35769
|
static async create(scope, options) {
|
|
35486
35770
|
const { createInMemoryServer: createInMemoryServer2 } = await Promise.resolve().then(() => (init_in_memory_server(), in_memory_server_exports));
|
|
35487
|
-
const sessionId = options?.session?.id ?? `direct:${(0,
|
|
35771
|
+
const sessionId = options?.session?.id ?? `direct:${(0, import_utils49.randomUUID)()}`;
|
|
35488
35772
|
const clientInfo = options?.clientInfo ?? { name: "mcp-client", version: "1.0.0" };
|
|
35489
35773
|
const authInfo = {};
|
|
35490
35774
|
if (options?.authToken) {
|
|
@@ -35844,7 +36128,7 @@ function buildAuthInfo(authContext, defaultSessionId) {
|
|
|
35844
36128
|
if (!authContext && !defaultSessionId) {
|
|
35845
36129
|
return void 0;
|
|
35846
36130
|
}
|
|
35847
|
-
const sessionId = authContext?.sessionId ?? defaultSessionId ?? `direct:${(0,
|
|
36131
|
+
const sessionId = authContext?.sessionId ?? defaultSessionId ?? `direct:${(0, import_utils50.randomUUID)()}`;
|
|
35848
36132
|
const user = authContext?.user ? { iss: "direct", sub: authContext.user.sub ?? "direct", ...authContext.user } : { iss: "direct", sub: "direct" };
|
|
35849
36133
|
const clientId = user.sub ?? "direct";
|
|
35850
36134
|
const authInfo = {
|
|
@@ -35859,11 +36143,11 @@ function buildAuthInfo(authContext, defaultSessionId) {
|
|
|
35859
36143
|
}
|
|
35860
36144
|
return authInfo;
|
|
35861
36145
|
}
|
|
35862
|
-
var
|
|
36146
|
+
var import_utils50, DirectMcpServerImpl;
|
|
35863
36147
|
var init_direct_server = __esm({
|
|
35864
36148
|
"libs/sdk/src/direct/direct-server.ts"() {
|
|
35865
36149
|
"use strict";
|
|
35866
|
-
|
|
36150
|
+
import_utils50 = require("@frontmcp/utils");
|
|
35867
36151
|
init_common();
|
|
35868
36152
|
init_errors();
|
|
35869
36153
|
DirectMcpServerImpl = class {
|
|
@@ -35873,7 +36157,7 @@ var init_direct_server = __esm({
|
|
|
35873
36157
|
defaultSessionId;
|
|
35874
36158
|
constructor(scope) {
|
|
35875
36159
|
this.scope = scope;
|
|
35876
|
-
this.defaultSessionId = `direct:${(0,
|
|
36160
|
+
this.defaultSessionId = `direct:${(0, import_utils50.randomUUID)()}`;
|
|
35877
36161
|
this.ready = Promise.resolve();
|
|
35878
36162
|
}
|
|
35879
36163
|
/**
|
|
@@ -36104,7 +36388,7 @@ var front_mcp_exports = {};
|
|
|
36104
36388
|
__export(front_mcp_exports, {
|
|
36105
36389
|
FrontMcpInstance: () => FrontMcpInstance
|
|
36106
36390
|
});
|
|
36107
|
-
var
|
|
36391
|
+
var import_utils51, FrontMcpInstance;
|
|
36108
36392
|
var init_front_mcp = __esm({
|
|
36109
36393
|
"libs/sdk/src/front-mcp/front-mcp.ts"() {
|
|
36110
36394
|
"use strict";
|
|
@@ -36115,13 +36399,14 @@ var init_front_mcp = __esm({
|
|
|
36115
36399
|
init_logger_registry();
|
|
36116
36400
|
init_direct();
|
|
36117
36401
|
init_errors();
|
|
36118
|
-
|
|
36402
|
+
import_utils51 = require("@frontmcp/utils");
|
|
36119
36403
|
FrontMcpInstance = class _FrontMcpInstance2 {
|
|
36120
36404
|
config;
|
|
36121
36405
|
ready;
|
|
36122
36406
|
logger;
|
|
36123
36407
|
providers;
|
|
36124
36408
|
scopes;
|
|
36409
|
+
log;
|
|
36125
36410
|
constructor(config) {
|
|
36126
36411
|
this.config = config;
|
|
36127
36412
|
this.ready = this.initialize();
|
|
@@ -36131,10 +36416,16 @@ var init_front_mcp = __esm({
|
|
|
36131
36416
|
await this.providers.ready;
|
|
36132
36417
|
this.logger = new LoggerRegistry(this.providers);
|
|
36133
36418
|
await this.logger.ready;
|
|
36419
|
+
this.log = this.providers.get(FrontMcpLogger);
|
|
36420
|
+
const name33 = this.config.info?.name;
|
|
36421
|
+
const version = this.config.info?.version;
|
|
36422
|
+
const tag = [name33, version].filter(Boolean).join(" v");
|
|
36423
|
+
this.log?.info(`Initializing FrontMCP${tag ? ` "${tag}"` : ""}...`);
|
|
36134
36424
|
this.scopes = new ScopeRegistry(this.providers);
|
|
36135
36425
|
await this.scopes.ready;
|
|
36136
36426
|
}
|
|
36137
36427
|
async start() {
|
|
36428
|
+
this.log?.info("Starting FrontMCP server...");
|
|
36138
36429
|
const server = this.providers.get(FrontMcpServer);
|
|
36139
36430
|
if (!server) {
|
|
36140
36431
|
throw new ServerNotFoundError();
|
|
@@ -36158,6 +36449,7 @@ var init_front_mcp = __esm({
|
|
|
36158
36449
|
const frontMcp = new _FrontMcpInstance2(options);
|
|
36159
36450
|
await frontMcp.ready;
|
|
36160
36451
|
await frontMcp.start();
|
|
36452
|
+
frontMcp.log?.info("FrontMCP bootstrap complete");
|
|
36161
36453
|
}
|
|
36162
36454
|
/**
|
|
36163
36455
|
* Creates and initializes a FrontMCP instance without starting the HTTP server.
|
|
@@ -36178,6 +36470,7 @@ var init_front_mcp = __esm({
|
|
|
36178
36470
|
throw new ServerNotFoundError();
|
|
36179
36471
|
}
|
|
36180
36472
|
server.prepare();
|
|
36473
|
+
frontMcp.log?.info("FrontMCP handler created (serverless mode)");
|
|
36181
36474
|
return server.getHandler();
|
|
36182
36475
|
}
|
|
36183
36476
|
/**
|
|
@@ -36237,6 +36530,7 @@ var init_front_mcp = __esm({
|
|
|
36237
36530
|
if (scopes.length === 0) {
|
|
36238
36531
|
throw new InternalMcpError("No scopes initialized. Ensure at least one app is configured.");
|
|
36239
36532
|
}
|
|
36533
|
+
frontMcp.log?.info("FrontMCP direct server created");
|
|
36240
36534
|
return new DirectMcpServerImpl(scopes[0]);
|
|
36241
36535
|
}
|
|
36242
36536
|
/**
|
|
@@ -36304,11 +36598,11 @@ var init_front_mcp = __esm({
|
|
|
36304
36598
|
const frontMcp = new _FrontMcpInstance2(parsedConfig);
|
|
36305
36599
|
await frontMcp.ready;
|
|
36306
36600
|
await frontMcp.start();
|
|
36307
|
-
|
|
36601
|
+
frontMcp.log?.info(`MCP server listening on unix://${socketPath}`);
|
|
36308
36602
|
const cleanup = async () => {
|
|
36309
36603
|
try {
|
|
36310
|
-
if (await (0,
|
|
36311
|
-
await (0,
|
|
36604
|
+
if (await (0, import_utils51.fileExists)(socketPath)) {
|
|
36605
|
+
await (0, import_utils51.unlink)(socketPath);
|
|
36312
36606
|
}
|
|
36313
36607
|
} catch {
|
|
36314
36608
|
}
|
|
@@ -36368,7 +36662,7 @@ var init_front_mcp = __esm({
|
|
|
36368
36662
|
serverInfo: scope.metadata.info
|
|
36369
36663
|
};
|
|
36370
36664
|
const mcpServer = new McpServer2(scope.metadata.info, serverOptions);
|
|
36371
|
-
const sessionId = `stdio:${(0,
|
|
36665
|
+
const sessionId = `stdio:${(0, import_utils51.randomUUID)()}`;
|
|
36372
36666
|
const handlers = createMcpHandlers2({ scope, serverOptions });
|
|
36373
36667
|
for (const handler of handlers) {
|
|
36374
36668
|
const originalHandler = handler.handler;
|
|
@@ -38695,11 +38989,11 @@ var init_decide_request_intent_utils = __esm({
|
|
|
38695
38989
|
|
|
38696
38990
|
// libs/sdk/src/common/utils/path.utils.ts
|
|
38697
38991
|
function normalizeEntryPrefix(entryPath) {
|
|
38698
|
-
const t = (0,
|
|
38992
|
+
const t = (0, import_utils52.trimSlashes)(entryPath ?? "");
|
|
38699
38993
|
return t ? `/${t}` : "";
|
|
38700
38994
|
}
|
|
38701
38995
|
function normalizeScopeBase(scopeBase) {
|
|
38702
|
-
const t = (0,
|
|
38996
|
+
const t = (0, import_utils52.trimSlashes)(scopeBase ?? "");
|
|
38703
38997
|
return t ? `/${t}` : "";
|
|
38704
38998
|
}
|
|
38705
38999
|
function getRequestBaseUrl(req, entryPath) {
|
|
@@ -38720,22 +39014,22 @@ function computeResource(req, entryPath, scopeBase) {
|
|
|
38720
39014
|
function urlToSafeId(url) {
|
|
38721
39015
|
const u = new URL(url);
|
|
38722
39016
|
const raw = (u.host + (u.pathname && u.pathname !== "/" ? u.pathname : "")).replace(/\/+$/, "");
|
|
38723
|
-
return (0,
|
|
39017
|
+
return (0, import_utils52.trimSlashes)(raw).replace(/[^a-zA-Z0-9_-]/g, "-");
|
|
38724
39018
|
}
|
|
38725
39019
|
function makeWellKnownPaths(name33, entryPrefix, scopeBase = "") {
|
|
38726
39020
|
const prefix = normalizeEntryPrefix(entryPrefix);
|
|
38727
39021
|
const scope = normalizeScopeBase(scopeBase);
|
|
38728
|
-
const reversed = (0,
|
|
38729
|
-
const inPrefixRoot = `${prefix}${(0,
|
|
38730
|
-
const inPrefixScope = `${prefix}${scope}${(0,
|
|
39022
|
+
const reversed = (0, import_utils52.joinPath)(".well-known", name33) + `${prefix}${scope}`;
|
|
39023
|
+
const inPrefixRoot = `${prefix}${(0, import_utils52.joinPath)(".well-known", name33)}${scope}`;
|
|
39024
|
+
const inPrefixScope = `${prefix}${scope}${(0, import_utils52.joinPath)(".well-known", name33)}`;
|
|
38731
39025
|
return /* @__PURE__ */ new Set([reversed, inPrefixRoot, inPrefixScope]);
|
|
38732
39026
|
}
|
|
38733
|
-
var
|
|
39027
|
+
var import_utils52, import_utils53;
|
|
38734
39028
|
var init_path_utils = __esm({
|
|
38735
39029
|
"libs/sdk/src/common/utils/path.utils.ts"() {
|
|
38736
39030
|
"use strict";
|
|
38737
|
-
import_utils51 = require("@frontmcp/utils");
|
|
38738
39031
|
import_utils52 = require("@frontmcp/utils");
|
|
39032
|
+
import_utils53 = require("@frontmcp/utils");
|
|
38739
39033
|
}
|
|
38740
39034
|
});
|
|
38741
39035
|
|
|
@@ -39382,6 +39676,36 @@ var init_skill_entry = __esm({
|
|
|
39382
39676
|
getPriority() {
|
|
39383
39677
|
return this.metadata.priority ?? 0;
|
|
39384
39678
|
}
|
|
39679
|
+
/**
|
|
39680
|
+
* Get the skill's license.
|
|
39681
|
+
*/
|
|
39682
|
+
getLicense() {
|
|
39683
|
+
return this.metadata.license;
|
|
39684
|
+
}
|
|
39685
|
+
/**
|
|
39686
|
+
* Get the skill's compatibility notes.
|
|
39687
|
+
*/
|
|
39688
|
+
getCompatibility() {
|
|
39689
|
+
return this.metadata.compatibility;
|
|
39690
|
+
}
|
|
39691
|
+
/**
|
|
39692
|
+
* Get the skill's spec metadata (arbitrary key-value pairs).
|
|
39693
|
+
*/
|
|
39694
|
+
getSpecMetadata() {
|
|
39695
|
+
return this.metadata.specMetadata;
|
|
39696
|
+
}
|
|
39697
|
+
/**
|
|
39698
|
+
* Get the skill's allowed tools (space-delimited string).
|
|
39699
|
+
*/
|
|
39700
|
+
getAllowedTools() {
|
|
39701
|
+
return this.metadata.allowedTools;
|
|
39702
|
+
}
|
|
39703
|
+
/**
|
|
39704
|
+
* Get the skill's bundled resource directories.
|
|
39705
|
+
*/
|
|
39706
|
+
getResources() {
|
|
39707
|
+
return this.metadata.resources;
|
|
39708
|
+
}
|
|
39385
39709
|
};
|
|
39386
39710
|
}
|
|
39387
39711
|
});
|
|
@@ -40177,7 +40501,7 @@ __export(index_exports, {
|
|
|
40177
40501
|
isTransparentMode: () => import_auth10.isTransparentMode,
|
|
40178
40502
|
isUrlInstructions: () => isUrlInstructions,
|
|
40179
40503
|
isVercelKvProvider: () => isVercelKvProvider,
|
|
40180
|
-
joinPath: () =>
|
|
40504
|
+
joinPath: () => import_utils53.joinPath,
|
|
40181
40505
|
jsonWebKeySetSchema: () => import_auth.jsonWebKeySetSchema,
|
|
40182
40506
|
jwkParametersSchema: () => import_auth.jwkParametersSchema,
|
|
40183
40507
|
jwkSchema: () => import_auth.jwkSchema,
|
|
@@ -40254,7 +40578,7 @@ __export(index_exports, {
|
|
|
40254
40578
|
toolPaginationOptionsSchema: () => toolPaginationOptionsSchema,
|
|
40255
40579
|
transparentAuthOptionsSchema: () => import_auth6.transparentAuthOptionsSchema,
|
|
40256
40580
|
transportOptionsSchema: () => transportOptionsSchema,
|
|
40257
|
-
trimSlashes: () =>
|
|
40581
|
+
trimSlashes: () => import_utils53.trimSlashes,
|
|
40258
40582
|
tryDecryptStoredValue: () => tryDecryptStoredValue,
|
|
40259
40583
|
tryGetConfig: () => tryGetConfig,
|
|
40260
40584
|
urlToSafeId: () => urlToSafeId,
|