@frontmcp/sdk 0.4.1 → 0.5.0
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/README.md +30 -18
- package/package.json +20 -5
- package/src/app/app.registry.d.ts +3 -2
- package/src/app/app.registry.js +3 -1
- package/src/app/app.registry.js.map +1 -1
- package/src/app/instances/app.local.instance.js +2 -2
- package/src/app/instances/app.local.instance.js.map +1 -1
- package/src/auth/auth.registry.d.ts +34 -2
- package/src/auth/auth.registry.js +162 -24
- package/src/auth/auth.registry.js.map +1 -1
- package/src/auth/auth.utils.js +8 -9
- package/src/auth/auth.utils.js.map +1 -1
- package/src/auth/authorization/authorization.class.d.ts +125 -0
- package/src/auth/authorization/authorization.class.js +224 -0
- package/src/auth/authorization/authorization.class.js.map +1 -0
- package/src/auth/authorization/authorization.types.d.ts +300 -0
- package/src/auth/authorization/authorization.types.js +79 -0
- package/src/auth/authorization/authorization.types.js.map +1 -0
- package/src/auth/authorization/index.d.ts +5 -0
- package/src/auth/authorization/index.js +19 -0
- package/src/auth/authorization/index.js.map +1 -0
- package/src/auth/authorization/orchestrated.authorization.d.ts +242 -0
- package/src/auth/authorization/orchestrated.authorization.js +306 -0
- package/src/auth/authorization/orchestrated.authorization.js.map +1 -0
- package/src/auth/authorization/public.authorization.d.ts +91 -0
- package/src/auth/authorization/public.authorization.js +132 -0
- package/src/auth/authorization/public.authorization.js.map +1 -0
- package/src/auth/authorization/transparent.authorization.d.ts +130 -0
- package/src/auth/authorization/transparent.authorization.js +147 -0
- package/src/auth/authorization/transparent.authorization.js.map +1 -0
- package/src/auth/consent/consent.types.d.ts +111 -0
- package/src/auth/consent/consent.types.js +119 -0
- package/src/auth/consent/consent.types.js.map +1 -0
- package/src/auth/consent/index.d.ts +1 -0
- package/src/auth/consent/index.js +13 -0
- package/src/auth/consent/index.js.map +1 -0
- package/src/auth/detection/auth-provider-detection.d.ts +84 -0
- package/src/auth/detection/auth-provider-detection.js +230 -0
- package/src/auth/detection/auth-provider-detection.js.map +1 -0
- package/src/auth/detection/index.d.ts +1 -0
- package/src/auth/detection/index.js +15 -0
- package/src/auth/detection/index.js.map +1 -0
- package/src/auth/flows/auth.verify.flow.d.ts +110 -0
- package/src/auth/flows/auth.verify.flow.js +379 -0
- package/src/auth/flows/auth.verify.flow.js.map +1 -0
- package/src/auth/flows/oauth.authorize.flow.d.ts +118 -164
- package/src/auth/flows/oauth.authorize.flow.js +701 -33
- package/src/auth/flows/oauth.authorize.flow.js.map +1 -1
- package/src/auth/flows/oauth.callback.flow.d.ts +117 -0
- package/src/auth/flows/oauth.callback.flow.js +357 -0
- package/src/auth/flows/oauth.callback.flow.js.map +1 -0
- package/src/auth/flows/oauth.register.flow.d.ts +32 -125
- package/src/auth/flows/oauth.token.flow.d.ts +52 -154
- package/src/auth/flows/oauth.token.flow.js +193 -55
- package/src/auth/flows/oauth.token.flow.js.map +1 -1
- package/src/auth/flows/session.verify.flow.d.ts +66 -321
- package/src/auth/flows/session.verify.flow.js +107 -18
- package/src/auth/flows/session.verify.flow.js.map +1 -1
- package/src/auth/flows/well-known.jwks.flow.d.ts +34 -205
- package/src/auth/flows/well-known.jwks.flow.js +15 -8
- package/src/auth/flows/well-known.jwks.flow.js.map +1 -1
- package/src/auth/flows/well-known.oauth-authorization-server.flow.d.ts +48 -223
- package/src/auth/flows/well-known.oauth-authorization-server.flow.js +2 -3
- package/src/auth/flows/well-known.oauth-authorization-server.flow.js.map +1 -1
- package/src/auth/flows/well-known.prm.flow.d.ts +19 -120
- package/src/auth/flows/well-known.prm.flow.js +3 -4
- package/src/auth/flows/well-known.prm.flow.js.map +1 -1
- package/src/auth/instances/instance.local-primary-auth.d.ts +91 -4
- package/src/auth/instances/instance.local-primary-auth.js +236 -6
- package/src/auth/instances/instance.local-primary-auth.js.map +1 -1
- package/src/auth/instances/instance.remote-primary-auth.d.ts +4 -3
- package/src/auth/instances/instance.remote-primary-auth.js +2 -2
- package/src/auth/instances/instance.remote-primary-auth.js.map +1 -1
- package/src/auth/session/authorization-vault.d.ts +611 -0
- package/src/auth/session/authorization-vault.js +817 -0
- package/src/auth/session/authorization-vault.js.map +1 -0
- package/src/auth/session/authorization.store.d.ts +301 -0
- package/src/auth/session/authorization.store.js +323 -0
- package/src/auth/session/authorization.store.js.map +1 -0
- package/src/auth/session/encrypted-authorization-vault.d.ts +181 -0
- package/src/auth/session/encrypted-authorization-vault.js +493 -0
- package/src/auth/session/encrypted-authorization-vault.js.map +1 -0
- package/src/auth/session/index.d.ts +4 -4
- package/src/auth/session/index.js +11 -7
- package/src/auth/session/index.js.map +1 -1
- package/src/auth/session/session.schema.d.ts +1 -1
- package/src/auth/session/session.service.d.ts +1 -1
- package/src/auth/session/transport-session.manager.d.ts +101 -0
- package/src/auth/session/transport-session.manager.js +300 -0
- package/src/auth/session/transport-session.manager.js.map +1 -0
- package/src/auth/session/transport-session.types.d.ts +457 -0
- package/src/auth/session/transport-session.types.js +110 -0
- package/src/auth/session/transport-session.types.js.map +1 -0
- package/src/auth/session/utils/session-id.utils.d.ts +14 -2
- package/src/auth/session/utils/session-id.utils.js +68 -19
- package/src/auth/session/utils/session-id.utils.js.map +1 -1
- package/src/auth/session/vault-encryption.d.ts +189 -0
- package/src/auth/session/vault-encryption.js +263 -0
- package/src/auth/session/vault-encryption.js.map +1 -0
- package/src/auth/ui/base-layout.d.ts +188 -0
- package/src/auth/ui/base-layout.js +292 -0
- package/src/auth/ui/base-layout.js.map +1 -0
- package/src/auth/ui/htmx-templates.d.ts +135 -0
- package/src/auth/ui/htmx-templates.js +433 -0
- package/src/auth/ui/htmx-templates.js.map +1 -0
- package/src/auth/ui/index.d.ts +11 -0
- package/src/auth/ui/index.js +35 -0
- package/src/auth/ui/index.js.map +1 -0
- package/src/auth/utils/audience.validator.d.ts +129 -0
- package/src/auth/utils/audience.validator.js +196 -0
- package/src/auth/utils/audience.validator.js.map +1 -0
- package/src/auth/utils/index.d.ts +2 -0
- package/src/auth/utils/index.js +7 -0
- package/src/auth/utils/index.js.map +1 -0
- package/src/auth/utils/www-authenticate.utils.d.ts +97 -0
- package/src/auth/utils/www-authenticate.utils.js +183 -0
- package/src/auth/utils/www-authenticate.utils.js.map +1 -0
- package/src/common/common.schema.d.ts +2 -16
- package/src/common/constants.d.ts +3 -0
- package/src/common/constants.js +6 -1
- package/src/common/constants.js.map +1 -1
- package/src/common/decorators/decorator-utils.d.ts +131 -0
- package/src/common/decorators/decorator-utils.js +195 -0
- package/src/common/decorators/decorator-utils.js.map +1 -0
- package/src/common/decorators/front-mcp.decorator.js +3 -2
- package/src/common/decorators/front-mcp.decorator.js.map +1 -1
- package/src/common/decorators/hook.decorator.d.ts +58 -2
- package/src/common/decorators/hook.decorator.js +127 -17
- package/src/common/decorators/hook.decorator.js.map +1 -1
- package/src/common/decorators/plugin.decorator.d.ts +1 -1
- package/src/common/decorators/plugin.decorator.js +11 -10
- package/src/common/decorators/plugin.decorator.js.map +1 -1
- package/src/common/decorators/resource.decorator.d.ts +32 -3
- package/src/common/decorators/resource.decorator.js +46 -4
- package/src/common/decorators/resource.decorator.js.map +1 -1
- package/src/common/decorators/tool.decorator.d.ts +54 -5
- package/src/common/decorators/tool.decorator.js.map +1 -1
- package/src/common/dynamic/dynamic.plugin.d.ts +22 -11
- package/src/common/dynamic/dynamic.plugin.js +7 -1
- package/src/common/dynamic/dynamic.plugin.js.map +1 -1
- package/src/common/entries/prompt.entry.d.ts +46 -2
- package/src/common/entries/prompt.entry.js +10 -0
- package/src/common/entries/prompt.entry.js.map +1 -1
- package/src/common/entries/resource.entry.d.ts +69 -6
- package/src/common/entries/resource.entry.js +27 -3
- package/src/common/entries/resource.entry.js.map +1 -1
- package/src/common/entries/scope.entry.d.ts +5 -1
- package/src/common/entries/scope.entry.js +3 -3
- package/src/common/entries/scope.entry.js.map +1 -1
- package/src/common/flow/flow.utils.d.ts +56 -0
- package/src/common/flow/flow.utils.js +96 -0
- package/src/common/flow/flow.utils.js.map +1 -0
- package/src/common/index.d.ts +2 -2
- package/src/common/index.js +2 -2
- package/src/common/index.js.map +1 -1
- package/src/common/interfaces/execution-context.interface.d.ts +59 -0
- package/src/common/interfaces/execution-context.interface.js +81 -0
- package/src/common/interfaces/execution-context.interface.js.map +1 -0
- package/src/common/interfaces/flow.interface.d.ts +1 -1
- package/src/common/interfaces/flow.interface.js.map +1 -1
- package/src/common/interfaces/index.d.ts +1 -0
- package/src/common/interfaces/index.js +1 -0
- package/src/common/interfaces/index.js.map +1 -1
- package/src/common/interfaces/internal/primary-auth-provider.interface.d.ts +17 -2
- package/src/common/interfaces/internal/primary-auth-provider.interface.js +52 -4
- package/src/common/interfaces/internal/primary-auth-provider.interface.js.map +1 -1
- package/src/common/interfaces/internal/registry.interface.d.ts +16 -2
- package/src/common/interfaces/internal/registry.interface.js.map +1 -1
- package/src/common/interfaces/plugin.interface.js.map +1 -1
- package/src/common/interfaces/prompt.interface.d.ts +53 -4
- package/src/common/interfaces/prompt.interface.js +78 -0
- package/src/common/interfaces/prompt.interface.js.map +1 -1
- package/src/common/interfaces/resource.interface.d.ts +47 -17
- package/src/common/interfaces/resource.interface.js +53 -0
- package/src/common/interfaces/resource.interface.js.map +1 -1
- package/src/common/interfaces/tool.interface.d.ts +39 -22
- package/src/common/interfaces/tool.interface.js +61 -34
- package/src/common/interfaces/tool.interface.js.map +1 -1
- package/src/common/metadata/adapter.metadata.d.ts +1 -9
- package/src/common/metadata/app.metadata.d.ts +425 -730
- package/src/common/metadata/auth-provider.metadata.d.ts +2 -12
- package/src/common/metadata/flow.metadata.d.ts +10 -25
- package/src/common/metadata/front-mcp.metadata.d.ts +602 -1023
- package/src/common/metadata/front-mcp.metadata.js +6 -4
- package/src/common/metadata/front-mcp.metadata.js.map +1 -1
- package/src/common/metadata/hook.metadata.d.ts +1 -1
- package/src/common/metadata/hook.metadata.js.map +1 -1
- package/src/common/metadata/index.d.ts +1 -0
- package/src/common/metadata/index.js +1 -0
- package/src/common/metadata/index.js.map +1 -1
- package/src/common/metadata/logger.metadata.d.ts +1 -9
- package/src/common/metadata/plugin.metadata.d.ts +8 -30
- package/src/common/metadata/prompt.metadata.d.ts +4 -161
- package/src/common/metadata/provider.metadata.d.ts +2 -12
- package/src/common/metadata/resource.metadata.d.ts +6 -98
- package/src/common/metadata/resource.metadata.js +15 -6
- package/src/common/metadata/resource.metadata.js.map +1 -1
- package/src/common/metadata/tool-ui.metadata.d.ts +10 -0
- package/src/common/metadata/tool-ui.metadata.js +12 -0
- package/src/common/metadata/tool-ui.metadata.js.map +1 -0
- package/src/common/metadata/tool.metadata.d.ts +78 -199
- package/src/common/metadata/tool.metadata.js +11 -14
- package/src/common/metadata/tool.metadata.js.map +1 -1
- package/src/common/providers/base-config.provider.d.ts +84 -0
- package/src/common/providers/base-config.provider.js +128 -0
- package/src/common/providers/base-config.provider.js.map +1 -0
- package/src/common/records/plugin.record.d.ts +5 -6
- package/src/common/records/plugin.record.js.map +1 -1
- package/src/common/records/prompt.record.js.map +1 -1
- package/src/common/records/resource.record.d.ts +17 -1
- package/src/common/records/resource.record.js +12 -6
- package/src/common/records/resource.record.js.map +1 -1
- package/src/common/records/tool.record.js.map +1 -1
- package/src/common/schemas/annotated-class.schema.d.ts +9 -9
- package/src/common/schemas/annotated-class.schema.js +92 -27
- package/src/common/schemas/annotated-class.schema.js.map +1 -1
- package/src/common/schemas/http-input.schema.d.ts +6 -30
- package/src/common/schemas/http-output.schema.d.ts +326 -1630
- package/src/common/schemas/http-output.schema.js +39 -1
- package/src/common/schemas/http-output.schema.js.map +1 -1
- package/src/common/tokens/front-mcp.tokens.js +4 -1
- package/src/common/tokens/front-mcp.tokens.js.map +1 -1
- package/src/common/tokens/resource.tokens.d.ts +2 -0
- package/src/common/tokens/resource.tokens.js +4 -1
- package/src/common/tokens/resource.tokens.js.map +1 -1
- package/src/common/tokens/tool.tokens.d.ts +2 -0
- package/src/common/tokens/tool.tokens.js +2 -0
- package/src/common/tokens/tool.tokens.js.map +1 -1
- package/src/common/types/auth/jwt.types.d.ts +5 -31
- package/src/common/types/auth/session.types.d.ts +97 -192
- package/src/common/types/auth/session.types.js +24 -11
- package/src/common/types/auth/session.types.js.map +1 -1
- package/src/common/types/options/auth.options.d.ts +1013 -490
- package/src/common/types/options/auth.options.js +554 -36
- package/src/common/types/options/auth.options.js.map +1 -1
- package/src/common/types/options/http.options.d.ts +1 -9
- package/src/common/types/options/logging.options.d.ts +7 -13
- package/src/common/types/options/logging.options.js +4 -0
- package/src/common/types/options/logging.options.js.map +1 -1
- package/src/common/types/options/server-info.options.d.ts +3 -31
- package/src/common/types/options/session.options.d.ts +90 -10
- package/src/common/types/options/session.options.js +26 -3
- package/src/common/types/options/session.options.js.map +1 -1
- package/src/common/utils/decide-request-intent.utils.d.ts +8 -46
- package/src/common/utils/decide-request-intent.utils.js +88 -23
- package/src/common/utils/decide-request-intent.utils.js.map +1 -1
- package/src/completion/flows/complete.flow.d.ts +74 -0
- package/src/completion/flows/complete.flow.js +199 -0
- package/src/completion/flows/complete.flow.js.map +1 -0
- package/src/errors/authorization-required.error.d.ts +189 -0
- package/src/errors/authorization-required.error.js +274 -0
- package/src/errors/authorization-required.error.js.map +1 -0
- package/src/errors/index.d.ts +2 -1
- package/src/errors/index.js +17 -1
- package/src/errors/index.js.map +1 -1
- package/src/errors/mcp.error.d.ts +101 -1
- package/src/errors/mcp.error.js +147 -2
- package/src/errors/mcp.error.js.map +1 -1
- package/src/flows/flow.instance.js +4 -3
- package/src/flows/flow.instance.js.map +1 -1
- package/src/flows/flow.registry.js.map +1 -1
- package/src/flows/flow.stages.js +14 -11
- package/src/flows/flow.stages.js.map +1 -1
- package/src/front-mcp/front-mcp.providers.d.ts +464 -102
- package/src/front-mcp/front-mcp.providers.js +3 -5
- package/src/front-mcp/front-mcp.providers.js.map +1 -1
- package/src/hooks/hook.instance.d.ts +1 -1
- package/src/hooks/hook.instance.js +5 -2
- package/src/hooks/hook.instance.js.map +1 -1
- package/src/hooks/hook.registry.js +7 -5
- package/src/hooks/hook.registry.js.map +1 -1
- package/src/index.d.ts +28 -9
- package/src/index.js +5 -1
- package/src/index.js.map +1 -1
- package/src/logger/instances/instance.logger.js +3 -2
- package/src/logger/instances/instance.logger.js.map +1 -1
- package/src/logger/logger.registry.js +7 -2
- package/src/logger/logger.registry.js.map +1 -1
- package/src/logging/flows/set-level.flow.d.ts +62 -0
- package/src/logging/flows/set-level.flow.js +108 -0
- package/src/logging/flows/set-level.flow.js.map +1 -0
- package/src/mcp-apps/csp.d.ts +111 -0
- package/src/mcp-apps/csp.js +267 -0
- package/src/mcp-apps/csp.js.map +1 -0
- package/src/mcp-apps/index.d.ts +23 -0
- package/src/mcp-apps/index.js +91 -0
- package/src/mcp-apps/index.js.map +1 -0
- package/src/mcp-apps/schemas.d.ts +403 -0
- package/src/mcp-apps/schemas.js +345 -0
- package/src/mcp-apps/schemas.js.map +1 -0
- package/src/mcp-apps/template.d.ts +94 -0
- package/src/mcp-apps/template.js +419 -0
- package/src/mcp-apps/template.js.map +1 -0
- package/src/mcp-apps/types.d.ts +323 -0
- package/src/mcp-apps/types.js +59 -0
- package/src/mcp-apps/types.js.map +1 -0
- package/src/notification/index.d.ts +1 -0
- package/src/notification/index.js +13 -0
- package/src/notification/index.js.map +1 -0
- package/src/notification/notification.service.d.ts +378 -0
- package/src/notification/notification.service.js +727 -0
- package/src/notification/notification.service.js.map +1 -0
- package/src/plugin/plugin.registry.js +12 -9
- package/src/plugin/plugin.registry.js.map +1 -1
- package/src/prompt/flows/get-prompt.flow.d.ts +153 -0
- package/src/prompt/flows/get-prompt.flow.js +214 -0
- package/src/prompt/flows/get-prompt.flow.js.map +1 -0
- package/src/prompt/flows/prompts-list.flow.d.ts +67 -0
- package/src/prompt/flows/prompts-list.flow.js +176 -0
- package/src/prompt/flows/prompts-list.flow.js.map +1 -0
- package/src/prompt/index.d.ts +7 -0
- package/src/prompt/index.js +17 -0
- package/src/prompt/index.js.map +1 -0
- package/src/prompt/prompt.events.d.ts +17 -0
- package/src/prompt/prompt.events.js +25 -0
- package/src/prompt/prompt.events.js.map +1 -0
- package/src/prompt/prompt.instance.d.ts +30 -0
- package/src/prompt/prompt.instance.js +120 -0
- package/src/prompt/prompt.instance.js.map +1 -0
- package/src/prompt/prompt.registry.d.ts +79 -12
- package/src/prompt/prompt.registry.js +360 -15
- package/src/prompt/prompt.registry.js.map +1 -1
- package/src/prompt/prompt.types.d.ts +26 -0
- package/src/prompt/prompt.types.js +11 -0
- package/src/prompt/prompt.types.js.map +1 -0
- package/src/prompt/prompt.utils.d.ts +26 -0
- package/src/prompt/prompt.utils.js +136 -0
- package/src/prompt/prompt.utils.js.map +1 -0
- package/src/provider/provider.registry.d.ts +12 -5
- package/src/provider/provider.registry.js +30 -138
- package/src/provider/provider.registry.js.map +1 -1
- package/src/regsitry/registry.base.d.ts +1 -1
- package/src/regsitry/registry.base.js.map +1 -1
- package/src/resource/flows/read-resource.flow.d.ts +91 -0
- package/src/resource/flows/read-resource.flow.js +270 -0
- package/src/resource/flows/read-resource.flow.js.map +1 -0
- package/src/resource/flows/resource-templates-list.flow.d.ts +64 -0
- package/src/resource/flows/resource-templates-list.flow.js +191 -0
- package/src/resource/flows/resource-templates-list.flow.js.map +1 -0
- package/src/resource/flows/resources-list.flow.d.ts +64 -0
- package/src/resource/flows/resources-list.flow.js +196 -0
- package/src/resource/flows/resources-list.flow.js.map +1 -0
- package/src/resource/flows/subscribe-resource.flow.d.ts +45 -0
- package/src/resource/flows/subscribe-resource.flow.js +123 -0
- package/src/resource/flows/subscribe-resource.flow.js.map +1 -0
- package/src/resource/flows/unsubscribe-resource.flow.d.ts +44 -0
- package/src/resource/flows/unsubscribe-resource.flow.js +107 -0
- package/src/resource/flows/unsubscribe-resource.flow.js.map +1 -0
- package/src/resource/index.d.ts +8 -0
- package/src/resource/index.js +20 -0
- package/src/resource/index.js.map +1 -0
- package/src/resource/resource.events.d.ts +24 -0
- package/src/resource/resource.events.js +17 -0
- package/src/resource/resource.events.js.map +1 -0
- package/src/resource/resource.instance.d.ts +35 -0
- package/src/resource/resource.instance.js +163 -0
- package/src/resource/resource.instance.js.map +1 -0
- package/src/resource/resource.registry.d.ts +106 -12
- package/src/resource/resource.registry.js +449 -13
- package/src/resource/resource.registry.js.map +1 -1
- package/src/resource/resource.types.d.ts +35 -0
- package/src/resource/resource.types.js +11 -0
- package/src/resource/resource.types.js.map +1 -0
- package/src/resource/resource.utils.d.ts +30 -0
- package/src/resource/resource.utils.js +151 -0
- package/src/resource/resource.utils.js.map +1 -0
- package/src/scope/flows/http.request.flow.d.ts +48 -330
- package/src/scope/flows/http.request.flow.js +306 -78
- package/src/scope/flows/http.request.flow.js.map +1 -1
- package/src/scope/scope.instance.d.ts +12 -0
- package/src/scope/scope.instance.js +145 -15
- package/src/scope/scope.instance.js.map +1 -1
- package/src/tool/flows/call-tool.flow.d.ts +64 -1110
- package/src/tool/flows/call-tool.flow.js +303 -15
- package/src/tool/flows/call-tool.flow.js.map +1 -1
- package/src/tool/flows/tools-list.flow.d.ts +32 -473
- package/src/tool/flows/tools-list.flow.js +121 -40
- package/src/tool/flows/tools-list.flow.js.map +1 -1
- package/src/tool/tool.events.d.ts +8 -1
- package/src/tool/tool.events.js.map +1 -1
- package/src/tool/tool.instance.d.ts +3 -1
- package/src/tool/tool.instance.js +17 -3
- package/src/tool/tool.instance.js.map +1 -1
- package/src/tool/tool.registry.d.ts +7 -1
- package/src/tool/tool.registry.js +26 -10
- package/src/tool/tool.registry.js.map +1 -1
- package/src/tool/tool.types.d.ts +4 -4
- package/src/tool/tool.types.js.map +1 -1
- package/src/tool/tool.utils.d.ts +3 -12
- package/src/tool/tool.utils.js +39 -193
- package/src/tool/tool.utils.js.map +1 -1
- package/src/tool/ui/index.d.ts +22 -0
- package/src/tool/ui/index.js +63 -0
- package/src/tool/ui/index.js.map +1 -0
- package/src/tool/ui/platform-adapters.d.ts +10 -0
- package/src/tool/ui/platform-adapters.js +18 -0
- package/src/tool/ui/platform-adapters.js.map +1 -0
- package/src/tool/ui/template-helpers.d.ts +46 -0
- package/src/tool/ui/template-helpers.js +112 -0
- package/src/tool/ui/template-helpers.js.map +1 -0
- package/src/tool/ui/ui-resource-template.d.ts +34 -0
- package/src/tool/ui/ui-resource-template.js +64 -0
- package/src/tool/ui/ui-resource-template.js.map +1 -0
- package/src/tool/ui/ui-resource.handler.d.ts +74 -0
- package/src/tool/ui/ui-resource.handler.js +129 -0
- package/src/tool/ui/ui-resource.handler.js.map +1 -0
- package/src/transport/adapters/transport.local.adapter.d.ts +2 -2
- package/src/transport/adapters/transport.local.adapter.js +28 -7
- package/src/transport/adapters/transport.local.adapter.js.map +1 -1
- package/src/transport/adapters/transport.sse.adapter.d.ts +2 -2
- package/src/transport/adapters/transport.sse.adapter.js +4 -3
- package/src/transport/adapters/transport.sse.adapter.js.map +1 -1
- package/src/transport/adapters/transport.streamable-http.adapter.d.ts +10 -3
- package/src/transport/adapters/transport.streamable-http.adapter.js +54 -8
- package/src/transport/adapters/transport.streamable-http.adapter.js.map +1 -1
- package/src/transport/flows/handle.sse.flow.d.ts +29 -63
- package/src/transport/flows/handle.sse.flow.js +78 -10
- package/src/transport/flows/handle.sse.flow.js.map +1 -1
- package/src/transport/flows/handle.stateless-http.flow.d.ts +29 -0
- package/src/transport/flows/handle.stateless-http.flow.js +102 -0
- package/src/transport/flows/handle.stateless-http.flow.js.map +1 -0
- package/src/transport/flows/handle.streamable-http.flow.d.ts +32 -64
- package/src/transport/flows/handle.streamable-http.flow.js +158 -26
- package/src/transport/flows/handle.streamable-http.flow.js.map +1 -1
- package/src/transport/legacy/legacy.sse.tranporter.d.ts +9 -0
- package/src/transport/legacy/legacy.sse.tranporter.js +17 -2
- package/src/transport/legacy/legacy.sse.tranporter.js.map +1 -1
- package/src/transport/mcp-handlers/call-tool-request.handler.js +27 -1
- package/src/transport/mcp-handlers/call-tool-request.handler.js.map +1 -1
- package/src/transport/mcp-handlers/complete-request.handler.d.ts +69 -0
- package/src/transport/mcp-handlers/complete-request.handler.js +11 -0
- package/src/transport/mcp-handlers/complete-request.handler.js.map +1 -0
- package/src/transport/mcp-handlers/get-prompt-request.handler.d.ts +87 -0
- package/src/transport/mcp-handlers/get-prompt-request.handler.js +11 -0
- package/src/transport/mcp-handlers/get-prompt-request.handler.js.map +1 -0
- package/src/transport/mcp-handlers/index.d.ts +517 -208
- package/src/transport/mcp-handlers/index.js +39 -2
- package/src/transport/mcp-handlers/index.js.map +1 -1
- package/src/transport/mcp-handlers/initialize-request.handler.d.ts +1 -1
- package/src/transport/mcp-handlers/initialize-request.handler.js +73 -7
- package/src/transport/mcp-handlers/initialize-request.handler.js.map +1 -1
- package/src/transport/mcp-handlers/list-prompts-request.handler.d.ts +54 -0
- package/src/transport/mcp-handlers/list-prompts-request.handler.js +11 -0
- package/src/transport/mcp-handlers/list-prompts-request.handler.js.map +1 -0
- package/src/transport/mcp-handlers/list-resource-templates-request.handler.d.ts +51 -0
- package/src/transport/mcp-handlers/list-resource-templates-request.handler.js +12 -0
- package/src/transport/mcp-handlers/list-resource-templates-request.handler.js.map +1 -0
- package/src/transport/mcp-handlers/list-resources-request.handler.d.ts +51 -0
- package/src/transport/mcp-handlers/list-resources-request.handler.js +12 -0
- package/src/transport/mcp-handlers/list-resources-request.handler.js.map +1 -0
- package/src/transport/mcp-handlers/list-tools-request.handler.d.ts +19 -146
- package/src/transport/mcp-handlers/logging-set-level-request.handler.d.ts +46 -0
- package/src/transport/mcp-handlers/logging-set-level-request.handler.js +34 -0
- package/src/transport/mcp-handlers/logging-set-level-request.handler.js.map +1 -0
- package/src/transport/mcp-handlers/mcp-handlers.types.d.ts +3 -7
- package/src/transport/mcp-handlers/mcp-handlers.types.js.map +1 -1
- package/src/transport/mcp-handlers/read-resource-request.handler.d.ts +46 -0
- package/src/transport/mcp-handlers/read-resource-request.handler.js +12 -0
- package/src/transport/mcp-handlers/read-resource-request.handler.js.map +1 -0
- package/src/transport/mcp-handlers/roots-list-changed-notification.handler.d.ts +11 -0
- package/src/transport/mcp-handlers/roots-list-changed-notification.handler.js +26 -0
- package/src/transport/mcp-handlers/roots-list-changed-notification.handler.js.map +1 -0
- package/src/transport/mcp-handlers/subscribe-request.handler.d.ts +37 -0
- package/src/transport/mcp-handlers/subscribe-request.handler.js +34 -0
- package/src/transport/mcp-handlers/subscribe-request.handler.js.map +1 -0
- package/src/transport/mcp-handlers/unsubscribe-request.handler.d.ts +37 -0
- package/src/transport/mcp-handlers/unsubscribe-request.handler.js +34 -0
- package/src/transport/mcp-handlers/unsubscribe-request.handler.js.map +1 -0
- package/src/transport/transport.local.js +7 -2
- package/src/transport/transport.local.js.map +1 -1
- package/src/transport/transport.registry.d.ts +30 -0
- package/src/transport/transport.registry.js +84 -1
- package/src/transport/transport.registry.js.map +1 -1
- package/src/transport/transport.types.d.ts +3 -3
- package/src/transport/transport.types.js.map +1 -1
- package/src/utils/content.utils.d.ts +48 -0
- package/src/utils/content.utils.js +194 -0
- package/src/utils/content.utils.js.map +1 -0
- package/src/utils/index.d.ts +8 -0
- package/src/utils/index.js +55 -0
- package/src/utils/index.js.map +1 -0
- package/src/utils/lineage.utils.d.ts +40 -0
- package/src/utils/lineage.utils.js +82 -0
- package/src/utils/lineage.utils.js.map +1 -0
- package/src/utils/naming.utils.d.ts +46 -0
- package/src/utils/naming.utils.js +136 -0
- package/src/utils/naming.utils.js.map +1 -0
- package/src/utils/types.utils.d.ts +2 -2
- package/src/utils/types.utils.js.map +1 -1
- package/src/utils/uri-template.utils.d.ts +57 -0
- package/src/utils/uri-template.utils.js +113 -0
- package/src/utils/uri-template.utils.js.map +1 -0
- package/src/utils/uri-validation.utils.d.ts +40 -0
- package/src/utils/uri-validation.utils.js +76 -0
- package/src/utils/uri-validation.utils.js.map +1 -0
- package/src/__test-utils__/fixtures/hook.fixtures.d.ts +0 -46
- package/src/__test-utils__/fixtures/hook.fixtures.js +0 -114
- package/src/__test-utils__/fixtures/hook.fixtures.js.map +0 -1
- package/src/__test-utils__/fixtures/index.d.ts +0 -7
- package/src/__test-utils__/fixtures/index.js +0 -11
- package/src/__test-utils__/fixtures/index.js.map +0 -1
- package/src/__test-utils__/fixtures/plugin.fixtures.d.ts +0 -46
- package/src/__test-utils__/fixtures/plugin.fixtures.js +0 -127
- package/src/__test-utils__/fixtures/plugin.fixtures.js.map +0 -1
- package/src/__test-utils__/fixtures/provider.fixtures.d.ts +0 -69
- package/src/__test-utils__/fixtures/provider.fixtures.js +0 -131
- package/src/__test-utils__/fixtures/provider.fixtures.js.map +0 -1
- package/src/__test-utils__/fixtures/scope.fixtures.d.ts +0 -14
- package/src/__test-utils__/fixtures/scope.fixtures.js +0 -59
- package/src/__test-utils__/fixtures/scope.fixtures.js.map +0 -1
- package/src/__test-utils__/fixtures/tool.fixtures.d.ts +0 -36
- package/src/__test-utils__/fixtures/tool.fixtures.js +0 -91
- package/src/__test-utils__/fixtures/tool.fixtures.js.map +0 -1
- package/src/__test-utils__/helpers/assertion.helpers.d.ts +0 -45
- package/src/__test-utils__/helpers/assertion.helpers.js +0 -153
- package/src/__test-utils__/helpers/assertion.helpers.js.map +0 -1
- package/src/__test-utils__/helpers/async.helpers.d.ts +0 -48
- package/src/__test-utils__/helpers/async.helpers.js +0 -112
- package/src/__test-utils__/helpers/async.helpers.js.map +0 -1
- package/src/__test-utils__/helpers/index.d.ts +0 -6
- package/src/__test-utils__/helpers/index.js +0 -10
- package/src/__test-utils__/helpers/index.js.map +0 -1
- package/src/__test-utils__/helpers/setup.helpers.d.ts +0 -54
- package/src/__test-utils__/helpers/setup.helpers.js +0 -106
- package/src/__test-utils__/helpers/setup.helpers.js.map +0 -1
- package/src/__test-utils__/index.d.ts +0 -9
- package/src/__test-utils__/index.js +0 -14
- package/src/__test-utils__/index.js.map +0 -1
- package/src/__test-utils__/mocks/flow-instance.mock.d.ts +0 -50
- package/src/__test-utils__/mocks/flow-instance.mock.js +0 -72
- package/src/__test-utils__/mocks/flow-instance.mock.js.map +0 -1
- package/src/__test-utils__/mocks/hook-registry.mock.d.ts +0 -25
- package/src/__test-utils__/mocks/hook-registry.mock.js +0 -65
- package/src/__test-utils__/mocks/hook-registry.mock.js.map +0 -1
- package/src/__test-utils__/mocks/index.d.ts +0 -8
- package/src/__test-utils__/mocks/index.js +0 -12
- package/src/__test-utils__/mocks/index.js.map +0 -1
- package/src/__test-utils__/mocks/plugin-registry.mock.d.ts +0 -43
- package/src/__test-utils__/mocks/plugin-registry.mock.js +0 -70
- package/src/__test-utils__/mocks/plugin-registry.mock.js.map +0 -1
- package/src/__test-utils__/mocks/provider-registry.mock.d.ts +0 -39
- package/src/__test-utils__/mocks/provider-registry.mock.js +0 -72
- package/src/__test-utils__/mocks/provider-registry.mock.js.map +0 -1
- package/src/__test-utils__/mocks/tool-registry.mock.d.ts +0 -43
- package/src/__test-utils__/mocks/tool-registry.mock.js +0 -79
- package/src/__test-utils__/mocks/tool-registry.mock.js.map +0 -1
- package/src/auth/path.utils.d.ts +0 -20
- package/src/auth/path.utils.js +0 -71
- package/src/auth/path.utils.js.map +0 -1
- package/src/common/decorators-old/async-with.decorator.d.ts +0 -10
- package/src/common/decorators-old/async-with.decorator.js +0 -24
- package/src/common/decorators-old/async-with.decorator.js.map +0 -1
- package/src/common/decorators-old/auth-hook.decorator.d.ts +0 -14
- package/src/common/decorators-old/auth-hook.decorator.js +0 -27
- package/src/common/decorators-old/auth-hook.decorator.js.map +0 -1
- package/src/common/decorators-old/session-hook.decorator.d.ts +0 -14
- package/src/common/decorators-old/session-hook.decorator.js +0 -27
- package/src/common/decorators-old/session-hook.decorator.js.map +0 -1
|
@@ -0,0 +1,378 @@
|
|
|
1
|
+
import { Server as McpServer } from '@modelcontextprotocol/sdk/server/index.js';
|
|
2
|
+
import { type LoggingLevel, type Root } from '@modelcontextprotocol/sdk/types.js';
|
|
3
|
+
import type { Scope } from '../scope';
|
|
4
|
+
import type { AIPlatformType } from '../common/types/auth/session.types';
|
|
5
|
+
import type { PlatformDetectionConfig } from '../common/types/options/session.options';
|
|
6
|
+
/**
|
|
7
|
+
* Re-export Root from MCP SDK for convenience.
|
|
8
|
+
* Per MCP 2025-11-25 specification.
|
|
9
|
+
*/
|
|
10
|
+
export type { Root };
|
|
11
|
+
/**
|
|
12
|
+
* Re-export AIPlatformType from session types for backwards compatibility.
|
|
13
|
+
*/
|
|
14
|
+
export type { AIPlatformType } from '../common/types/auth/session.types';
|
|
15
|
+
/**
|
|
16
|
+
* Alias for MCP SDK's LoggingLevel for backwards compatibility.
|
|
17
|
+
* @deprecated Use LoggingLevel from @modelcontextprotocol/sdk/types.js directly
|
|
18
|
+
*/
|
|
19
|
+
export type McpLoggingLevel = LoggingLevel;
|
|
20
|
+
/**
|
|
21
|
+
* Client capabilities from the initialize request.
|
|
22
|
+
* Stored per session to understand what the client supports.
|
|
23
|
+
*/
|
|
24
|
+
export interface ClientCapabilities {
|
|
25
|
+
/** Whether the client supports roots and root change notifications */
|
|
26
|
+
roots?: {
|
|
27
|
+
listChanged?: boolean;
|
|
28
|
+
};
|
|
29
|
+
/** Other capabilities can be added here as needed */
|
|
30
|
+
sampling?: Record<string, unknown>;
|
|
31
|
+
/** Experimental capabilities including MCP Apps extension */
|
|
32
|
+
experimental?: {
|
|
33
|
+
/** MCP Apps (ext-apps) extension capability */
|
|
34
|
+
'io.modelcontextprotocol/ui'?: {
|
|
35
|
+
/** Supported MIME types (e.g., ['text/html+mcp']) */
|
|
36
|
+
mimeTypes?: string[];
|
|
37
|
+
};
|
|
38
|
+
[key: string]: unknown;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Client info from the MCP initialize request.
|
|
43
|
+
* Contains the name and version of the calling client.
|
|
44
|
+
*/
|
|
45
|
+
export interface ClientInfo {
|
|
46
|
+
/** Client application name (e.g., "claude-desktop", "chatgpt", "cursor") */
|
|
47
|
+
name: string;
|
|
48
|
+
/** Client version string */
|
|
49
|
+
version: string;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* MCP Apps extension key in capabilities.experimental
|
|
53
|
+
*/
|
|
54
|
+
export declare const MCP_APPS_EXTENSION_KEY: "io.modelcontextprotocol/ui";
|
|
55
|
+
/**
|
|
56
|
+
* Check if client capabilities include MCP Apps extension.
|
|
57
|
+
* @param capabilities - Client capabilities from initialize request
|
|
58
|
+
* @returns true if the client supports MCP Apps
|
|
59
|
+
*/
|
|
60
|
+
export declare function hasMcpAppsExtension(capabilities?: ClientCapabilities): boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Detect platform from client capabilities.
|
|
63
|
+
* Checks for known extension capabilities before falling back to client info.
|
|
64
|
+
* @param capabilities - Client capabilities from initialize request
|
|
65
|
+
* @returns Platform type if detected from capabilities, undefined otherwise
|
|
66
|
+
*/
|
|
67
|
+
export declare function detectPlatformFromCapabilities(capabilities?: ClientCapabilities): AIPlatformType | undefined;
|
|
68
|
+
/**
|
|
69
|
+
* Detect platform from user-agent header.
|
|
70
|
+
* Called during session creation before MCP initialize.
|
|
71
|
+
*
|
|
72
|
+
* @param userAgent - The User-Agent header value
|
|
73
|
+
* @param config - Optional platform detection configuration
|
|
74
|
+
* @returns The detected platform type
|
|
75
|
+
*/
|
|
76
|
+
export declare function detectPlatformFromUserAgent(userAgent?: string, config?: PlatformDetectionConfig): AIPlatformType;
|
|
77
|
+
/**
|
|
78
|
+
* Detect the AI platform type from client info.
|
|
79
|
+
* Supports custom mappings that are checked before default detection.
|
|
80
|
+
*
|
|
81
|
+
* @param clientInfo - Client info from MCP initialize request
|
|
82
|
+
* @param config - Optional platform detection configuration with custom mappings
|
|
83
|
+
* @returns The detected platform type
|
|
84
|
+
*/
|
|
85
|
+
export declare function detectAIPlatform(clientInfo?: ClientInfo, config?: PlatformDetectionConfig): AIPlatformType;
|
|
86
|
+
/**
|
|
87
|
+
* MCP logging level priority (lower number = more verbose).
|
|
88
|
+
* Uses LoggingLevel from MCP SDK for type safety.
|
|
89
|
+
*/
|
|
90
|
+
export declare const MCP_LOGGING_LEVEL_PRIORITY: Record<LoggingLevel, number>;
|
|
91
|
+
/**
|
|
92
|
+
* MCP notification method types per the 2025-11-25 specification.
|
|
93
|
+
*/
|
|
94
|
+
export type McpNotificationMethod = 'notifications/resources/list_changed' | 'notifications/tools/list_changed' | 'notifications/prompts/list_changed' | 'notifications/resources/updated' | 'notifications/message';
|
|
95
|
+
/**
|
|
96
|
+
* Information about a registered MCP server/transport connection.
|
|
97
|
+
*/
|
|
98
|
+
export interface RegisteredServer {
|
|
99
|
+
/** Unique session identifier */
|
|
100
|
+
sessionId: string;
|
|
101
|
+
/** The MCP server instance */
|
|
102
|
+
server: McpServer;
|
|
103
|
+
/** Timestamp when the server was registered */
|
|
104
|
+
registeredAt: number;
|
|
105
|
+
/** Client capabilities from the initialize request */
|
|
106
|
+
clientCapabilities?: ClientCapabilities;
|
|
107
|
+
/** Client info (name/version) from the initialize request */
|
|
108
|
+
clientInfo?: ClientInfo;
|
|
109
|
+
/** Detected AI platform type based on client info */
|
|
110
|
+
platformType?: AIPlatformType;
|
|
111
|
+
/** Cached roots from the client (invalidated on roots/list_changed) */
|
|
112
|
+
cachedRoots?: Root[];
|
|
113
|
+
/** Timestamp when roots were last fetched */
|
|
114
|
+
rootsFetchedAt?: number;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* NotificationService manages server→client notifications per MCP 2025-11-25 spec.
|
|
118
|
+
*
|
|
119
|
+
* It tracks all active MCP server instances and broadcasts notifications when
|
|
120
|
+
* registries (resources, tools, prompts) change.
|
|
121
|
+
*
|
|
122
|
+
* It also manages resource subscriptions per session, allowing clients to
|
|
123
|
+
* subscribe to specific resource URIs and receive notifications when they change.
|
|
124
|
+
*
|
|
125
|
+
* @example
|
|
126
|
+
* ```typescript
|
|
127
|
+
* // In LocalTransportAdapter after server.connect()
|
|
128
|
+
* scope.notifications.registerServer(sessionId, this.server);
|
|
129
|
+
*
|
|
130
|
+
* // On session close
|
|
131
|
+
* scope.notifications.unregisterServer(sessionId);
|
|
132
|
+
*
|
|
133
|
+
* // Resource subscriptions
|
|
134
|
+
* scope.notifications.subscribeResource(sessionId, 'file://path/to/file');
|
|
135
|
+
* scope.notifications.unsubscribeResource(sessionId, 'file://path/to/file');
|
|
136
|
+
* ```
|
|
137
|
+
*/
|
|
138
|
+
export declare class NotificationService {
|
|
139
|
+
private readonly scope;
|
|
140
|
+
private readonly logger;
|
|
141
|
+
private readonly servers;
|
|
142
|
+
private readonly unsubscribers;
|
|
143
|
+
/** Maps session ID to set of subscribed resource URIs */
|
|
144
|
+
private readonly subscriptions;
|
|
145
|
+
/** Maps session ID to minimum log level for that session */
|
|
146
|
+
private readonly logLevels;
|
|
147
|
+
/**
|
|
148
|
+
* Set of terminated session IDs (for session invalidation on DELETE).
|
|
149
|
+
* Uses LRU-style eviction to prevent unbounded memory growth.
|
|
150
|
+
*/
|
|
151
|
+
private readonly terminatedSessions;
|
|
152
|
+
/** Maximum number of terminated sessions to track before eviction */
|
|
153
|
+
private static readonly MAX_TERMINATED_SESSIONS;
|
|
154
|
+
constructor(scope: Scope);
|
|
155
|
+
/**
|
|
156
|
+
* Initialize the notification service and subscribe to registry changes.
|
|
157
|
+
* Called after all registries are ready.
|
|
158
|
+
*/
|
|
159
|
+
initialize(): Promise<void>;
|
|
160
|
+
/**
|
|
161
|
+
* Register an MCP server instance for receiving notifications.
|
|
162
|
+
* Call this when a transport connection is established.
|
|
163
|
+
*
|
|
164
|
+
* @param sessionId - Unique session identifier
|
|
165
|
+
* @param server - The MCP server instance
|
|
166
|
+
*/
|
|
167
|
+
registerServer(sessionId: string, server: McpServer): void;
|
|
168
|
+
/**
|
|
169
|
+
* Unregister an MCP server instance.
|
|
170
|
+
* Call this when a transport connection is closed.
|
|
171
|
+
* Also cleans up any resource subscriptions for this session.
|
|
172
|
+
*
|
|
173
|
+
* @param sessionId - The session identifier to unregister
|
|
174
|
+
* @returns true if the server was registered and is now unregistered, false if not found
|
|
175
|
+
*/
|
|
176
|
+
unregisterServer(sessionId: string): boolean;
|
|
177
|
+
/**
|
|
178
|
+
* Terminate a session. This adds the session ID to the terminated set,
|
|
179
|
+
* preventing further use of this session ID. This is called during DELETE
|
|
180
|
+
* session handling per MCP 2025-11-25 spec.
|
|
181
|
+
*
|
|
182
|
+
* Note: For stateless sessions (encrypted JWTs), the session ID cannot be
|
|
183
|
+
* truly "invalidated" cryptographically, but we track it in memory to reject
|
|
184
|
+
* future requests with this session ID on this server instance.
|
|
185
|
+
*
|
|
186
|
+
* @param sessionId - The session ID to terminate
|
|
187
|
+
* @returns true if the session was registered and is now terminated
|
|
188
|
+
*/
|
|
189
|
+
terminateSession(sessionId: string): boolean;
|
|
190
|
+
/**
|
|
191
|
+
* Check if a session has been terminated.
|
|
192
|
+
* Used during session verification to reject requests with terminated session IDs.
|
|
193
|
+
*
|
|
194
|
+
* @param sessionId - The session ID to check
|
|
195
|
+
* @returns true if the session has been terminated
|
|
196
|
+
*/
|
|
197
|
+
isSessionTerminated(sessionId: string): boolean;
|
|
198
|
+
/**
|
|
199
|
+
* Broadcast a notification to all registered servers.
|
|
200
|
+
*
|
|
201
|
+
* @param method - The MCP notification method
|
|
202
|
+
* @param params - Optional notification parameters
|
|
203
|
+
*/
|
|
204
|
+
broadcastNotification(method: McpNotificationMethod, params?: Record<string, unknown>): void;
|
|
205
|
+
/**
|
|
206
|
+
* Send a notification to a specific session.
|
|
207
|
+
*
|
|
208
|
+
* @param sessionId - The target session
|
|
209
|
+
* @param method - The MCP notification method
|
|
210
|
+
* @param params - Optional notification parameters
|
|
211
|
+
*/
|
|
212
|
+
sendNotificationToSession(sessionId: string, method: McpNotificationMethod, params?: Record<string, unknown>): void;
|
|
213
|
+
/**
|
|
214
|
+
* Subscribe a session to receive notifications when a specific resource changes.
|
|
215
|
+
*
|
|
216
|
+
* @param sessionId - The session to subscribe
|
|
217
|
+
* @param uri - The resource URI to subscribe to
|
|
218
|
+
* @returns true if this is a new subscription, false if already subscribed
|
|
219
|
+
*/
|
|
220
|
+
subscribeResource(sessionId: string, uri: string): boolean;
|
|
221
|
+
/**
|
|
222
|
+
* Unsubscribe a session from a specific resource.
|
|
223
|
+
*
|
|
224
|
+
* @param sessionId - The session to unsubscribe
|
|
225
|
+
* @param uri - The resource URI to unsubscribe from
|
|
226
|
+
* @returns true if the subscription was removed, false if not subscribed
|
|
227
|
+
*/
|
|
228
|
+
unsubscribeResource(sessionId: string, uri: string): boolean;
|
|
229
|
+
/**
|
|
230
|
+
* Check if a session is subscribed to a specific resource.
|
|
231
|
+
*
|
|
232
|
+
* @param sessionId - The session to check
|
|
233
|
+
* @param uri - The resource URI
|
|
234
|
+
* @returns true if subscribed
|
|
235
|
+
*/
|
|
236
|
+
isSubscribed(sessionId: string, uri: string): boolean;
|
|
237
|
+
/**
|
|
238
|
+
* Get all sessions subscribed to a specific resource.
|
|
239
|
+
*
|
|
240
|
+
* @param uri - The resource URI
|
|
241
|
+
* @returns Array of session IDs subscribed to this resource
|
|
242
|
+
*/
|
|
243
|
+
getSubscribersForResource(uri: string): string[];
|
|
244
|
+
/**
|
|
245
|
+
* Send a resource update notification to subscribed sessions only.
|
|
246
|
+
* Per MCP 2025-11-25 spec, only sessions that have subscribed to this
|
|
247
|
+
* resource via `resources/subscribe` will receive the notification.
|
|
248
|
+
*
|
|
249
|
+
* @param uri - The resource URI that was updated
|
|
250
|
+
*/
|
|
251
|
+
notifyResourceUpdated(uri: string): void;
|
|
252
|
+
/**
|
|
253
|
+
* Get the number of registered servers.
|
|
254
|
+
*/
|
|
255
|
+
get serverCount(): number;
|
|
256
|
+
/**
|
|
257
|
+
* Set the minimum log level for a session.
|
|
258
|
+
* Only log messages at or above this level will be sent to the session.
|
|
259
|
+
* Per MCP spec, the default level when not set is determined by the server.
|
|
260
|
+
*
|
|
261
|
+
* @param sessionId - The session to configure
|
|
262
|
+
* @param level - The minimum log level
|
|
263
|
+
* @returns true if the session was found and level was set
|
|
264
|
+
*/
|
|
265
|
+
setLogLevel(sessionId: string, level: McpLoggingLevel): boolean;
|
|
266
|
+
/**
|
|
267
|
+
* Get the current log level for a session.
|
|
268
|
+
*
|
|
269
|
+
* @param sessionId - The session to query
|
|
270
|
+
* @returns The log level, or undefined if not set
|
|
271
|
+
*/
|
|
272
|
+
getLogLevel(sessionId: string): McpLoggingLevel | undefined;
|
|
273
|
+
/**
|
|
274
|
+
* Send a log message to all sessions that have enabled the given level.
|
|
275
|
+
* Per MCP 2025-11-25 spec, this sends a 'notifications/message' notification
|
|
276
|
+
* to sessions whose configured minimum level allows this message through.
|
|
277
|
+
*
|
|
278
|
+
* @param level - The log level of this message
|
|
279
|
+
* @param loggerName - Optional logger name/component identifier
|
|
280
|
+
* @param data - The log message data (string or structured data)
|
|
281
|
+
*/
|
|
282
|
+
sendLogMessage(level: McpLoggingLevel, loggerName: string | undefined, data: unknown): void;
|
|
283
|
+
/**
|
|
284
|
+
* Send a log message to a specific session, respecting its log level.
|
|
285
|
+
*
|
|
286
|
+
* @param sessionId - The target session
|
|
287
|
+
* @param level - The log level of this message
|
|
288
|
+
* @param loggerName - Optional logger name/component identifier
|
|
289
|
+
* @param data - The log message data
|
|
290
|
+
* @returns true if the message was sent (session exists and level allows)
|
|
291
|
+
*/
|
|
292
|
+
sendLogMessageToSession(sessionId: string, level: McpLoggingLevel, loggerName: string | undefined, data: unknown): boolean;
|
|
293
|
+
/**
|
|
294
|
+
* Set client capabilities for a session.
|
|
295
|
+
* Called during initialization to store what the client supports.
|
|
296
|
+
*
|
|
297
|
+
* @param sessionId - The session to configure
|
|
298
|
+
* @param capabilities - The client's capabilities from the initialize request
|
|
299
|
+
* @returns true if the session was found and capabilities were set
|
|
300
|
+
*/
|
|
301
|
+
setClientCapabilities(sessionId: string, capabilities: ClientCapabilities): boolean;
|
|
302
|
+
/**
|
|
303
|
+
* Get client capabilities for a session.
|
|
304
|
+
*
|
|
305
|
+
* @param sessionId - The session to query
|
|
306
|
+
* @returns The client's capabilities, or undefined if not set
|
|
307
|
+
*/
|
|
308
|
+
getClientCapabilities(sessionId: string): ClientCapabilities | undefined;
|
|
309
|
+
/**
|
|
310
|
+
* Set client info for a session and auto-detect the AI platform type.
|
|
311
|
+
* Called during initialization to store who the client is.
|
|
312
|
+
* Uses the scope's platform detection configuration for custom mappings.
|
|
313
|
+
*
|
|
314
|
+
* @param sessionId - The session to configure
|
|
315
|
+
* @param clientInfo - The client's info (name/version) from the initialize request
|
|
316
|
+
* @returns The detected platform type, or undefined if the session was not found
|
|
317
|
+
*/
|
|
318
|
+
setClientInfo(sessionId: string, clientInfo: ClientInfo): AIPlatformType | undefined;
|
|
319
|
+
/**
|
|
320
|
+
* Get client info for a session.
|
|
321
|
+
*
|
|
322
|
+
* @param sessionId - The session to query
|
|
323
|
+
* @returns The client's info, or undefined if not set
|
|
324
|
+
*/
|
|
325
|
+
getClientInfo(sessionId: string): ClientInfo | undefined;
|
|
326
|
+
/**
|
|
327
|
+
* Get the detected AI platform type for a session.
|
|
328
|
+
* This is auto-detected from client info during initialization.
|
|
329
|
+
*
|
|
330
|
+
* @param sessionId - The session to query
|
|
331
|
+
* @returns The detected platform type, or 'unknown' if not detected
|
|
332
|
+
*/
|
|
333
|
+
getPlatformType(sessionId: string): AIPlatformType;
|
|
334
|
+
/**
|
|
335
|
+
* Check if a session's client supports roots listing.
|
|
336
|
+
*
|
|
337
|
+
* @param sessionId - The session to check
|
|
338
|
+
* @returns true if the client supports roots
|
|
339
|
+
*/
|
|
340
|
+
supportsRoots(sessionId: string): boolean;
|
|
341
|
+
/**
|
|
342
|
+
* List roots from the client for a session.
|
|
343
|
+
* This sends a `roots/list` request to the client and returns the roots.
|
|
344
|
+
*
|
|
345
|
+
* If the client doesn't support roots, returns an empty array.
|
|
346
|
+
* Results are cached and invalidated when `notifications/roots/list_changed` is received.
|
|
347
|
+
*
|
|
348
|
+
* @param sessionId - The session to request roots from
|
|
349
|
+
* @param options - Options for the request
|
|
350
|
+
* @param options.forceRefresh - If true, bypass the cache and fetch fresh roots
|
|
351
|
+
* @param options.timeout - Timeout in milliseconds (default: 30000)
|
|
352
|
+
* @returns Array of roots from the client
|
|
353
|
+
*/
|
|
354
|
+
listRoots(sessionId: string, options?: {
|
|
355
|
+
forceRefresh?: boolean;
|
|
356
|
+
timeout?: number;
|
|
357
|
+
}): Promise<Root[]>;
|
|
358
|
+
/**
|
|
359
|
+
* Invalidate cached roots for a session.
|
|
360
|
+
* Call this when receiving `notifications/roots/list_changed` from the client.
|
|
361
|
+
*
|
|
362
|
+
* @param sessionId - The session whose roots cache should be invalidated
|
|
363
|
+
* @returns true if the session was found and cache was invalidated
|
|
364
|
+
*/
|
|
365
|
+
invalidateRootsCache(sessionId: string): boolean;
|
|
366
|
+
/**
|
|
367
|
+
* Get the cached roots for a session without fetching from the client.
|
|
368
|
+
*
|
|
369
|
+
* @param sessionId - The session to query
|
|
370
|
+
* @returns Cached roots, or undefined if not cached
|
|
371
|
+
*/
|
|
372
|
+
getCachedRoots(sessionId: string): Root[] | undefined;
|
|
373
|
+
/**
|
|
374
|
+
* Clean up subscriptions and resources.
|
|
375
|
+
*/
|
|
376
|
+
destroy(): Promise<void>;
|
|
377
|
+
private sendNotificationToServer;
|
|
378
|
+
}
|