@cyanheads/mcp-ts-core 0.11.4 → 0.12.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/AGENTS.md +28 -24
- package/CLAUDE.md +28 -24
- package/README.md +10 -10
- package/biome.json +1 -1
- package/changelog/0.11.x/0.11.5.md +28 -0
- package/changelog/0.12.x/0.12.0.md +96 -0
- package/changelog/template.md +55 -16
- package/dist/cli/init.js +1 -1
- package/dist/cli/init.js.map +1 -1
- package/dist/config/index.d.ts +0 -18
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +0 -25
- package/dist/config/index.js.map +1 -1
- package/dist/core/app.d.ts +5 -7
- package/dist/core/app.d.ts.map +1 -1
- package/dist/core/app.js +18 -27
- package/dist/core/app.js.map +1 -1
- package/dist/core/context.d.ts +90 -57
- package/dist/core/context.d.ts.map +1 -1
- package/dist/core/context.js +32 -33
- package/dist/core/context.js.map +1 -1
- package/dist/core/gcPressure.d.ts.map +1 -1
- package/dist/core/gcPressure.js +3 -4
- package/dist/core/gcPressure.js.map +1 -1
- package/dist/core/index.d.ts +6 -7
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +10 -2
- package/dist/core/index.js.map +1 -1
- package/dist/core/serverManifest.d.ts +1 -3
- package/dist/core/serverManifest.d.ts.map +1 -1
- package/dist/core/serverManifest.js +9 -4
- package/dist/core/serverManifest.js.map +1 -1
- package/dist/core/worker.d.ts.map +1 -1
- package/dist/core/worker.js +32 -35
- package/dist/core/worker.js.map +1 -1
- package/dist/logs/combined.log +10 -0
- package/dist/logs/error.log +6 -0
- package/dist/logs/interactions.log +0 -0
- package/dist/mcp-server/inputRequired.d.ts +52 -0
- package/dist/mcp-server/inputRequired.d.ts.map +1 -0
- package/dist/mcp-server/inputRequired.js +76 -0
- package/dist/mcp-server/inputRequired.js.map +1 -0
- package/dist/mcp-server/notifications.d.ts +33 -31
- package/dist/mcp-server/notifications.d.ts.map +1 -1
- package/dist/mcp-server/notifications.js +34 -26
- package/dist/mcp-server/notifications.js.map +1 -1
- package/dist/mcp-server/prompts/prompt-registration.d.ts +2 -2
- package/dist/mcp-server/prompts/prompt-registration.d.ts.map +1 -1
- package/dist/mcp-server/prompts/prompt-registration.js +15 -5
- package/dist/mcp-server/prompts/prompt-registration.js.map +1 -1
- package/dist/mcp-server/prompts/utils/promptDefinition.d.ts +1 -1
- package/dist/mcp-server/prompts/utils/promptDefinition.d.ts.map +1 -1
- package/dist/mcp-server/resources/resource-registration.d.ts +3 -3
- package/dist/mcp-server/resources/resource-registration.d.ts.map +1 -1
- package/dist/mcp-server/resources/resource-registration.js +8 -15
- package/dist/mcp-server/resources/resource-registration.js.map +1 -1
- package/dist/mcp-server/resources/resourceSubscriptions.d.ts +45 -0
- package/dist/mcp-server/resources/resourceSubscriptions.d.ts.map +1 -0
- package/dist/mcp-server/resources/resourceSubscriptions.js +51 -0
- package/dist/mcp-server/resources/resourceSubscriptions.js.map +1 -0
- package/dist/mcp-server/resources/utils/resourceDefinition.d.ts +3 -5
- package/dist/mcp-server/resources/utils/resourceDefinition.d.ts.map +1 -1
- package/dist/mcp-server/resources/utils/resourceDefinition.js +1 -1
- package/dist/mcp-server/resources/utils/resourceDefinition.js.map +1 -1
- package/dist/mcp-server/resources/utils/resourceHandlerFactory.d.ts +8 -15
- package/dist/mcp-server/resources/utils/resourceHandlerFactory.d.ts.map +1 -1
- package/dist/mcp-server/resources/utils/resourceHandlerFactory.js +21 -22
- package/dist/mcp-server/resources/utils/resourceHandlerFactory.js.map +1 -1
- package/dist/mcp-server/server.d.ts +12 -21
- package/dist/mcp-server/server.d.ts.map +1 -1
- package/dist/mcp-server/server.js +38 -28
- package/dist/mcp-server/server.js.map +1 -1
- package/dist/mcp-server/tools/tool-registration.d.ts +11 -33
- package/dist/mcp-server/tools/tool-registration.d.ts.map +1 -1
- package/dist/mcp-server/tools/tool-registration.js +17 -243
- package/dist/mcp-server/tools/tool-registration.js.map +1 -1
- package/dist/mcp-server/tools/utils/toolDefinition.d.ts +1 -3
- package/dist/mcp-server/tools/utils/toolDefinition.d.ts.map +1 -1
- package/dist/mcp-server/tools/utils/toolDefinition.js +48 -1
- package/dist/mcp-server/tools/utils/toolDefinition.js.map +1 -1
- package/dist/mcp-server/tools/utils/toolHandlerFactory.d.ts +46 -20
- package/dist/mcp-server/tools/utils/toolHandlerFactory.d.ts.map +1 -1
- package/dist/mcp-server/tools/utils/toolHandlerFactory.js +131 -25
- package/dist/mcp-server/tools/utils/toolHandlerFactory.js.map +1 -1
- package/dist/mcp-server/transports/ITransport.d.ts +2 -2
- package/dist/mcp-server/transports/ITransport.d.ts.map +1 -1
- package/dist/mcp-server/transports/auth/authFactory.js +1 -1
- package/dist/mcp-server/transports/auth/authFactory.js.map +1 -1
- package/dist/mcp-server/transports/auth/lib/authTypes.d.ts +1 -1
- package/dist/mcp-server/transports/auth/lib/authTypes.d.ts.map +1 -1
- package/dist/mcp-server/transports/auth/lib/authUtils.d.ts.map +1 -1
- package/dist/mcp-server/transports/auth/lib/authUtils.js +5 -13
- package/dist/mcp-server/transports/auth/lib/authUtils.js.map +1 -1
- package/dist/mcp-server/transports/auth/strategies/jwtStrategy.js +5 -11
- package/dist/mcp-server/transports/auth/strategies/jwtStrategy.js.map +1 -1
- package/dist/mcp-server/transports/auth/strategies/oauthStrategy.d.ts.map +1 -1
- package/dist/mcp-server/transports/auth/strategies/oauthStrategy.js +9 -22
- package/dist/mcp-server/transports/auth/strategies/oauthStrategy.js.map +1 -1
- package/dist/mcp-server/transports/heartbeat.d.ts.map +1 -1
- package/dist/mcp-server/transports/heartbeat.js +4 -8
- package/dist/mcp-server/transports/heartbeat.js.map +1 -1
- package/dist/mcp-server/transports/http/httpErrorHandler.d.ts.map +1 -1
- package/dist/mcp-server/transports/http/httpErrorHandler.js +6 -24
- package/dist/mcp-server/transports/http/httpErrorHandler.js.map +1 -1
- package/dist/mcp-server/transports/http/httpServer.d.ts +3 -3
- package/dist/mcp-server/transports/http/httpServer.d.ts.map +1 -1
- package/dist/mcp-server/transports/http/httpServer.js +15 -32
- package/dist/mcp-server/transports/http/httpServer.js.map +1 -1
- package/dist/mcp-server/transports/http/httpTransport.d.ts +25 -8
- package/dist/mcp-server/transports/http/httpTransport.d.ts.map +1 -1
- package/dist/mcp-server/transports/http/httpTransport.js +156 -310
- package/dist/mcp-server/transports/http/httpTransport.js.map +1 -1
- package/dist/mcp-server/transports/http/landing-page/assets/styles.d.ts.map +1 -1
- package/dist/mcp-server/transports/http/landing-page/assets/styles.js +0 -1
- package/dist/mcp-server/transports/http/landing-page/assets/styles.js.map +1 -1
- package/dist/mcp-server/transports/http/landing-page/handler.d.ts.map +1 -1
- package/dist/mcp-server/transports/http/landing-page/handler.js +4 -8
- package/dist/mcp-server/transports/http/landing-page/handler.js.map +1 -1
- package/dist/mcp-server/transports/http/landing-page/sections/tools.js +0 -2
- package/dist/mcp-server/transports/http/landing-page/sections/tools.js.map +1 -1
- package/dist/mcp-server/transports/http/protectedResourceMetadata.d.ts.map +1 -1
- package/dist/mcp-server/transports/http/protectedResourceMetadata.js +2 -6
- package/dist/mcp-server/transports/http/protectedResourceMetadata.js.map +1 -1
- package/dist/mcp-server/transports/http/robotsTxt.js +2 -2
- package/dist/mcp-server/transports/http/robotsTxt.js.map +1 -1
- package/dist/mcp-server/transports/http/serverCard.d.ts.map +1 -1
- package/dist/mcp-server/transports/http/serverCard.js +2 -6
- package/dist/mcp-server/transports/http/serverCard.js.map +1 -1
- package/dist/mcp-server/transports/http/sessionStore.d.ts +48 -45
- package/dist/mcp-server/transports/http/sessionStore.d.ts.map +1 -1
- package/dist/mcp-server/transports/http/sessionStore.js +141 -185
- package/dist/mcp-server/transports/http/sessionStore.js.map +1 -1
- package/dist/mcp-server/transports/manager.d.ts +12 -4
- package/dist/mcp-server/transports/manager.d.ts.map +1 -1
- package/dist/mcp-server/transports/manager.js +35 -33
- package/dist/mcp-server/transports/manager.js.map +1 -1
- package/dist/mcp-server/transports/stdio/stdioTransport.d.ts +24 -31
- package/dist/mcp-server/transports/stdio/stdioTransport.d.ts.map +1 -1
- package/dist/mcp-server/transports/stdio/stdioTransport.js +23 -38
- package/dist/mcp-server/transports/stdio/stdioTransport.js.map +1 -1
- package/dist/mcp-server/types.d.ts +25 -0
- package/dist/mcp-server/types.d.ts.map +1 -0
- package/dist/mcp-server/types.js +10 -0
- package/dist/mcp-server/types.js.map +1 -0
- package/dist/services/canvas/core/CanvasInstance.d.ts +2 -2
- package/dist/services/canvas/core/CanvasInstance.d.ts.map +1 -1
- package/dist/services/canvas/core/CanvasInstance.js.map +1 -1
- package/dist/services/canvas/core/CanvasRegistry.d.ts +4 -4
- package/dist/services/canvas/core/CanvasRegistry.d.ts.map +1 -1
- package/dist/services/canvas/core/CanvasRegistry.js +8 -18
- package/dist/services/canvas/core/CanvasRegistry.js.map +1 -1
- package/dist/services/canvas/core/DataCanvas.d.ts +5 -5
- package/dist/services/canvas/core/DataCanvas.d.ts.map +1 -1
- package/dist/services/canvas/core/DataCanvas.js +2 -3
- package/dist/services/canvas/core/DataCanvas.js.map +1 -1
- package/dist/services/canvas/core/IDataCanvasProvider.d.ts +11 -11
- package/dist/services/canvas/core/IDataCanvasProvider.d.ts.map +1 -1
- package/dist/services/canvas/providers/duckdb/DuckdbProvider.d.ts +11 -11
- package/dist/services/canvas/providers/duckdb/DuckdbProvider.d.ts.map +1 -1
- package/dist/services/canvas/providers/duckdb/DuckdbProvider.js +4 -10
- package/dist/services/canvas/providers/duckdb/DuckdbProvider.js.map +1 -1
- package/dist/services/llm/providers/openrouter.provider.d.ts.map +1 -1
- package/dist/services/llm/providers/openrouter.provider.js +2 -5
- package/dist/services/llm/providers/openrouter.provider.js.map +1 -1
- package/dist/services/mirror/core/defineMirror.js +1 -1
- package/dist/services/mirror/core/defineMirror.js.map +1 -1
- package/dist/services/mirror/types.d.ts +5 -5
- package/dist/services/mirror/types.d.ts.map +1 -1
- package/dist/services/speech/providers/elevenlabs.provider.js +1 -1
- package/dist/services/speech/providers/elevenlabs.provider.js.map +1 -1
- package/dist/services/speech/providers/whisper.provider.js +1 -1
- package/dist/services/speech/providers/whisper.provider.js.map +1 -1
- package/dist/storage/core/StorageService.d.ts +1 -1
- package/dist/storage/core/StorageService.d.ts.map +1 -1
- package/dist/storage/core/StorageService.js +12 -20
- package/dist/storage/core/StorageService.js.map +1 -1
- package/dist/storage/core/storageFactory.d.ts.map +1 -1
- package/dist/storage/core/storageFactory.js.map +1 -1
- package/dist/storage/core/storageValidation.d.ts +1 -1
- package/dist/storage/core/storageValidation.d.ts.map +1 -1
- package/dist/storage/core/storageValidation.js +2 -2
- package/dist/storage/core/storageValidation.js.map +1 -1
- package/dist/storage/providers/cloudflare/d1Provider.d.ts +1 -1
- package/dist/storage/providers/cloudflare/d1Provider.d.ts.map +1 -1
- package/dist/storage/providers/cloudflare/d1Provider.js +4 -12
- package/dist/storage/providers/cloudflare/d1Provider.js.map +1 -1
- package/dist/storage/providers/cloudflare/kvProvider.d.ts +1 -1
- package/dist/storage/providers/cloudflare/kvProvider.d.ts.map +1 -1
- package/dist/storage/providers/cloudflare/kvProvider.js +3 -8
- package/dist/storage/providers/cloudflare/kvProvider.js.map +1 -1
- package/dist/storage/providers/cloudflare/r2Provider.d.ts +1 -1
- package/dist/storage/providers/cloudflare/r2Provider.d.ts.map +1 -1
- package/dist/storage/providers/cloudflare/r2Provider.js +3 -8
- package/dist/storage/providers/cloudflare/r2Provider.js.map +1 -1
- package/dist/storage/providers/inMemory/inMemoryProvider.d.ts +1 -1
- package/dist/storage/providers/inMemory/inMemoryProvider.d.ts.map +1 -1
- package/dist/storage/providers/inMemory/inMemoryProvider.js +2 -4
- package/dist/storage/providers/inMemory/inMemoryProvider.js.map +1 -1
- package/dist/testing/index.d.ts +35 -12
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/index.js +53 -38
- package/dist/testing/index.js.map +1 -1
- package/dist/testing/vitest.d.ts +1 -1
- package/dist/testing/vitest.d.ts.map +1 -1
- package/dist/types-global/errors.d.ts +28 -15
- package/dist/types-global/errors.d.ts.map +1 -1
- package/dist/types-global/errors.js +8 -1
- package/dist/types-global/errors.js.map +1 -1
- package/dist/utils/formatting/diffFormatter.d.ts +5 -5
- package/dist/utils/formatting/diffFormatter.d.ts.map +1 -1
- package/dist/utils/formatting/diffFormatter.js +7 -20
- package/dist/utils/formatting/diffFormatter.js.map +1 -1
- package/dist/utils/formatting/tableFormatter.d.ts +3 -3
- package/dist/utils/formatting/tableFormatter.d.ts.map +1 -1
- package/dist/utils/formatting/tableFormatter.js +6 -17
- package/dist/utils/formatting/tableFormatter.js.map +1 -1
- package/dist/utils/formatting/treeFormatter.d.ts +3 -3
- package/dist/utils/formatting/treeFormatter.d.ts.map +1 -1
- package/dist/utils/formatting/treeFormatter.js +5 -18
- package/dist/utils/formatting/treeFormatter.js.map +1 -1
- package/dist/utils/index.d.ts +4 -2
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +2 -2
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/internal/error-handler/errorHandler.d.ts +1 -1
- package/dist/utils/internal/error-handler/errorHandler.d.ts.map +1 -1
- package/dist/utils/internal/error-handler/errorHandler.js +23 -11
- package/dist/utils/internal/error-handler/errorHandler.js.map +1 -1
- package/dist/utils/internal/error-handler/types.d.ts +10 -13
- package/dist/utils/internal/error-handler/types.d.ts.map +1 -1
- package/dist/utils/internal/logger.d.ts +3 -3
- package/dist/utils/internal/logger.d.ts.map +1 -1
- package/dist/utils/internal/logger.js +11 -5
- package/dist/utils/internal/logger.js.map +1 -1
- package/dist/utils/internal/performance.d.ts +1 -1
- package/dist/utils/internal/performance.d.ts.map +1 -1
- package/dist/utils/internal/performance.js +57 -13
- package/dist/utils/internal/performance.js.map +1 -1
- package/dist/utils/internal/requestContext.d.ts +79 -55
- package/dist/utils/internal/requestContext.d.ts.map +1 -1
- package/dist/utils/internal/requestContext.js +77 -32
- package/dist/utils/internal/requestContext.js.map +1 -1
- package/dist/utils/metrics/tokenCounter.d.ts +3 -3
- package/dist/utils/metrics/tokenCounter.d.ts.map +1 -1
- package/dist/utils/metrics/tokenCounter.js.map +1 -1
- package/dist/utils/network/fetchWithTimeout.d.ts +2 -2
- package/dist/utils/network/fetchWithTimeout.d.ts.map +1 -1
- package/dist/utils/network/fetchWithTimeout.js +8 -24
- package/dist/utils/network/fetchWithTimeout.js.map +1 -1
- package/dist/utils/network/retry.d.ts +2 -2
- package/dist/utils/network/retry.d.ts.map +1 -1
- package/dist/utils/overflow/outlineOnOverflow.d.ts +1 -1
- package/dist/utils/overflow/outlineOnOverflow.d.ts.map +1 -1
- package/dist/utils/pagination/pagination.d.ts +3 -3
- package/dist/utils/pagination/pagination.d.ts.map +1 -1
- package/dist/utils/pagination/pagination.js +3 -3
- package/dist/utils/pagination/pagination.js.map +1 -1
- package/dist/utils/parsing/csvParser.d.ts +2 -2
- package/dist/utils/parsing/csvParser.d.ts.map +1 -1
- package/dist/utils/parsing/csvParser.js +4 -8
- package/dist/utils/parsing/csvParser.js.map +1 -1
- package/dist/utils/parsing/dateParser.d.ts +3 -3
- package/dist/utils/parsing/dateParser.d.ts.map +1 -1
- package/dist/utils/parsing/dateParser.js +3 -2
- package/dist/utils/parsing/dateParser.js.map +1 -1
- package/dist/utils/parsing/frontmatterParser.d.ts +2 -2
- package/dist/utils/parsing/frontmatterParser.d.ts.map +1 -1
- package/dist/utils/parsing/frontmatterParser.js +7 -10
- package/dist/utils/parsing/frontmatterParser.js.map +1 -1
- package/dist/utils/parsing/htmlExtractor.d.ts +2 -2
- package/dist/utils/parsing/htmlExtractor.d.ts.map +1 -1
- package/dist/utils/parsing/htmlExtractor.js +6 -11
- package/dist/utils/parsing/htmlExtractor.js.map +1 -1
- package/dist/utils/parsing/jsonParser.d.ts +2 -2
- package/dist/utils/parsing/jsonParser.d.ts.map +1 -1
- package/dist/utils/parsing/jsonParser.js +4 -8
- package/dist/utils/parsing/jsonParser.js.map +1 -1
- package/dist/utils/parsing/pdfParser.d.ts +10 -10
- package/dist/utils/parsing/pdfParser.d.ts.map +1 -1
- package/dist/utils/parsing/pdfParser.js +26 -89
- package/dist/utils/parsing/pdfParser.js.map +1 -1
- package/dist/utils/parsing/xmlParser.d.ts +2 -2
- package/dist/utils/parsing/xmlParser.d.ts.map +1 -1
- package/dist/utils/parsing/xmlParser.js +4 -8
- package/dist/utils/parsing/xmlParser.js.map +1 -1
- package/dist/utils/parsing/yamlParser.d.ts +2 -2
- package/dist/utils/parsing/yamlParser.d.ts.map +1 -1
- package/dist/utils/parsing/yamlParser.js +4 -8
- package/dist/utils/parsing/yamlParser.js.map +1 -1
- package/dist/utils/scheduling/scheduler.d.ts.map +1 -1
- package/dist/utils/scheduling/scheduler.js +5 -6
- package/dist/utils/scheduling/scheduler.js.map +1 -1
- package/dist/utils/security/rateLimiter.d.ts +2 -2
- package/dist/utils/security/rateLimiter.d.ts.map +1 -1
- package/dist/utils/security/rateLimiter.js +1 -1
- package/dist/utils/security/rateLimiter.js.map +1 -1
- package/dist/utils/telemetry/attributes.d.ts +23 -7
- package/dist/utils/telemetry/attributes.d.ts.map +1 -1
- package/dist/utils/telemetry/attributes.js +23 -10
- package/dist/utils/telemetry/attributes.js.map +1 -1
- package/dist/utils/telemetry/trace.d.ts +3 -3
- package/dist/utils/telemetry/trace.d.ts.map +1 -1
- package/dist/utils/telemetry/trace.js +4 -2
- package/dist/utils/telemetry/trace.js.map +1 -1
- package/package.json +22 -26
- package/scripts/lint-mcp.ts +1 -3
- package/scripts/lint-packaging.ts +1 -1
- package/skills/add-service/SKILL.md +2 -2
- package/skills/add-test/SKILL.md +42 -20
- package/skills/add-tool/SKILL.md +68 -19
- package/skills/api-canvas/SKILL.md +2 -2
- package/skills/api-config/SKILL.md +1 -11
- package/skills/api-context/SKILL.md +175 -111
- package/skills/api-linter/SKILL.md +2 -2
- package/skills/api-telemetry/SKILL.md +8 -12
- package/skills/api-testing/SKILL.md +53 -52
- package/skills/code-simplifier/SKILL.md +2 -2
- package/skills/design-mcp-server/SKILL.md +34 -18
- package/skills/field-test/SKILL.md +4 -2
- package/skills/git-wrapup/SKILL.md +3 -3
- package/skills/polish-docs-meta/SKILL.md +1 -1
- package/skills/polish-docs-meta/references/agent-protocol.md +2 -2
- package/skills/polish-docs-meta/references/readme.md +1 -1
- package/skills/release-and-publish/SKILL.md +3 -1
- package/skills/report-issue-framework/SKILL.md +2 -2
- package/skills/report-issue-local/SKILL.md +2 -2
- package/skills/security-pass/SKILL.md +16 -14
- package/templates/.github/CODE_OF_CONDUCT.md +28 -0
- package/templates/.github/CONTRIBUTING.md +50 -0
- package/templates/.github/SECURITY.md +24 -0
- package/templates/AGENTS.md +6 -6
- package/templates/CLAUDE.md +6 -6
- package/templates/changelog/template.md +55 -16
- package/templates/tests/resources/echo.resource.test.ts +16 -9
- package/dist/mcp-server/elicitation.d.ts +0 -64
- package/dist/mcp-server/elicitation.d.ts.map +0 -1
- package/dist/mcp-server/elicitation.js +0 -81
- package/dist/mcp-server/elicitation.js.map +0 -1
- package/dist/mcp-server/protocolSession.d.ts +0 -34
- package/dist/mcp-server/protocolSession.d.ts.map +0 -1
- package/dist/mcp-server/protocolSession.js +0 -13
- package/dist/mcp-server/protocolSession.js.map +0 -1
- package/dist/mcp-server/tasks/core/evictingTaskMessageQueue.d.ts +0 -53
- package/dist/mcp-server/tasks/core/evictingTaskMessageQueue.d.ts.map +0 -1
- package/dist/mcp-server/tasks/core/evictingTaskMessageQueue.js +0 -65
- package/dist/mcp-server/tasks/core/evictingTaskMessageQueue.js.map +0 -1
- package/dist/mcp-server/tasks/core/sessionAwareTaskStore.d.ts +0 -70
- package/dist/mcp-server/tasks/core/sessionAwareTaskStore.d.ts.map +0 -1
- package/dist/mcp-server/tasks/core/sessionAwareTaskStore.js +0 -130
- package/dist/mcp-server/tasks/core/sessionAwareTaskStore.js.map +0 -1
- package/dist/mcp-server/tasks/core/storageBackedTaskStore.d.ts +0 -109
- package/dist/mcp-server/tasks/core/storageBackedTaskStore.d.ts.map +0 -1
- package/dist/mcp-server/tasks/core/storageBackedTaskStore.js +0 -209
- package/dist/mcp-server/tasks/core/storageBackedTaskStore.js.map +0 -1
- package/dist/mcp-server/tasks/core/taskManager.d.ts +0 -91
- package/dist/mcp-server/tasks/core/taskManager.d.ts.map +0 -1
- package/dist/mcp-server/tasks/core/taskManager.js +0 -210
- package/dist/mcp-server/tasks/core/taskManager.js.map +0 -1
- package/dist/mcp-server/tasks/core/taskTypes.d.ts +0 -18
- package/dist/mcp-server/tasks/core/taskTypes.d.ts.map +0 -1
- package/dist/mcp-server/tasks/core/taskTypes.js +0 -20
- package/dist/mcp-server/tasks/core/taskTypes.js.map +0 -1
- package/dist/mcp-server/tasks/utils/taskToolDefinition.d.ts +0 -101
- package/dist/mcp-server/tasks/utils/taskToolDefinition.d.ts.map +0 -1
- package/dist/mcp-server/tasks/utils/taskToolDefinition.js +0 -14
- package/dist/mcp-server/tasks/utils/taskToolDefinition.js.map +0 -1
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @fileoverview Request-scoped list-changed / resource-updated notifiers.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* standalone GET SSE stream
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
4
|
+
* Notifications fired from inside a handler are sent through the request's own
|
|
5
|
+
* `ctx.mcpReq.notify`, which stamps `relatedRequestId` so the message lands on
|
|
6
|
+
* that request's own response stream. The server-level `send*ListChanged()`
|
|
7
|
+
* path targets the standalone GET SSE stream instead, which does not exist
|
|
8
|
+
* under per-request serving (`createMcpHandler`'s modern leg and its stateless
|
|
9
|
+
* legacy fallback both build one instance per request) — notifications sent
|
|
10
|
+
* that way drop silently (#135).
|
|
11
|
+
*
|
|
12
|
+
* `notifications/resources/updated` is subscription-scoped: it is emitted only
|
|
13
|
+
* for URIs the client actually subscribed to via `resources/subscribe` (#354).
|
|
12
14
|
*
|
|
13
15
|
* @module src/mcp-server/notifications
|
|
14
16
|
*/
|
|
15
|
-
import type { ServerNotification } from '@modelcontextprotocol/
|
|
17
|
+
import type { ServerNotification } from '@modelcontextprotocol/server';
|
|
16
18
|
/**
|
|
17
|
-
* The
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* scope (some test harnesses pass a bare `Request`) has no sender, and we fall
|
|
22
|
-
* back to the server-level notifiers there.
|
|
19
|
+
* The slice of `ctx.mcpReq` these notifiers need. Typed with an optional
|
|
20
|
+
* `notify` so the runtime presence check is type-meaningful — a background or
|
|
21
|
+
* test scope may pass a stand-in without one, and callers fall back to the
|
|
22
|
+
* server-level notifiers there.
|
|
23
23
|
*/
|
|
24
24
|
interface NotificationSender {
|
|
25
|
-
|
|
25
|
+
notify?: (notification: ServerNotification) => Promise<void>;
|
|
26
26
|
}
|
|
27
27
|
/** The four list-changed / resource-updated closures attached to a handler `ctx`. */
|
|
28
28
|
export interface RequestScopedNotifiers {
|
|
@@ -31,25 +31,27 @@ export interface RequestScopedNotifiers {
|
|
|
31
31
|
notifyResourceUpdated: (uri: string) => void;
|
|
32
32
|
notifyToolListChanged: () => void;
|
|
33
33
|
}
|
|
34
|
+
/** Per-connection subscription state consulted before a resource-updated emit. */
|
|
35
|
+
export interface ResourceSubscriptions {
|
|
36
|
+
/** True when the connected client subscribed to this exact URI. */
|
|
37
|
+
has: (uri: string) => boolean;
|
|
38
|
+
}
|
|
34
39
|
/**
|
|
35
|
-
* Builds notifier closures bound to a single request's `
|
|
36
|
-
* The SDK stamps `relatedRequestId` onto these sends, so `@hono/mcp` routes them
|
|
37
|
-
* to that request's SSE response stream — the delivery path the server-level
|
|
38
|
-
* `server.send*ListChanged()` calls miss under the per-request McpServer model,
|
|
39
|
-
* where they drop silently (#135).
|
|
40
|
+
* Builds notifier closures bound to a single request's `ctx.mcpReq.notify`.
|
|
40
41
|
*
|
|
41
|
-
* Returns `undefined` when the supplied
|
|
42
|
-
* back to the server-level notifiers in that case.
|
|
42
|
+
* Returns `undefined` when the supplied request scope exposes no sender;
|
|
43
|
+
* callers fall back to the server-level notifiers in that case.
|
|
43
44
|
*
|
|
44
|
-
* Fire-and-forget by contract (`() => void`): the underlying
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
45
|
+
* Fire-and-forget by contract (`() => void`): the underlying promise is not
|
|
46
|
+
* awaited — a notification that can't flush (client already gone, response not
|
|
47
|
+
* upgraded to SSE) must not fail the handler. A flush failure is logged at
|
|
48
|
+
* debug rather than swallowed silently.
|
|
48
49
|
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
50
|
+
* @param mcpReq - The request scope from the SDK's `ServerContext`.
|
|
51
|
+
* @param subscriptions - Per-connection `resources/subscribe` registry. When
|
|
52
|
+
* supplied, `notifyResourceUpdated` emits only for subscribed URIs; when
|
|
53
|
+
* omitted (no subscription tracking available) every URI is emitted.
|
|
52
54
|
*/
|
|
53
|
-
export declare function buildRequestScopedNotifiers(
|
|
55
|
+
export declare function buildRequestScopedNotifiers(mcpReq: NotificationSender, subscriptions?: ResourceSubscriptions): RequestScopedNotifiers | undefined;
|
|
54
56
|
export {};
|
|
55
57
|
//# sourceMappingURL=notifications.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notifications.d.ts","sourceRoot":"","sources":["../../src/mcp-server/notifications.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"notifications.d.ts","sourceRoot":"","sources":["../../src/mcp-server/notifications.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAIvE;;;;;GAKG;AACH,UAAU,kBAAkB;IAC1B,MAAM,CAAC,EAAE,CAAC,YAAY,EAAE,kBAAkB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9D;AAED,qFAAqF;AACrF,MAAM,WAAW,sBAAsB;IACrC,uBAAuB,EAAE,MAAM,IAAI,CAAC;IACpC,yBAAyB,EAAE,MAAM,IAAI,CAAC;IACtC,qBAAqB,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7C,qBAAqB,EAAE,MAAM,IAAI,CAAC;CACnC;AAED,kFAAkF;AAClF,MAAM,WAAW,qBAAqB;IACpC,mEAAmE;IACnE,GAAG,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC;CAC/B;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,2BAA2B,CACzC,MAAM,EAAE,kBAAkB,EAC1B,aAAa,CAAC,EAAE,qBAAqB,GACpC,sBAAsB,GAAG,SAAS,CA2BpC"}
|
|
@@ -1,41 +1,40 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @fileoverview Request-scoped list-changed / resource-updated notifiers.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* standalone GET SSE stream
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
4
|
+
* Notifications fired from inside a handler are sent through the request's own
|
|
5
|
+
* `ctx.mcpReq.notify`, which stamps `relatedRequestId` so the message lands on
|
|
6
|
+
* that request's own response stream. The server-level `send*ListChanged()`
|
|
7
|
+
* path targets the standalone GET SSE stream instead, which does not exist
|
|
8
|
+
* under per-request serving (`createMcpHandler`'s modern leg and its stateless
|
|
9
|
+
* legacy fallback both build one instance per request) — notifications sent
|
|
10
|
+
* that way drop silently (#135).
|
|
11
|
+
*
|
|
12
|
+
* `notifications/resources/updated` is subscription-scoped: it is emitted only
|
|
13
|
+
* for URIs the client actually subscribed to via `resources/subscribe` (#354).
|
|
12
14
|
*
|
|
13
15
|
* @module src/mcp-server/notifications
|
|
14
16
|
*/
|
|
15
17
|
import { logger } from '../utils/internal/logger.js';
|
|
16
18
|
/**
|
|
17
|
-
* Builds notifier closures bound to a single request's `
|
|
18
|
-
* The SDK stamps `relatedRequestId` onto these sends, so `@hono/mcp` routes them
|
|
19
|
-
* to that request's SSE response stream — the delivery path the server-level
|
|
20
|
-
* `server.send*ListChanged()` calls miss under the per-request McpServer model,
|
|
21
|
-
* where they drop silently (#135).
|
|
19
|
+
* Builds notifier closures bound to a single request's `ctx.mcpReq.notify`.
|
|
22
20
|
*
|
|
23
|
-
* Returns `undefined` when the supplied
|
|
24
|
-
* back to the server-level notifiers in that case.
|
|
21
|
+
* Returns `undefined` when the supplied request scope exposes no sender;
|
|
22
|
+
* callers fall back to the server-level notifiers in that case.
|
|
25
23
|
*
|
|
26
|
-
* Fire-and-forget by contract (`() => void`): the underlying
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
24
|
+
* Fire-and-forget by contract (`() => void`): the underlying promise is not
|
|
25
|
+
* awaited — a notification that can't flush (client already gone, response not
|
|
26
|
+
* upgraded to SSE) must not fail the handler. A flush failure is logged at
|
|
27
|
+
* debug rather than swallowed silently.
|
|
30
28
|
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
29
|
+
* @param mcpReq - The request scope from the SDK's `ServerContext`.
|
|
30
|
+
* @param subscriptions - Per-connection `resources/subscribe` registry. When
|
|
31
|
+
* supplied, `notifyResourceUpdated` emits only for subscribed URIs; when
|
|
32
|
+
* omitted (no subscription tracking available) every URI is emitted.
|
|
34
33
|
*/
|
|
35
|
-
export function buildRequestScopedNotifiers(
|
|
36
|
-
if (typeof
|
|
34
|
+
export function buildRequestScopedNotifiers(mcpReq, subscriptions) {
|
|
35
|
+
if (typeof mcpReq.notify !== 'function')
|
|
37
36
|
return;
|
|
38
|
-
const send =
|
|
37
|
+
const send = mcpReq.notify.bind(mcpReq);
|
|
39
38
|
const emit = (notification) => {
|
|
40
39
|
void send(notification).catch((error) => {
|
|
41
40
|
logger.debug(`Notification ${notification.method} not delivered: ${error instanceof Error ? error.message : String(error)}`);
|
|
@@ -45,7 +44,16 @@ export function buildRequestScopedNotifiers(extra) {
|
|
|
45
44
|
notifyToolListChanged: () => emit({ method: 'notifications/tools/list_changed' }),
|
|
46
45
|
notifyResourceListChanged: () => emit({ method: 'notifications/resources/list_changed' }),
|
|
47
46
|
notifyPromptListChanged: () => emit({ method: 'notifications/prompts/list_changed' }),
|
|
48
|
-
notifyResourceUpdated: (uri) =>
|
|
47
|
+
notifyResourceUpdated: (uri) => {
|
|
48
|
+
// Spec: `notifications/resources/updated` SHOULD only be sent for a URI
|
|
49
|
+
// the client subscribed to. Emitting to a client that never subscribed is
|
|
50
|
+
// noise it has no handler for.
|
|
51
|
+
if (subscriptions && !subscriptions.has(uri)) {
|
|
52
|
+
logger.debug(`Resource update for ${uri} not sent: no active subscription.`);
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
emit({ method: 'notifications/resources/updated', params: { uri } });
|
|
56
|
+
},
|
|
49
57
|
};
|
|
50
58
|
}
|
|
51
59
|
//# sourceMappingURL=notifications.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notifications.js","sourceRoot":"","sources":["../../src/mcp-server/notifications.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"notifications.js","sourceRoot":"","sources":["../../src/mcp-server/notifications.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAIH,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AA0BpD;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,2BAA2B,CACzC,MAA0B,EAC1B,aAAqC;IAErC,IAAI,OAAO,MAAM,CAAC,MAAM,KAAK,UAAU;QAAE,OAAO;IAChD,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACxC,MAAM,IAAI,GAAG,CAAC,YAAgC,EAAQ,EAAE;QACtD,KAAK,IAAI,CAAC,YAAY,CAAC,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;YAC/C,MAAM,CAAC,KAAK,CACV,gBAAgB,YAAY,CAAC,MAAM,mBACjC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CACvD,EAAE,CACH,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC,CAAC;IACF,OAAO;QACL,qBAAqB,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,kCAAkC,EAAE,CAAC;QACjF,yBAAyB,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,sCAAsC,EAAE,CAAC;QACzF,uBAAuB,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,oCAAoC,EAAE,CAAC;QACrF,qBAAqB,EAAE,CAAC,GAAW,EAAE,EAAE;YACrC,wEAAwE;YACxE,0EAA0E;YAC1E,+BAA+B;YAC/B,IAAI,aAAa,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;gBAC7C,MAAM,CAAC,KAAK,CAAC,uBAAuB,GAAG,oCAAoC,CAAC,CAAC;gBAC7E,OAAO;YACT,CAAC;YACD,IAAI,CAAC,EAAE,MAAM,EAAE,iCAAiC,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC;QACvE,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
* @fileoverview Service for registering MCP prompts on a server instance.
|
|
3
3
|
*
|
|
4
4
|
* MCP Prompts Specification:
|
|
5
|
-
* @see {@link https://modelcontextprotocol.io/specification/
|
|
5
|
+
* @see {@link https://modelcontextprotocol.io/specification/2026-07-28/server/prompts | MCP Prompts}
|
|
6
6
|
* @module src/mcp-server/prompts/prompt-registration
|
|
7
7
|
*/
|
|
8
|
-
import type { McpServer } from '@modelcontextprotocol/
|
|
8
|
+
import type { McpServer } from '@modelcontextprotocol/server';
|
|
9
9
|
import type { AnyPromptDefinition } from '../../mcp-server/prompts/utils/promptDefinition.js';
|
|
10
10
|
import type { logger as defaultLogger } from '../../utils/internal/logger.js';
|
|
11
11
|
export declare class PromptRegistry {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompt-registration.d.ts","sourceRoot":"","sources":["../../../src/mcp-server/prompts/prompt-registration.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"prompt-registration.d.ts","sourceRoot":"","sources":["../../../src/mcp-server/prompts/prompt-registration.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EAAwC,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAGpG,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gDAAgD,CAAC;AAG1F,OAAO,KAAK,EAAE,MAAM,IAAI,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAI1E,qBAAa,cAAc;IAKvB,OAAO,CAAC,UAAU;IAClB,OAAO,CAAC,MAAM;IALhB,sEAAsE;IACtE,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAqB;IAErD,YACU,UAAU,EAAE,mBAAmB,EAAE,EACjC,MAAM,EAAE,OAAO,aAAa,EAClC;IAEJ;;OAEG;IACG,WAAW,CAAC,MAAM,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAiBlD;IAED,+EAA+E;IAC/E,OAAO,CAAC,gBAAgB;YAUV,cAAc;CAgE7B"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isInputRequiredSignal } from '../../mcp-server/inputRequired.js';
|
|
1
2
|
import { JsonRpcErrorCode, McpError } from '../../types-global/errors.js';
|
|
2
3
|
import { ErrorHandler } from '../../utils/internal/error-handler/errorHandler.js';
|
|
3
4
|
import { measurePromptGeneration } from '../../utils/internal/performance.js';
|
|
@@ -20,10 +21,9 @@ export class PromptRegistry {
|
|
|
20
21
|
operation: 'PromptRegistry.registerAll',
|
|
21
22
|
});
|
|
22
23
|
this.logger.debug(`Registering ${this.promptDefs.length} prompt(s)...`, context);
|
|
23
|
-
//
|
|
24
|
-
//
|
|
25
|
-
//
|
|
26
|
-
server.setPromptRequestHandlers();
|
|
24
|
+
// `prompts/list` and `prompts/get` are installed by the SDK from the
|
|
25
|
+
// declared `prompts` capability, so a server with no prompts still answers
|
|
26
|
+
// `prompts/list` with an empty array rather than `-32601`.
|
|
27
27
|
for (const promptDef of this.promptDefs) {
|
|
28
28
|
await this.registerPrompt(server, promptDef, context);
|
|
29
29
|
}
|
|
@@ -44,8 +44,13 @@ export class PromptRegistry {
|
|
|
44
44
|
server.registerPrompt(promptDef.name, {
|
|
45
45
|
...(promptDef.title && { title: promptDef.title }),
|
|
46
46
|
description: promptDef.description,
|
|
47
|
+
// The ZodObject itself, not `.shape`: the raw-shape overload
|
|
48
|
+
// rebuilds a fresh non-strict object (dropping `.strict()` and any
|
|
49
|
+
// object-level refinement), and requiredness is derived from the
|
|
50
|
+
// emitted JSON Schema, so a `.default()`ed argument correctly
|
|
51
|
+
// advertises as optional (#258).
|
|
47
52
|
...(promptDef.args && {
|
|
48
|
-
argsSchema: promptDef.args
|
|
53
|
+
argsSchema: promptDef.args,
|
|
49
54
|
}),
|
|
50
55
|
}, async (args) => {
|
|
51
56
|
try {
|
|
@@ -54,6 +59,11 @@ export class PromptRegistry {
|
|
|
54
59
|
return { messages };
|
|
55
60
|
}
|
|
56
61
|
catch (error) {
|
|
62
|
+
// `ctx.requestInput(...)` is protocol control flow, not a failure
|
|
63
|
+
// — `prompts/get` honors `input_required` on the 2026-07-28
|
|
64
|
+
// revision.
|
|
65
|
+
if (isInputRequiredSignal(error))
|
|
66
|
+
return error.result;
|
|
57
67
|
const handled = ErrorHandler.handleError(error, {
|
|
58
68
|
operation: `prompt:${promptDef.name}`,
|
|
59
69
|
context,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompt-registration.js","sourceRoot":"","sources":["../../../src/mcp-server/prompts/prompt-registration.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"prompt-registration.js","sourceRoot":"","sources":["../../../src/mcp-server/prompts/prompt-registration.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAEtE,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,gDAAgD,CAAC;AAE9E,OAAO,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAC1E,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAE3E,MAAM,OAAO,cAAc;IAKf,UAAU;IACV,MAAM;IALhB,sEAAsE;IACrD,eAAe,GAAG,IAAI,GAAG,EAAU,CAAC;IAErD,YACU,UAAiC,EACjC,MAA4B;0BAD5B,UAAU;sBACV,MAAM;IACb,CAAC;IAEJ;;OAEG;IACH,KAAK,CAAC,WAAW,CAAC,MAAiB;QACjC,IAAI,CAAC,eAAe,CAAC,KAAK,EAAE,CAAC;QAE7B,MAAM,OAAO,GAAG,qBAAqB,CAAC,oBAAoB,CAAC;YACzD,SAAS,EAAE,4BAA4B;SACxC,CAAC,CAAC;QAEH,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,eAAe,IAAI,CAAC,UAAU,CAAC,MAAM,eAAe,EAAE,OAAO,CAAC,CAAC;QAEjF,qEAAqE;QACrE,2EAA2E;QAC3E,2DAA2D;QAC3D,KAAK,MAAM,SAAS,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;YACxC,MAAM,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;QACxD,CAAC;QAED,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,2BAA2B,IAAI,CAAC,UAAU,CAAC,MAAM,U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O,CACb,SAAS,CAAC,QAAQ,CAAC,aAAyD,CAAC,CAC9E,EACH,EAAE,GAAG,OAAO,EAAE,UAAU,EAAE,SAAS,CAAC,IAAI,EAAE,EAC1C,aAAa,CACd,CAAC;oBACF,OAAO,EAAE,QAAQ,EAAE,CAAC;gBACtB,CAAC;gBAAC,OAAO,KAAc,EAAE,CAAC;oBACxB,kEAAkE;oBAClE,4DAA4D;oBAC5D,YAAY;oBACZ,IAAI,qBAAqB,CAAC,KAAK,CAAC;wBAAE,OAAO,KAAK,CAAC,MAAM,CAAC;oBAEtD,MAAM,OAAO,GAAG,YAAY,CAAC,WAAW,CAAC,KAAK,EAAE;wBAC9C,SAAS,EAAE,UAAU,SAAS,CAAC,IAAI,EAAE;wBACrC,OAAO;qBACR,CAAC,CAAC;oBACH,MAAM,OAAO,YAAY,QAAQ;wBAC/B,CAAC,CAAC,OAAO;wBACT,CAAC,CAAC,IAAI,QAAQ,CAAC,gBAAgB,CAAC,aAAa,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;gBACpE,CAAC;YACH,CAAC,CACF,CAAC;YAEF,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,sBAAsB,SAAS,CAAC,IAAI,EAAE,EAAE,OAAO,CAAC,CAAC;QACrE,CAAC,EACD;YACE,SAAS,EAAE,qBAAqB,SAAS,CAAC,IAAI,EAAE;YAChD,OAAO;YACP,SAAS,EAAE,gBAAgB,CAAC,oBAAoB;YAChD,QAAQ,EAAE,IAAI;SACf,CACF,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* @see {@link https://modelcontextprotocol.io/specification/2025-06-18/basic/prompts | MCP Prompts}
|
|
7
7
|
* @module src/mcp-server/prompts/utils/promptDefinition
|
|
8
8
|
*/
|
|
9
|
-
import type { PromptMessage } from '@modelcontextprotocol/
|
|
9
|
+
import type { PromptMessage } from '@modelcontextprotocol/server';
|
|
10
10
|
import type { ZodObject, ZodRawShape, z } from 'zod';
|
|
11
11
|
/**
|
|
12
12
|
* Represents the complete, self-contained definition of an MCP prompt.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"promptDefinition.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/prompts/utils/promptDefinition.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"promptDefinition.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/prompts/utils/promptDefinition.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAErD;;GAEG;AACH,MAAM,WAAW,gBAAgB,CAAC,KAAK,SAAS,SAAS,CAAC,WAAW,CAAC,GAAG,SAAS,GAAG,SAAS;IAC5F;;;;;;;OAOG;IACH,IAAI,CAAC,EAAE,KAAK,CAAC;IACb,8BAA8B;IAC9B,WAAW,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,QAAQ,EAAE,CACR,IAAI,EAAE,KAAK,SAAS,SAAS,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,KAChF,aAAa,EAAE,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC,CAAC;IAChD,6CAA6C;IAC7C,IAAI,EAAE,MAAM,CAAC;IACb;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,+DAA+D;IAC/D,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,kFAAkF;AAClF,MAAM,MAAM,mBAAmB,GAAG,gBAAgB,CAAC,SAAS,CAAC,WAAW,CAAC,GAAG,SAAS,CAAC,CAAC;AAMvF;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,MAAM,CAAC,KAAK,SAAS,SAAS,CAAC,WAAW,CAAC,GAAG,SAAS,GAAG,SAAS,EACjF,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,GAC7C,gBAAgB,CAAC,KAAK,CAAC,CAEzB"}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* @fileoverview Encapsulates the registration of all resource definitions with an McpServer.
|
|
3
3
|
* @module src/mcp-server/resources/resource-registration
|
|
4
4
|
*/
|
|
5
|
-
import { type McpServer } from '@modelcontextprotocol/
|
|
6
|
-
import type {
|
|
5
|
+
import { type McpServer } from '@modelcontextprotocol/server';
|
|
6
|
+
import type { ResourceSubscriptions } from '../../mcp-server/notifications.js';
|
|
7
7
|
import type { AnyResourceDefinition } from '../../mcp-server/resources/utils/resourceDefinition.js';
|
|
8
8
|
import { type ResourceHandlerFactoryServices } from '../../mcp-server/resources/utils/resourceHandlerFactory.js';
|
|
9
9
|
export declare class ResourceRegistry {
|
|
@@ -15,7 +15,7 @@ export declare class ResourceRegistry {
|
|
|
15
15
|
/**
|
|
16
16
|
* Registers all resolved resource definitions with the provided McpServer instance.
|
|
17
17
|
*/
|
|
18
|
-
registerAll(server: McpServer,
|
|
18
|
+
registerAll(server: McpServer, subscriptions?: ResourceSubscriptions): Promise<void>;
|
|
19
19
|
/** Throws at startup if a resource with the same name was already registered. */
|
|
20
20
|
private assertUniqueName;
|
|
21
21
|
private registerResource;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resource-registration.d.ts","sourceRoot":"","sources":["../../../src/mcp-server/resources/resource-registration.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,KAAK,SAAS,EAAoB,MAAM,
|
|
1
|
+
{"version":3,"file":"resource-registration.d.ts","sourceRoot":"","sources":["../../../src/mcp-server/resources/resource-registration.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,KAAK,SAAS,EAAoB,MAAM,8BAA8B,CAAC;AAEhF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAC3E,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oDAAoD,CAAC;AAChG,OAAO,EAEL,KAAK,8BAA8B,EAEpC,MAAM,wDAAwD,CAAC;AAUhE,qBAAa,gBAAgB;IAKzB,OAAO,CAAC,YAAY;IACpB,OAAO,CAAC,QAAQ;IALlB,wEAAwE;IACxE,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAqB;IAErD,YACU,YAAY,EAAE,qBAAqB,EAAE,EACrC,QAAQ,EAAE,8BAA8B,EAC9C;IAEJ;;OAEG;IACU,WAAW,CACtB,MAAM,EAAE,SAAS,EACjB,aAAa,CAAC,EAAE,qBAAqB,GACpC,OAAO,CAAC,IAAI,CAAC,CA2Bf;IAED,iFAAiF;IACjF,OAAO,CAAC,gBAAgB;YAUV,gBAAgB;CAqD/B"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @fileoverview Encapsulates the registration of all resource definitions with an McpServer.
|
|
3
3
|
* @module src/mcp-server/resources/resource-registration
|
|
4
4
|
*/
|
|
5
|
-
import { ResourceTemplate } from '@modelcontextprotocol/
|
|
5
|
+
import { ResourceTemplate } from '@modelcontextprotocol/server';
|
|
6
6
|
import { createResourceHandler, } from '../../mcp-server/resources/utils/resourceHandlerFactory.js';
|
|
7
7
|
import { JsonRpcErrorCode } from '../../types-global/errors.js';
|
|
8
8
|
import { ErrorHandler } from '../../utils/internal/error-handler/errorHandler.js';
|
|
@@ -23,7 +23,7 @@ export class ResourceRegistry {
|
|
|
23
23
|
/**
|
|
24
24
|
* Registers all resolved resource definitions with the provided McpServer instance.
|
|
25
25
|
*/
|
|
26
|
-
async registerAll(server,
|
|
26
|
+
async registerAll(server, subscriptions) {
|
|
27
27
|
this.registeredNames.clear();
|
|
28
28
|
// Per-server notifier closures targeting `server.send*ListChanged()`. Bound
|
|
29
29
|
// once per registerAll() call — never mutated on a shared services object
|
|
@@ -31,25 +31,18 @@ export class ResourceRegistry {
|
|
|
31
31
|
// factory prefers request-scoped notifiers (#135) and falls back to these
|
|
32
32
|
// only when a request has no notification sender.
|
|
33
33
|
const notifiers = {
|
|
34
|
-
elicitInput: (params) => server.server.elicitInput(params),
|
|
35
|
-
getClientCapabilities: () => protocolSession?.clientCapabilities ?? server.server.getClientCapabilities(),
|
|
36
34
|
notifyPromptListChanged: () => server.sendPromptListChanged(),
|
|
37
35
|
notifyResourceListChanged: () => server.sendResourceListChanged(),
|
|
38
|
-
notifyResourceUpdated: (uri) => server.server.sendResourceUpdated({ uri }),
|
|
39
36
|
notifyToolListChanged: () => server.sendToolListChanged(),
|
|
40
|
-
|
|
41
|
-
...(protocolSession?.registerRequest && {
|
|
42
|
-
registerRequest: protocolSession.registerRequest,
|
|
43
|
-
}),
|
|
37
|
+
...(subscriptions && { subscriptions }),
|
|
44
38
|
};
|
|
45
39
|
const context = requestContextService.createRequestContext({
|
|
46
40
|
operation: 'ResourceRegistry.registerAll',
|
|
47
41
|
});
|
|
48
42
|
logger.debug(`Registering ${this.resourceDefs.length} resource(s)...`, context);
|
|
49
|
-
//
|
|
50
|
-
//
|
|
51
|
-
//
|
|
52
|
-
server.setResourceRequestHandlers();
|
|
43
|
+
// `resources/list` and `resources/read` are installed by the SDK from the
|
|
44
|
+
// declared `resources` capability, so a server with no resources still
|
|
45
|
+
// answers `resources/list` with an empty array rather than `-32601`.
|
|
53
46
|
for (const resourceDef of this.resourceDefs) {
|
|
54
47
|
await this.registerResource(server, resourceDef, notifiers);
|
|
55
48
|
}
|
|
@@ -88,10 +81,10 @@ export class ResourceRegistry {
|
|
|
88
81
|
list: def.list,
|
|
89
82
|
...(def.complete && { complete: def.complete }),
|
|
90
83
|
});
|
|
91
|
-
server.
|
|
84
|
+
server.registerResource(resourceName, template, metadata, handler);
|
|
92
85
|
}
|
|
93
86
|
else {
|
|
94
|
-
server.
|
|
87
|
+
server.registerResource(resourceName, def.uriTemplate, metadata, (uri, ctx) => handler(uri, {}, ctx));
|
|
95
88
|
}
|
|
96
89
|
logger.debug(`Resource '${resourceName}' registered successfully.`, registrationContext);
|
|
97
90
|
}, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resource-registration.js","sourceRoot":"","sources":["../../../src/mcp-server/resources/resource-registration.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAkB,gBAAgB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"resource-registration.js","sourceRoot":"","sources":["../../../src/mcp-server/resources/resource-registration.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAkB,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAIhF,OAAO,EACL,qBAAqB,GAGtB,MAAM,wDAAwD,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,gDAAgD,CAAC;AAC9E,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAE3E,SAAS,uBAAuB,CAAC,WAAmB;IAClD,OAAO,WAAW,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;AACvC,CAAC;AAED,MAAM,OAAO,gBAAgB;IAKjB,YAAY;IACZ,QAAQ;IALlB,wEAAwE;IACvD,eAAe,GAAG,IAAI,GAAG,EAAU,CAAC;IAErD,YACU,YAAqC,EACrC,QAAwC;4BADxC,YAAY;wBACZ,QAAQ;IACf,CAAC;IAEJ;;OAEG;IACI,KAAK,CAAC,WAAW,CACtB,MAAiB,EACjB,aAAqC;QAErC,IAAI,CAAC,eAAe,CAAC,KAAK,EAAE,CAAC;QAE7B,4EAA4E;QAC5E,0EAA0E;QAC1E,0EAA0E;QAC1E,0EAA0E;QAC1E,kDAAkD;QAClD,MAAM,S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E,QAAQ,EAAE,OAAO,CAAC,CAAC;YACrE,CAAC;iBAAM,CAAC;gBACN,MAAM,CAAC,gBAAgB,CAAC,YAAY,EAAE,GAAG,CAAC,WAAW,EAAE,QAAQ,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAC5E,OAAO,CAAC,GAAG,EAAE,EAAE,EAAE,GAAG,CAAC,CACtB,CAAC;YACJ,CAAC;YAED,MAAM,CAAC,KAAK,CAAC,aAAa,YAAY,4BAA4B,EAAE,mBAAmB,CAAC,CAAC;QAC3F,CAAC,EACD;YACE,SAAS,EAAE,uBAAuB,YAAY,EAAE;YAChD,OAAO,EAAE,mBAAmB;YAC5B,SAAS,EAAE,gBAAgB,CAAC,oBAAoB;YAChD,QAAQ,EAAE,IAAI;SACf,CACF,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Per-connection `resources/subscribe` registry.
|
|
3
|
+
*
|
|
4
|
+
* The framework advertises `resources: { subscribe: true }`, and a declared
|
|
5
|
+
* capability is a promise: `resources/subscribe` and `resources/unsubscribe`
|
|
6
|
+
* must resolve, and `notifications/resources/updated` must only reach clients
|
|
7
|
+
* that actually subscribed to the URI (#354).
|
|
8
|
+
*
|
|
9
|
+
* This is the **2025-era** mechanism, and it is installed only on instances
|
|
10
|
+
* serving that era. The 2026-07-28 revision has no `resources/subscribe` RPC —
|
|
11
|
+
* a client opts in through `subscriptions/listen`'s `resourceSubscriptions`
|
|
12
|
+
* filter, and the SDK's listen router owns delivery. Handing a modern instance
|
|
13
|
+
* this registry would leave it permanently empty and silently drop every
|
|
14
|
+
* `ctx.notifyResourceUpdated(uri)`, so `createMcpServerInstance` passes none
|
|
15
|
+
* and the notifiers emit unconditionally there.
|
|
16
|
+
*
|
|
17
|
+
* Scope is the `McpServer` instance, which is also the connection: a persistent
|
|
18
|
+
* instance per session on the sessionful legacy arm, one per request under
|
|
19
|
+
* per-request serving. On the per-request arm a subscription cannot outlive the
|
|
20
|
+
* request that created it, so a handler-time `ctx.notifyResourceUpdated(uri)`
|
|
21
|
+
* only delivers when the same exchange subscribed first.
|
|
22
|
+
*
|
|
23
|
+
* @see {@link https://modelcontextprotocol.io/specification/2026-07-28/server/resources | MCP Resources}
|
|
24
|
+
* @module src/mcp-server/resources/resourceSubscriptions
|
|
25
|
+
*/
|
|
26
|
+
import type { McpServer } from '@modelcontextprotocol/server';
|
|
27
|
+
import type { ResourceSubscriptions } from '../../mcp-server/notifications.js';
|
|
28
|
+
/**
|
|
29
|
+
* Read-only view of one connection's subscription set. The set is mutated only
|
|
30
|
+
* by the `resources/subscribe` / `resources/unsubscribe` handlers installed
|
|
31
|
+
* alongside it.
|
|
32
|
+
*/
|
|
33
|
+
export interface ResourceSubscriptionRegistry extends ResourceSubscriptions {
|
|
34
|
+
readonly size: number;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Installs `resources/subscribe` / `resources/unsubscribe` on a server instance
|
|
38
|
+
* and returns the registry the notifiers read.
|
|
39
|
+
*
|
|
40
|
+
* Both handlers are idempotent and never fail: re-subscribing is a no-op, and
|
|
41
|
+
* unsubscribing from a URI that was never subscribed succeeds (the spec
|
|
42
|
+
* defines no error for it, and clients tear down optimistically).
|
|
43
|
+
*/
|
|
44
|
+
export declare function installResourceSubscriptions(server: McpServer): ResourceSubscriptionRegistry;
|
|
45
|
+
//# sourceMappingURL=resourceSubscriptions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resourceSubscriptions.d.ts","sourceRoot":"","sources":["../../../src/mcp-server/resources/resourceSubscriptions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAE9D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAE3E;;;;GAIG;AACH,MAAM,WAAW,4BAA6B,SAAQ,qBAAqB;IACzE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;;GAOG;AACH,wBAAgB,4BAA4B,CAAC,MAAM,EAAE,SAAS,GAAG,4BAA4B,CAmB5F"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Per-connection `resources/subscribe` registry.
|
|
3
|
+
*
|
|
4
|
+
* The framework advertises `resources: { subscribe: true }`, and a declared
|
|
5
|
+
* capability is a promise: `resources/subscribe` and `resources/unsubscribe`
|
|
6
|
+
* must resolve, and `notifications/resources/updated` must only reach clients
|
|
7
|
+
* that actually subscribed to the URI (#354).
|
|
8
|
+
*
|
|
9
|
+
* This is the **2025-era** mechanism, and it is installed only on instances
|
|
10
|
+
* serving that era. The 2026-07-28 revision has no `resources/subscribe` RPC —
|
|
11
|
+
* a client opts in through `subscriptions/listen`'s `resourceSubscriptions`
|
|
12
|
+
* filter, and the SDK's listen router owns delivery. Handing a modern instance
|
|
13
|
+
* this registry would leave it permanently empty and silently drop every
|
|
14
|
+
* `ctx.notifyResourceUpdated(uri)`, so `createMcpServerInstance` passes none
|
|
15
|
+
* and the notifiers emit unconditionally there.
|
|
16
|
+
*
|
|
17
|
+
* Scope is the `McpServer` instance, which is also the connection: a persistent
|
|
18
|
+
* instance per session on the sessionful legacy arm, one per request under
|
|
19
|
+
* per-request serving. On the per-request arm a subscription cannot outlive the
|
|
20
|
+
* request that created it, so a handler-time `ctx.notifyResourceUpdated(uri)`
|
|
21
|
+
* only delivers when the same exchange subscribed first.
|
|
22
|
+
*
|
|
23
|
+
* @see {@link https://modelcontextprotocol.io/specification/2026-07-28/server/resources | MCP Resources}
|
|
24
|
+
* @module src/mcp-server/resources/resourceSubscriptions
|
|
25
|
+
*/
|
|
26
|
+
/**
|
|
27
|
+
* Installs `resources/subscribe` / `resources/unsubscribe` on a server instance
|
|
28
|
+
* and returns the registry the notifiers read.
|
|
29
|
+
*
|
|
30
|
+
* Both handlers are idempotent and never fail: re-subscribing is a no-op, and
|
|
31
|
+
* unsubscribing from a URI that was never subscribed succeeds (the spec
|
|
32
|
+
* defines no error for it, and clients tear down optimistically).
|
|
33
|
+
*/
|
|
34
|
+
export function installResourceSubscriptions(server) {
|
|
35
|
+
const subscribed = new Set();
|
|
36
|
+
server.server.setRequestHandler('resources/subscribe', (request) => {
|
|
37
|
+
subscribed.add(request.params.uri);
|
|
38
|
+
return {};
|
|
39
|
+
});
|
|
40
|
+
server.server.setRequestHandler('resources/unsubscribe', (request) => {
|
|
41
|
+
subscribed.delete(request.params.uri);
|
|
42
|
+
return {};
|
|
43
|
+
});
|
|
44
|
+
return {
|
|
45
|
+
has: (uri) => subscribed.has(uri),
|
|
46
|
+
get size() {
|
|
47
|
+
return subscribed.size;
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=resourceSubscriptions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resourceSubscriptions.js","sourceRoot":"","sources":["../../../src/mcp-server/resources/resourceSubscriptions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAeH;;;;;;;GAOG;AACH,MAAM,UAAU,4BAA4B,CAAC,MAAiB;IAC5D,MAAM,UAAU,GAAG,IAAI,GAAG,EAAU,CAAC;IAErC,MAAM,CAAC,MAAM,CAAC,iBAAiB,CAAC,qBAAqB,EAAE,CAAC,OAAO,EAAE,EAAE;QACjE,UAAU,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QACnC,OAAO,EAAE,CAAC;IACZ,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,MAAM,CAAC,iBAAiB,CAAC,uBAAuB,EAAE,CAAC,OAAO,EAAE,EAAE;QACnE,UAAU,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QACtC,OAAO,EAAE,CAAC;IACZ,CAAC,CAAC,CAAC;IAEH,OAAO;QACL,GAAG,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC;QACjC,IAAI,IAAI;YACN,OAAO,UAAU,CAAC,IAAI,CAAC;QACzB,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -3,12 +3,10 @@
|
|
|
3
3
|
* Handler receives `(params, ctx)` — URI is available on `ctx.uri`.
|
|
4
4
|
*
|
|
5
5
|
* MCP Resources Specification:
|
|
6
|
-
* @see {@link https://modelcontextprotocol.io/specification/
|
|
6
|
+
* @see {@link https://modelcontextprotocol.io/specification/2026-07-28/server/resources | MCP Resources}
|
|
7
7
|
* @module src/mcp-server/resources/utils/resourceDefinition
|
|
8
8
|
*/
|
|
9
|
-
import type { CompleteResourceTemplateCallback } from '@modelcontextprotocol/
|
|
10
|
-
import type { RequestHandlerExtra } from '@modelcontextprotocol/sdk/shared/protocol.js';
|
|
11
|
-
import type { ListResourcesResult, ReadResourceResult, ServerNotification, ServerRequest } from '@modelcontextprotocol/sdk/types.js';
|
|
9
|
+
import type { CompleteResourceTemplateCallback, ListResourcesResult, ReadResourceResult, ServerContext } from '@modelcontextprotocol/server';
|
|
12
10
|
import type { ZodObject, ZodRawShape, z } from 'zod';
|
|
13
11
|
import type { HandlerContext, ReasonOf } from '../../../core/context.js';
|
|
14
12
|
import type { ErrorContract } from '../../../types-global/errors.js';
|
|
@@ -25,7 +23,7 @@ export interface ResourceAnnotations {
|
|
|
25
23
|
priority?: number;
|
|
26
24
|
}
|
|
27
25
|
/** Extra context provided to list() handlers. */
|
|
28
|
-
export type ListExtra =
|
|
26
|
+
export type ListExtra = ServerContext;
|
|
29
27
|
/**
|
|
30
28
|
* Represents a complete, self-contained definition of an MCP resource.
|
|
31
29
|
* Handler receives `(params, ctx)` — URI is available on `ctx.uri`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resourceDefinition.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/resources/utils/resourceDefinition.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"resourceDefinition.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/resources/utils/resourceDefinition.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EACV,gCAAgC,EAChC,mBAAmB,EACnB,kBAAkB,EAClB,aAAa,EACd,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAErD,OAAO,KAAK,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAE9D;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC,qEAAqE;IACrE,QAAQ,CAAC,EAAE,CAAC,MAAM,GAAG,WAAW,CAAC,EAAE,CAAC;IACpC,qEAAqE;IACrE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,kEAAkE;IAClE,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,iDAAiD;AACjD,MAAM,MAAM,SAAS,GAAG,aAAa,CAAC;AAEtC;;;GAGG;AACH,MAAM,WAAW,kBAAkB,CACjC,OAAO,SAAS,SAAS,CAAC,WAAW,CAAC,GAAG,SAAS,CAAC,WAAW,CAAC,EAC/D,OAAO,SAAS,SAAS,CAAC,WAAW,CAAC,GAAG,SAAS,GAAG,SAAS,EAC9D,OAAO,SAAS,SAAS,aAAa,EAAE,GAAG,SAAS,GAAG,SAAS;IAEhE;;;;;;;;;;;;;;;;;;OAkBG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,8BAA8B;IAC9B,WAAW,CAAC,EAAE,mBAAmB,CAAC;IAClC,4BAA4B;IA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AC;IACd;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,2CAA2C;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,iFAAiF;IACjF,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,0CAA0C;AAC1C,MAAM,MAAM,qBAAqB,GAAG,kBAAkB,CACpD,SAAS,CAAC,WAAW,CAAC,EACtB,SAAS,CAAC,WAAW,CAAC,GAAG,SAAS,EAClC,SAAS,aAAa,EAAE,GAAG,SAAS,CACrC,CAAC;AAMF;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,QAAQ,CACtB,OAAO,SAAS,SAAS,CAAC,WAAW,CAAC,EACtC,OAAO,SAAS,SAAS,CAAC,WAAW,CAAC,GAAG,SAAS,GAAG,SAAS,EAC9D,KAAK,CAAC,OAAO,SAAS,SAAS,aAAa,EAAE,GAAG,SAAS,GAAG,SAAS,EAEtE,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,IAAI,CAAC,kBAAkB,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,aAAa,CAAC,GAC1E,kBAAkB,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,CAE/C"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Handler receives `(params, ctx)` — URI is available on `ctx.uri`.
|
|
4
4
|
*
|
|
5
5
|
* MCP Resources Specification:
|
|
6
|
-
* @see {@link https://modelcontextprotocol.io/specification/
|
|
6
|
+
* @see {@link https://modelcontextprotocol.io/specification/2026-07-28/server/resources | MCP Resources}
|
|
7
7
|
* @module src/mcp-server/resources/utils/resourceDefinition
|
|
8
8
|
*/
|
|
9
9
|
// ---------------------------------------------------------------------------
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resourceDefinition.js","sourceRoot":"","sources":["../../../../src/mcp-server/resources/utils/resourceDefinition.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;
|
|
1
|
+
{"version":3,"file":"resourceDefinition.js","sourceRoot":"","sources":["../../../../src/mcp-server/resources/utils/resourceDefinition.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAuIH,8EAA8E;AAC9E,UAAU;AACV,8EAA8E;AAE9E;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,QAAQ,CAKtB,WAAmB,EACnB,OAA2E;IAE3E,OAAO,EAAE,WAAW,EAAE,GAAG,OAAO,EAAE,CAAC;AACrC,CAAC"}
|