@frontmcp/sdk 1.11.1-rc.1 → 1.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app/instances/app.esm.instance.d.ts.map +1 -1
- package/app/instances/empty-app-registries.d.ts +1 -0
- package/app/instances/empty-app-registries.d.ts.map +1 -1
- package/auth/flows/oauth.callback.flow.d.ts +5 -0
- package/auth/flows/oauth.callback.flow.d.ts.map +1 -1
- package/auth/flows/oauth.connect.flow.d.ts +4 -2
- package/auth/flows/oauth.connect.flow.d.ts.map +1 -1
- package/auth/instances/instance.local-primary-auth.d.ts +2 -0
- package/auth/instances/instance.local-primary-auth.d.ts.map +1 -1
- package/auth/vault/auth-providers.providers.d.ts +22 -16
- package/auth/vault/auth-providers.providers.d.ts.map +1 -1
- package/auth/vault/index.d.ts +1 -2
- package/auth/vault/index.d.ts.map +1 -1
- package/auth/vault/unconfigured-auth-providers.d.ts +4 -0
- package/auth/vault/unconfigured-auth-providers.d.ts.map +1 -0
- package/browser/app/instances/app.esm.instance.mjs +2 -0
- package/browser/app/instances/empty-app-registries.mjs +2 -0
- package/browser/auth/flows/oauth.callback.flow.mjs +26 -1
- package/browser/auth/flows/oauth.connect.flow.mjs +31 -24
- package/browser/auth/instances/instance.local-primary-auth.mjs +3 -0
- package/browser/auth/vault/auth-providers.providers.mjs +114 -0
- package/browser/auth/vault/credential-cache.mjs +5 -0
- package/browser/auth/vault/unconfigured-auth-providers.mjs +21 -0
- package/browser/common/entries/scope.entry.mjs +23 -4
- package/browser/common/interfaces/execution-context.interface.mjs +5 -0
- package/browser/common/interfaces/internal/primary-auth-provider.interface.mjs +4 -0
- package/browser/common/interfaces/server.interface.mjs +2 -0
- package/browser/common/metadata/front-mcp.metadata.mjs +3 -0
- package/browser/common/tokens/front-mcp.tokens.mjs +1 -0
- package/browser/direct/direct-client.mjs +2 -1
- package/browser/direct/token-auth-info.mjs +2 -0
- package/browser/elicitation/helpers/elicit.helper.mjs +10 -7
- package/browser/errors/index.mjs +1 -1
- package/browser/errors/misconfiguration.mjs +3 -1
- package/browser/errors/plugin.errors.mjs +20 -0
- package/browser/errors/tool-credentials-required.error.mjs +18 -5
- package/browser/front-mcp/front-mcp.mjs +1 -3
- package/browser/health/health.service.mjs +14 -10
- package/browser/index.cjs +2873 -2332
- package/browser/index.mjs +9 -3
- package/browser/notification/notification.service.mjs +5 -5
- package/browser/plugin/plugin.registry.mjs +39 -2
- package/browser/provider/provider.registry.mjs +2 -0
- package/browser/scope/dev-events-observability.mjs +9 -5
- package/browser/scope/scope.instance.mjs +15 -2
- package/browser/skill/errors/skill-bundle-not-loaded.error.mjs +21 -0
- package/browser/skill/flows/load-skill.flow.mjs +13 -9
- package/browser/skill/flows/search-skills.flow.mjs +10 -2
- package/browser/skill/index.mjs +2 -0
- package/browser/skill/sep-2640/resources/skill-index.resource.mjs +2 -0
- package/browser/skill/sep-2640/sep-2640.resource-helpers.mjs +5 -2
- package/browser/skill/skill-catalog-source.mjs +33 -1
- package/browser/skill/skill-instructions.helper.mjs +14 -14
- package/browser/skill/skill.registry.mjs +6 -0
- package/browser/surface/index.mjs +6 -0
- package/browser/surface/list-change-batch.mjs +51 -0
- package/browser/surface/live-surface.mjs +2 -2
- package/browser/tool/flows/call-tool.flow.mjs +18 -4
- package/browser/tool/flows/tool-credentials.gate.mjs +60 -10
- package/browser/tool/tool.registry.mjs +9 -2
- package/browser/transport/mcp-20260728/mrtr.mjs +13 -6
- package/browser/transport/mcp-20260728/subscriptions.mjs +6 -6
- package/browser/transport/mcp-handlers/skills-list-request.handler.mjs +19 -7
- package/browser/transport/mcp-handlers/skills-mcp.types.mjs +6 -4
- package/browser/transport/web-fetch-handler.mjs +6 -8
- package/common/entries/scope.entry.d.ts +15 -3
- package/common/entries/scope.entry.d.ts.map +1 -1
- package/common/interfaces/execution-context.interface.d.ts +3 -1
- package/common/interfaces/execution-context.interface.d.ts.map +1 -1
- package/common/interfaces/internal/primary-auth-provider.interface.d.ts +3 -0
- package/common/interfaces/internal/primary-auth-provider.interface.d.ts.map +1 -1
- package/common/interfaces/server.interface.d.ts +2 -0
- package/common/interfaces/server.interface.d.ts.map +1 -1
- package/common/metadata/app.metadata.d.ts +1 -1
- package/common/metadata/front-mcp.metadata.d.ts +304 -92
- package/common/metadata/front-mcp.metadata.d.ts.map +1 -1
- package/common/tokens/front-mcp.tokens.d.ts.map +1 -1
- package/common/types/options/elicitation/schema.d.ts +1 -1
- package/common/types/options/redis/schema.d.ts +3 -3
- package/common/types/options/redis/schema.d.ts.map +1 -1
- package/common/types/options/skills-http/schema.d.ts +2 -2
- package/common/types/options/transport/schema.d.ts +4 -4
- package/context/frontmcp-context.d.ts +1 -1
- package/context/frontmcp-context.d.ts.map +1 -1
- package/direct/client.types.d.ts +48 -28
- package/direct/client.types.d.ts.map +1 -1
- package/direct/index.d.ts +1 -1
- package/direct/index.d.ts.map +1 -1
- package/direct/token-auth-info.d.ts +5 -1
- package/direct/token-auth-info.d.ts.map +1 -1
- package/elicitation/helpers/elicit.helper.d.ts +5 -0
- package/elicitation/helpers/elicit.helper.d.ts.map +1 -1
- package/errors/error-handler.d.ts +1 -0
- package/errors/error-handler.d.ts.map +1 -1
- package/errors/mcp.error.d.ts +2 -0
- package/errors/mcp.error.d.ts.map +1 -1
- package/errors/misconfiguration.d.ts.map +1 -1
- package/errors/plugin.errors.d.ts +8 -0
- package/errors/plugin.errors.d.ts.map +1 -1
- package/errors/tool-credentials-required.error.d.ts +10 -2
- package/errors/tool-credentials-required.error.d.ts.map +1 -1
- package/esm/index.mjs +31 -31
- package/front-mcp/front-mcp.d.ts.map +1 -1
- package/health/health.service.d.ts +8 -4
- package/health/health.service.d.ts.map +1 -1
- package/index.d.ts +2 -2
- package/index.d.ts.map +1 -1
- package/index.js +38 -38
- package/package.json +10 -10
- package/plugin/plugin.registry.d.ts +3 -1
- package/plugin/plugin.registry.d.ts.map +1 -1
- package/provider/provider.registry.d.ts.map +1 -1
- package/scope/dev-events-observability.d.ts +2 -0
- package/scope/dev-events-observability.d.ts.map +1 -1
- package/scope/scope.instance.d.ts.map +1 -1
- package/server/adapters/utf8-json.parser.d.ts +2 -0
- package/server/adapters/utf8-json.parser.d.ts.map +1 -1
- package/skill/errors/index.d.ts +1 -0
- package/skill/errors/index.d.ts.map +1 -1
- package/skill/errors/skill-bundle-not-loaded.error.d.ts +16 -0
- package/skill/errors/skill-bundle-not-loaded.error.d.ts.map +1 -0
- package/skill/flows/load-skill.flow.d.ts +2 -2
- package/skill/flows/load-skill.flow.d.ts.map +1 -1
- package/skill/flows/search-skills.flow.d.ts +5 -1
- package/skill/flows/search-skills.flow.d.ts.map +1 -1
- package/skill/index.d.ts +1 -0
- package/skill/index.d.ts.map +1 -1
- package/skill/sep-2640/resources/skill-index.resource.d.ts.map +1 -1
- package/skill/sep-2640/sep-2640.resource-helpers.d.ts +2 -1
- package/skill/sep-2640/sep-2640.resource-helpers.d.ts.map +1 -1
- package/skill/skill-catalog-source.d.ts +24 -2
- package/skill/skill-catalog-source.d.ts.map +1 -1
- package/skill/skill-instructions.helper.d.ts +5 -0
- package/skill/skill-instructions.helper.d.ts.map +1 -1
- package/skill/skill.registry.d.ts +9 -0
- package/skill/skill.registry.d.ts.map +1 -1
- package/surface/index.d.ts +1 -0
- package/surface/index.d.ts.map +1 -1
- package/surface/list-change-batch.d.ts +28 -0
- package/surface/list-change-batch.d.ts.map +1 -0
- package/tool/flows/call-tool.flow.d.ts +5 -2
- package/tool/flows/call-tool.flow.d.ts.map +1 -1
- package/tool/flows/tool-credentials.gate.d.ts +26 -0
- package/tool/flows/tool-credentials.gate.d.ts.map +1 -1
- package/tool/tool.registry.d.ts +2 -0
- package/tool/tool.registry.d.ts.map +1 -1
- package/transport/mcp-20260728/mrtr.d.ts +6 -2
- package/transport/mcp-20260728/mrtr.d.ts.map +1 -1
- package/transport/mcp-20260728/subscriptions.d.ts.map +1 -1
- package/transport/mcp-handlers/skills-list-request.handler.d.ts.map +1 -1
- package/transport/mcp-handlers/skills-mcp.types.d.ts +3 -1
- package/transport/mcp-handlers/skills-mcp.types.d.ts.map +1 -1
- package/auth/vault/auth-providers.context-extension.d.ts +0 -68
- package/auth/vault/auth-providers.context-extension.d.ts.map +0 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// libs/sdk/src/common/metadata/front-mcp.metadata.ts
|
|
2
|
+
import { authProvidersVaultOptionsSchema } from "@frontmcp/auth";
|
|
2
3
|
import { guardConfigSchema } from "@frontmcp/guard";
|
|
3
4
|
import { internalZ as z } from "@frontmcp/lazy-zod";
|
|
4
5
|
import { MAX_CONCURRENT_TASKS_PER_SESSION } from "../../task/task.types.mjs";
|
|
@@ -60,6 +61,7 @@ var frontMcpBaseSchema = z.object({
|
|
|
60
61
|
instructionsBudget: instructionsBudgetOptionsSchema.optional(),
|
|
61
62
|
manifest: serverManifestOptionSchema.optional(),
|
|
62
63
|
providers: z.array(annotatedFrontMcpProvidersSchema).optional().default([]),
|
|
64
|
+
authProvidersVault: authProvidersVaultOptionsSchema.optional(),
|
|
63
65
|
lifecycle: lifecycleOptionsSchema.optional(),
|
|
64
66
|
offload: offloadOptionsSchema.optional(),
|
|
65
67
|
devtools: devtoolsOptionsSchema.optional(),
|
|
@@ -242,6 +244,7 @@ var frontMcpLiteSchema = z.object({
|
|
|
242
244
|
instructionsBudget: instructionsBudgetOptionsSchema.optional(),
|
|
243
245
|
manifest: serverManifestOptionSchema.optional(),
|
|
244
246
|
providers: z.array(annotatedFrontMcpProvidersSchema).optional().default([]),
|
|
247
|
+
authProvidersVault: authProvidersVaultOptionsSchema.optional(),
|
|
245
248
|
lifecycle: lifecycleOptionsSchema.optional(),
|
|
246
249
|
offload: offloadOptionsSchema.optional(),
|
|
247
250
|
devtools: devtoolsOptionsSchema.optional(),
|
|
@@ -21,6 +21,7 @@ var FrontMcpTokens = {
|
|
|
21
21
|
logging: tokenFactory.meta("logging"),
|
|
22
22
|
// global scoped providers
|
|
23
23
|
providers: tokenFactory.meta("providers"),
|
|
24
|
+
authProvidersVault: tokenFactory.meta("authProvidersVault"),
|
|
24
25
|
// provider lifecycle hooks (onShutdown timeout)
|
|
25
26
|
lifecycle: tokenFactory.meta("lifecycle"),
|
|
26
27
|
offload: tokenFactory.meta("offload"),
|
|
@@ -318,7 +318,7 @@ var DirectClientImpl = class _DirectClientImpl {
|
|
|
318
318
|
* Response is validated using `SkillsLoadResultSchema`.
|
|
319
319
|
*/
|
|
320
320
|
async loadSkills(skillIds, options) {
|
|
321
|
-
|
|
321
|
+
const result = await this.mcpClient.request(
|
|
322
322
|
{
|
|
323
323
|
method: "skills/load",
|
|
324
324
|
params: {
|
|
@@ -328,6 +328,7 @@ var DirectClientImpl = class _DirectClientImpl {
|
|
|
328
328
|
},
|
|
329
329
|
SkillsLoadResultSchema
|
|
330
330
|
);
|
|
331
|
+
return result;
|
|
331
332
|
}
|
|
332
333
|
/**
|
|
333
334
|
* List available skills with optional filtering and pagination.
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// libs/sdk/src/direct/token-auth-info.ts
|
|
2
2
|
import { isAnonymousSubject } from "@frontmcp/auth";
|
|
3
|
+
import { DirectPublicAuth } from "../auth/direct-public-auth.mjs";
|
|
3
4
|
import {
|
|
4
5
|
authInfoFromAuthorization,
|
|
5
6
|
normalizeEntryPrefix,
|
|
@@ -7,6 +8,7 @@ import {
|
|
|
7
8
|
} from "../common/index.mjs";
|
|
8
9
|
import { PublicMcpError, SessionVerificationFailedError, UnauthorizedError } from "../errors/index.mjs";
|
|
9
10
|
async function authInfoForToken(scope, token) {
|
|
11
|
+
if (scope.auth instanceof DirectPublicAuth) return {};
|
|
10
12
|
const mcpPath = `${normalizeEntryPrefix(scope.entryPath)}${normalizeScopeBase(scope.routeBase)}` || "/";
|
|
11
13
|
const request = {
|
|
12
14
|
method: "POST",
|
|
@@ -31,13 +31,16 @@ async function performElicit(deps, message, requestedSchema, options) {
|
|
|
31
31
|
}
|
|
32
32
|
if (mrtr) {
|
|
33
33
|
const zodSchema = requestedSchema instanceof z.ZodType ? requestedSchema : z.object(requestedSchema);
|
|
34
|
-
const answer2 = mrtr.resolveElicitation(
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
34
|
+
const answer2 = mrtr.resolveElicitation(
|
|
35
|
+
{
|
|
36
|
+
message,
|
|
37
|
+
requestedSchema: toJSONSchema(zodSchema),
|
|
38
|
+
...elicitOptions?.mode ? { mode: elicitOptions.mode } : {},
|
|
39
|
+
...elicitOptions?.url ? { url: elicitOptions.url } : {},
|
|
40
|
+
...elicitOptions?.elicitationId ? { elicitationId: elicitOptions.elicitationId } : {}
|
|
41
|
+
},
|
|
42
|
+
deps.inputKey
|
|
43
|
+
);
|
|
41
44
|
if (answer2.status !== "accept") {
|
|
42
45
|
return answer2;
|
|
43
46
|
}
|
package/browser/errors/index.mjs
CHANGED
|
@@ -260,7 +260,7 @@ import {
|
|
|
260
260
|
CallRecorderConfigurationError
|
|
261
261
|
} from "./sdk.errors.mjs";
|
|
262
262
|
export { DynamicJobRegistrationDisabledError, JobAdmissionTimeoutError, JobCancelledError, JobInterruptedError, JobNotAuthorizedError, JobRunFinishedError, JobRunNotCancellableError, JobRunNotFoundError, JobRunnerBootError, JobRunnerUnavailableError, JobStoreNotSupportedError, JobTimeoutError } from "./job.errors.mjs";
|
|
263
|
-
export { DuplicatePluginError, UnenforcedMetadataError } from "./plugin.errors.mjs";
|
|
263
|
+
export { DuplicatePluginEntryError, DuplicatePluginError, PluginConfiguredTwiceError, UnenforcedMetadataError } from "./plugin.errors.mjs";
|
|
264
264
|
export {
|
|
265
265
|
AgentCallDepthExceededError,
|
|
266
266
|
AgentConfigKeyNotFoundError,
|
|
@@ -7,7 +7,9 @@ var MISCONFIGURATION_REMEDIES = {
|
|
|
7
7
|
UNENFORCED_METADATA: "An entry declares a field only a plugin enforces (approval, featureFlag, ...) and no installed plugin that enforces it reaches the entry, so the server refuses to start. Install the plugin or remove the field; the server log names the entries.",
|
|
8
8
|
AUTH_CONFIGURATION_ERROR: "The auth or authorities configuration is invalid (for example, entries declare authorities and the server has no authorities option, or a rule checks nothing), so the server refuses to start. The server log names the entries.",
|
|
9
9
|
TOOL_ALIAS_CONFLICT: "A tool alias (`@Tool({ aliases })`) is also the name of a tool or the alias of another tool, so the server refuses to start. Give each alias to one tool; the server log names the conflicts.",
|
|
10
|
-
DUPLICATE_PLUGIN: "A plugin that can be installed once per server is installed twice (in one plugins list, or by the server and an app, or by two apps), so the server refuses to start. Install it once; the server log names the plugin."
|
|
10
|
+
DUPLICATE_PLUGIN: "A plugin that can be installed once per server is installed twice (in one plugins list, or by the server and an app, or by two apps), so the server refuses to start. Install it once; the server log names the plugin.",
|
|
11
|
+
DUPLICATE_PLUGIN_ENTRY: "One plugins list names a plugin twice, so the server refuses to start. List it once with all its options, or install the other configuration on another app; the server log names the plugin, the list and both entries.",
|
|
12
|
+
PLUGIN_CONFIGURED_TWICE: "A server option (such as `observability`) installs a plugin that the server plugins list names too, so the server refuses to start. Configure the plugin in one place; the server log names the option and the plugin."
|
|
11
13
|
};
|
|
12
14
|
function findMisconfiguration(error) {
|
|
13
15
|
let current = error;
|
|
@@ -31,7 +31,27 @@ var DuplicatePluginError = class extends PublicMcpError {
|
|
|
31
31
|
);
|
|
32
32
|
}
|
|
33
33
|
};
|
|
34
|
+
var DuplicatePluginEntryError = class extends PublicMcpError {
|
|
35
|
+
constructor(pluginName, listName, firstEntry, secondEntry) {
|
|
36
|
+
super(
|
|
37
|
+
`Plugin "${pluginName}" is listed twice in ${listName} (entries ${firstEntry} and ${secondEntry}), and only one entry could be installed. List it once, with all its options in that entry, or install the other configuration on an @App of its own.`,
|
|
38
|
+
"DUPLICATE_PLUGIN_ENTRY",
|
|
39
|
+
500
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
var PluginConfiguredTwiceError = class extends PublicMcpError {
|
|
44
|
+
constructor(pluginClassName, serverOption) {
|
|
45
|
+
super(
|
|
46
|
+
`${pluginClassName} is configured twice: by @FrontMcp({ ${serverOption} }) and by an ${pluginClassName} entry in @FrontMcp({ plugins }). Configure it in one place: move the entry's options to ${serverOption} and remove the entry, or remove ${serverOption}.`,
|
|
47
|
+
"PLUGIN_CONFIGURED_TWICE",
|
|
48
|
+
500
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
};
|
|
34
52
|
export {
|
|
53
|
+
DuplicatePluginEntryError,
|
|
35
54
|
DuplicatePluginError,
|
|
55
|
+
PluginConfiguredTwiceError,
|
|
36
56
|
UnenforcedMetadataError
|
|
37
57
|
};
|
|
@@ -9,13 +9,14 @@ var ToolCredentialsRequiredError = class extends PublicMcpError {
|
|
|
9
9
|
providers;
|
|
10
10
|
/** Connect/authorize URL to (re)authorize the provider(s), if resolvable. */
|
|
11
11
|
authUrl;
|
|
12
|
+
/** Whether the caller has to sign in to this server before it can connect the provider(s). */
|
|
13
|
+
signInRequired;
|
|
12
14
|
constructor(params) {
|
|
13
|
-
|
|
14
|
-
const defaultMessage = `Tool "${params.toolId}" requires credentials for ${providerList} which are not connected for this session. ` + (params.authUrl ? `Connect via: ${params.authUrl}` : `Please authorize the required provider(s) and retry.`);
|
|
15
|
-
super(params.message || defaultMessage, "TOOL_CREDENTIALS_REQUIRED", 401);
|
|
15
|
+
super(params.message || defaultMessageOf(params), "TOOL_CREDENTIALS_REQUIRED", 401);
|
|
16
16
|
this.toolId = params.toolId;
|
|
17
17
|
this.providers = params.providers;
|
|
18
18
|
this.authUrl = params.authUrl;
|
|
19
|
+
this.signInRequired = params.signInRequired === true;
|
|
19
20
|
}
|
|
20
21
|
/**
|
|
21
22
|
* Convert to JSON-RPC error format per MCP specification.
|
|
@@ -23,7 +24,7 @@ var ToolCredentialsRequiredError = class extends PublicMcpError {
|
|
|
23
24
|
* @example
|
|
24
25
|
* {
|
|
25
26
|
* "code": -32001,
|
|
26
|
-
* "message": "Tool \"deploy_app\" requires credentials for github ...",
|
|
27
|
+
* "message": "Tool \"deploy_app\" requires credentials for github ... Connect github to continue: open the link in this error's data (authUrl).",
|
|
27
28
|
* "data": {
|
|
28
29
|
* "tool": "deploy_app",
|
|
29
30
|
* "providers": ["github"],
|
|
@@ -39,11 +40,23 @@ var ToolCredentialsRequiredError = class extends PublicMcpError {
|
|
|
39
40
|
data: {
|
|
40
41
|
tool: this.toolId,
|
|
41
42
|
providers: this.providers,
|
|
42
|
-
...this.authUrl ? { authUrl: this.authUrl, auth_url: this.authUrl } : {}
|
|
43
|
+
...this.authUrl ? { authUrl: this.authUrl, auth_url: this.authUrl } : {},
|
|
44
|
+
...this.signInRequired ? { signInRequired: true } : {}
|
|
43
45
|
}
|
|
44
46
|
};
|
|
45
47
|
}
|
|
46
48
|
};
|
|
49
|
+
function defaultMessageOf(params) {
|
|
50
|
+
const providerList = params.providers.join(", ");
|
|
51
|
+
if (params.signInRequired) {
|
|
52
|
+
return `Tool "${params.toolId}" requires credentials for ${providerList}, and this caller isn't signed in. Sign in to this server, then connect ${providerList}.`;
|
|
53
|
+
}
|
|
54
|
+
const notConnected = `Tool "${params.toolId}" requires credentials for ${providerList} which are not connected for this session.`;
|
|
55
|
+
if (params.authUrl) {
|
|
56
|
+
return `${notConnected} Connect ${providerList} to continue: open the link in this error's data (authUrl).`;
|
|
57
|
+
}
|
|
58
|
+
return `${notConnected} Please authorize the required provider(s) and retry.`;
|
|
59
|
+
}
|
|
47
60
|
export {
|
|
48
61
|
ToolCredentialsRequiredError
|
|
49
62
|
};
|
|
@@ -244,9 +244,7 @@ var FrontMcpInstance = class _FrontMcpInstance {
|
|
|
244
244
|
const { HealthService } = await import("../health/index.mjs");
|
|
245
245
|
const composite = new HealthService(healthConfig, this.config.info);
|
|
246
246
|
for (const scopeService of scopeServices) {
|
|
247
|
-
|
|
248
|
-
composite.registerProbe(probe);
|
|
249
|
-
}
|
|
247
|
+
composite.registerProbeSource(() => scopeService.getProbes());
|
|
250
248
|
}
|
|
251
249
|
const primaryScope = this.getPrimaryScope();
|
|
252
250
|
if (primaryScope) {
|
|
@@ -3,7 +3,7 @@ import { getRuntimeContext, sha256Hex } from "@frontmcp/utils";
|
|
|
3
3
|
import { createRemoteAppProbe, createTransportSessionProbe } from "./health.probes.mjs";
|
|
4
4
|
var processStartTime = Date.now();
|
|
5
5
|
var HealthService = class {
|
|
6
|
-
|
|
6
|
+
probeSources = [];
|
|
7
7
|
config;
|
|
8
8
|
serverInfo;
|
|
9
9
|
scopeView;
|
|
@@ -18,7 +18,13 @@ var HealthService = class {
|
|
|
18
18
|
* Register a health probe.
|
|
19
19
|
*/
|
|
20
20
|
registerProbe(probe) {
|
|
21
|
-
this.
|
|
21
|
+
this.probeSources.push(() => [probe]);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Register a list of probes that every check reads again, so a probe added to it or removed from it later counts.
|
|
25
|
+
*/
|
|
26
|
+
registerProbeSource(source) {
|
|
27
|
+
this.probeSources.push(source);
|
|
22
28
|
}
|
|
23
29
|
/**
|
|
24
30
|
* Auto-discover and register probes from scope infrastructure.
|
|
@@ -26,7 +32,7 @@ var HealthService = class {
|
|
|
26
32
|
* Walks the scope's stores and registries to create built-in probes:
|
|
27
33
|
* - Session store (if transport persistence is configured)
|
|
28
34
|
* - Remote MCP apps (via existing HealthCheckManager)
|
|
29
|
-
* - Probes plugins
|
|
35
|
+
* - Probes plugins register on the scope, at any time
|
|
30
36
|
* - User-defined probes from config
|
|
31
37
|
*/
|
|
32
38
|
autoDiscoverProbes(scope) {
|
|
@@ -55,9 +61,7 @@ var HealthService = class {
|
|
|
55
61
|
}
|
|
56
62
|
});
|
|
57
63
|
}
|
|
58
|
-
|
|
59
|
-
this.registerProbe(probe);
|
|
60
|
-
}
|
|
64
|
+
this.registerProbeSource(() => scope.healthProbes ?? []);
|
|
61
65
|
const userProbes = this.config.probes ?? [];
|
|
62
66
|
for (const probe of userProbes) {
|
|
63
67
|
if (probe && typeof probe.check === "function" && typeof probe.name === "string") {
|
|
@@ -99,7 +103,7 @@ var HealthService = class {
|
|
|
99
103
|
const timeoutMs = this.config.readyz?.timeoutMs ?? 5e3;
|
|
100
104
|
const includeDetails = this.resolveIncludeDetails();
|
|
101
105
|
const results = await Promise.all(
|
|
102
|
-
this.
|
|
106
|
+
this.getProbes().map(async (probe) => {
|
|
103
107
|
const result = await this.runProbeWithTimeout(probe, timeoutMs);
|
|
104
108
|
return { name: probe.name, result };
|
|
105
109
|
})
|
|
@@ -124,13 +128,13 @@ var HealthService = class {
|
|
|
124
128
|
* Get the number of registered probes.
|
|
125
129
|
*/
|
|
126
130
|
getProbeCount() {
|
|
127
|
-
return this.
|
|
131
|
+
return this.getProbes().length;
|
|
128
132
|
}
|
|
129
133
|
/**
|
|
130
|
-
* Get
|
|
134
|
+
* Get the probes the next check runs (used for aggregation across scopes).
|
|
131
135
|
*/
|
|
132
136
|
getProbes() {
|
|
133
|
-
return this.
|
|
137
|
+
return this.probeSources.flatMap((source) => source());
|
|
134
138
|
}
|
|
135
139
|
/**
|
|
136
140
|
* Set the scope view for catalog computation (used for composite services).
|