@1mcp/agent 0.39.0-beta.3 → 0.39.0-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/admin/assets/{admin-OAuthServicesWorkspace-D_GlqLxL.js → admin-OAuthServicesWorkspace-CKR1HA-8.js} +1 -1
- package/build/admin/assets/{admin-console-CMRxMjQo.js → admin-console-OfHKqRm-.js} +3 -3
- package/build/admin/index.html +1 -1
- package/build/auth/oauthAuthority.d.ts +149 -0
- package/build/auth/oauthAuthority.d.ts.map +1 -0
- package/build/auth/oauthAuthority.js +101 -0
- package/build/auth/oauthAuthority.js.map +1 -0
- package/build/auth/oauthAuthorizationFlow.d.ts +7 -1
- package/build/auth/oauthAuthorizationFlow.d.ts.map +1 -1
- package/build/auth/oauthAuthorizationFlow.js +60 -74
- package/build/auth/oauthAuthorizationFlow.js.map +1 -1
- package/build/auth/oauthEndpointFetch.d.ts +20 -0
- package/build/auth/oauthEndpointFetch.d.ts.map +1 -0
- package/build/auth/oauthEndpointFetch.js +246 -0
- package/build/auth/oauthEndpointFetch.js.map +1 -0
- package/build/auth/sessionTypes.d.ts +1 -1
- package/build/auth/storage/clientSessionRepository.d.ts +19 -0
- package/build/auth/storage/clientSessionRepository.d.ts.map +1 -1
- package/build/auth/storage/clientSessionRepository.js +178 -0
- package/build/auth/storage/clientSessionRepository.js.map +1 -1
- package/build/auth/storage/fileStorageService.d.ts +9 -1
- package/build/auth/storage/fileStorageService.d.ts.map +1 -1
- package/build/auth/storage/fileStorageService.js +32 -5
- package/build/auth/storage/fileStorageService.js.map +1 -1
- package/build/auth/storage/inboundOAuthStorage.d.ts +14 -0
- package/build/auth/storage/inboundOAuthStorage.d.ts.map +1 -0
- package/build/auth/storage/inboundOAuthStorage.js +29 -0
- package/build/auth/storage/inboundOAuthStorage.js.map +1 -0
- package/build/auth/storage/nativeCredentialStore.d.ts +44 -0
- package/build/auth/storage/nativeCredentialStore.d.ts.map +1 -0
- package/build/auth/storage/nativeCredentialStore.js +177 -0
- package/build/auth/storage/nativeCredentialStore.js.map +1 -0
- package/build/auth/storage/oauthStorageService.d.ts +8 -1
- package/build/auth/storage/oauthStorageService.d.ts.map +1 -1
- package/build/auth/storage/oauthStorageService.js +69 -47
- package/build/auth/storage/oauthStorageService.js.map +1 -1
- package/build/auth/storage/protectedRecordStorage.d.ts +129 -0
- package/build/auth/storage/protectedRecordStorage.d.ts.map +1 -0
- package/build/auth/storage/protectedRecordStorage.js +1139 -0
- package/build/auth/storage/protectedRecordStorage.js.map +1 -0
- package/build/auth/storage/sessionRepository.d.ts.map +1 -1
- package/build/auth/storage/sessionRepository.js +10 -0
- package/build/auth/storage/sessionRepository.js.map +1 -1
- package/build/auth/storage/upstreamOAuthStorage.d.ts +15 -0
- package/build/auth/storage/upstreamOAuthStorage.d.ts.map +1 -0
- package/build/auth/storage/upstreamOAuthStorage.js +25 -0
- package/build/auth/storage/upstreamOAuthStorage.js.map +1 -0
- package/build/auth/storage/upstreamOAuthStoragePath.d.ts +3 -0
- package/build/auth/storage/upstreamOAuthStoragePath.d.ts.map +1 -0
- package/build/auth/storage/upstreamOAuthStoragePath.js +8 -0
- package/build/auth/storage/upstreamOAuthStoragePath.js.map +1 -0
- package/build/commands/auth/exportOAuthCredentials.d.ts +9 -0
- package/build/commands/auth/exportOAuthCredentials.d.ts.map +1 -0
- package/build/commands/auth/exportOAuthCredentials.js +71 -0
- package/build/commands/auth/exportOAuthCredentials.js.map +1 -0
- package/build/commands/auth/exportUpstreamCredentials.d.ts +5 -0
- package/build/commands/auth/exportUpstreamCredentials.d.ts.map +1 -0
- package/build/commands/auth/exportUpstreamCredentials.js +6 -0
- package/build/commands/auth/exportUpstreamCredentials.js.map +1 -0
- package/build/commands/auth/index.d.ts.map +1 -1
- package/build/commands/auth/index.js +23 -1
- package/build/commands/auth/index.js.map +1 -1
- package/build/commands/inspect/inspectUtils.d.ts.map +1 -1
- package/build/commands/inspect/inspectUtils.js +2 -3
- package/build/commands/inspect/inspectUtils.js.map +1 -1
- package/build/commands/run/runUtils.js +2 -2
- package/build/commands/run/runUtils.js.map +1 -1
- package/build/commands/serve/index.d.ts +5 -0
- package/build/commands/serve/index.d.ts.map +1 -1
- package/build/commands/serve/index.js +5 -0
- package/build/commands/serve/index.js.map +1 -1
- package/build/commands/serve/serveBackground.d.ts.map +1 -1
- package/build/commands/serve/serveBackground.js +1 -0
- package/build/commands/serve/serveBackground.js.map +1 -1
- package/build/config/configLoader.d.ts.map +1 -1
- package/build/config/configLoader.js +13 -0
- package/build/config/configLoader.js.map +1 -1
- package/build/config/configManager.d.ts.map +1 -1
- package/build/config/configManager.js +44 -2
- package/build/config/configManager.js.map +1 -1
- package/build/config/configWatcher.d.ts.map +1 -1
- package/build/config/configWatcher.js +3 -1
- package/build/config/configWatcher.js.map +1 -1
- package/build/config/envProcessor.d.ts.map +1 -1
- package/build/config/envProcessor.js +3 -1
- package/build/config/envProcessor.js.map +1 -1
- package/build/config/mcpConfigManager.d.ts.map +1 -1
- package/build/config/mcpConfigManager.js +4 -1
- package/build/config/mcpConfigManager.js.map +1 -1
- package/build/config/projectConfigLoader.d.ts.map +1 -1
- package/build/config/projectConfigLoader.js +7 -0
- package/build/config/projectConfigLoader.js.map +1 -1
- package/build/constants/mcp.d.ts +1 -1
- package/build/constants/mcp.js +1 -1
- package/build/core/capabilities/asyncLoadingOrchestrator.d.ts.map +1 -1
- package/build/core/capabilities/asyncLoadingOrchestrator.js +31 -2
- package/build/core/capabilities/asyncLoadingOrchestrator.js.map +1 -1
- package/build/core/capabilities/capabilityAggregator.d.ts +3 -1
- package/build/core/capabilities/capabilityAggregator.d.ts.map +1 -1
- package/build/core/capabilities/capabilityAggregator.js +9 -2
- package/build/core/capabilities/capabilityAggregator.js.map +1 -1
- package/build/core/capabilities/capabilityCatalog.d.ts +24 -1
- package/build/core/capabilities/capabilityCatalog.d.ts.map +1 -1
- package/build/core/capabilities/capabilityCatalog.js +410 -39
- package/build/core/capabilities/capabilityCatalog.js.map +1 -1
- package/build/core/capabilities/capabilityPagination.d.ts +18 -1
- package/build/core/capabilities/capabilityPagination.d.ts.map +1 -1
- package/build/core/capabilities/capabilityPagination.js +101 -15
- package/build/core/capabilities/capabilityPagination.js.map +1 -1
- package/build/core/capabilities/capabilityVisibility.d.ts +13 -1
- package/build/core/capabilities/capabilityVisibility.d.ts.map +1 -1
- package/build/core/capabilities/capabilityVisibility.js +24 -1
- package/build/core/capabilities/capabilityVisibility.js.map +1 -1
- package/build/core/capabilities/catalogGeneration.d.ts.map +1 -1
- package/build/core/capabilities/catalogGeneration.js +20 -1
- package/build/core/capabilities/catalogGeneration.js.map +1 -1
- package/build/core/capabilities/configuredToolSnapshot.d.ts +1 -0
- package/build/core/capabilities/configuredToolSnapshot.d.ts.map +1 -1
- package/build/core/capabilities/configuredToolSnapshot.js +30 -4
- package/build/core/capabilities/configuredToolSnapshot.js.map +1 -1
- package/build/core/capabilities/lazyLoadingOrchestrator.d.ts +2 -0
- package/build/core/capabilities/lazyLoadingOrchestrator.d.ts.map +1 -1
- package/build/core/capabilities/lazyLoadingOrchestrator.js +20 -4
- package/build/core/capabilities/lazyLoadingOrchestrator.js.map +1 -1
- package/build/core/capabilities/metaToolProvider.d.ts +3 -1
- package/build/core/capabilities/metaToolProvider.d.ts.map +1 -1
- package/build/core/capabilities/metaToolProvider.js +42 -4
- package/build/core/capabilities/metaToolProvider.js.map +1 -1
- package/build/core/capabilities/runtimeCapabilityCatalog.d.ts +15 -2
- package/build/core/capabilities/runtimeCapabilityCatalog.d.ts.map +1 -1
- package/build/core/capabilities/runtimeCapabilityCatalog.js +153 -16
- package/build/core/capabilities/runtimeCapabilityCatalog.js.map +1 -1
- package/build/core/capabilities/schemaCache.d.ts.map +1 -1
- package/build/core/capabilities/schemaCache.js +41 -0
- package/build/core/capabilities/schemaCache.js.map +1 -1
- package/build/core/capabilities/schemas/metaToolSchemas.d.ts +1 -0
- package/build/core/capabilities/schemas/metaToolSchemas.d.ts.map +1 -1
- package/build/core/capabilities/schemas/metaToolSchemas.js +1 -0
- package/build/core/capabilities/schemas/metaToolSchemas.js.map +1 -1
- package/build/core/capabilities/toolRegistry.d.ts +7 -3
- package/build/core/capabilities/toolRegistry.d.ts.map +1 -1
- package/build/core/capabilities/toolRegistry.js +28 -9
- package/build/core/capabilities/toolRegistry.js.map +1 -1
- package/build/core/instructions/instructionAggregator.d.ts.map +1 -1
- package/build/core/instructions/instructionAggregator.js +3 -1
- package/build/core/instructions/instructionAggregator.js.map +1 -1
- package/build/core/instructions/templateTypes.d.ts +1 -1
- package/build/core/instructions/templateTypes.d.ts.map +1 -1
- package/build/core/instructions/templateTypes.js +3 -3
- package/build/core/loading/loadingStateTracker.d.ts.map +1 -1
- package/build/core/loading/loadingStateTracker.js +11 -2
- package/build/core/loading/loadingStateTracker.js.map +1 -1
- package/build/core/loading/mcpLoadingManager.d.ts.map +1 -1
- package/build/core/loading/mcpLoadingManager.js +6 -2
- package/build/core/loading/mcpLoadingManager.js.map +1 -1
- package/build/core/protocol/requestHandlerUtils.d.ts +2 -2
- package/build/core/protocol/requestHandlerUtils.d.ts.map +1 -1
- package/build/core/protocol/requestHandlerUtils.js +7 -4
- package/build/core/protocol/requestHandlerUtils.js.map +1 -1
- package/build/core/server/agentConfig.d.ts +1 -0
- package/build/core/server/agentConfig.d.ts.map +1 -1
- package/build/core/server/agentConfig.js +1 -0
- package/build/core/server/agentConfig.js.map +1 -1
- package/build/core/server/disabledTools.d.ts +1 -1
- package/build/core/server/disabledTools.d.ts.map +1 -1
- package/build/core/server/disabledTools.js +18 -25
- package/build/core/server/disabledTools.js.map +1 -1
- package/build/core/server/processIdentity.d.ts.map +1 -1
- package/build/core/server/processIdentity.js +67 -18
- package/build/core/server/processIdentity.js.map +1 -1
- package/build/core/server/runtimeLaunchIpc.d.ts +14 -1
- package/build/core/server/runtimeLaunchIpc.d.ts.map +1 -1
- package/build/core/server/runtimeReplacementConfig.d.ts +14 -1
- package/build/core/server/runtimeReplacementConfig.d.ts.map +1 -1
- package/build/core/server/toolDescriptionOverrides.d.ts +1 -0
- package/build/core/server/toolDescriptionOverrides.d.ts.map +1 -1
- package/build/core/server/toolDescriptionOverrides.js +30 -5
- package/build/core/server/toolDescriptionOverrides.js.map +1 -1
- package/build/core/tools/handlers/serverManagementHandler.d.ts +21 -0
- package/build/core/tools/handlers/serverManagementHandler.d.ts.map +1 -1
- package/build/core/tools/internal/adapters/helpers/configTransformers.d.ts +3 -0
- package/build/core/tools/internal/adapters/helpers/configTransformers.d.ts.map +1 -1
- package/build/core/tools/internal/schemas/discovery.d.ts +1 -1
- package/build/core/tools/internal/schemas/index.d.ts +1 -1
- package/build/core/types/transport.d.ts +25 -2
- package/build/core/types/transport.d.ts.map +1 -1
- package/build/core/types/transport.js +12 -0
- package/build/core/types/transport.js.map +1 -1
- package/build/domains/admin/configuredToolInventory.d.ts.map +1 -1
- package/build/domains/admin/configuredToolInventory.js +47 -9
- package/build/domains/admin/configuredToolInventory.js.map +1 -1
- package/build/domains/admin/runtimeConfiguredToolInspectionService.d.ts.map +1 -1
- package/build/domains/admin/runtimeConfiguredToolInspectionService.js +13 -3
- package/build/domains/admin/runtimeConfiguredToolInspectionService.js.map +1 -1
- package/build/gateway/adapters/modern/modernInboundEraAdapter.d.ts.map +1 -1
- package/build/gateway/adapters/modern/modernInboundEraAdapter.js +3 -3
- package/build/gateway/adapters/modern/modernInboundEraAdapter.js.map +1 -1
- package/build/gateway/adapters/modern/modernOutboundEraAdapter.d.ts.map +1 -1
- package/build/gateway/adapters/modern/modernOutboundEraAdapter.js +4 -0
- package/build/gateway/adapters/modern/modernOutboundEraAdapter.js.map +1 -1
- package/build/gateway/contracts/gatewayFailure.d.ts +39 -1
- package/build/gateway/contracts/gatewayFailure.d.ts.map +1 -1
- package/build/gateway/contracts/gatewayFailure.js +139 -0
- package/build/gateway/contracts/gatewayFailure.js.map +1 -1
- package/build/gateway/interactions/nativeInputResponses.d.ts +16 -0
- package/build/gateway/interactions/nativeInputResponses.d.ts.map +1 -0
- package/build/gateway/interactions/nativeInputResponses.js +76 -0
- package/build/gateway/interactions/nativeInputResponses.js.map +1 -0
- package/build/gateway/interactions/validateInteractionResponse.d.ts.map +1 -1
- package/build/gateway/interactions/validateInteractionResponse.js +20 -1
- package/build/gateway/interactions/validateInteractionResponse.js.map +1 -1
- package/build/gateway/ports/outboundEraAdapter.d.ts +2 -0
- package/build/gateway/ports/outboundEraAdapter.d.ts.map +1 -1
- package/build/logger/diagnosticRedaction.d.ts +3 -0
- package/build/logger/diagnosticRedaction.d.ts.map +1 -0
- package/build/logger/diagnosticRedaction.js +12 -0
- package/build/logger/diagnosticRedaction.js.map +1 -0
- package/build/logger/httpDiagnostics.d.ts +25 -0
- package/build/logger/httpDiagnostics.d.ts.map +1 -0
- package/build/logger/httpDiagnostics.js +125 -0
- package/build/logger/httpDiagnostics.js.map +1 -0
- package/build/logger/localDiagnosticRecord.d.ts +11 -0
- package/build/logger/localDiagnosticRecord.d.ts.map +1 -0
- package/build/logger/localDiagnosticRecord.js +9 -0
- package/build/logger/localDiagnosticRecord.js.map +1 -0
- package/build/logger/localDiagnostics.d.ts +5 -0
- package/build/logger/localDiagnostics.d.ts.map +1 -0
- package/build/logger/localDiagnostics.js +116 -0
- package/build/logger/localDiagnostics.js.map +1 -0
- package/build/logger/logger.d.ts +7 -0
- package/build/logger/logger.d.ts.map +1 -1
- package/build/logger/logger.js +14 -0
- package/build/logger/logger.js.map +1 -1
- package/build/observability/events/registry.d.ts +163 -49
- package/build/observability/events/registry.d.ts.map +1 -1
- package/build/observability/events/registry.js +136 -49
- package/build/observability/events/registry.js.map +1 -1
- package/build/observability/privacy/fields.d.ts +3 -1
- package/build/observability/privacy/fields.d.ts.map +1 -1
- package/build/observability/privacy/fields.js +23 -0
- package/build/observability/privacy/fields.js.map +1 -1
- package/build/sdk/contracts/catalogCoverageInvalidation.d.ts +4 -0
- package/build/sdk/contracts/catalogCoverageInvalidation.d.ts.map +1 -0
- package/build/sdk/contracts/catalogCoverageInvalidation.js +13 -0
- package/build/sdk/contracts/catalogCoverageInvalidation.js.map +1 -0
- package/build/sdk/contracts/mcpParamHeaders.d.ts +17 -0
- package/build/sdk/contracts/mcpParamHeaders.d.ts.map +1 -0
- package/build/sdk/contracts/mcpParamHeaders.js +134 -0
- package/build/sdk/contracts/mcpParamHeaders.js.map +1 -0
- package/build/sdk/contracts/requestProgress.d.ts +29 -0
- package/build/sdk/contracts/requestProgress.d.ts.map +1 -0
- package/build/sdk/contracts/requestProgress.js +126 -0
- package/build/sdk/contracts/requestProgress.js.map +1 -0
- package/build/sdk/legacy/auth/sdkOAuthClientProvider.d.ts +77 -84
- package/build/sdk/legacy/auth/sdkOAuthClientProvider.d.ts.map +1 -1
- package/build/sdk/legacy/auth/sdkOAuthClientProvider.js +632 -209
- package/build/sdk/legacy/auth/sdkOAuthClientProvider.js.map +1 -1
- package/build/sdk/legacy/auth/sdkOAuthServerProvider.d.ts.map +1 -1
- package/build/sdk/legacy/auth/sdkOAuthServerProvider.js +25 -7
- package/build/sdk/legacy/auth/sdkOAuthServerProvider.js.map +1 -1
- package/build/sdk/legacy/client/runtime/clientManager.d.ts +5 -1
- package/build/sdk/legacy/client/runtime/clientManager.d.ts.map +1 -1
- package/build/sdk/legacy/client/runtime/clientManager.js +213 -6
- package/build/sdk/legacy/client/runtime/clientManager.js.map +1 -1
- package/build/sdk/legacy/client/runtime/connectionHandler.d.ts.map +1 -1
- package/build/sdk/legacy/client/runtime/connectionHandler.js +70 -4
- package/build/sdk/legacy/client/runtime/connectionHandler.js.map +1 -1
- package/build/sdk/legacy/client/runtime/legacyInteractionLease.d.ts +2 -1
- package/build/sdk/legacy/client/runtime/legacyInteractionLease.d.ts.map +1 -1
- package/build/sdk/legacy/client/runtime/legacyInteractionLease.js +11 -2
- package/build/sdk/legacy/client/runtime/legacyInteractionLease.js.map +1 -1
- package/build/sdk/legacy/client/runtime/legacySdkClientAdapter.d.ts.map +1 -1
- package/build/sdk/legacy/client/runtime/legacySdkClientAdapter.js +28 -2
- package/build/sdk/legacy/client/runtime/legacySdkClientAdapter.js.map +1 -1
- package/build/sdk/legacy/client/runtime/mcpParamHeaders.d.ts +2 -0
- package/build/sdk/legacy/client/runtime/mcpParamHeaders.d.ts.map +1 -0
- package/build/sdk/legacy/client/runtime/mcpParamHeaders.js +2 -0
- package/build/sdk/legacy/client/runtime/mcpParamHeaders.js.map +1 -0
- package/build/sdk/legacy/client/runtime/modernSdkClientAdapter.d.ts +6 -0
- package/build/sdk/legacy/client/runtime/modernSdkClientAdapter.d.ts.map +1 -1
- package/build/sdk/legacy/client/runtime/modernSdkClientAdapter.js +117 -6
- package/build/sdk/legacy/client/runtime/modernSdkClientAdapter.js.map +1 -1
- package/build/sdk/legacy/client/runtime/oauthFlowHandler.d.ts +1 -1
- package/build/sdk/legacy/client/runtime/oauthFlowHandler.d.ts.map +1 -1
- package/build/sdk/legacy/client/runtime/oauthFlowHandler.js +68 -16
- package/build/sdk/legacy/client/runtime/oauthFlowHandler.js.map +1 -1
- package/build/sdk/legacy/commands/serve.d.ts +1 -0
- package/build/sdk/legacy/commands/serve.d.ts.map +1 -1
- package/build/sdk/legacy/commands/serve.js +28 -2
- package/build/sdk/legacy/commands/serve.js.map +1 -1
- package/build/sdk/legacy/server/protocol/notificationHandlers.d.ts.map +1 -1
- package/build/sdk/legacy/server/protocol/notificationHandlers.js +2 -6
- package/build/sdk/legacy/server/protocol/notificationHandlers.js.map +1 -1
- package/build/sdk/legacy/server/protocol/privateInteractionConnection.d.ts +1 -1
- package/build/sdk/legacy/server/protocol/privateInteractionConnection.d.ts.map +1 -1
- package/build/sdk/legacy/server/protocol/privateInteractionConnection.js +31 -11
- package/build/sdk/legacy/server/protocol/privateInteractionConnection.js.map +1 -1
- package/build/sdk/legacy/server/protocol/promptRequestHandlers.d.ts.map +1 -1
- package/build/sdk/legacy/server/protocol/promptRequestHandlers.js +4 -4
- package/build/sdk/legacy/server/protocol/promptRequestHandlers.js.map +1 -1
- package/build/sdk/legacy/server/protocol/requestInteractionScope.d.ts.map +1 -1
- package/build/sdk/legacy/server/protocol/requestInteractionScope.js +62 -10
- package/build/sdk/legacy/server/protocol/requestInteractionScope.js.map +1 -1
- package/build/sdk/legacy/server/protocol/requestProviderProgress.d.ts +8 -0
- package/build/sdk/legacy/server/protocol/requestProviderProgress.d.ts.map +1 -0
- package/build/sdk/legacy/server/protocol/requestProviderProgress.js +29 -0
- package/build/sdk/legacy/server/protocol/requestProviderProgress.js.map +1 -0
- package/build/sdk/legacy/server/protocol/resourceRequestHandlers.d.ts.map +1 -1
- package/build/sdk/legacy/server/protocol/resourceRequestHandlers.js +20 -2
- package/build/sdk/legacy/server/protocol/resourceRequestHandlers.js.map +1 -1
- package/build/sdk/legacy/server/protocol/toolRequestHandlers.d.ts.map +1 -1
- package/build/sdk/legacy/server/protocol/toolRequestHandlers.js +151 -60
- package/build/sdk/legacy/server/protocol/toolRequestHandlers.js.map +1 -1
- package/build/sdk/legacy/server/retained-sdk/LICENSE +21 -0
- package/build/sdk/legacy/server/retained-sdk/provenance.json +17 -0
- package/build/sdk/legacy/server/retained-sdk/streamableHttp.js +160 -0
- package/build/sdk/legacy/server/retained-sdk/webStandardStreamableHttp.js +950 -0
- package/build/sdk/legacy/server/runtime/clientInstancePool.d.ts.map +1 -1
- package/build/sdk/legacy/server/runtime/clientInstancePool.js +34 -6
- package/build/sdk/legacy/server/runtime/clientInstancePool.js.map +1 -1
- package/build/sdk/legacy/server/runtime/mcpLoggingEnhancer.d.ts.map +1 -1
- package/build/sdk/legacy/server/runtime/mcpLoggingEnhancer.js +4 -2
- package/build/sdk/legacy/server/runtime/mcpLoggingEnhancer.js.map +1 -1
- package/build/sdk/legacy/server/runtime/serverManager.d.ts.map +1 -1
- package/build/sdk/legacy/server/runtime/serverManager.js +3 -1
- package/build/sdk/legacy/server/runtime/serverManager.js.map +1 -1
- package/build/sdk/legacy/server/runtime/templateServerManager.d.ts.map +1 -1
- package/build/sdk/legacy/server/runtime/templateServerManager.js +32 -7
- package/build/sdk/legacy/server/runtime/templateServerManager.js.map +1 -1
- package/build/sdk/legacy/server/streamableHttp.js +1 -1
- package/build/sdk/legacy/shared/resourceTemplateRouting.d.ts.map +1 -1
- package/build/sdk/legacy/shared/resourceTemplateRouting.js +29 -11
- package/build/sdk/legacy/shared/resourceTemplateRouting.js.map +1 -1
- package/build/sdk/legacy/transport/http/middlewares/scopeAuthMiddleware.d.ts.map +1 -1
- package/build/sdk/legacy/transport/http/middlewares/scopeAuthMiddleware.js +12 -1
- package/build/sdk/legacy/transport/http/middlewares/scopeAuthMiddleware.js.map +1 -1
- package/build/sdk/legacy/transport/http/modernInboundLegacyBridge.d.ts +4 -0
- package/build/sdk/legacy/transport/http/modernInboundLegacyBridge.d.ts.map +1 -1
- package/build/sdk/legacy/transport/http/modernInboundLegacyBridge.js +11 -0
- package/build/sdk/legacy/transport/http/modernInboundLegacyBridge.js.map +1 -1
- package/build/sdk/legacy/transport/http/server.d.ts.map +1 -1
- package/build/sdk/legacy/transport/http/server.js +16 -2
- package/build/sdk/legacy/transport/http/server.js.map +1 -1
- package/build/sdk/legacy/transport/transportFactory.d.ts.map +1 -1
- package/build/sdk/legacy/transport/transportFactory.js +34 -12
- package/build/sdk/legacy/transport/transportFactory.js.map +1 -1
- package/build/transport/http/middlewares/httpRequestLogger.d.ts +4 -2
- package/build/transport/http/middlewares/httpRequestLogger.d.ts.map +1 -1
- package/build/transport/http/middlewares/httpRequestLogger.js +135 -16
- package/build/transport/http/middlewares/httpRequestLogger.js.map +1 -1
- package/build/transport/http/routes/cliTokenRoute.d.ts.map +1 -1
- package/build/transport/http/routes/cliTokenRoute.js +1 -0
- package/build/transport/http/routes/cliTokenRoute.js.map +1 -1
- package/build/transport/http/routes/healthRoutes.d.ts +11 -1
- package/build/transport/http/routes/healthRoutes.d.ts.map +1 -1
- package/build/transport/http/routes/healthRoutes.js +6 -2
- package/build/transport/http/routes/healthRoutes.js.map +1 -1
- package/build/transport/http/routes/inspectHelpers.d.ts.map +1 -1
- package/build/transport/http/routes/inspectHelpers.js +4 -3
- package/build/transport/http/routes/inspectHelpers.js.map +1 -1
- package/build/transport/http/routes/modernHttpRoutes.d.ts +4 -0
- package/build/transport/http/routes/modernHttpRoutes.d.ts.map +1 -1
- package/build/transport/http/routes/modernHttpRoutes.js +168 -24
- package/build/transport/http/routes/modernHttpRoutes.js.map +1 -1
- package/build/transport/http/routes/modernInteractionBinding.d.ts +2 -1
- package/build/transport/http/routes/modernInteractionBinding.d.ts.map +1 -1
- package/build/transport/http/routes/modernInteractionBinding.js +7 -4
- package/build/transport/http/routes/modernInteractionBinding.js.map +1 -1
- package/build/transport/http/routes/modernToolHeaderRegistry.d.ts +16 -0
- package/build/transport/http/routes/modernToolHeaderRegistry.d.ts.map +1 -0
- package/build/transport/http/routes/modernToolHeaderRegistry.js +161 -0
- package/build/transport/http/routes/modernToolHeaderRegistry.js.map +1 -0
- package/build/transport/http/routes/oauthRoutes.d.ts.map +1 -1
- package/build/transport/http/routes/oauthRoutes.js +6 -3
- package/build/transport/http/routes/oauthRoutes.js.map +1 -1
- package/build/transport/http/routes/toolRoutes.d.ts.map +1 -1
- package/build/transport/http/routes/toolRoutes.js +18 -2
- package/build/transport/http/routes/toolRoutes.js.map +1 -1
- package/build/utils/core/parsing.d.ts +2 -0
- package/build/utils/core/parsing.d.ts.map +1 -1
- package/build/utils/core/parsing.js +19 -0
- package/build/utils/core/parsing.js.map +1 -1
- package/build/utils/core/resourceUris.d.ts +6 -0
- package/build/utils/core/resourceUris.d.ts.map +1 -0
- package/build/utils/core/resourceUris.js +104 -0
- package/build/utils/core/resourceUris.js.map +1 -0
- package/build/utils/core/toolNames.d.ts +8 -0
- package/build/utils/core/toolNames.d.ts.map +1 -0
- package/build/utils/core/toolNames.js +56 -0
- package/build/utils/core/toolNames.js.map +1 -0
- package/package.json +68 -64
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { acquireRuntimeCapabilityCatalog } from '../../../../core/capabilities/runtimeCapabilityCatalog.js';
|
|
1
|
+
import { acquireRuntimeCapabilityCatalog, isIssuedRuntimeResourceEntry, } from '../../../../core/capabilities/runtimeCapabilityCatalog.js';
|
|
2
2
|
import { getRequestSession, resolveCapabilityVisibility } from '../../../../core/protocol/requestHandlerUtils.js';
|
|
3
|
+
import { createGatewayFailure } from '../../../../gateway/contracts/gatewayFailure.js';
|
|
4
|
+
import { withSelectedNativeInputResponses } from '../../../../gateway/interactions/nativeInputResponses.js';
|
|
3
5
|
import { RESPONSE_JSON_VALUE_LIMITS } from '../../../contracts/index.js';
|
|
4
6
|
import { requestLegacyOutbound, } from '../../client/runtime/legacyOutboundConnection.js';
|
|
5
7
|
import { revalidateLegacyRequestAuthInfo } from '../auth/requestAuthRevalidation.js';
|
|
@@ -8,6 +10,7 @@ import { projectResourceUri, resolveResourceRoute } from '../../shared/resourceT
|
|
|
8
10
|
import { ListResourcesRequestSchema, ListResourceTemplatesRequestSchema, ReadResourceRequestSchema, SubscribeRequestSchema, UnsubscribeRequestSchema, } from '../../types.js';
|
|
9
11
|
import { withErrorHandling } from '../../../../utils/core/errorHandling.js';
|
|
10
12
|
import { withPrivateInteractionConnection } from './privateInteractionConnection.js';
|
|
13
|
+
import { withProviderRequestProgress } from './requestProviderProgress.js';
|
|
11
14
|
import { bindOwnedCatalogConnections, bindOwnedNotificationAuthorization, subscribeOwnedResource, unsubscribeOwnedResource, } from './resourceSubscriptions.js';
|
|
12
15
|
export function registerResourceHandlers(outboundConns, inboundConn) {
|
|
13
16
|
const acquire = (cursor, kind = 'resources') => acquireRuntimeCapabilityCatalog(outboundConns, resolveCapabilityVisibility(outboundConns, inboundConn, getRequestSession(inboundConn), 'resources'), { continuation: cursor ? { kind, cursor, enablePagination: inboundConn.enablePagination ?? false } : undefined });
|
|
@@ -55,7 +58,22 @@ export function registerResourceHandlers(outboundConns, inboundConn) {
|
|
|
55
58
|
server.setRequestHandler(ReadResourceRequestSchema, withErrorHandling(async (request, extra) => {
|
|
56
59
|
const snapshot = await acquire();
|
|
57
60
|
const route = resolveResourceRoute(snapshot, request.params.uri);
|
|
58
|
-
const
|
|
61
|
+
const assertResourceCurrent = () => {
|
|
62
|
+
// A private lease can wait past handle expiry or owner revocation.
|
|
63
|
+
try {
|
|
64
|
+
const current = resolveResourceRoute(snapshot, request.params.uri);
|
|
65
|
+
if (current.entry === route.entry &&
|
|
66
|
+
current.connection === route.connection &&
|
|
67
|
+
current.upstreamIdentity === route.upstreamIdentity)
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
catch {
|
|
71
|
+
// Report only the trusted boundary failure, without the caller's URI.
|
|
72
|
+
}
|
|
73
|
+
throw createGatewayFailure({ kind: 'protocol', code: '-32602', message: 'Resource route is unavailable' });
|
|
74
|
+
};
|
|
75
|
+
const { _meta: _callerMeta, ...params } = request.params;
|
|
76
|
+
const result = await withProviderRequestProgress(outboundConns, route.connection, route.entry, extra, request.params._meta?.progressToken, () => withPrivateInteractionConnection(route.connection, inboundConn, extra, route.entry, (selected) => withSelectedNativeInputResponses(request.params.uri, 'resources/read', selected.adapter, route.upstreamIdentity, () => requestLegacyOutbound(selected, 'resources/read', { ...params, uri: route.upstreamIdentity })), assertResourceCurrent, isIssuedRuntimeResourceEntry(route.entry) ? route.entry : undefined), assertResourceCurrent);
|
|
59
77
|
return {
|
|
60
78
|
...result,
|
|
61
79
|
contents: result.contents.map((content) => ({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resourceRequestHandlers.js","sourceRoot":"","sources":["../../../../../src/sdk/legacy/server/protocol/resourceRequestHandlers.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"resourceRequestHandlers.js","sourceRoot":"","sources":["../../../../../src/sdk/legacy/server/protocol/resourceRequestHandlers.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,+BAA+B,EAC/B,4BAA4B,GAC7B,MAAM,oDAAoD,CAAC;AAC5D,OAAO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AChB,KAAK,CAAC,KAAK,EACX,KAAK,EACL,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,aAAa,EACnC,GAAG,EAAE,CACH,gCAAgC,CAC9B,KAAK,CAAC,UAAU,EAChB,WAAW,EACX,KAAK,EACL,KAAK,CAAC,KAAK,EACX,CAAC,QAAQ,EAAE,EAAE,CACX,gCAAgC,CAC9B,OAAO,CAAC,MAAM,CAAC,GAAG,EAClB,gBAAgB,EAChB,QAAQ,CAAC,OAAO,EAChB,KAAK,CAAC,gBAAgB,EACtB,GAAG,EAAE,CACH,qBAAqB,CACnB,QAAQ,EACR,gBAAgB,EAChB,EAAE,GAAG,MAAM,EAAE,GAAG,EAAE,KAAK,CAAC,gBAAgB,EAAE,CAC3C,CACJ,EACH,qBAAqB,EACrB,4BAA4B,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CACpE,EACH,qBAAqB,CACtB,CAAC;QACF,OAAO;YACL,GAAG,MAAM;YACT,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;gBAC1C,GAAG,OAAO;gBACV,GAAG,EAAE,kBAAkB,CAAC,QAAQ,EAAE,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,aAAa,EAAE,OAAO,CAAC,GAAG,CAAC;aAChF,CAAC,CAAC;SACJ,CAAC;IACJ,CAAC,EAAE,wBAAwB,CAAC,CAC7B,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toolRequestHandlers.d.ts","sourceRoot":"","sources":["../../../../../src/sdk/legacy/server/protocol/toolRequestHandlers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"toolRequestHandlers.d.ts","sourceRoot":"","sources":["../../../../../src/sdk/legacy/server/protocol/toolRequestHandlers.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,uBAAuB,EAAE,MAAM,mDAAmD,CAAC;AAe5F,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAO7D,OAAO,EAAE,KAAK,yBAAyB,EAAE,MAAM,4DAA4D,CAAC;AAiB5G,wBAAgB,oBAAoB,CAClC,aAAa,EAAE,yBAAyB,EACxC,WAAW,EAAE,iBAAiB,EAC9B,uBAAuB,CAAC,EAAE,uBAAuB,GAChD,IAAI,CAiSN"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { randomUUID } from 'node:crypto';
|
|
1
2
|
import { getConfiguredServerTargets } from '../../../../config/configuredServerTargets.js';
|
|
2
3
|
import { InternalCapabilitiesProvider } from '../../../../core/capabilities/internalCapabilitiesProvider.js';
|
|
3
4
|
import { acquireRuntimeCapabilityCatalog, } from '../../../../core/capabilities/runtimeCapabilityCatalog.js';
|
|
@@ -8,13 +9,17 @@ import { getRequestSession, resolveCapabilityVisibility, resolveLazyCapabilityVi
|
|
|
8
9
|
import { getDisabledSourceToolError } from '../../../../core/server/disabledTools.js';
|
|
9
10
|
import { withRuntimeAdmission } from '../../../../core/server/runtimeDrain.js';
|
|
10
11
|
import { SchemaBoundaryError } from '../../../../core/validation/schemaBoundary.js';
|
|
11
|
-
import {
|
|
12
|
+
import { withSelectedNativeInputResponses } from '../../../../gateway/interactions/nativeInputResponses.js';
|
|
13
|
+
import { writeLocalDiagnostic } from '../../../../logger/localDiagnostics.js';
|
|
14
|
+
import { ownData } from '../../../../observability/privacy/fields.js';
|
|
15
|
+
import { ErrorCode, RESPONSE_JSON_VALUE_LIMITS, toJsonValue } from '../../../contracts/index.js';
|
|
12
16
|
import { revalidateLegacyRequestAuthInfo } from '../auth/requestAuthRevalidation.js';
|
|
13
17
|
import { getLegacyInboundServer } from '../runtime/legacyInboundConnection.js';
|
|
14
18
|
import { canonicalBridgeToolRegistrar, projectCanonicalToolResult, projectLegacyTool, projectLegacyToolResult, projectLegacyTools, } from '../../shared/schemaProjection.js';
|
|
15
19
|
import { CallToolRequestSchema, ListToolsRequestSchema } from '../../types.js';
|
|
16
20
|
import { withErrorHandling } from '../../../../utils/core/errorHandling.js';
|
|
17
21
|
import { withPrivateInteractionConnection } from './privateInteractionConnection.js';
|
|
22
|
+
import { withProviderRequestProgress } from './requestProviderProgress.js';
|
|
18
23
|
import { bindOwnedCatalogConnections, bindOwnedNotificationAuthorization } from './resourceSubscriptions.js';
|
|
19
24
|
export function registerToolHandlers(outboundConns, inboundConn, lazyLoadingOrchestrator) {
|
|
20
25
|
const sessionId = getRequestSession(inboundConn);
|
|
@@ -49,7 +54,7 @@ export function registerToolHandlers(outboundConns, inboundConn, lazyLoadingOrch
|
|
|
49
54
|
}
|
|
50
55
|
: undefined,
|
|
51
56
|
});
|
|
52
|
-
return { snapshot, visibility, provider, serverConfigs };
|
|
57
|
+
return { snapshot, visibility: resolved, provider, serverConfigs };
|
|
53
58
|
};
|
|
54
59
|
const server = getLegacyInboundServer(inboundConn);
|
|
55
60
|
server.setRequestHandler(ListToolsRequestSchema, withErrorHandling(withRuntimeAdmission(async (request, extra) => {
|
|
@@ -80,70 +85,156 @@ export function registerToolHandlers(outboundConns, inboundConn, lazyLoadingOrch
|
|
|
80
85
|
? canonicalBridgeToolRegistrar(server)
|
|
81
86
|
: server.setRequestHandler.bind(server);
|
|
82
87
|
registerToolCall(CallToolRequestSchema, withErrorHandling(withRuntimeAdmission(async (request, extra) => {
|
|
83
|
-
const
|
|
84
|
-
const
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
88
|
+
const startedAt = performance.now();
|
|
89
|
+
const requested = { callId: randomUUID(), requestedTool: request.params.name };
|
|
90
|
+
let diagnosticRoute = requested;
|
|
91
|
+
let phase = 'capability_acquisition';
|
|
92
|
+
const reportFailure = (error) => {
|
|
93
|
+
const fields = () => {
|
|
94
|
+
const code = ownData(error, 'code');
|
|
95
|
+
const failureKind = ownData(error, 'kind') ?? ownData(ownData(error, 'data'), 'kind');
|
|
96
|
+
let outcome = 'failed';
|
|
97
|
+
if (extra?.signal?.aborted || failureKind === 'cancelled')
|
|
98
|
+
outcome = 'cancelled';
|
|
99
|
+
else if (code === ErrorCode.RequestTimeout ||
|
|
100
|
+
code === 'schema_evaluation_timeout' ||
|
|
101
|
+
failureKind === 'deadline-exceeded')
|
|
102
|
+
outcome = 'timeout';
|
|
103
|
+
else if (typeof code === 'string' && code.startsWith('schema_'))
|
|
104
|
+
outcome = 'validation_failed';
|
|
105
|
+
return { ...diagnosticRoute, phase, outcome, error, durationMs: performance.now() - startedAt };
|
|
106
|
+
};
|
|
107
|
+
writeLocalDiagnostic('warn', 'tool.failed', fields);
|
|
108
|
+
writeLocalDiagnostic('debug', 'tool.failure-details', fields);
|
|
109
|
+
};
|
|
110
|
+
writeLocalDiagnostic('info', 'tool.requested', requested);
|
|
111
|
+
writeLocalDiagnostic('debug', 'tool.arguments', () => ({ ...requested, arguments: request.params.arguments }));
|
|
94
112
|
try {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
113
|
+
const args = request.params.arguments;
|
|
114
|
+
const toolListContinuation = lazy &&
|
|
115
|
+
request.params.name === 'tool_list' &&
|
|
116
|
+
args &&
|
|
117
|
+
typeof args === 'object' &&
|
|
118
|
+
typeof args.cursor === 'string';
|
|
119
|
+
const { snapshot, visibility, provider, serverConfigs } = await acquire(undefined, extra?.signal, {
|
|
120
|
+
upstream: !toolListContinuation,
|
|
121
|
+
});
|
|
122
|
+
phase = 'routing';
|
|
123
|
+
const resolved = snapshot.resolve('tools', request.params.name);
|
|
124
|
+
if (!resolved) {
|
|
125
|
+
const entry = snapshot.generation.resolve('tools', request.params.name);
|
|
126
|
+
const error = entry && getDisabledSourceToolError(serverConfigs, entry.route.server, entry.route.upstreamIdentity);
|
|
127
|
+
if (error) {
|
|
128
|
+
writeLocalDiagnostic('warn', 'tool.rejected', () => ({
|
|
129
|
+
...diagnosticRoute,
|
|
130
|
+
phase,
|
|
131
|
+
outcome: 'disabled',
|
|
132
|
+
durationMs: performance.now() - startedAt,
|
|
133
|
+
}));
|
|
134
|
+
return structuredToolResult({ error });
|
|
135
|
+
}
|
|
136
|
+
throw new Error(`Unknown tool: ${request.params.name}`);
|
|
137
|
+
}
|
|
138
|
+
diagnosticRoute = {
|
|
139
|
+
...requested,
|
|
140
|
+
server: resolved.entry.route.server,
|
|
141
|
+
tool: resolved.entry.route.upstreamIdentity,
|
|
142
|
+
origin: resolved.entry.route.origin,
|
|
143
|
+
routingScope: sessionId ? 'session' : 'default',
|
|
144
|
+
timeoutMs: resolved.connection?.requestTimeoutMs,
|
|
145
|
+
};
|
|
146
|
+
writeLocalDiagnostic('info', 'tool.routed', diagnosticRoute);
|
|
147
|
+
const adapter = resolved.connection?.adapter;
|
|
148
|
+
phase = 'input_validation';
|
|
149
|
+
let validateOutput;
|
|
150
|
+
try {
|
|
151
|
+
validateOutput = await snapshot.prepareToolCall(request.params.name, request.params.arguments, extra?.signal);
|
|
152
|
+
}
|
|
153
|
+
catch (error) {
|
|
154
|
+
if (error instanceof SchemaBoundaryError && error.code === 'schema_input_invalid') {
|
|
155
|
+
reportFailure(error);
|
|
156
|
+
const route = resolved.entry.route;
|
|
157
|
+
if (route.origin === 'internal' && route.connectionKey === '\0app.1mcp/meta-tools') {
|
|
158
|
+
const detail = { type: 'validation', message: error.code };
|
|
159
|
+
switch (route.upstreamIdentity) {
|
|
160
|
+
case 'tool_list':
|
|
161
|
+
return structuredToolResult({
|
|
162
|
+
tools: [],
|
|
163
|
+
totalCount: 0,
|
|
164
|
+
servers: [],
|
|
165
|
+
hasMore: false,
|
|
166
|
+
error: detail,
|
|
167
|
+
});
|
|
168
|
+
case 'tool_schema':
|
|
169
|
+
return structuredToolResult({ schema: {}, error: detail });
|
|
170
|
+
case 'tool_invoke':
|
|
171
|
+
return structuredToolResult({ result: {}, server: '', tool: '', error: detail });
|
|
172
|
+
}
|
|
109
173
|
}
|
|
174
|
+
return { isError: true, content: [{ type: 'text', text: error.code }] };
|
|
110
175
|
}
|
|
111
|
-
|
|
176
|
+
throw error;
|
|
112
177
|
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
178
|
+
const finish = async (result) => {
|
|
179
|
+
phase = 'output_validation';
|
|
180
|
+
await validateOutput(result);
|
|
181
|
+
phase = 'result_projection';
|
|
182
|
+
const projected = (inboundConn.canonicalSchemaProjection ? projectCanonicalToolResult : projectLegacyToolResult)(result, resolved.entry.sourceObject.outputSchema);
|
|
183
|
+
writeLocalDiagnostic('info', 'tool.completed', () => ({
|
|
184
|
+
...diagnosticRoute,
|
|
185
|
+
outcome: ownData(result, 'isError') === true ? 'upstream_error' : 'success',
|
|
186
|
+
durationMs: performance.now() - startedAt,
|
|
187
|
+
}));
|
|
188
|
+
writeLocalDiagnostic('debug', 'tool.result', () => ({ ...diagnosticRoute, result }));
|
|
189
|
+
return projected;
|
|
190
|
+
};
|
|
191
|
+
phase = 'routing_revalidation';
|
|
192
|
+
if (extra?.signal?.aborted)
|
|
193
|
+
throw new SchemaBoundaryError('schema_evaluation_unavailable', true);
|
|
194
|
+
const { route } = resolved.entry;
|
|
195
|
+
validateOutput.assertCurrent();
|
|
196
|
+
if (route.origin === 'internal') {
|
|
197
|
+
phase = 'internal';
|
|
198
|
+
if (lazyLoadingOrchestrator && route.connectionKey === '\0app.1mcp/meta-tools') {
|
|
199
|
+
return await finish(structuredToolResult(await lazyLoadingOrchestrator.callMetaTool(route.upstreamIdentity, request.params.arguments, visibility, extra?.signal,
|
|
200
|
+
// This request already enumerated its visible backends; answer from that
|
|
201
|
+
// snapshot rather than a shared registry that may be stale or partial.
|
|
202
|
+
toolListContinuation ? undefined : ToolRegistry.fromCapabilitySnapshot(snapshot))));
|
|
203
|
+
}
|
|
204
|
+
return await finish(structuredToolResult(await provider.executeTool(route.upstreamIdentity, request.params.arguments, lazy ? visibility : undefined)));
|
|
205
|
+
}
|
|
206
|
+
if (!resolved.connection)
|
|
207
|
+
throw new Error(`Server not connected: ${route.server}`);
|
|
208
|
+
const connection = resolved.connection;
|
|
209
|
+
if (connection.adapter !== adapter || !snapshot.isCurrent())
|
|
210
|
+
throw new SchemaBoundaryError('schema_evaluation_unavailable', true);
|
|
211
|
+
const disabled = getDisabledSourceToolError(getConfiguredServerTargets(), route.server, route.upstreamIdentity);
|
|
212
|
+
if (disabled) {
|
|
213
|
+
writeLocalDiagnostic('warn', 'tool.rejected', () => ({
|
|
214
|
+
...diagnosticRoute,
|
|
215
|
+
phase,
|
|
216
|
+
outcome: 'disabled',
|
|
217
|
+
durationMs: performance.now() - startedAt,
|
|
218
|
+
}));
|
|
219
|
+
return structuredToolResult({ error: disabled });
|
|
129
220
|
}
|
|
130
|
-
|
|
221
|
+
phase = 'upstream';
|
|
222
|
+
return await finish(await withProviderRequestProgress(outboundConns, connection, resolved.entry, extra, request.params._meta?.progressToken, () => withPrivateInteractionConnection(connection, inboundConn, extra, resolved.entry, (selected) => {
|
|
223
|
+
const selectedAdapter = selected.adapter;
|
|
224
|
+
diagnosticRoute = { ...diagnosticRoute, timeoutMs: selected.requestTimeoutMs };
|
|
225
|
+
writeLocalDiagnostic('debug', 'tool.dispatch', () => ({ ...diagnosticRoute, phase }));
|
|
226
|
+
return withSelectedNativeInputResponses(request.params.name, 'tools/call', selectedAdapter, route.upstreamIdentity, () => executeWithPostAuthOAuthRecovery(route.server, selected, () => requestLegacyAdapter(selectedAdapter, 'tools/call', toJsonValue({
|
|
227
|
+
name: route.upstreamIdentity,
|
|
228
|
+
...(request.params.arguments === undefined
|
|
229
|
+
? {}
|
|
230
|
+
: { arguments: request.params.arguments }),
|
|
231
|
+
}), { signal: extra?.signal, timeoutMs: selected.requestTimeoutMs })));
|
|
232
|
+
}, validateOutput.assertCurrent), validateOutput.assertCurrent));
|
|
233
|
+
}
|
|
234
|
+
catch (error) {
|
|
235
|
+
reportFailure(error);
|
|
236
|
+
throw error;
|
|
131
237
|
}
|
|
132
|
-
if (!resolved.connection)
|
|
133
|
-
throw new Error(`Server not connected: ${route.server}`);
|
|
134
|
-
const connection = resolved.connection;
|
|
135
|
-
if (connection.adapter !== adapter || !snapshot.isCurrent())
|
|
136
|
-
throw new SchemaBoundaryError('schema_evaluation_unavailable', true);
|
|
137
|
-
const disabled = getDisabledSourceToolError(getConfiguredServerTargets(), route.server, route.upstreamIdentity);
|
|
138
|
-
if (disabled)
|
|
139
|
-
return structuredToolResult({ error: disabled });
|
|
140
|
-
return finish(await withPrivateInteractionConnection(connection, inboundConn, extra, resolved.entry, (selected) => {
|
|
141
|
-
const selectedAdapter = selected.adapter;
|
|
142
|
-
return executeWithPostAuthOAuthRecovery(route.server, selected, () => requestLegacyAdapter(selectedAdapter, 'tools/call', toJsonValue({
|
|
143
|
-
name: route.upstreamIdentity,
|
|
144
|
-
...(request.params.arguments === undefined ? {} : { arguments: request.params.arguments }),
|
|
145
|
-
}), { signal: extra?.signal, timeoutMs: selected.requestTimeoutMs }));
|
|
146
|
-
}, validateOutput.assertCurrent));
|
|
147
238
|
}), 'Error calling tool'));
|
|
148
239
|
}
|
|
149
240
|
function structuredToolResult(result) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toolRequestHandlers.js","sourceRoot":"","sources":["../../../../../src/sdk/legacy/server/protocol/toolRequestHandlers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,wCAAwC,CAAC;AACpF,OAAO,EAAE,4BAA4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
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"package": "@modelcontextprotocol/sdk",
|
|
3
|
+
"version": "1.30.0",
|
|
4
|
+
"patchSha256": "75c775371ba4b626db950c68d95331c6e8c9a3949d551aba01d9d1332cb82937",
|
|
5
|
+
"transformation": "public-import-specifiers-and-source-map-trailer-only",
|
|
6
|
+
"files": {
|
|
7
|
+
"streamableHttp.js": {
|
|
8
|
+
"sourceSha256": "e811d93af3f5e62497cf208ce162761c64cfd1c79fc4a0d8c77be59e0a77360b",
|
|
9
|
+
"generatedSha256": "798ec0d7cc9db09084327cebe8ef46c4604472184b60fc972a0be2962a9480ab"
|
|
10
|
+
},
|
|
11
|
+
"webStandardStreamableHttp.js": {
|
|
12
|
+
"sourceSha256": "c4e3e9fab26e2a7dad55b4bba9598d7bb444f5f19fdef38b1a4982278e37174c",
|
|
13
|
+
"generatedSha256": "8213b814fd01f1c21711ad306c55a4938c0268d9bfd2c1ef60286992b99aa1dd"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"licenseSha256": "5e13dbbc1d120fc2a03cecde7c91424ae2d7de11b63d58ded2f4431e261ee50d"
|
|
17
|
+
}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Node.js HTTP Streamable HTTP Server Transport
|
|
3
|
+
*
|
|
4
|
+
* This is a thin wrapper around `WebStandardStreamableHTTPServerTransport` that provides
|
|
5
|
+
* compatibility with Node.js HTTP server (IncomingMessage/ServerResponse).
|
|
6
|
+
*
|
|
7
|
+
* For web-standard environments (Cloudflare Workers, Deno, Bun), use `WebStandardStreamableHTTPServerTransport` directly.
|
|
8
|
+
*/
|
|
9
|
+
import { getRequestListener } from '@hono/node-server';
|
|
10
|
+
import { WebStandardStreamableHTTPServerTransport } from './webStandardStreamableHttp.js';
|
|
11
|
+
/**
|
|
12
|
+
* Server transport for Streamable HTTP: this implements the MCP Streamable HTTP transport specification.
|
|
13
|
+
* It supports both SSE streaming and direct HTTP responses.
|
|
14
|
+
*
|
|
15
|
+
* This is a wrapper around `WebStandardStreamableHTTPServerTransport` that provides Node.js HTTP compatibility.
|
|
16
|
+
* It uses the `@hono/node-server` library to convert between Node.js HTTP and Web Standard APIs.
|
|
17
|
+
*
|
|
18
|
+
* Usage example:
|
|
19
|
+
*
|
|
20
|
+
* ```typescript
|
|
21
|
+
* // Stateful mode - server sets the session ID
|
|
22
|
+
* const statefulTransport = new StreamableHTTPServerTransport({
|
|
23
|
+
* sessionIdGenerator: () => randomUUID(),
|
|
24
|
+
* });
|
|
25
|
+
*
|
|
26
|
+
* // Stateless mode - explicitly set session ID to undefined
|
|
27
|
+
* const statelessTransport = new StreamableHTTPServerTransport({
|
|
28
|
+
* sessionIdGenerator: undefined,
|
|
29
|
+
* });
|
|
30
|
+
*
|
|
31
|
+
* // Using with pre-parsed request body
|
|
32
|
+
* app.post('/mcp', (req, res) => {
|
|
33
|
+
* transport.handleRequest(req, res, req.body);
|
|
34
|
+
* });
|
|
35
|
+
* ```
|
|
36
|
+
*
|
|
37
|
+
* In stateful mode:
|
|
38
|
+
* - Session ID is generated and included in response headers
|
|
39
|
+
* - Session ID is always included in initialization responses
|
|
40
|
+
* - Requests with invalid session IDs are rejected with 404 Not Found
|
|
41
|
+
* - Non-initialization requests without a session ID are rejected with 400 Bad Request
|
|
42
|
+
* - State is maintained in-memory (connections, message history)
|
|
43
|
+
*
|
|
44
|
+
* In stateless mode:
|
|
45
|
+
* - No Session ID is included in any responses
|
|
46
|
+
* - No session validation is performed
|
|
47
|
+
*/
|
|
48
|
+
export class StreamableHTTPServerTransport {
|
|
49
|
+
constructor(options = {}) {
|
|
50
|
+
// Store auth and parsedBody per request for passing through to handleRequest
|
|
51
|
+
this._requestContext = new WeakMap();
|
|
52
|
+
this._webStandardTransport = new WebStandardStreamableHTTPServerTransport(options);
|
|
53
|
+
// Create a request listener that wraps the web standard transport
|
|
54
|
+
// getRequestListener converts Node.js HTTP to Web Standard and properly handles SSE streaming
|
|
55
|
+
// overrideGlobalObjects: false prevents Hono from overwriting global Response, which would
|
|
56
|
+
// break frameworks like Next.js whose response classes extend the native Response
|
|
57
|
+
this._requestListener = getRequestListener(async (webRequest) => {
|
|
58
|
+
// Get context if available (set during handleRequest)
|
|
59
|
+
const context = this._requestContext.get(webRequest);
|
|
60
|
+
return this._webStandardTransport.handleRequest(webRequest, {
|
|
61
|
+
authInfo: context?.authInfo,
|
|
62
|
+
parsedBody: context?.parsedBody
|
|
63
|
+
});
|
|
64
|
+
}, { overrideGlobalObjects: false });
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Gets the session ID for this transport instance.
|
|
68
|
+
*/
|
|
69
|
+
get sessionId() {
|
|
70
|
+
return this._webStandardTransport.sessionId;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Sets callback for when the transport is closed.
|
|
74
|
+
*/
|
|
75
|
+
set onclose(handler) {
|
|
76
|
+
this._webStandardTransport.onclose = handler;
|
|
77
|
+
}
|
|
78
|
+
get onclose() {
|
|
79
|
+
return this._webStandardTransport.onclose;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Sets callback for transport errors.
|
|
83
|
+
*/
|
|
84
|
+
set onerror(handler) {
|
|
85
|
+
this._webStandardTransport.onerror = handler;
|
|
86
|
+
}
|
|
87
|
+
get onerror() {
|
|
88
|
+
return this._webStandardTransport.onerror;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Sets callback for incoming messages.
|
|
92
|
+
*/
|
|
93
|
+
set onmessage(handler) {
|
|
94
|
+
this._webStandardTransport.onmessage = handler;
|
|
95
|
+
}
|
|
96
|
+
get onmessage() {
|
|
97
|
+
return this._webStandardTransport.onmessage;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Starts the transport. This is required by the Transport interface but is a no-op
|
|
101
|
+
* for the Streamable HTTP transport as connections are managed per-request.
|
|
102
|
+
*/
|
|
103
|
+
async start() {
|
|
104
|
+
return this._webStandardTransport.start();
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Closes the transport and all active connections.
|
|
108
|
+
*/
|
|
109
|
+
async close() {
|
|
110
|
+
return this._webStandardTransport.close();
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Sends a JSON-RPC message through the transport.
|
|
114
|
+
*/
|
|
115
|
+
async send(message, options) {
|
|
116
|
+
return this._webStandardTransport.send(message, options);
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Handles an incoming HTTP request, whether GET or POST.
|
|
120
|
+
*
|
|
121
|
+
* This method converts Node.js HTTP objects to Web Standard Request/Response
|
|
122
|
+
* and delegates to the underlying WebStandardStreamableHTTPServerTransport.
|
|
123
|
+
*
|
|
124
|
+
* @param req - Node.js IncomingMessage, optionally with auth property from middleware
|
|
125
|
+
* @param res - Node.js ServerResponse
|
|
126
|
+
* @param parsedBody - Optional pre-parsed body from body-parser middleware
|
|
127
|
+
*/
|
|
128
|
+
async handleRequest(req, res, parsedBody) {
|
|
129
|
+
// Store context for this request to pass through auth and parsedBody
|
|
130
|
+
// We need to intercept the request creation to attach this context
|
|
131
|
+
const authInfo = req.auth;
|
|
132
|
+
// Create a custom handler that includes our context
|
|
133
|
+
// overrideGlobalObjects: false prevents Hono from overwriting global Response, which would
|
|
134
|
+
// break frameworks like Next.js whose response classes extend the native Response
|
|
135
|
+
const handler = getRequestListener(async (webRequest) => {
|
|
136
|
+
return this._webStandardTransport.handleRequest(webRequest, {
|
|
137
|
+
authInfo,
|
|
138
|
+
parsedBody
|
|
139
|
+
});
|
|
140
|
+
}, { overrideGlobalObjects: false });
|
|
141
|
+
// Delegate to the request listener which handles all the Node.js <-> Web Standard conversion
|
|
142
|
+
// including proper SSE streaming support
|
|
143
|
+
await handler(req, res);
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Close an SSE stream for a specific request, triggering client reconnection.
|
|
147
|
+
* Use this to implement polling behavior during long-running operations -
|
|
148
|
+
* client will reconnect after the retry interval specified in the priming event.
|
|
149
|
+
*/
|
|
150
|
+
closeSSEStream(requestId) {
|
|
151
|
+
this._webStandardTransport.closeSSEStream(requestId);
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Close the standalone GET SSE stream, triggering client reconnection.
|
|
155
|
+
* Use this to implement polling behavior for server-initiated notifications.
|
|
156
|
+
*/
|
|
157
|
+
closeStandaloneSSEStream() {
|
|
158
|
+
this._webStandardTransport.closeStandaloneSSEStream();
|
|
159
|
+
}
|
|
160
|
+
}
|