@redocly/reef 0.137.0-next.0 → 0.137.0-next.10
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/CHANGELOG.md +234 -0
- package/dist/api-schemas/otel-traces.d.ts +1359 -0
- package/dist/api-schemas/otel-traces.js +1 -0
- package/dist/cli/stats/collectors/asyncapi/index.d.ts +3 -0
- package/dist/cli/stats/collectors/asyncapi/index.js +1 -0
- package/dist/cli/stats/collectors/extension-sampling.d.ts +44 -0
- package/dist/cli/stats/collectors/extension-sampling.js +1 -0
- package/dist/cli/stats/collectors/openapi/index.js +1 -1
- package/dist/cli/stats/collectors/page-slugs/index.d.ts +9 -0
- package/dist/cli/stats/collectors/page-slugs/index.js +1 -0
- package/dist/cli/stats/collectors/prepare-stats-walk.d.ts +10 -0
- package/dist/cli/stats/collectors/prepare-stats-walk.js +1 -0
- package/dist/cli/stats/collectors/run-stats-collector.d.ts +24 -0
- package/dist/cli/stats/collectors/run-stats-collector.js +1 -0
- package/dist/cli/stats/index.js +1 -1
- package/dist/client/app/hooks/useMcpData.d.ts +1 -0
- package/dist/client/app/hooks/useMcpData.js +1 -1
- package/dist/client/app/markdoc/custom-components/openapi/json-schema.js +1 -1
- package/dist/client/app/markdoc/custom-components/openapi/openapi-code-sample.js +1 -1
- package/dist/client/app/markdoc/custom-components/openapi/openapi-example.js +1 -1
- package/dist/client/app/markdoc/custom-components/openapi/openapi-response-sample.js +1 -1
- package/dist/client/app/markdoc/custom-components/openapi/replay-openapi.js +1 -1
- package/dist/client/app/markdoc/custom-components/openapi/use-markdown-adapter.d.ts +45 -0
- package/dist/client/app/markdoc/custom-components/openapi/use-markdown-adapter.js +1 -0
- package/dist/client/app/utils/loadAndNavigate.js +1 -1
- package/dist/client/providers/hooks.js +1 -1
- package/dist/client/providers/post-message/PostMessageProvider.js +1 -1
- package/dist/client/templates/api-docs/helpers.d.ts +4 -1
- package/dist/client/templates/api-docs/helpers.js +5 -1
- package/dist/client/templates/api-docs/template.js +8 -3
- package/dist/client/utils/catalog/get-next-page-param.d.ts +1 -1
- package/dist/client/utils/catalog/get-next-page-param.js +1 -1
- package/dist/compiled/svgo/svgo-node.js +32 -32
- package/dist/constants/l10n/langs/ar.js +1 -1
- package/dist/constants/l10n/langs/de.js +1 -1
- package/dist/constants/l10n/langs/en.js +1 -1
- package/dist/constants/l10n/langs/es.js +1 -1
- package/dist/constants/l10n/langs/fr.js +1 -1
- package/dist/constants/l10n/langs/hi.js +1 -1
- package/dist/constants/l10n/langs/it.js +1 -1
- package/dist/constants/l10n/langs/ja.js +1 -1
- package/dist/constants/l10n/langs/ko.js +1 -1
- package/dist/constants/l10n/langs/pl.js +1 -1
- package/dist/constants/l10n/langs/pt-BR.js +1 -1
- package/dist/constants/l10n/langs/pt.js +1 -1
- package/dist/constants/l10n/langs/ru.js +1 -1
- package/dist/constants/l10n/langs/uk.js +1 -1
- package/dist/constants/l10n/langs/zh.js +1 -1
- package/dist/server/config/env-config.d.ts +6 -0
- package/dist/server/config/env-schema.d.ts +15 -0
- package/dist/server/config/env-schemas/feature-flags.d.ts +9 -1
- package/dist/server/config/env-schemas/feature-flags.js +1 -1
- package/dist/server/config/env-schemas/search.d.ts +3 -0
- package/dist/server/config/env-schemas/search.js +1 -1
- package/dist/server/constants/common.d.ts +1 -0
- package/dist/server/constants/common.js +1 -1
- package/dist/server/constants/mcp.d.ts +5 -0
- package/dist/server/constants/mcp.js +1 -0
- package/dist/server/constants/plugins/search.d.ts +0 -2
- package/dist/server/constants/plugins/search.js +1 -1
- package/dist/server/constants/rbac.d.ts +3 -0
- package/dist/server/constants/rbac.js +1 -0
- package/dist/server/esbuild/esbuild.js +3 -3
- package/dist/server/esbuild/plugins/mcp-tool-handlers-resolver.js +1 -1
- package/dist/server/plugins/api-docs/options.js +1 -1
- package/dist/server/plugins/api-docs/search/create-indexer.d.ts +5 -0
- package/dist/server/plugins/api-docs/search/create-indexer.js +1 -0
- package/dist/server/plugins/api-docs/search/get-ai-search-documents.js +28 -28
- package/dist/server/plugins/api-docs/search/search-resolver.js +1 -1
- package/dist/server/plugins/{openapi-docs/is-openapi-doc.d.ts → api-docs/utils/is-api-doc.d.ts} +4 -2
- package/dist/server/plugins/api-docs/utils/is-api-doc.js +1 -0
- package/dist/server/plugins/arazzo-docs/arazzo-doc-loader.d.ts +1 -1
- package/dist/server/plugins/arazzo-docs/arazzo-doc-loader.js +1 -1
- package/dist/server/plugins/config-parser/loaders/content-slugs-loader.d.ts +5 -0
- package/dist/server/plugins/config-parser/loaders/content-slugs-loader.js +1 -1
- package/dist/server/plugins/entitlements/index.js +1 -1
- package/dist/server/plugins/l10n/index.js +1 -1
- package/dist/server/plugins/lifecycle.js +2 -2
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-link.js +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-open-api-ref.js +1 -1
- package/dist/server/plugins/markdown/html/html-jsx-attribute-mapping.js +1 -1
- package/dist/server/plugins/markdown/utils/sanitize-malformed-md-content.js +2 -2
- package/dist/server/plugins/mcp/auth/auth-handlers.d.ts +1 -2
- package/dist/server/plugins/mcp/auth/auth-handlers.js +1 -1
- package/dist/server/plugins/mcp/auth/token-audience-telemetry.d.ts +7 -0
- package/dist/server/plugins/mcp/auth/token-audience-telemetry.js +1 -0
- package/dist/server/plugins/mcp/auth/token-audience.d.ts +6 -0
- package/dist/server/plugins/mcp/auth/token-audience.js +1 -0
- package/dist/server/plugins/mcp/codemode/capabilities/fetch/index.js +4 -4
- package/dist/server/plugins/mcp/codemode/code-execution-telemetry.d.ts +3 -1
- package/dist/server/plugins/mcp/codemode/code-execution-telemetry.js +1 -1
- package/dist/server/plugins/mcp/codemode/invoke-tool.js +1 -1
- package/dist/server/plugins/mcp/codemode/prompts.js +1 -1
- package/dist/server/plugins/mcp/codemode/sandbox/polyfills/fetch-shim.d.ts +1 -1
- package/dist/server/plugins/mcp/codemode/sandbox/polyfills/fetch-shim.js +9 -3
- package/dist/server/plugins/mcp/codemode/tools/describe-tools.d.ts +1 -1
- package/dist/server/plugins/mcp/codemode/tools/describe-tools.js +1 -1
- package/dist/server/plugins/mcp/codemode/tools/execute-schema.js +1 -1
- package/dist/server/plugins/mcp/codemode/tools/execute.js +1 -1
- package/dist/server/plugins/mcp/codemode/tools/manage-credentials.d.ts +1 -0
- package/dist/server/plugins/mcp/codemode/tools/manage-credentials.js +2 -2
- package/dist/server/plugins/mcp/codemode/types.d.ts +1 -0
- package/dist/server/plugins/mcp/constants.d.ts +1 -1
- package/dist/server/plugins/mcp/constants.js +1 -1
- package/dist/server/plugins/mcp/custom-tools/extract-tool-definition.d.ts +13 -0
- package/dist/server/plugins/mcp/custom-tools/extract-tool-definition.js +1 -0
- package/dist/server/plugins/mcp/custom-tools/scan-custom-tools.d.ts +6 -0
- package/dist/server/plugins/mcp/custom-tools/scan-custom-tools.js +1 -0
- package/dist/server/plugins/mcp/custom-tools/validate-tool-definition.d.ts +3 -0
- package/dist/server/plugins/mcp/custom-tools/validate-tool-definition.js +1 -0
- package/dist/server/plugins/mcp/docs-mcp/tool-schemas.d.ts +2 -0
- package/dist/server/plugins/mcp/docs-mcp/tool-schemas.js +1 -1
- package/dist/server/plugins/mcp/docs-mcp/tools/core/search.js +2 -2
- package/dist/server/plugins/mcp/docs-mcp/tools/openapi/get-endpoints.js +1 -1
- package/dist/server/plugins/mcp/docs-mcp/tools/openapi/list-apis.js +1 -1
- package/dist/server/plugins/mcp/docs-mcp/tools/openapi/utils.js +1 -1
- package/dist/server/plugins/mcp/gateway-mcp/callable-apis.d.ts +10 -0
- package/dist/server/plugins/mcp/gateway-mcp/callable-apis.js +1 -0
- package/dist/server/plugins/mcp/gateway-mcp/credential-validation.d.ts +4 -0
- package/dist/server/plugins/mcp/gateway-mcp/credential-validation.js +1 -0
- package/dist/server/plugins/mcp/gateway-mcp/elicitation.d.ts +15 -5
- package/dist/server/plugins/mcp/gateway-mcp/elicitation.js +5 -3
- package/dist/server/plugins/mcp/gateway-mcp/eligibility.js +1 -1
- package/dist/server/plugins/mcp/gateway-mcp/fetch/fetch-audit.d.ts +2 -1
- package/dist/server/plugins/mcp/gateway-mcp/fetch/fetch-audit.js +1 -1
- package/dist/server/plugins/mcp/gateway-mcp/fetch/fetch-bridge.d.ts +10 -1
- package/dist/server/plugins/mcp/gateway-mcp/fetch/fetch-bridge.js +1 -1
- package/dist/server/plugins/mcp/gateway-mcp/fetch/upstream-detail.d.ts +7 -0
- package/dist/server/plugins/mcp/gateway-mcp/fetch/upstream-detail.js +1 -0
- package/dist/server/plugins/mcp/gateway-mcp/fetch-capability.d.ts +2 -10
- package/dist/server/plugins/mcp/gateway-mcp/fetch-capability.js +1 -1
- package/dist/server/plugins/mcp/gateway-mcp/secret-store.d.ts +16 -4
- package/dist/server/plugins/mcp/gateway-mcp/secret-store.js +1 -1
- package/dist/server/plugins/mcp/gateway-mcp/upstream-auth-scheme.d.ts +26 -1
- package/dist/server/plugins/mcp/gateway-mcp/upstream-auth-scheme.js +2 -1
- package/dist/server/plugins/mcp/gateway-mcp/upstream-auth.d.ts +12 -0
- package/dist/server/plugins/mcp/gateway-mcp/upstream-auth.js +1 -1
- package/dist/server/plugins/mcp/handlers/docs-mcp-handler.js +1 -1
- package/dist/server/plugins/mcp/handlers/errors.d.ts +7 -2
- package/dist/server/plugins/mcp/handlers/errors.js +1 -1
- package/dist/server/plugins/mcp/handlers/handle-mcp-request.js +1 -1
- package/dist/server/plugins/mcp/handlers/mcp-credentials-handler.js +1 -124
- package/dist/server/plugins/mcp/handlers/mcp-credentials-page.d.ts +12 -0
- package/dist/server/plugins/mcp/handlers/mcp-credentials-page.js +225 -0
- package/dist/server/plugins/mcp/index.d.ts +0 -2
- package/dist/server/plugins/mcp/index.js +1 -1
- package/dist/server/plugins/mcp/servers/docs-server.d.ts +2 -2
- package/dist/server/plugins/mcp/servers/docs-server.js +1 -1
- package/dist/server/plugins/mcp/servers/mcp-server.d.ts +2 -11
- package/dist/server/plugins/mcp/servers/mcp-server.js +4 -2
- package/dist/server/plugins/mcp/types.d.ts +32 -5
- package/dist/server/plugins/mcp/utils/available-sandbox-tools.d.ts +4 -0
- package/dist/server/plugins/mcp/utils/available-sandbox-tools.js +1 -0
- package/dist/server/plugins/mcp/utils/find-gated-tool-names.d.ts +12 -0
- package/dist/server/plugins/mcp/utils/find-gated-tool-names.js +1 -0
- package/dist/server/plugins/mcp/utils/mcp-client.d.ts +13 -0
- package/dist/server/plugins/mcp/utils/mcp-client.js +1 -0
- package/dist/server/plugins/mcp/utils/tool-registration.d.ts +17 -0
- package/dist/server/plugins/mcp/utils/tool-registration.js +1 -0
- package/dist/server/plugins/mcp/workers/execute-mcp-tool.d.ts +6 -1
- package/dist/server/plugins/mcp/workers/execute-mcp-tool.js +1 -1
- package/dist/server/plugins/mcp/workers/import-mcp-tool-handlers.d.ts +5 -0
- package/dist/server/plugins/mcp/workers/import-mcp-tool-handlers.js +1 -0
- package/dist/server/plugins/mcp/workers/mcp-tool-telemetry.d.ts +6 -11
- package/dist/server/plugins/mcp/workers/mcp-tool-telemetry.js +1 -1
- package/dist/server/plugins/mcp/workers/tool-file-system.d.ts +6 -0
- package/dist/server/plugins/mcp/workers/tool-file-system.js +1 -0
- package/dist/server/plugins/search/ai-indexer/prepare-semantic-documents.d.ts +4 -2
- package/dist/server/plugins/search/ai-indexer/prepare-semantic-documents.js +1 -3
- package/dist/server/plugins/search/engines/flexsearch/index.js +1 -1
- package/dist/server/plugins/search/engines/flexsearch/search-index.d.ts +8 -4
- package/dist/server/plugins/search/engines/flexsearch/search-index.js +1 -1
- package/dist/server/plugins/search/engines/typesense/index.js +1 -1
- package/dist/server/plugins/search/index.js +1 -1
- package/dist/server/plugins/search/llmstxt/build-page-llms-txt-md.d.ts +4 -0
- package/dist/server/plugins/search/llmstxt/build-page-llms-txt-md.js +3 -0
- package/dist/server/plugins/search/llmstxt/create-llms-txt-generator.d.ts +4 -0
- package/dist/server/plugins/search/llmstxt/create-llms-txt-generator.js +1 -0
- package/dist/server/plugins/search/llmstxt/get-llms-txt-exclude-matcher.d.ts +4 -0
- package/dist/server/plugins/search/llmstxt/get-llms-txt-exclude-matcher.js +1 -0
- package/dist/server/plugins/search/llmstxt/index.d.ts +2 -2
- package/dist/server/plugins/search/llmstxt/is-included-in-llms-txt.d.ts +6 -0
- package/dist/server/plugins/search/llmstxt/is-included-in-llms-txt.js +1 -0
- package/dist/server/plugins/search/utils.d.ts +2 -1
- package/dist/server/plugins/search/utils.js +2 -2
- package/dist/server/sandbox/constants/sandbox.d.ts +4 -1
- package/dist/server/sandbox/constants/sandbox.js +1 -1
- package/dist/server/sandbox/sandbox.js +2 -2
- package/dist/server/sandbox/utils/returns-from-top-level.d.ts +4 -0
- package/dist/server/sandbox/utils/returns-from-top-level.js +1 -0
- package/dist/server/store.d.ts +2 -0
- package/dist/server/store.js +1 -1
- package/dist/server/types/plugins/common.d.ts +5 -0
- package/dist/server/types/plugins/search.d.ts +7 -2
- package/dist/server/types/web-server.d.ts +8 -0
- package/dist/server/utils/envs/get-api-route-allowed-env-variables.js +1 -1
- package/dist/server/utils/get-route-ai-documents-store.d.ts +5 -0
- package/dist/server/utils/get-route-ai-documents-store.js +1 -0
- package/dist/server/utils/get-route-static-data.d.ts +4 -0
- package/dist/server/utils/get-route-static-data.js +1 -0
- package/dist/server/utils/llmstxt/agent-feedback-llms-footer.js +1 -1
- package/dist/server/utils/llmstxt/resolve-llms-txt-md.d.ts +10 -0
- package/dist/server/utils/llmstxt/resolve-llms-txt-md.js +1 -0
- package/dist/server/utils/rbac/can-anonymous-access-mcp-feature.d.ts +3 -0
- package/dist/server/utils/rbac/can-anonymous-access-mcp-feature.js +1 -0
- package/dist/server/utils/rbac/should-handle-mcp-auth.d.ts +2 -0
- package/dist/server/utils/rbac/should-handle-mcp-auth.js +1 -0
- package/dist/server/utils/rbac.js +1 -1
- package/dist/server/utils/search/highlight-text-for-search.js +1 -1
- package/dist/server/web-server/auth.d.ts +13 -2
- package/dist/server/web-server/auth.js +3 -3
- package/dist/server/web-server/dev-server.js +1 -1
- package/dist/server/web-server/handle-api-route-request.js +1 -1
- package/dist/server/web-server/middleware/ensureSearchData.js +1 -1
- package/dist/server/web-server/routes/ask-ai.d.ts +1 -0
- package/dist/server/web-server/routes/ask-ai.js +1 -1
- package/dist/server/web-server/routes/auth.js +1 -1
- package/dist/server/web-server/routes/dynamic-route.d.ts +2 -1
- package/dist/server/web-server/routes/dynamic-route.js +1 -1
- package/dist/server/web-server/routes/error.js +1 -1
- package/dist/server/web-server/routes/helpers/resolve-ui-locales-for-idp-login.js +1 -1
- package/dist/server/web-server/routes/index.d.ts +2 -1
- package/dist/server/web-server/routes/index.js +1 -1
- package/dist/server/web-server/routes/llms-txt.d.ts +4 -0
- package/dist/server/web-server/routes/llms-txt.js +1 -0
- package/dist/server/web-server/routes/mcp-routes/agent-card.js +1 -1
- package/dist/server/web-server/routes/mcp-routes/mcp-server-card.js +1 -1
- package/dist/server/web-server/routes/otel/otel.js +1 -1
- package/dist/server/web-server/routes/page-data.js +1 -1
- package/dist/server/web-server/routes/resolve-route.js +1 -1
- package/dist/server/web-server/utils/get-request-origin.d.ts +2 -0
- package/dist/server/web-server/utils/get-request-origin.js +1 -1
- package/dist/server/web-server/utils/prepare-list-response.d.ts +2 -4
- package/dist/server/web-server/utils/prepare-list-response.js +1 -1
- package/dist/server/web-server/utils.d.ts +1 -1
- package/dist/server/web-server/utils.js +1 -1
- package/dist/server/workers/mcp-tool-worker-pool.d.ts +1 -0
- package/dist/server/workers/mcp-tool-worker-pool.js +1 -1
- package/dist/server/workers/mcp-tool-worker.js +1 -1
- package/dist/server/workers/types.d.ts +9 -2
- package/dist/server/workers/worker-pool.d.ts +1 -0
- package/dist/server/workers/worker-pool.js +1 -1
- package/dist/types/global-data.d.ts +1 -0
- package/dist/utils/guards/is-plain-object.d.ts +19 -0
- package/dist/utils/guards/is-plain-object.js +1 -0
- package/package.json +12 -15
- package/dist/client/templates/asyncapi-docs/helpers.d.ts +0 -12
- package/dist/client/templates/asyncapi-docs/helpers.js +0 -1
- package/dist/client/templates/asyncapi-docs/template.d.ts +0 -15
- package/dist/client/templates/asyncapi-docs/template.js +0 -9
- package/dist/client/templates/openapi-docs/helpers.d.ts +0 -18
- package/dist/client/templates/openapi-docs/helpers.js +0 -5
- package/dist/client/templates/openapi-docs/template.d.ts +0 -6
- package/dist/client/templates/openapi-docs/template.js +0 -14
- package/dist/server/esbuild/plugins/api-docs-module-replacer/empty-check.d.ts +0 -9
- package/dist/server/esbuild/plugins/api-docs-module-replacer/empty-check.js +0 -1
- package/dist/server/esbuild/plugins/api-docs-module-replacer/empty-overlay.d.ts +0 -2
- package/dist/server/esbuild/plugins/api-docs-module-replacer/empty-overlay.js +0 -1
- package/dist/server/esbuild/plugins/api-docs-module-replacer/index.d.ts +0 -6
- package/dist/server/esbuild/plugins/api-docs-module-replacer/index.js +0 -1
- package/dist/server/esbuild/plugins/openapi-docs-module-replacer/empty-check.d.ts +0 -8
- package/dist/server/esbuild/plugins/openapi-docs-module-replacer/empty-check.js +0 -1
- package/dist/server/esbuild/plugins/openapi-docs-module-replacer/empty-overlay.d.ts +0 -2
- package/dist/server/esbuild/plugins/openapi-docs-module-replacer/empty-overlay.js +0 -1
- package/dist/server/esbuild/plugins/openapi-docs-module-replacer/empty-use-license-key.d.ts +0 -5
- package/dist/server/esbuild/plugins/openapi-docs-module-replacer/empty-use-license-key.js +0 -1
- package/dist/server/esbuild/plugins/openapi-docs-module-replacer/index.d.ts +0 -6
- package/dist/server/esbuild/plugins/openapi-docs-module-replacer/index.js +0 -1
- package/dist/server/esbuild/plugins/openapi-docs-module-replacer/loadAndBundleSpec.mock.d.ts +0 -3
- package/dist/server/esbuild/plugins/openapi-docs-module-replacer/loadAndBundleSpec.mock.js +0 -1
- package/dist/server/plugins/api-docs/search/search-indexer.d.ts +0 -9
- package/dist/server/plugins/api-docs/search/search-indexer.js +0 -1
- package/dist/server/plugins/asyncapi-docs/asyncapi-doc-loader.d.ts +0 -18
- package/dist/server/plugins/asyncapi-docs/asyncapi-doc-loader.js +0 -5
- package/dist/server/plugins/asyncapi-docs/get-server-props.d.ts +0 -4
- package/dist/server/plugins/asyncapi-docs/get-server-props.js +0 -1
- package/dist/server/plugins/asyncapi-docs/get-template-path.d.ts +0 -2
- package/dist/server/plugins/asyncapi-docs/get-template-path.js +0 -1
- package/dist/server/plugins/asyncapi-docs/index.d.ts +0 -3
- package/dist/server/plugins/asyncapi-docs/index.js +0 -1
- package/dist/server/plugins/asyncapi-docs/is-asyncapi-doc.d.ts +0 -3
- package/dist/server/plugins/asyncapi-docs/is-asyncapi-doc.js +0 -1
- package/dist/server/plugins/asyncapi-docs/search/get-ai-search-documents.d.ts +0 -9
- package/dist/server/plugins/asyncapi-docs/search/get-ai-search-documents.js +0 -56
- package/dist/server/plugins/asyncapi-docs/search/schema-processor.d.ts +0 -8
- package/dist/server/plugins/asyncapi-docs/search/schema-processor.js +0 -1
- package/dist/server/plugins/asyncapi-docs/search/search-facets.d.ts +0 -8
- package/dist/server/plugins/asyncapi-docs/search/search-facets.js +0 -1
- package/dist/server/plugins/asyncapi-docs/search/search-resolver.d.ts +0 -5
- package/dist/server/plugins/asyncapi-docs/search/search-resolver.js +0 -1
- package/dist/server/plugins/asyncapi-docs/store-definition-bundles.d.ts +0 -4
- package/dist/server/plugins/asyncapi-docs/store-definition-bundles.js +0 -1
- package/dist/server/plugins/graphql-docs/constants.d.ts +0 -2
- package/dist/server/plugins/graphql-docs/constants.js +0 -1
- package/dist/server/plugins/graphql-docs/get-template-path.d.ts +0 -2
- package/dist/server/plugins/graphql-docs/get-template-path.js +0 -1
- package/dist/server/plugins/graphql-docs/graphql-doc-loader.d.ts +0 -17
- package/dist/server/plugins/graphql-docs/graphql-doc-loader.js +0 -1
- package/dist/server/plugins/graphql-docs/index.d.ts +0 -4
- package/dist/server/plugins/graphql-docs/index.js +0 -1
- package/dist/server/plugins/graphql-docs/is-graphql-doc.d.ts +0 -2
- package/dist/server/plugins/graphql-docs/is-graphql-doc.js +0 -1
- package/dist/server/plugins/graphql-docs/search/ai/get-ai-search-document.d.ts +0 -17
- package/dist/server/plugins/graphql-docs/search/ai/get-ai-search-document.js +0 -4
- package/dist/server/plugins/graphql-docs/search/ai/utils.d.ts +0 -14
- package/dist/server/plugins/graphql-docs/search/ai/utils.js +0 -36
- package/dist/server/plugins/graphql-docs/search/search-facets.d.ts +0 -8
- package/dist/server/plugins/graphql-docs/search/search-facets.js +0 -1
- package/dist/server/plugins/graphql-docs/search/search-resolver.d.ts +0 -5
- package/dist/server/plugins/graphql-docs/search/search-resolver.js +0 -1
- package/dist/server/plugins/graphql-docs/spec-download.api.d.ts +0 -3
- package/dist/server/plugins/graphql-docs/spec-download.api.js +0 -1
- package/dist/server/plugins/graphql-docs/template/GraphQLDocs.d.ts +0 -5
- package/dist/server/plugins/graphql-docs/template/GraphQLDocs.js +0 -4
- package/dist/server/plugins/graphql-docs/types.d.ts +0 -40
- package/dist/server/plugins/graphql-docs/types.js +0 -0
- package/dist/server/plugins/openapi-docs/ai-search-indexer.d.ts +0 -14
- package/dist/server/plugins/openapi-docs/ai-search-indexer.js +0 -1
- package/dist/server/plugins/openapi-docs/decorators.d.ts +0 -25
- package/dist/server/plugins/openapi-docs/decorators.js +0 -1
- package/dist/server/plugins/openapi-docs/format-bundle-error.d.ts +0 -6
- package/dist/server/plugins/openapi-docs/format-bundle-error.js +0 -5
- package/dist/server/plugins/openapi-docs/get-server-props.d.ts +0 -4
- package/dist/server/plugins/openapi-docs/get-server-props.js +0 -1
- package/dist/server/plugins/openapi-docs/get-template-path.d.ts +0 -2
- package/dist/server/plugins/openapi-docs/get-template-path.js +0 -1
- package/dist/server/plugins/openapi-docs/index.d.ts +0 -3
- package/dist/server/plugins/openapi-docs/index.js +0 -1
- package/dist/server/plugins/openapi-docs/is-openapi-doc.js +0 -1
- package/dist/server/plugins/openapi-docs/load-definition.d.ts +0 -31
- package/dist/server/plugins/openapi-docs/load-definition.js +0 -3
- package/dist/server/plugins/openapi-docs/openapi-search-builder.d.ts +0 -24
- package/dist/server/plugins/openapi-docs/openapi-search-builder.js +0 -1
- package/dist/server/plugins/openapi-docs/search/get-ai-search-documents.d.ts +0 -18
- package/dist/server/plugins/openapi-docs/search/get-ai-search-documents.js +0 -94
- package/dist/server/plugins/openapi-docs/search/search-facets.d.ts +0 -11
- package/dist/server/plugins/openapi-docs/search/search-facets.js +0 -1
- package/dist/server/plugins/openapi-docs/search/search-resolver.d.ts +0 -5
- package/dist/server/plugins/openapi-docs/search/search-resolver.js +0 -1
- package/dist/server/plugins/openapi-docs/search-indexer.d.ts +0 -17
- package/dist/server/plugins/openapi-docs/search-indexer.js +0 -1
- package/dist/server/plugins/openapi-docs/spec-download.api.d.ts +0 -4
- package/dist/server/plugins/openapi-docs/spec-download.api.js +0 -1
- package/dist/server/plugins/openapi-docs/store-definition-bundles.d.ts +0 -4
- package/dist/server/plugins/openapi-docs/store-definition-bundles.js +0 -1
- package/dist/server/plugins/openapi-docs/types.d.ts +0 -17
- package/dist/server/plugins/openapi-docs/types.js +0 -0
- package/dist/server/plugins/openapi-docs/utils.d.ts +0 -25
- package/dist/server/plugins/openapi-docs/utils.js +0 -1
- /package/dist/client/templates/{openapi-docs → api-docs}/mock-server-config.d.ts +0 -0
- /package/dist/client/templates/{openapi-docs → api-docs}/mock-server-config.js +0 -0
- /package/dist/{server/plugins → markdoc}/helpers/parse-partials.d.ts +0 -0
- /package/dist/{server/plugins → markdoc}/helpers/parse-partials.js +0 -0
- /package/dist/server/plugins/{openapi-docs → api-docs/utils}/ast-utils.d.ts +0 -0
- /package/dist/server/plugins/{openapi-docs → api-docs/utils}/ast-utils.js +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import o from"node:path";import{ASYNC_API_DOCS_TEMPLATE_ID as T,GRAPHQL_TEMPLATE_ID as v,OPENAPI_DOCS_TEMPLATE_ID as y}from"../../../../constants/common.js";import{isLocalLink as D}from"../../../../utils/path/is-local-link.js";import{normalizeRouteSlug as h}from"../../../../utils/path/normalize-route-slug.js";import{removeFragment as F}from"../../../../utils/path/remove-fragment.js";import{getInnerText as M}from"../../../../markdoc/helpers/get-inner-text.js";import{getNodeAttribute as U}from"../../../../markdoc/helpers/get-node-attribute.js";import{setNodeAttributeValue as p}from"../../../../markdoc/helpers/set-node-attribute-value.js";import{isAuthRoutePath as W}from"../../../../utils/auth/is-auth-route-path.js";import{isApiDownloadLink as j}from"../../../utils/is-api-download-link.js";import{MdResolveError as g}from"./md-resolve-error.js";import{getLinkOriginalAttrName as B}from"./utils.js";import{isOpenApiURL as $}from"../../
|
|
1
|
+
import o from"node:path";import{ASYNC_API_DOCS_TEMPLATE_ID as T,GRAPHQL_TEMPLATE_ID as v,OPENAPI_DOCS_TEMPLATE_ID as y}from"../../../../constants/common.js";import{isLocalLink as D}from"../../../../utils/path/is-local-link.js";import{normalizeRouteSlug as h}from"../../../../utils/path/normalize-route-slug.js";import{removeFragment as F}from"../../../../utils/path/remove-fragment.js";import{getInnerText as M}from"../../../../markdoc/helpers/get-inner-text.js";import{getNodeAttribute as U}from"../../../../markdoc/helpers/get-node-attribute.js";import{setNodeAttributeValue as p}from"../../../../markdoc/helpers/set-node-attribute-value.js";import{isAuthRoutePath as W}from"../../../../utils/auth/is-auth-route-path.js";import{isApiDownloadLink as j}from"../../../utils/is-api-download-link.js";import{MdResolveError as g}from"./md-resolve-error.js";import{getLinkOriginalAttrName as B}from"./utils.js";import{isOpenApiURL as $}from"../../api-docs/utils/is-api-doc.js";import{parseBaseName as C}from"../../utils.js";import{isMarkdownPage as V}from"../is-markdown-page.js";import{copyStaticFile as b}from"../../../utils/fs.js";async function at(i,s,E,{actions:k,context:f}){const{contentDir:d,outdir:S,getRouteByFsPath:w,hasRouteOrRedirectBySlug:A}=k,L=B(s),e=i[L]||U(i,s);if(i[L]=e,!D(e)||j(e)||W(e))return;const[z,t="",R,P]=/^([^\?#]+)?([^#]+)?(.+)?/.exec(e)||[],c=i.type==="image"?"IMAGE":"LINK",u=String(i.attributes.title||i.attributes.alt||M([i])||""),n=F(E);if(i.type!=="image"){const{isOpenapiDetected:r,isOpenapiValid:m}=await $(t,n,k,f);if(r&&!m)throw new g(`OpenAPI route ${e} does not exist`,{rawLink:e,link:t,title:u,brokenLinkType:c})}if(o.extname(t)===""){if(t.startsWith("/")){if(!A(h(t)))throw new g(`Route ${t} does not exist`,{rawLink:e,link:t,title:u,brokenLinkType:c});p(i,s,t+(R||"")+(P||""))}if(!e.startsWith("#")&&!t.startsWith("/")&&V(n)){const r=w(n)?.slug;if(!r)return;const{isIndexFile:m}=C(n),x=m?h(o.posix.join(r,t)):h(o.posix.join(r,"../",t));if(!A(h(x)))throw new g(`Route ${t} does not exist`,{rawLink:e,link:x,title:u,brokenLinkType:c});p(i,s,x+(R||"")+(P||""))}return}const a=t.startsWith("/")?t.substring(1):o.posix.join(o.posix.dirname(n),decodeURI(t)),_=t.startsWith("/")?o.posix.join("static",t.substring(1)):"",I=f.fs.exists(a),O=f.fs.exists(_),l=w(a);if(!I&&!l&&!O)throw p(i,s,"#"),new g(`File ${a} does not exist`,{rawLink:e,link:a,title:u,brokenLinkType:c});if(l){const r=[y,v,T].includes(l.templateId);p(i,s,(r?l.baseSlug:l.slug)+(P||""))}else if(I){const r=f.fs.getFileInfo(a);if(!r||r.isVirtual)return;const m=await b(d,r.realRelativePath,S);p(i,s,m)}}export{at as resolveLink};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import f from"node:path";import{API_DOCS_SHARED_DATA_PREFIX as p}from"../../../constants/plugins/api-docs.js";import{getNodeAttribute as A}from"../../../../markdoc/helpers/get-node-attribute.js";import{setNodeAttributeValue as w}from"../../../../markdoc/helpers/set-node-attribute-value.js";import{isOpenapiDoc as d}from"../../
|
|
1
|
+
import f from"node:path";import{API_DOCS_SHARED_DATA_PREFIX as p}from"../../../constants/plugins/api-docs.js";import{getNodeAttribute as A}from"../../../../markdoc/helpers/get-node-attribute.js";import{setNodeAttributeValue as w}from"../../../../markdoc/helpers/set-node-attribute-value.js";import{isOpenapiDoc as d}from"../../api-docs/utils/is-api-doc.js";import{MdResolveError as a}from"./md-resolve-error.js";import{getLinkOriginalAttrName as g}from"./utils.js";async function R(r,t,e,{context:n}){const s=g(t);let o=r[s]||A(r,t);if(o||await d(e,n)&&(o=f.basename(e)),r[s]=o,!o)return;const i=f.posix.join(f.posix.dirname(e),o),m=p+i;if(w(r,t,m),!n.fs.exists(i))throw new a(`Definition file ${i} does not exist`,{rawLink:i});if(await n.isPathIgnored(i))throw new a(`Definition file ${i} is ignored in config`,{rawLink:i});return{sharedDataId:m}}export{R as resolveOpenApiRef};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a={for:"htmlFor",class:"className","accept-charset":"acceptCharset",accesskey:"accessKey",allowfullscreen:"allowFullScreen",allowtransparency:"allowTransparency",autocomplete:"autoComplete",autoplay:"autoPlay",cellpadding:"cellPadding",cellspacing:"cellSpacing",charset:"charSet",classid:"classID",colspan:"colSpan",contenteditable:"contentEditable",contextmenu:"contextMenu",crossorigin:"crossOrigin",datetime:"dateTime",enctype:"encType",formaction:"formAction",formenctype:"formEncType",formmethod:"formMethod",formnovalidate:"formNoValidate",formtarget:"formTarget",frameborder:"frameBorder",hreflang:"hrefLang","http-equiv":"httpEquiv",inputmode:"inputMode",keyparams:"keyParams",keytype:"keyType",marginheight:"marginHeight",marginwidth:"marginWidth",maxlength:"maxLength",mediagroup:"mediaGroup",minlength:"minLength",novalidate:"noValidate",playsinline:"playsInline",radiogroup:"radioGroup",readonly:"readOnly",referrerpolicy:"referrerPolicy",rowspan:"rowSpan",spellcheck:"spellCheck",srcdoc:"srcDoc",srclang:"srcLang",srcset:"srcSet",tabindex:"tabIndex",usemap:"useMap",autocapitalize:"autoCapitalize",autocorrect:"autoCorrect",autosave:"autoSave",itemprop:"itemProp",itemscope:"itemScope",itemtype:"itemType",itemid:"itemID",itemref:"itemRef","accent-height":"accentHeight","alignment-baseline":"alignmentBaseline","arabic-form":"arabicForm","baseline-shift":"baselineShift","cap-height":"capHeight","clip-path":"clipPath","clip-rule":"clipRule","color-interpolation":"colorInterpolation","color-interpolation-filters":"colorInterpolationFilters","color-profile":"colorProfile","color-rendering":"colorRendering","dominant-baseline":"dominantBaseline","enable-background":"enableBackground","fill-opacity":"fillOpacity","fill-rule":"fillRule","flood-color":"floodColor","flood-opacity":"floodOpacity","font-family":"fontFamily","font-size":"fontSize","font-size-adjust":"fontSizeAdjust","font-stretch":"fontStretch","font-style":"fontStyle","font-variant":"fontVariant","font-weight":"fontWeight","glyph-name":"glyphName","glyph-orientation-horizontal":"glyphOrientationHorizontal","glyph-orientation-vertical":"glyphOrientationVertical","horiz-adv-x":"horizAdvX","horiz-origin-x":"horizOriginX","image-rendering":"imageRendering","letter-spacing":"letterSpacing","lighting-color":"lightingColor","marker-end":"markerEnd","marker-mid":"markerMid","marker-start":"markerStart","overline-position":"overlinePosition","overline-thickness":"overlineThickness","paint-order":"paintOrder","panose-1":"panose1","pointer-events":"pointerEvents","rendering-intent":"renderingIntent","shape-rendering":"shapeRendering","stop-color":"stopColor","stop-opacity":"stopOpacity","strikethrough-position":"strikethroughPosition","strikethrough-thickness":"strikethroughThickness","stroke-dasharray":"strokeDasharray","stroke-dashoffset":"strokeDashoffset","stroke-linecap":"strokeLinecap","stroke-linejoin":"strokeLinejoin","stroke-miterlimit":"strokeMiterlimit","stroke-opacity":"strokeOpacity","stroke-width":"strokeWidth","text-anchor":"textAnchor","text-decoration":"textDecoration","text-rendering":"textRendering","underline-position":"underlinePosition","underline-thickness":"underlineThickness","unicode-bidi":"unicodeBidi","unicode-range":"unicodeRange","units-per-em":"unitsPerEm","v-alphabetic":"vAlphabetic","v-hanging":"vHanging","v-ideographic":"vIdeographic","v-mathematical":"vMathematical","vector-effect":"vectorEffect","vert-adv-y":"vertAdvY","vert-origin-x":"vertOriginX","vert-origin-y":"vertOriginY","word-spacing":"wordSpacing","writing-mode":"writingMode","x-height":"xHeight","xlink:actuate":"xlinkActuate","xlink:arcrole":"xlinkArcrole","xlink:href":"xlinkHref","xlink:role":"xlinkRole","xlink:show":"xlinkShow","xlink:title":"xlinkTitle","xlink:type":"xlinkType","xml:base":"xmlBase","xmlns:xlink":"xmlnsXlink","xml:lang":"xmlLang","xml:space":"xmlSpace"};function s(r,t){const e={};for(const[i,n]of Object.entries(r))switch(i){case"value":t==="input"||t==="textarea"?e.defaultValue=n:e.value=n;break;case"checked":t==="input"?e.defaultChecked=!0:e.checked=n;break;case"style":e.style=c(n);break;default:e[a[i]||i]=n}return e}function l(r){return r.match(/^--/)?r:r.replace(/-[a-z]/g,t=>t[1].toUpperCase())}function c(r){return r.split(";").filter(t=>t.trim().length).reduce((t,e)=>{const i=e.indexOf(":"),n=i===-1?e:e.slice(0,i),o=i===-1?"":e.slice(i+1);return t[l(n.trim())]=o.trim(),t},{})}export{s as getJsxConvertedAttributes};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function
|
|
2
|
-
${
|
|
1
|
+
function c(n){return n.replace(/\[([^\]]*<[^>]*>[^\]]*)\]\(([^)]+)\)/g,(r,t,s)=>`[${t.replace(/(`+)[^`]+\1|[<>]/g,e=>e==="<"?"<":e===">"?">":e)}](${s})`).replace(/({%\s*(\w+)(?:\s+[^%]*)?%})(\s*)({%\s*\/\2\s*%})/g,(r,t,s,l,e)=>`${t}
|
|
2
|
+
${e}`)}export{c as sanitizeMalformedMdContent};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { ApiFunctionsContext, ApiFunctionsUser } from '@redocly/config';
|
|
2
2
|
import type { Store } from '../../../store.js';
|
|
3
|
-
export declare function shouldHandleMcpAuth(requiresLogin: boolean, rbacConfig?: Record<string, unknown>): boolean;
|
|
4
3
|
export declare function isMcpContentProtected(store: Store): boolean;
|
|
5
4
|
export declare function handleMcpAuth(request: Request, context: ApiFunctionsContext): Promise<{
|
|
6
5
|
isAuthenticated: boolean;
|
|
@@ -8,7 +7,7 @@ export declare function handleMcpAuth(request: Request, context: ApiFunctionsCon
|
|
|
8
7
|
currentUser?: ApiFunctionsUser;
|
|
9
8
|
accessToken?: string;
|
|
10
9
|
}>;
|
|
11
|
-
export declare function constructUnauthorizedResponse(baseUrl: string): Response;
|
|
10
|
+
export declare function constructUnauthorizedResponse(baseUrl: string, publicMcpUrl?: string): Response;
|
|
12
11
|
export declare function constructForbiddenResponse(): Response;
|
|
13
12
|
export declare function constructInvalidTokenResponse(baseUrl: string): Response;
|
|
14
13
|
//# sourceMappingURL=auth-handlers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{extractTokenFromAuthHeader as
|
|
1
|
+
import{extractTokenFromAuthHeader as d}from"../../../plugins/mcp/utils/jwt.js";import{SUPPORTED_MCP_SCOPES as p}from"../constants.js";import{getUserParamsFromCookies as h}from"../../../web-server/auth.js";import{ServerRoutes as c}from"../../../../constants/api.js";import{withPathPrefix as l}from"@redocly/theme/core/utils";import{shouldHandleMcpAuth as f}from"../../../utils/rbac/should-handle-mcp-auth.js";import{checkTokenAudience as m,isTokenAudienceEnforced as A,toAudienceList as T}from"./token-audience.js";import{reportMcpTokenAudienceMismatch as k}from"./token-audience-telemetry.js";function x(t){const e=t.getConfig().access;return f(!!e?.requiresLogin,e?.rbac||{})}async function E(t,e){const o=t.headers.get("Authorization");if(!o)return{isAuthenticated:!1};const i=d(o),r=e?.config?.ssoDirect||{},n=i?await h(r,{authorization:i}):{};if(!(i&&n&&n.isAuthenticated))return{isAuthenticated:!1,isTokenValid:!1};const s=n.aud;if(m(s)==="mismatch"){const a=A();if(k({audience:T(s).join(","),enforced:a}),a)return{isAuthenticated:!1,isTokenValid:!1}}return{isAuthenticated:!0,isTokenValid:!0,currentUser:{teams:n.teams||[],email:n.email||"",claims:n,isAuthenticated:!0,idpAccessToken:n.idpAccessToken||void 0,idpId:n.idpId||void 0},accessToken:i}}function u(t,e){const o=`${t}${c.MCP_OAUTH_PROTECTED_RESOURCE}${l("/mcp")}`,i=`${t}${c.MCP_OAUTH_AUTHORIZATION_SERVER}`,r=e?[`error="${e.code}"`,`error_description="${e.description}"`]:[];return r.push(`resource_metadata="${o}"`,`scope="${p.join(" ")}"`,`authorization_uri="${i}"`),`Bearer ${r.join(", ")}`}function S(t,e){const o=e?`Authentication required. A public endpoint that serves anonymous-accessible content is available at ${e}.`:"Authentication required";return new Response(JSON.stringify({error:"unauthorized",message:o}),{status:401,headers:{"Content-Type":"application/json","WWW-Authenticate":u(t),"Access-Control-Allow-Origin":"*"}})}function w(){return new Response(JSON.stringify({error:"forbidden",message:"You do not have access to this MCP server"}),{status:403,headers:{"Content-Type":"application/json","Access-Control-Allow-Origin":"*"}})}function y(t){return new Response(JSON.stringify({error:"invalid_token",message:"Invalid or expired token"}),{status:401,headers:{"Content-Type":"application/json","WWW-Authenticate":u(t,{code:"invalid_token",description:"Invalid or expired token"}),"Access-Control-Allow-Origin":"*"}})}export{w as constructForbiddenResponse,y as constructInvalidTokenResponse,S as constructUnauthorizedResponse,E as handleMcpAuth,x as isMcpContentProtected};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
type TokenAudienceMismatchEvent = {
|
|
2
|
+
audience: string;
|
|
3
|
+
enforced: boolean;
|
|
4
|
+
};
|
|
5
|
+
export declare function reportMcpTokenAudienceMismatch({ audience, enforced, }: TokenAudienceMismatchEvent): void;
|
|
6
|
+
export {};
|
|
7
|
+
//# sourceMappingURL=token-audience-telemetry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{telemetry as t}from"../../../telemetry/index.js";import{logger as o}from"../../../tools/notifiers/logger.js";import{McpServerType as c}from"../constants.js";import{serverAttributes as m}from"../utils/telemetry-attributes.js";function a({audience:e,enforced:r}){try{t.sendMcpTokenAudienceMismatchMessage([{...m(c.Docs),audience:e,enforced:r}])}catch{}o.warn(`MCP token audience mismatch [audience=${e}] enforced=${r}`)}export{a as reportMcpTokenAudienceMismatch};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { McpUserInfo } from '../types.js';
|
|
2
|
+
export type TokenAudienceResult = 'match' | 'mismatch' | 'skipped';
|
|
3
|
+
export declare function toAudienceList(aud: McpUserInfo['aud']): string[];
|
|
4
|
+
export declare function checkTokenAudience(aud: McpUserInfo['aud']): TokenAudienceResult;
|
|
5
|
+
export declare function isTokenAudienceEnforced(): boolean;
|
|
6
|
+
//# sourceMappingURL=token-audience.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{envConfig as t}from"../../../config/env-config.js";function i(n){return n?(Array.isArray(n)?n:[n]).filter(e=>typeof e=="string"&&!!e):[]}function c(n){const e=t.ORGANIZATION_ID,r=i(n);return!e||r.length===0?"skipped":r.includes(e)?"match":"mismatch"}function f(){return t.REDOCLY_MCP_ENFORCE_TOKEN_AUDIENCE===!0}export{c as checkTokenAudience,f as isTokenAudienceEnforced,i as toAudienceList};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{getCallableApis as
|
|
2
|
-
`),
|
|
3
|
-
`);function m(
|
|
4
|
-
`)}};export{
|
|
1
|
+
import{getCallableApis as n,isFetchCapable as o}from"../../../gateway-mcp/callable-apis.js";import{FETCH_TOOL_NAME as i}from"../../constants.js";const c=["```ts","/**"," * Call a documented API. Only the callable APIs' documented hosts are reachable."," * Responses cap at 1 MiB and redirects are not followed."," */","declare function fetch(url: string | URL, init?: {"," method?: string;"," /** `content-type` is set automatically for URLSearchParams/FormData unless you set one. */"," headers?: Record<string, string>;"," /** string \xB7 URLSearchParams (\u2192 application/x-www-form-urlencoded) \xB7 FormData (\u2192 multipart/form-data) */"," body?: string | URLSearchParams | FormData;"," /** Security scheme name (from the operation's `security` or `getSecuritySchemes`) whose credential to send. Omit to let the server choose. */"," securityScheme?: string;","}): Promise<{"," status: number;"," statusText: string;"," ok: boolean;"," headers: { get(name: string): string | null };"," json(): Promise<unknown>;"," text(): Promise<string>;","}>;","```"].join(`
|
|
2
|
+
`),l=["Example - list the paid invoices of a billing API:","","```ts","const { items } = await tools.listApis({ filter: 'billing' });","const [api] = items;",`if (!api) return { error: 'no API matches "billing"' };`,"const { endpoints } = await tools.getEndpoints({ name: api.name });","const ep = endpoints.find((e) => e.method === 'GET' && e.path.includes('invoices'));","const info = await tools.getEndpointInfo({ name: api.name, path: ep.path, method: ep.method });","const url = new URL((info.servers?.[0]?.url ?? '') + ep.path);","// Every name below comes from `info.endpoint.parameters` - read them first, never guess them.","url.searchParams.set('filter', 'status:paid');","url.searchParams.set('sort', '-createdTime');","url.searchParams.set('limit', '100');","try {"," const res = await fetch(url, { method: ep.method });"," return res.ok ? await res.json() : { status: res.status, error: await res.text() };","} catch (error) {"," return { error: error instanceof Error ? error.message : String(error), endpointId: info };","}","```"].join(`
|
|
3
|
+
`);function m(s){const t=new Map;for(const{name:e,version:r}of s){if(!e)continue;const a=t.get(e)??[];r&&a.push(r),t.set(e,a)}return[...t.entries()].map(([e,r])=>r.length>1?`${e} (${r.map(a=>`v${a}`).join(", ")})`:e).join(", ")}const p={id:i,purpose:"Call the documented APIs over HTTP",isActive:o,annotations:{readOnlyHint:!1,destructiveHint:!0,openWorldHint:!0},renderSection(s){const t=m(n(s));return["## `fetch` \u2014 call the documented APIs","",c,"","Always call `getEndpointInfo` before `fetch` for the exact URL, required parameters, and body shape. Put filtering, sorting, and paging in the query parameters, and keep sandbox JS for what the endpoint cannot express. Never guess.","","When an operation accepts more than one security scheme, pass `securityScheme` with the scheme name the user holds a credential for; without it the server picks one, and a mismatched credential fails upstream.","",`Callable APIs (their documented hosts are reachable via \`fetch\`): ${t}`,"",l].join(`
|
|
4
|
+
`)}};export{c as FETCH_DECLARATION,p as fetchCapability};
|
|
@@ -4,8 +4,10 @@ type CodeExecutedEvent = {
|
|
|
4
4
|
fetchCount: number;
|
|
5
5
|
outcome: 'ok' | 'error';
|
|
6
6
|
durationMs: number;
|
|
7
|
+
client?: string;
|
|
8
|
+
clientVersion?: string;
|
|
7
9
|
};
|
|
8
10
|
/** Audit record for one sandbox run. Carries the code fingerprint, never the code. */
|
|
9
|
-
export declare function reportCodeExecuted({ audit, fetchCount, outcome, durationMs, }: CodeExecutedEvent): void;
|
|
11
|
+
export declare function reportCodeExecuted({ audit, fetchCount, outcome, durationMs, client, clientVersion, }: CodeExecutedEvent): void;
|
|
10
12
|
export {};
|
|
11
13
|
//# sourceMappingURL=code-execution-telemetry.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{telemetry as
|
|
1
|
+
import{telemetry as f}from"../../../telemetry/index.js";import{logger as g}from"../../../tools/notifiers/logger.js";import{McpServerType as l}from"../constants.js";import{serverAttributes as n}from"../utils/telemetry-attributes.js";function $({audit:e,fetchCount:o,outcome:r,durationMs:t,client:c,clientVersion:s}){try{f.sendMcpCodeExecutedMessage([{...n(l.Docs),code_sha256:e.sha256,code_length:e.length,fetch_count:o,outcome:r,flags:e.flags,duration_ms:t,client:c,client_version:s}])}catch{}g.info(`Gateway MCP code executed [${e.sha256.slice(0,12)}] outcome=${r} codeLength=${e.length} fetchCount=${o}`+(e.flags?` flags=${e.flags}`:"")+` durationMs=${t}`)}export{$ as reportCodeExecuted};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{executeMcpTool as
|
|
1
|
+
import{executeMcpTool as c}from"../workers/execute-mcp-tool.js";async function a(t,r,o,u){const e=await c({toolName:t,args:r,context:o,extra:u});if(e.isError)throw new Error(n(e));return e.structuredContent!==void 0?e.structuredContent:i(n(e))}function n(t){return t.content.filter(r=>r.type==="text").map(r=>r.text).join("")}function i(t){try{return JSON.parse(t)}catch{return t}}export{a as invokeTool};
|
|
@@ -2,6 +2,6 @@ import{buildToolList as i}from"./build-tool-list.js";const l=2048,c="Both `execu
|
|
|
2
2
|
`):e}function h(e,t=[]){const o=["Run JavaScript in a sandbox against the documentation tools on the global `tools` object.",e?"The extra globals are `tools`, `fetch`, `URL`, `URLSearchParams`, and `FormData` - there is no `console`, `setTimeout`, `require`, or Node.js API; all other I/O goes through `tools`.":"The only extra global is `tools` - there is no `fetch`, `console`, `setTimeout`, `require`, or Node.js API; all I/O goes through `tools`.","","Workflow - minimize round-trips; one `describe-tools` call plus one `execute` call covers most requests:","1. Analyze the request and decide which sandbox tools it needs.","2. Call `describe-tools` with those names to get their exact TypeScript signatures - inputs, result shapes, and a worked example. NEVER call `execute` with guessed method names, parameter names, enum values, or result field names: read fields off the declared return types, not from assumptions.","3. Batch everything into a SINGLE script: chain tool calls, pass one call's output into the next, process results in plain JavaScript, and `return` only what the request needs."].join(`
|
|
3
3
|
`);return a(o,t)}const d=["Get the exact TypeScript signatures of the sandbox tools available to `execute`.","Analyze the user request first, then pass `tools` with only the tool names the request needs (every name is listed in this input schema / description); omit `tools` only when you cannot tell which tools apply.","Always call this before your first `execute` and never guess signatures. Request every tool the task may need in ONE call instead of calling this repeatedly."].join(`
|
|
4
4
|
`);function u(e,t=[]){const o=["This server exposes documentation tools (API discovery, endpoint details, security schemes, full-text search) through two tools:","- `describe-tools` returns the exact TypeScript signatures of the sandbox tools.","- `execute` runs JavaScript that calls those tools on the global `tools` object.","Workflow: analyze the request, call `describe-tools` once with only the tool names it needs, then batch everything into a single `execute` script. Minimize round-trips and never guess tool signatures.",...e?["The sandbox also has a global `fetch` that can call the documented APIs (allow-listed hosts only). Include `fetch` in your `describe-tools` call to get its contract and the list of callable APIs."]:[]].join(`
|
|
5
|
-
`);return a(o,t)}const p=["Example - list the write endpoints of an API:","","```ts","const { items } = await tools.listApis({ filter: 'billing' });","const { endpoints } = await tools.getEndpoints({ name:
|
|
5
|
+
`);return a(o,t)}const p=["Example - list the write endpoints of an API:","","```ts","const { items } = await tools.listApis({ filter: 'billing' });","const [api] = items;",`if (!api) return { error: 'no API matches "billing"' };`,"const { endpoints } = await tools.getEndpoints({ name: api.name });","const writes = endpoints.filter((e) => e.method !== 'GET');","return { api: api.name, writes: writes.map((e) => `${e.method} ${e.path}`) };","```"].join(`
|
|
6
6
|
`),m=["Types named `OpenApi\u2026` are the standard OpenAPI Specification objects.","Payload samples live on a media type object (`requestBody.content[mediaType]`, `responses[code].content[mediaType]`): `.example` holds a single value, `.examples[name].value` a named map, and some descriptions only set `.schema.example`. Read each before concluding a sample is absent."].join(`
|
|
7
7
|
`);export{d as DESCRIBE_TOOLS_DESCRIPTION,l as DESCRIPTION_CHAR_LIMIT,c as EXECUTE_ARGS_NOTE,p as PLAIN_EXECUTE_EXAMPLE,m as USAGE_NOTES,u as buildCodeModeInstructions,h as buildExecuteDescription};
|
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
* `fetch`: not a polyfill but a bridge. It takes the host rail off the global object so guest
|
|
3
3
|
* code cannot reach it directly, encodes the body, and hands the host a plain request.
|
|
4
4
|
*/
|
|
5
|
-
export declare const FETCH_SHIM = "\n const hostFetch = globalThis.__fetchBridge.fetch;\n delete globalThis.__fetchBridge;\n // RFC 7578: a field name travels with its quote and line breaks escaped, so a name cannot close its own header and open a part the caller did not write.\n const escapeFieldName = (name) =>\n String(name).replace(\n /[\"\\r\\n]/g,\n (char) => '%' + char.charCodeAt(0).toString(16).toUpperCase().padStart(2, '0'),\n );\n globalThis.fetch = (url, init = {}) => {\n let body;\n let autoContentType;\n if (init.body instanceof URLSearchParams) {\n body = init.body.toString();\n autoContentType = 'application/x-www-form-urlencoded';\n } else if (init.body instanceof FormData) {\n const boundary = '----FormBoundary' + Math.random().toString(36).slice(2);\n body = init.body._fields\n .map(([k, v]) =>\n '--' + boundary + '\\r\\nContent-Disposition: form-data; name=\"' + escapeFieldName(k) + '\"\\r\\n\\r\\n' + v,\n )\n .join('\\r\\n') + '\\r\\n--' + boundary + '--';\n autoContentType = 'multipart/form-data; boundary=' + boundary;\n } else if (init.body != null && typeof init.body !== 'string') {\n throw new TypeError('fetch body must be a string, URLSearchParams, or FormData');\n } else {\n body = init.body ?? undefined;\n }\n const callerHeaders = init.headers;\n const hasContentType = callerHeaders != null && Object.keys(callerHeaders).some(\n (k) => k.toLowerCase() === 'content-type',\n );\n const headers = autoContentType && !hasContentType\n ? Object.assign({ 'content-type': autoContentType }, callerHeaders)\n : callerHeaders;\n return hostFetch({
|
|
5
|
+
export declare const FETCH_SHIM = "\n const hostFetch = globalThis.__fetchBridge.fetch;\n delete globalThis.__fetchBridge;\n // RFC 7578: a field name travels with its quote and line breaks escaped, so a name cannot close its own header and open a part the caller did not write.\n const escapeFieldName = (name) =>\n String(name).replace(\n /[\"\\r\\n]/g,\n (char) => '%' + char.charCodeAt(0).toString(16).toUpperCase().padStart(2, '0'),\n );\n globalThis.fetch = (url, init = {}) => {\n let body;\n let autoContentType;\n if (init.body instanceof URLSearchParams) {\n body = init.body.toString();\n autoContentType = 'application/x-www-form-urlencoded';\n } else if (init.body instanceof FormData) {\n const boundary = '----FormBoundary' + Math.random().toString(36).slice(2);\n body = init.body._fields\n .map(([k, v]) =>\n '--' + boundary + '\\r\\nContent-Disposition: form-data; name=\"' + escapeFieldName(k) + '\"\\r\\n\\r\\n' + v,\n )\n .join('\\r\\n') + '\\r\\n--' + boundary + '--';\n autoContentType = 'multipart/form-data; boundary=' + boundary;\n } else if (init.body != null && typeof init.body !== 'string') {\n throw new TypeError('fetch body must be a string, URLSearchParams, or FormData');\n } else {\n body = init.body ?? undefined;\n }\n const callerHeaders = init.headers;\n const hasContentType = callerHeaders != null && Object.keys(callerHeaders).some(\n (k) => k.toLowerCase() === 'content-type',\n );\n const headers = autoContentType && !hasContentType\n ? Object.assign({ 'content-type': autoContentType }, callerHeaders)\n : callerHeaders;\n return hostFetch({\n url: String(url),\n method: init.method,\n headers,\n body,\n securityScheme: init.securityScheme,\n })\n .then((res) => {\n const resHeaders = res.headers || {};\n return {\n status: res.status,\n statusText: res.statusText,\n ok: res.ok,\n headers: {\n get: (name) => {\n const value = resHeaders[String(name).toLowerCase()];\n return value === undefined ? null : value;\n },\n },\n json: () => Promise.resolve(JSON.parse(res.bodyText)),\n text: () => Promise.resolve(res.bodyText),\n };\n });\n };\n";
|
|
6
6
|
//# sourceMappingURL=fetch-shim.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{FETCH_BRIDGE_FUNCTION_NAME as t,FETCH_BRIDGE_GLOBAL_NAME as e}from"../../constants.js";const
|
|
1
|
+
import{FETCH_BRIDGE_FUNCTION_NAME as t,FETCH_BRIDGE_GLOBAL_NAME as e}from"../../constants.js";const a=`
|
|
2
2
|
const hostFetch = globalThis.${e}.${t};
|
|
3
3
|
delete globalThis.${e};
|
|
4
4
|
// RFC 7578: a field name travels with its quote and line breaks escaped, so a name cannot close its own header and open a part the caller did not write.
|
|
@@ -33,7 +33,13 @@ import{FETCH_BRIDGE_FUNCTION_NAME as t,FETCH_BRIDGE_GLOBAL_NAME as e}from"../../
|
|
|
33
33
|
const headers = autoContentType && !hasContentType
|
|
34
34
|
? Object.assign({ 'content-type': autoContentType }, callerHeaders)
|
|
35
35
|
: callerHeaders;
|
|
36
|
-
return hostFetch({
|
|
36
|
+
return hostFetch({
|
|
37
|
+
url: String(url),
|
|
38
|
+
method: init.method,
|
|
39
|
+
headers,
|
|
40
|
+
body,
|
|
41
|
+
securityScheme: init.securityScheme,
|
|
42
|
+
})
|
|
37
43
|
.then((res) => {
|
|
38
44
|
const resHeaders = res.headers || {};
|
|
39
45
|
return {
|
|
@@ -51,4 +57,4 @@ import{FETCH_BRIDGE_FUNCTION_NAME as t,FETCH_BRIDGE_GLOBAL_NAME as e}from"../../
|
|
|
51
57
|
};
|
|
52
58
|
});
|
|
53
59
|
};
|
|
54
|
-
`;export{
|
|
60
|
+
`;export{a as FETCH_SHIM};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { McpToolSchema } from '../../../../types';
|
|
2
2
|
import type { McpToolCallback, McpToolContext } from '../../types.js';
|
|
3
3
|
import { type SandboxCapability } from '../capabilities/index.js';
|
|
4
|
-
export declare function describeToolsSchema(tools: McpToolSchema[], capabilities: SandboxCapability[]):
|
|
4
|
+
export declare function describeToolsSchema(tools: McpToolSchema[], capabilities: SandboxCapability[]): McpToolSchema;
|
|
5
5
|
export declare function describeTools(tools: McpToolSchema[], isToolAvailable: (toolName: string) => Promise<boolean>, capabilities: SandboxCapability[], context: McpToolContext): McpToolCallback;
|
|
6
6
|
//# sourceMappingURL=describe-tools.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{renderDescribeToolsOutput as
|
|
1
|
+
import{renderDescribeToolsOutput as S}from"../capabilities/index.js";import{McpServerType as y}from"../../constants.js";import{reportMcpToolCalled as v,reportMcpToolError as O}from"../../workers/mcp-tool-telemetry.js";import{DESCRIBE_TOOLS_TOOL_NAME as p}from"../constants.js";import{DESCRIBE_TOOLS_DESCRIPTION as k}from"../prompts.js";import{sanitizeToolName as s}from"../build-tool-type-declarations.js";import{UnknownToolError as w}from"./tool-errors.js";function x(i,l){const r=[...new Set([...i.map(n=>s(n.name)),...l.map(n=>s(n.id))])];return{name:p,title:"Describe tools",description:k,schema:{type:"object",required:[],additionalProperties:!1,properties:{tools:{type:"array",description:`Tool names to describe: ${r.join(", ")}. Omit to describe everything.`,items:r.length>0?{type:"string",enum:r}:{type:"string"},nullable:!0}}}}}function P(i,l,r,n){const c=new Map(i.map(t=>[s(t.name),t])),m=new Map(r.map(t=>[s(t.id),t]));return async t=>{const d=performance.now(),f=n.mcpMode??"code";try{const o=[...new Set((t.tools??[]).map(s))],a=o.length===0,u=o.filter(e=>!c.has(e)&&!m.has(e));if(u.length>0){const e=[...c.keys(),...m.keys()];throw new w(`Unknown tool(s): ${u.join(", ")}. Valid tools: ${e.join(", ")}.`)}const g=a?r:r.filter(e=>o.includes(s(e.id))),T=a?i:o.filter(e=>c.has(e)).map(e=>c.get(e)),M=await Promise.all(T.map(e=>l(e.name))),E=T.filter((e,b)=>M[b]),h=S(E,g,n);return v({tool:p,mode:f,serverType:y.Docs,durationMs:Math.round(performance.now()-d),outputLength:h.length}),{content:[{type:"text",text:h}]}}catch(o){const a=o instanceof w;throw O({tool:p,mode:f,serverType:y.Docs,durationMs:Math.round(performance.now()-d),message:o instanceof Error?o.message:String(o),stack:!a&&o instanceof Error&&o.stack||"",errorClass:a?"tool_error":"server_error"}),o}}}export{P as describeTools,x as describeToolsSchema};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{EXECUTE_TOOL_NAME as e}from"../constants.js";import{buildExecuteDescription as t}from"../prompts.js";const n={
|
|
1
|
+
import{EXECUTE_TOOL_NAME as e}from"../constants.js";import{buildExecuteDescription as t}from"../prompts.js";const n={readOnlyHint:!0,openWorldHint:!1},r={name:e,title:"Execute code",description:t(!1),annotations:n,schema:{type:"object",required:["code","description"],additionalProperties:!1,properties:{code:{type:"string",description:"JavaScript to run in the sandbox. Return a value to receive it as the result.",minLength:1},description:{type:"string",description:"A short, human-readable summary of what this code does.",minLength:1},sessionHandle:{type:"string",description:"Handle returned by createAnonymousSession. Required when an API needs credentials. This parameter is only offered when createAnonymousSession is available, so pass it whenever you have called that tool.",minLength:1}}}};export{n as EXECUTE_BASE_ANNOTATIONS,r as EXECUTE_TOOL_SCHEMA};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{runInSandbox as p}from"../../../../sandbox/sandbox.js";import{isMcpToolAvailable as h}from"../../workers/execute-mcp-tool.js";import{importMcpToolHandlers as E}from"../../workers/import-mcp-tool-handlers.js";import{isFetchCapable as b}from"../../gateway-mcp/callable-apis.js";import{buildExecuteHostFetch as w}from"../../gateway-mcp/fetch-capability.js";import{withAuthRequiredMeta as C}from"../../gateway-mcp/upstream-auth.js";import{CODE_MODE_TOOL_NAMES as O,EXECUTE_TOOL_NAME as y}from"../constants.js";import{sanitizeToolName as T}from"../build-tool-type-declarations.js";import{invokeTool as M}from"../invoke-tool.js";import{createSandboxSetup as A}from"../sandbox/create-sandbox-setup.js";import{auditCode as F}from"../code-audit.js";import{reportCodeExecuted as S}from"../code-execution-telemetry.js";import{logCodeExecutionAudit as _}from"../code-execution-audit.js";const x=async(t,o,d)=>{const r=new Set,a=await N(o,d,r),n=[],e=b(o)?await w(o,l=>n.push(l)):void 0;let c=0;const u=e?l=>(c+=1,e(l)):void 0,i=F(t.code);_({audit:i,code:t.code,description:t.description,sessionHandle:t.sessionHandle,toolNames:Object.keys(a),fetchBudget:o.gatewayFetchBudgetPerExec,fetchCapable:e!==void 0});const m=Date.now(),{result:f,error:s}=await p(t.code,{setupContext:A(a,u)});return S({audit:i,fetchCount:c,outcome:s===void 0?"ok":"error",durationMs:Date.now()-m,client:o.client,clientVersion:o.clientVersion}),C({content:[{type:"text",text:JSON.stringify({result:f,error:s})}],isError:s!==void 0,...s!==void 0&&r.has(s)?{errorClass:"tool_error"}:{}},n)};async function N(t,o,d){const r=Object.keys(await E()).filter(e=>!O.has(e)),a=await Promise.all(r.map(e=>h({toolName:e,context:t}).catch(()=>!1))),n={};return r.forEach((e,c)=>{a[c]&&(n[T(e)]=u=>M(e,u,t,o).catch(i=>{throw i instanceof Error&&d.add(i.message),i}))}),n}var J={[y]:x};export{J as default};
|
|
@@ -14,6 +14,7 @@ export declare function isManageApiCredentialsToolAvailable(context: McpToolCont
|
|
|
14
14
|
export declare function manageApiCredentialsSchema(context: McpToolContext): McpToolSchema;
|
|
15
15
|
export declare function manageApiCredentials(context: McpToolContext, deps: ManageApiCredentialsDeps): (args: {
|
|
16
16
|
api?: unknown;
|
|
17
|
+
scheme?: unknown;
|
|
17
18
|
sessionHandle?: unknown;
|
|
18
19
|
}) => Promise<CallToolResult | InputRequiredResult>;
|
|
19
20
|
//# sourceMappingURL=manage-credentials.d.ts.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{MANAGE_API_CREDENTIALS_TOOL_NAME as
|
|
2
|
-
`),annotations:{
|
|
1
|
+
import{MANAGE_API_CREDENTIALS_TOOL_NAME as v}from"../../constants.js";import{buildUpstreamCredentialFallback as y,buildUpstreamCredentialInputRequired as b,schemeLabelOf as P}from"../../gateway-mcp/elicitation.js";import{getCallableApis as m,isFetchCapable as S}from"../../gateway-mcp/callable-apis.js";import{secretStore as I}from"../../gateway-mcp/secret-store.js";import{MISSING_SESSION_HANDLE_MESSAGE as w,resolveSecretSubject as k}from"../../gateway-mcp/subject.js";import{resolveUpstreamApiAuth as j}from"../../gateway-mcp/upstream-auth-scheme.js";function H(e){return!!e.elicitationEnabled&&S(e)}function U(e){const t=m(e).map(n=>n.relativePath);return{name:v,title:"Manage API credentials",description:["Get a secure link where the user sets, replaces, or removes the credentials this server sends to a documented API.","Call it when the user wants to change or clear an API key, or when a tool result tells you the stored credentials were rejected.","The link covers every credential the API accepts, so scheme is optional - pass it only when a tool result names the scheme that was rejected.","It returns a link for the user to open - never ask for the secret in the conversation and never pass it as an argument."].join(`
|
|
2
|
+
`),annotations:{readOnlyHint:!1,openWorldHint:!1},schema:{type:"object",required:["api"],additionalProperties:!1,properties:{api:{type:"string",description:`The API to manage credentials for.${t.length>0?` One of: ${t.join(", ")}.`:""}`,minLength:1,...t.length>0?{enum:t}:{}},scheme:{type:"string",description:"Name of the security scheme to manage the credential for, as named in the API description (a tool result that reports a rejected credential names it). Omit it to let the link cover every scheme the API accepts.",minLength:1},sessionHandle:{type:"string",description:"Handle returned by createAnonymousSession. Required while the caller is anonymous, so the credentials are stored against the same subject the API calls use.",minLength:1}}}}}function _(e,c){return async t=>{const n=k(e.user,typeof t.sessionHandle=="string"?t.sessionHandle:void 0);if(n.kind==="invalid")return l(n.message);if(n.kind==="anonymous")return l(w);const{subject:u}=n,h=typeof t.api=="string"?t.api:"",s=m(e).find(o=>o.relativePath===h||o.name===h);if(!s){const o=m(e).map(g=>g.relativePath).join(", ");return l(`Unknown api "${h}". Credentials can only be managed for the APIs this server can call: ${o||"none"}.`)}const r=await j(e,s.relativePath),a=typeof t.scheme=="string"?t.scheme:void 0,A=Object.keys(r.schemes);if(a&&!r.schemes[a])return l(`Unknown scheme "${a}" for api "${s.relativePath}". The security schemes this server can store credentials for are: ${A.join(", ")}.`);const i=a??r.defaultScheme,p=P(r.schemes,i),d=await c.getKv(),f={subject:u,baseUrl:e.baseUrl??"",target:{api:s.relativePath,name:s.name,scheme:i,...p?{schemeLabel:p}:{}},auth:r.schemes[i],apiAuth:r,kv:d,hasExistingSecret:await I.hasSecret(d,u,s.relativePath,i),reason:{kind:"requested"}};return c.getClientCapabilities()?.elicitation?.url?await b(f):{content:[{type:"text",text:await y(f)}],isError:!1}}}function l(e){return{content:[{type:"text",text:e}],isError:!0}}export{H as isManageApiCredentialsToolAvailable,_ as manageApiCredentials,U as manageApiCredentialsSchema};
|
|
@@ -12,9 +12,9 @@ export declare const MCP_PROTOCOL_VERSION = "2025-11-25";
|
|
|
12
12
|
export declare const DEFAULT_CONNECTION_TIMEOUT_MS = 30000;
|
|
13
13
|
export declare const SSE_KEEPALIVE_INTERVAL_MS = 15000;
|
|
14
14
|
export declare const MAX_DOCUMENTS_PER_CATEGORY = 3;
|
|
15
|
-
export declare const MCP_NOT_ALLOWED_TEMPLATE_ID = "mcp-not-allowed";
|
|
16
15
|
export declare const DEFAULT_DOCS_MCP_SERVER_NAME = "Docs MCP server";
|
|
17
16
|
export declare const SUPPORTED_MCP_SCOPES: readonly ['openid', 'profile', 'email', 'offline_access'];
|
|
18
17
|
export declare const CREATE_ANONYMOUS_SESSION_TOOL_NAME = "createAnonymousSession";
|
|
19
18
|
export declare const MANAGE_API_CREDENTIALS_TOOL_NAME = "manageApiCredentials";
|
|
19
|
+
export declare const CUSTOM_MCP_TOOLS_META_DIR = "custom-mcp-tools-meta";
|
|
20
20
|
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{LATEST_PROTOCOL_VERSION as o}from"@modelcontextprotocol/server";const
|
|
1
|
+
import{LATEST_PROTOCOL_VERSION as o}from"@modelcontextprotocol/server";const r={Docs:"docs"},t={InternalError:-32603,ServerError:-32e3,InvalidRequest:-32600,MethodNotFound:-32601,InvalidParams:-32602},E=o,_=3e4,s=15e3,O=3,n="Docs MCP server",S=["openid","profile","email","offline_access"],c="createAnonymousSession",T="manageApiCredentials",M="custom-mcp-tools-meta";export{c as CREATE_ANONYMOUS_SESSION_TOOL_NAME,M as CUSTOM_MCP_TOOLS_META_DIR,_ as DEFAULT_CONNECTION_TIMEOUT_MS,n as DEFAULT_DOCS_MCP_SERVER_NAME,T as MANAGE_API_CREDENTIALS_TOOL_NAME,O as MAX_DOCUMENTS_PER_CATEGORY,E as MCP_PROTOCOL_VERSION,t as McpErrorCodes,r as McpServerType,s as SSE_KEEPALIVE_INTERVAL_MS,S as SUPPORTED_MCP_SCOPES};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ToolDefinitionValidationResult } from '../types.js';
|
|
2
|
+
export type ExtractToolDefinitionParams = {
|
|
3
|
+
toolName: string;
|
|
4
|
+
absoluteSourcePath: string;
|
|
5
|
+
contentDir: string;
|
|
6
|
+
serverOutDir: string;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Reads a tool's schema by bundling the file with esbuild and importing the bundle
|
|
10
|
+
* once at build time; the source file itself only runs in the worker pool.
|
|
11
|
+
*/
|
|
12
|
+
export declare function extractToolDefinition(params: ExtractToolDefinitionParams): Promise<ToolDefinitionValidationResult>;
|
|
13
|
+
//# sourceMappingURL=extract-tool-definition.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{existsSync as p}from"node:fs";import{mkdir as b,rm as g,writeFile as w}from"node:fs/promises";import{dirname as y,join as f}from"node:path";import{pathToFileURL as T}from"node:url";import{build as v}from"esbuild";import{shaHex as x}from"../../../utils/crypto/sha-hex.js";import{CUSTOM_MCP_TOOLS_META_DIR as $}from"../constants.js";import{validateToolDefinition as D}from"./validate-tool-definition.js";const m=new Map;async function C(t){const{toolName:n,absoluteSourcePath:a,contentDir:d,serverOutDir:h}=t;let i;try{const e=f(d,"tsconfig.json");i=(await v({entryPoints:[a],write:!1,bundle:!0,format:"esm",platform:"node",mainFields:["module","main"],logLevel:"silent",...p(e)?{tsconfig:e}:{}})).outputFiles[0].text}catch(e){return{ok:!1,errors:[`the file cannot be bundled: ${u(e)}`]}}const s=x(i),l=`${n}:${a}:${s}`,c=m.get(l);if(c)return c;const o=f(h,$,`${s.slice(0,16)}.mjs`);let r;try{await b(y(o),{recursive:!0}),await w(o,i);const e=await import(T(o).href);r=D(n,e.default)}catch(e){r={ok:!1,errors:[`the file failed to load: ${u(e)}. Tool files must not have module-level side effects.`]}}finally{await g(o,{force:!0}).catch(()=>{})}return m.set(l,r),r}function u(t){return t instanceof Error?t.message:String(t)}export{C as extractToolDefinition};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { LifecycleContext, ProcessContentActions } from '../../../types';
|
|
2
|
+
import type { CustomMcpToolsState } from '../types.js';
|
|
3
|
+
/** Registers every file in an `@mcp` folder as one MCP tool, named after the file. */
|
|
4
|
+
export declare function scanCustomMcpTools(actions: ProcessContentActions, context: LifecycleContext, state: CustomMcpToolsState): Promise<number>;
|
|
5
|
+
export declare function resetCustomMcpTools(actions: Pick<ProcessContentActions, 'removeMcpTools'>, state: CustomMcpToolsState): void;
|
|
6
|
+
//# sourceMappingURL=scan-custom-tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{basename as f,join as d}from"node:path";import{envConfig as p}from"../../../config/env-config.js";import{reporter as i}from"../../../tools/notifiers/reporter.js";import{CODE_MODE_TOOL_NAMES as E}from"../codemode/constants.js";import{ALL_DEFAULT_TOOL_NAMES as O}from"../docs-mcp/tool-schemas.js";import{extractToolDefinition as h}from"./extract-tool-definition.js";const T=/(^|\/)@mcp\/.*\.(ts|js)$/,M=/^[a-zA-Z0-9_-]{1,64}$/,_=new Set([...E,...O]);async function S(o,r,a){if(!p.REDOCLY_EXP_MCP_CUSTOM_TOOLS_ENABLED)return 0;C(o,a);const u=new Set(o.getMcpTools().map(n=>n.name)),l=new Map;for(const n of r.fs.scan(T)){if(n.isVirtual||n.relativePath.endsWith(".d.ts"))continue;const{relativePath:t}=n,e=f(t).replace(/\.(ts|js)$/,"");if(!M.test(e)){await i.panicOnBuildContentError(`Invalid MCP tool file "${t}": the tool name "${e}" is derived from the file name and may only contain letters, numbers, hyphens, and underscores (max 64 characters). Rename the file.`);continue}const c=l.get(e);if(c){await i.panicOnBuildContentError(`Duplicate MCP tool name "${e}": defined by both "${c}" and "${t}". Tool names are file names, so each file name must be unique across @mcp folders.`);continue}if(_.has(e)||u.has(e)){await i.panicOnBuildContentError(`Invalid MCP tool file "${t}": the tool name "${e}" is already used by a built-in MCP tool. Rename the file.`);continue}l.set(e,t);const m=d(o.contentDir,t),s=await h({toolName:e,absoluteSourcePath:m,contentDir:o.contentDir,serverOutDir:o.serverOutDir});if(!s.ok){await i.panicOnBuildContentError(`Invalid MCP tool file "${t}": ${s.errors.join(" ")}`);continue}o.addMcpTools(m,[s.schema]),a.registeredToolNames.push(e)}return a.registeredToolNames.length}function C(o,r){o.removeMcpTools(r.registeredToolNames),r.registeredToolNames=[]}export{C as resetCustomMcpTools,S as scanCustomMcpTools};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { ToolDefinitionValidationResult, ToolFileDefaultExport } from '../types.js';
|
|
2
|
+
export declare function validateToolDefinition(toolName: string, moduleDefault: ToolFileDefaultExport): ToolDefinitionValidationResult;
|
|
3
|
+
//# sourceMappingURL=validate-tool-definition.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{isPlainObject as s}from"../../../../utils/guards/is-plain-object.js";function f(c,a){if(!s(a))return{ok:!1,errors:["the default export must be an object with `description` and `execute` properties. Move shared helper code outside the `@mcp` folder."]};const{description:i,inputSchema:t,outputSchema:n,annotations:o,isAvailable:u,execute:p}=a,e=[];return(typeof i!="string"||i.trim()==="")&&e.push("`description` must be a non-empty string."),typeof p!="function"&&e.push("`execute` must be a function."),t!==void 0&&(s(t)?t.type!==void 0&&t.type!=="object"&&e.push('`inputSchema.type` must be "object" because MCP tool arguments are named.'):e.push("`inputSchema` must be a JSON Schema object.")),n!==void 0&&!s(n)&&e.push("`outputSchema` must be a JSON Schema object."),o!==void 0&&!s(o)&&e.push("`annotations` must be an object."),u!==void 0&&typeof u!="function"&&e.push("`isAvailable` must be a function."),e.length>0||typeof i!="string"?{ok:!1,errors:e}:{ok:!0,schema:{name:c,description:i,schema:{type:"object",...t??{properties:{}}},...n?{outputSchema:n}:{},...o?{annotations:o}:{},hasAvailabilityGate:typeof u=="function"}}}export{f as validateToolDefinition};
|
|
@@ -6,5 +6,7 @@ export declare function getDefaultToolSchemas(config: {
|
|
|
6
6
|
rbac?: Record<string, unknown>;
|
|
7
7
|
hasGraphqlApis?: boolean;
|
|
8
8
|
elicitationEnabled?: boolean;
|
|
9
|
+
hasCallableApis?: boolean;
|
|
9
10
|
}): McpToolSchema[];
|
|
11
|
+
export declare const ALL_DEFAULT_TOOL_NAMES: ReadonlySet<string>;
|
|
10
12
|
//# sourceMappingURL=tool-schemas.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{shouldHandleMcpAuth as d}from"../auth/auth-handlers.js";import{CREATE_ANONYMOUS_SESSION_TOOL_NAME as m}from"../constants.js";import{GRAPHQL_TYPE_KINDS as o,GRAPHQL_LIST_SCOPES as h}from"./tools/graphql/constants.js";import{OPERATION_METHODS as p}from"./tools/openapi/constants.js";const i={type:"string",nullable:!0},n={limit:{type:"number"},total:{type:"number"},page:{type:"number"},totalPages:{type:"number"}},r={codemodeType:"OpenApiServer[]"},s={codemodeType:"OpenApiSecurityRequirement[]"},l={codemodeType:"Record<string, OpenApiSecurityScheme>"},y={codemodeType:"OpenApiDocument"},f={codemodeType:"OpenApiOperation & { path: string; method: string }"},g={type:"object",additionalProperties:!1,required:[],properties:{filter:{type:"string",description:"Matches part of an API name, or of a description when no name matches",minLength:1,nullable:!0},page:{type:"number",description:"Page number",minimum:1,default:1,nullable:!0},limit:{type:"number",description:"Number of APIs per page. Default is 300",minimum:1,default:300,nullable:!0}}},a={type:"object",required:["name"],additionalProperties:!1,properties:{name:{type:"string",description:"API name, or a unique part of it",minLength:1},version:{type:"string",description:"API version",nullable:!0},filePath:{type:"string",description:"API definition file path",nullable:!0}}},b={type:"object",required:["name","path","method"],additionalProperties:!1,properties:{name:{type:"string",description:"API name, or a unique part of it",minLength:1},path:{type:"string",description:"Endpoint path (e.g. /api/v1/users)",minLength:1},method:{type:"string",description:"HTTP method (GET, POST, PUT, DELETE, etc.)",enum:[...p.map(e=>e.toUpperCase()),...p],minLength:1},version:{type:"string",description:"API version (required when multiple APIs share the same name but differ by version)",nullable:!0},filePath:{type:"string",description:"API definition file path",nullable:!0}}},S={type:"object",required:[],additionalProperties:!1,properties:{}},v={type:"object",required:[],additionalProperties:!1,properties:{}};function I(e){const t=[{name:"list-apis",description:"Lists available APIs with their context and purpose",schema:g,annotations:{title:"List APIs",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},outputSchema:{type:"object",properties:{items:{type:"array",items:{type:"object",properties:{name:{type:"string"},description:i,version:i,servers:r,filePath:{type:"string",description:"API definition file path"}}}},...n}}},{name:"get-endpoints",description:"Get all endpoints for a specific API",schema:a,annotations:{title:"Get Endpoints",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},outputSchema:{type:"object",properties:{api:{type:"string"},version:{type:"string"},servers:r,endpoints:{type:"array",items:{type:"object",properties:{path:{type:"string"},method:{type:"string"},summary:i,description:i,security:s}}}}}},{name:"get-endpoint-info",description:"Get comprehensive information about specific endpoint including parameters, security, and examples",schema:b,annotations:{title:"Get Endpoint Info",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},outputSchema:{type:"object",properties:{api:{type:"string"},version:{type:"string"},servers:r,endpoint:f,globalSecurity:s,securitySchemes:l}}},{name:"get-security-schemes",description:"Get the security schemes for a specific API",schema:a,annotations:{title:"Get Security Schemes",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},outputSchema:{type:"object",properties:{name:i,version:i,securitySchemes:l,security:s}}},{name:"get-full-api-description",description:"Get the complete OpenAPI description",schema:a,annotations:{title:"Get Full API Description",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},outputSchema:{type:"object",properties:{api:{type:"string"},version:{type:"string"},definition:y}}},q(e.products,e.locales)];return d(e.requiresLogin,e.rbac)&&t.push({name:"whoami",description:"Get information about the currently authenticated user",schema:S,annotations:{title:"Who Am I",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},outputSchema:{type:"object",properties:{email:{type:"string"},name:{type:"string"},subject:{type:"string"},clientId:{type:"string"},scope:{type:"string"},issuedAt:{type:"string"},expiresAt:{type:"string"}}}}),e.hasGraphqlApis&&t.push(...T()),e.elicitationEnabled&&t.push({name:m,description:"Create an anonymous session handle for storing upstream API credentials. Pass the returned sessionHandle to execute when an API needs credentials and the caller is not signed in. Treat it as a secret and reuse it across calls.",schema:v,annotations:{title:"Create anonymous session",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1,openWorldHint:!1},outputSchema:{type:"object",required:["sessionHandle"],properties:{sessionHandle:{type:"string"}}}}),t}const H={type:"object",required:[],additionalProperties:!1,properties:{filter:{type:"string",description:"GraphQL schema name (or part of it)",minLength:1,nullable:!0},page:{type:"number",description:"Page number",minimum:1,default:1,nullable:!0},limit:{type:"number",description:"Number of results per page. Default is 300",minimum:1,default:300,nullable:!0}}},P={type:"object",required:["name"],additionalProperties:!1,properties:{name:{type:"string",description:"GraphQL schema name",minLength:1},kind:{type:"string",description:'Optional: return only a single category of schema members. With scope "fields", restricts to the fields of that parent category ("objects", "interfaces", or "inputs" only).',enum:[...o],nullable:!0},scope:{type:"string",description:'Optional: what each list item is. "members" (default) lists top-level types and operations. "fields" flattens every field of every object/interface/input type into "ParentType.fieldName" entries with their descriptions \u2014 combine with `filter` to search nested fields anywhere in the schema.',enum:[...h],nullable:!0},filter:{type:"string",description:'Optional: only members whose name or description contains this substring, case-insensitive (e.g. "custom tags")',minLength:1,nullable:!0},referencesType:{type:"string",description:'Optional: only members that reference this type directly or transitively (via return, field, argument, union-member or input-field types). Finds cross-cutting members that never name it \u2014 e.g. referencesType "Book" surfaces a search query returning a union that includes Book.',minLength:1,nullable:!0},page:{type:"number",description:"Page number",minimum:1,default:1,nullable:!0},limit:{type:"number",description:"Number of results per page. Default is 300",minimum:1,default:300,nullable:!0}}},A={type:"object",required:["name","type"],additionalProperties:!1,properties:{name:{type:"string",description:"GraphQL schema name",minLength:1},type:{type:"string",description:"Name of the type, operation, or directive",minLength:1},includeReferencedTypes:{type:"boolean",description:"Also include the SDL of every type referenced transitively. Gives the whole subgraph at once, but can be large for highly-connected types.",default:!1,nullable:!0}}},L={type:"object",required:["name"],additionalProperties:!1,properties:{name:{type:"string",description:"GraphQL schema name",minLength:1}}};function T(){return[{name:"list-graphql-apis",description:"Lists available GraphQL schemas with their context and purpose",schema:H,annotations:{title:"List GraphQL APIs",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},outputSchema:{type:"object",properties:{items:{type:"array",items:{type:"object",properties:{name:{type:"string"},description:i}}},...n}}},{name:"get-graphql-type-list",description:'List all operations and types in a GraphQL schema as a flat, paginated list. Each item is tagged with its kind (query, object, enum, \u2026) and carries a one-line description; operations also include their return type and argument signature \u2014 use it to decide which members to fetch in detail. Narrow the result with `kind` (one category), `filter` (case-insensitive substring of the member name or description, e.g. "book"), or `referencesType` (only members that use a given type, directly or transitively) to explore a domain cheaply instead of pulling the full schema. To search nested fields \u2014 not just type names \u2014 set scope "fields": it flattens every field of every object/interface/input type into "ParentType.fieldName" entries with their descriptions, so `filter` finds things like an input field whose docstring mentions your keyword.',schema:P,annotations:{title:"Get GraphQL Type List",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},outputSchema:{type:"object",properties:{name:{type:"string"},items:{type:"array",items:{type:"object",properties:{kind:{type:"string",enum:o},name:{type:"string"},description:i,type:{type:"string"},args:{type:"string"},directives:{type:"string"}}}},...n}}},{name:"get-graphql-type",description:'Get the SDL for a single GraphQL type, operation (query/mutation/subscription field), or directive. Without includeReferencedTypes, the SDL is followed by a one-level manifest of every directly referenced type\'s field names (e.g. "input ActionOperationInput { addTags, removeTags }"), so you can see what nested types contain before fetching them. Set includeReferencedTypes to instead pull in the full SDL of every type it references transitively \u2014 the whole structural subgraph in one call, ideal for complete exploration of an entity (e.g. Book and all the types it touches). That traversal only follows what the target depends on; to go the other direction and find the members that use a type, call get-graphql-type-list with `referencesType`.',schema:A,annotations:{title:"Get GraphQL Type",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},outputSchema:{type:"string"}},{name:"get-graphql-schema",description:"Get the complete GraphQL schema as SDL \u2014 the whole type graph in one call. Returns everything, so it can be very large and token-expensive for big schemas; prefer get-graphql-type-list (filter/paginate) plus targeted get-graphql-type calls, and reach for this only for small schemas or when you truly need the full SDL.",schema:L,annotations:{title:"Get GraphQL Schema",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},outputSchema:{type:"string"}}]}function q(e,t){const c=e&&e.length>0,u=t&&t.length>0;return{name:"search",description:"Search across the documentation to fetch relevant content for a given query",schema:{type:"object",required:["query"],additionalProperties:!1,properties:{query:{type:"string",description:"Search query. Should be a single word or that phrase that is presented in a documentation.",minLength:1},...c?{product:{type:"string",description:"Optional product name to filter search results by specific product.",enum:e,nullable:!0}}:{},...u?{locale:{type:"string",description:"Optional locale code to filter search results by documentation language (e.g. 'en', 'ja'). Use the locale matching the language of the user's request. Defaults to the project's default locale.",enum:t,nullable:!0}}:{}}},annotations:{title:"Search Documentation",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!1,openWorldHint:!1},outputSchema:{type:"string"}}}export{I as getDefaultToolSchemas};
|
|
1
|
+
import{shouldHandleMcpAuth as d}from"../../../utils/rbac/should-handle-mcp-auth.js";import{CREATE_ANONYMOUS_SESSION_TOOL_NAME as m}from"../constants.js";import{GRAPHQL_TYPE_KINDS as o,GRAPHQL_LIST_SCOPES as h}from"./tools/graphql/constants.js";import{OPERATION_METHODS as p}from"./tools/openapi/constants.js";const i={type:"string",nullable:!0},n={limit:{type:"number"},total:{type:"number"},page:{type:"number"},totalPages:{type:"number"}},r={codemodeType:"OpenApiServer[]"},s={codemodeType:"OpenApiSecurityRequirement[]"},l={codemodeType:"Record<string, OpenApiSecurityScheme>"},y={codemodeType:"OpenApiDocument"},f={codemodeType:"OpenApiOperation & { path: string; method: string }"},g={type:"object",additionalProperties:!1,required:[],properties:{filter:{type:"string",description:"Matches part of an API name, or of a description when no name matches",minLength:1,nullable:!0},page:{type:"number",description:"Page number",minimum:1,default:1,nullable:!0},limit:{type:"number",description:"Number of APIs per page. Default is 300",minimum:1,default:300,nullable:!0}}},a={type:"object",required:["name"],additionalProperties:!1,properties:{name:{type:"string",description:"API name, or a unique part of it",minLength:1},version:{type:"string",description:"API version",nullable:!0},filePath:{type:"string",description:"API definition file path",nullable:!0}}},b={type:"object",required:["name","path","method"],additionalProperties:!1,properties:{name:{type:"string",description:"API name, or a unique part of it",minLength:1},path:{type:"string",description:"Endpoint path (e.g. /api/v1/users)",minLength:1},method:{type:"string",description:"HTTP method (GET, POST, PUT, DELETE, etc.)",enum:[...p.map(e=>e.toUpperCase()),...p],minLength:1},version:{type:"string",description:"API version (required when multiple APIs share the same name but differ by version)",nullable:!0},filePath:{type:"string",description:"API definition file path",nullable:!0}}},S={type:"object",required:[],additionalProperties:!1,properties:{}},v={type:"object",required:[],additionalProperties:!1,properties:{}};function H(e){const t=[{name:"list-apis",title:"List APIs",description:"Lists the APIs documented in this project",schema:g,annotations:{readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},outputSchema:{type:"object",properties:{items:{type:"array",items:{type:"object",properties:{name:{type:"string"},description:i,version:i,servers:r,filePath:{type:"string",description:"API definition file path"},...e.hasCallableApis?{callable:{type:"boolean",description:"true = the documented hosts of this API are reachable via `fetch`; false = documentation only"}}:{}}}},...n}}},{name:"get-endpoints",title:"Get endpoints",description:"Get all endpoints for a specific API",schema:a,annotations:{readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},outputSchema:{type:"object",properties:{api:{type:"string"},version:{type:"string"},servers:r,endpoints:{type:"array",items:{type:"object",properties:{path:{type:"string"},method:{type:"string"},summary:i,description:i,security:s}}}}}},{name:"get-endpoint-info",title:"Get endpoint info",description:"Get comprehensive information about specific endpoint including parameters, security, and examples",schema:b,annotations:{readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},outputSchema:{type:"object",properties:{api:{type:"string"},version:{type:"string"},servers:r,endpoint:f,globalSecurity:s,securitySchemes:l}}},{name:"get-security-schemes",title:"Get security schemes",description:"Get the security schemes for a specific API",schema:a,annotations:{readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},outputSchema:{type:"object",properties:{name:i,version:i,securitySchemes:l,security:s}}},{name:"get-full-api-description",title:"Get full API description",description:"Get the complete OpenAPI description",schema:a,annotations:{readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},outputSchema:{type:"object",properties:{api:{type:"string"},version:{type:"string"},definition:y}}},T(e.products,e.locales)];return d(e.requiresLogin,e.rbac)&&t.push({name:"whoami",title:"Who am I",description:"Get information about the currently authenticated user",schema:S,annotations:{readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},outputSchema:{type:"object",properties:{email:{type:"string"},name:{type:"string"},subject:{type:"string"},clientId:{type:"string"},scope:{type:"string"},issuedAt:{type:"string"},expiresAt:{type:"string"}}}}),e.hasGraphqlApis&&t.push(...O()),e.elicitationEnabled&&t.push({name:m,title:"Create anonymous session",description:"Create an anonymous session handle for storing upstream API credentials. Pass the returned sessionHandle to execute when an API needs credentials and the caller is not signed in. Treat it as a secret and reuse it across calls.",schema:v,annotations:{readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1,openWorldHint:!1},outputSchema:{type:"object",required:["sessionHandle"],properties:{sessionHandle:{type:"string"}}}}),t}const A={type:"object",required:[],additionalProperties:!1,properties:{filter:{type:"string",description:"GraphQL schema name (or part of it)",minLength:1,nullable:!0},page:{type:"number",description:"Page number",minimum:1,default:1,nullable:!0},limit:{type:"number",description:"Number of results per page. Default is 300",minimum:1,default:300,nullable:!0}}},P={type:"object",required:["name"],additionalProperties:!1,properties:{name:{type:"string",description:"GraphQL schema name",minLength:1},kind:{type:"string",description:'Optional: return only a single category of schema members. With scope "fields", restricts to the fields of that parent category ("objects", "interfaces", or "inputs" only).',enum:[...o],nullable:!0},scope:{type:"string",description:'Optional: what each list item is. "members" (default) lists top-level types and operations. "fields" flattens every field of every object/interface/input type into "ParentType.fieldName" entries with their descriptions \u2014 combine with `filter` to search nested fields anywhere in the schema.',enum:[...h],nullable:!0},filter:{type:"string",description:'Optional: only members whose name or description contains this substring, case-insensitive (e.g. "custom tags")',minLength:1,nullable:!0},referencesType:{type:"string",description:'Optional: only members that reference this type directly or transitively (via return, field, argument, union-member or input-field types). Finds cross-cutting members that never name it \u2014 e.g. referencesType "Book" surfaces a search query returning a union that includes Book.',minLength:1,nullable:!0},page:{type:"number",description:"Page number",minimum:1,default:1,nullable:!0},limit:{type:"number",description:"Number of results per page. Default is 300",minimum:1,default:300,nullable:!0}}},L={type:"object",required:["name","type"],additionalProperties:!1,properties:{name:{type:"string",description:"GraphQL schema name",minLength:1},type:{type:"string",description:"Name of the type, operation, or directive",minLength:1},includeReferencedTypes:{type:"boolean",description:"Also include the SDL of every type referenced transitively. Gives the whole subgraph at once, but can be large for highly-connected types.",default:!1,nullable:!0}}},q={type:"object",required:["name"],additionalProperties:!1,properties:{name:{type:"string",description:"GraphQL schema name",minLength:1}}};function O(){return[{name:"list-graphql-apis",title:"List GraphQL APIs",description:"Lists available GraphQL schemas with their context and purpose",schema:A,annotations:{readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},outputSchema:{type:"object",properties:{items:{type:"array",items:{type:"object",properties:{name:{type:"string"},description:i}}},...n}}},{name:"get-graphql-type-list",title:"Get GraphQL type list",description:'List all operations and types in a GraphQL schema as a flat, paginated list. Each item is tagged with its kind (query, object, enum, \u2026) and carries a one-line description; operations also include their return type and argument signature \u2014 use it to decide which members to fetch in detail. Narrow the result with `kind` (one category), `filter` (case-insensitive substring of the member name or description, e.g. "book"), or `referencesType` (only members that use a given type, directly or transitively) to explore a domain cheaply instead of pulling the full schema. To search nested fields \u2014 not just type names \u2014 set scope "fields": it flattens every field of every object/interface/input type into "ParentType.fieldName" entries with their descriptions, so `filter` finds things like an input field whose docstring mentions your keyword.',schema:P,annotations:{readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},outputSchema:{type:"object",properties:{name:{type:"string"},items:{type:"array",items:{type:"object",properties:{kind:{type:"string",enum:o},name:{type:"string"},description:i,type:{type:"string"},args:{type:"string"},directives:{type:"string"}}}},...n}}},{name:"get-graphql-type",title:"Get GraphQL type",description:'Get the SDL for a single GraphQL type, operation (query/mutation/subscription field), or directive. Without includeReferencedTypes, the SDL is followed by a one-level manifest of every directly referenced type\'s field names (e.g. "input ActionOperationInput { addTags, removeTags }"), so you can see what nested types contain before fetching them. Set includeReferencedTypes to instead pull in the full SDL of every type it references transitively \u2014 the whole structural subgraph in one call, ideal for complete exploration of an entity (e.g. Book and all the types it touches). That traversal only follows what the target depends on; to go the other direction and find the members that use a type, call get-graphql-type-list with `referencesType`.',schema:L,annotations:{readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},outputSchema:{type:"string"}},{name:"get-graphql-schema",title:"Get GraphQL schema",description:"Get the complete GraphQL schema as SDL \u2014 the whole type graph in one call. Returns everything, so it can be very large and token-expensive for big schemas; prefer get-graphql-type-list (filter/paginate) plus targeted get-graphql-type calls, and reach for this only for small schemas or when you truly need the full SDL.",schema:q,annotations:{readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},outputSchema:{type:"string"}}]}function T(e,t){const c=e&&e.length>0,u=t&&t.length>0;return{name:"search",title:"Search documentation",description:"Search across the documentation to fetch relevant content for a given query",schema:{type:"object",required:["query"],additionalProperties:!1,properties:{query:{type:"string",description:"Search query. Should be a single word or that phrase that is presented in a documentation.",minLength:1},...c?{product:{type:"string",description:"Optional product name to filter search results by specific product.",enum:e,nullable:!0}}:{},...u?{locale:{type:"string",description:"Optional locale code to filter search results by documentation language (e.g. 'en', 'ja'). Use the locale matching the language of the user's request. Defaults to the project's default locale.",enum:t,nullable:!0}}:{}}},annotations:{readOnlyHint:!0,destructiveHint:!1,idempotentHint:!1,openWorldHint:!1},outputSchema:{type:"string"}}}const E=new Set(H({requiresLogin:!0,hasGraphqlApis:!0,elicitationEnabled:!0}).map(e=>e.name));export{E as ALL_DEFAULT_TOOL_NAMES,H as getDefaultToolSchemas};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{removeTrailingSlash as
|
|
1
|
+
import{removeTrailingSlash as g,withPathPrefix as y,withoutPathPrefix as E}from"@redocly/theme/core/utils";import{ServerRoutes as L}from"../../../../../../constants/api.js";import{DEFAULT_LOCALE_PLACEHOLDER as S}from"../../../../../../constants/common.js";const w=async(n,t)=>{const{query:e,product:c,locale:l}=n,u=t.config.l10n?.defaultLocale||S,h=JSON.stringify({query:e,product:c,locale:l||u}),f=`${t.internalBaseUrl||t.baseUrl}${y(L.SEMANTIC_SEARCH)}`,o=t.accessToken?`authorization=${String(t.accessToken).replace(/^Bearer /,"")}`:"";try{const s=await fetch(f,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json",...o?{Cookie:o}:{}},body:h});if(!s.ok)return{content:[{type:"text",text:"Error retrieving search results."}],isError:!0};const p=await s.json(),d=new Set(t.searchIgnoredRoutes??[]),a=(p||[]).filter(r=>!R(r.url,d));if(a.length===0)return{content:[{type:"text",text:"No results found."}]};const m=r=>{try{return new URL(r,t.baseUrl).toString()}catch{return r}},i=a.map(r=>`### [${r.title}](${m(r.url)})
|
|
2
2
|
|
|
3
3
|
${r.content}
|
|
4
4
|
`).join(`
|
|
5
5
|
|
|
6
|
-
`).trim();return{content:[{type:"text",text:
|
|
6
|
+
`).trim();return{content:[{type:"text",text:i.length?i:"No results found."}]}}catch{return{content:[{type:"text",text:"Error retrieving search results."}],isError:!0}}};function R(n,t){if(t.size===0)return!1;let e;try{e=new URL(n,"https://relative.invalid").pathname}catch{return!1}e=g(E(e));try{e=decodeURI(e)}catch{}return t.has(e)}var v={search:w};export{v as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{loadApiDescription as i}from"./load-api-description.js";import{getEndpointsFromPaths as s}from"./utils.js";const p=async(
|
|
1
|
+
import{loadApiDescription as i}from"./load-api-description.js";import{getEndpointsFromPaths as s}from"./utils.js";const p=async(e,r)=>{let t;try{t=await i(e,r)}catch(o){return{content:[{type:"text",text:o.message}],isError:!0}}const n=s(t);return{content:[{type:"text",text:JSON.stringify({api:t.info?.title||"",version:t.info?.version||"",servers:t.servers||[],endpoints:n},null,2)}]}};var d={"get-endpoints":p};export{d as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{filterApiDescriptionsByName as g}from"../../utils/api-name-matching.js";const h=async(
|
|
1
|
+
import{isFetchCapable as d}from"../../../gateway-mcp/callable-apis.js";import{filterApiDescriptionsByName as g}from"../../utils/api-name-matching.js";const h=async(n,i)=>{const{filter:s,page:l=1,limit:e=300}=n,o=d(i);let t=Object.values(i.apiDescriptionsMap);s&&(t=g(t,s));const a=(l-1)*e,c=a+e,p=Math.ceil(t.length/e),r=t.length;return t=t.slice(a,c),{content:[{type:"text",text:JSON.stringify({items:t.map(({relativePath:f,fetchEligible:m,...u})=>({filePath:f,...u,...o?{callable:m===!0}:{}})),limit:e,total:r,page:l,totalPages:p})}]}};var y={"list-apis":h};export{y as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import a from"node:path";import{existsSync as f}from"node:fs";import{readFile as d}from"node:fs/promises";import{replaceFileExtension as h}from"../../../../../plugins/
|
|
1
|
+
import a from"node:path";import{existsSync as f}from"node:fs";import{readFile as d}from"node:fs/promises";import{replaceFileExtension as h}from"../../../../../plugins/api-docs/utils/replace-file-extension.js";import{PUBLIC_API_DEFINITIONS_FOLDER as u}from"../../../../../constants/common.js";import{filterDataByAccessDeep as l}from"../../../../../utils/rbac.js";import{checkEndpointAndDeleteXMcp as c}from"../../../utils/xmcp-utils.js";import{HTTP_METHODS as y}from"./constants.js";function P(t){return typeof t=="object"&&t!==null&&"responses"in t&&typeof t.responses=="object"}function S(t){const{paths:n={}}=t,e=[];for(const[r,i]of Object.entries(n)){const s=!c(i,"docs");for(const[p,o]of Object.entries(i))y.has(p.toLowerCase())&&(s||!c(o,"docs")||e.push({path:r,method:p.toUpperCase(),summary:o.summary,description:o.description,security:o.security}))}return e}async function T({relativePath:t,outdir:n,user:e,rbac:r={},requiresLogin:i=!1}){const s=a.join(n||"",u,h(t,".json"));if(!f(s))return;const o=await d(s,"utf-8"),m=JSON.parse(o);return l(m,{isAuthenticated:e?.isAuthenticated,email:e?.email,teams:e?.teams},r,i)}export{T as getApiDescriptionFromFs,S as getEndpointsFromPaths,P as isMcpEndpoint};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ApiDescriptionInfo, McpToolContext } from '../types.js';
|
|
2
|
+
export declare function getCallableApis(context: McpToolContext): ApiDescriptionInfo[];
|
|
3
|
+
/**
|
|
4
|
+
* Fetch capability at request/worker time is derived purely from the build-time stamps:
|
|
5
|
+
* `fetchEligible` is stamped per API by the lifecycle plugin under `isGatewayCapabilityEnabled`
|
|
6
|
+
* (entitlement + hide checks), and the map arriving here is already RBAC-filtered.
|
|
7
|
+
* No EntitlementsProvider read — this code runs in graphs where the provider is uninitialized.
|
|
8
|
+
*/
|
|
9
|
+
export declare function isFetchCapable(context: McpToolContext): boolean;
|
|
10
|
+
//# sourceMappingURL=callable-apis.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function i(e){return Object.values(e.apiDescriptionsMap??{}).filter(t=>t.fetchEligible)}function l(e){return i(e).length>0}export{i as getCallableApis,l as isFetchCapable};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { UpstreamAuthScheme } from './upstream-auth-scheme.js';
|
|
2
|
+
export declare function rejectCredential(auth: UpstreamAuthScheme, value: string): string | undefined;
|
|
3
|
+
export declare function assertHeaderSafe(header: string, value: string): void;
|
|
4
|
+
//# sourceMappingURL=credential-validation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const r=/[\r\n]/,o=255;function a(n){for(let e=0;e<n.length;e+=1){const t=n.charCodeAt(e);if(t===0||t>255)return!0}return!1}function s(n,e){if(!e)return"Enter a value before saving.";if(r.test(e))return"The value contains a line break. Paste it as a single line and save again.";if(a(e))return"The value contains a character that cannot be sent in an HTTP header, such as a curly quote or an invisible character. Copy the value again as plain text and save.";if(n.kind==="cookie")return i(n.name,e)}function i(n,e){if(e.includes(";")||e.toLowerCase().includes(`${n.toLowerCase()}=`))return`This looks like a whole cookie header. Paste only the value of the ${n} cookie, without the "${n}=" prefix and without any other name=value pairs.`}function c(n,e){if(!(!r.test(e)&&!a(e)))throw new Error(`The credential cannot be sent as the ${n} header value.`)}export{c as assertHeaderSafe,s as rejectCredential};
|