@redocly/realm 0.136.0-next.5 → 0.136.0-next.7
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 +60 -0
- package/dist/bin.js +1 -1
- package/dist/cli/build/analytics/collect-analytics.js +1 -1
- package/dist/cli/build/index.js +1 -1
- package/dist/cli/eject/resolveEjectParams.js +1 -1
- package/dist/cli/stats/collectors/openapi/index.js +1 -1
- package/dist/cli/stats/index.js +1 -1
- package/dist/client/App.js +1 -1
- package/dist/client/TestProvider.js +1 -1
- package/dist/client/api-docs-builder-entry.d.ts +3 -0
- package/dist/client/api-docs-builder-entry.js +1 -0
- package/dist/client/app/Feedback/useSubmitFeedback.js +1 -1
- package/dist/client/app/Sidebar/Sidebar.js +3 -3
- package/dist/client/app/Sidebar/helpers/hide-empty-separators.d.ts +13 -0
- package/dist/client/app/Sidebar/helpers/hide-empty-separators.js +1 -0
- package/dist/client/app/Sidebar/useActions.js +1 -1
- package/dist/client/app/Sidebar/utils.js +1 -1
- package/dist/client/app/hooks/codeHighlight/useCodeHighlight.js +1 -1
- package/dist/client/app/hooks/index.d.ts +1 -0
- package/dist/client/app/hooks/index.js +1 -1
- package/dist/client/app/hooks/useAutoScroll.js +1 -1
- package/dist/client/app/hooks/useUserClaims.js +1 -1
- package/dist/client/app/l10n/hooks/index.d.ts +1 -0
- package/dist/client/app/l10n/hooks/index.js +1 -1
- package/dist/client/app/l10n/hooks/useTranslationKeys.d.ts +2 -0
- package/dist/client/app/l10n/hooks/useTranslationKeys.js +1 -0
- package/dist/client/app/markdoc/custom-components/openapi/json-schema.d.ts +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.d.ts +1 -5
- 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.d.ts +8 -24
- package/dist/client/app/markdoc/custom-components/openapi/replay-openapi.js +1 -1
- package/dist/client/app/markdoc/hooks/use-store.d.ts +8 -6
- package/dist/client/app/markdoc/utils/build-replay-operation-source-map.d.ts +20 -0
- package/dist/client/app/markdoc/utils/build-replay-operation-source-map.js +1 -0
- package/dist/client/app/markdoc/utils/find-api-item.d.ts +15 -0
- package/dist/client/app/markdoc/utils/find-api-item.js +1 -0
- package/dist/client/app/markdoc/utils/find-code-sample-panel.d.ts +11 -0
- package/dist/client/app/markdoc/utils/find-code-sample-panel.js +1 -0
- package/dist/client/app/markdoc/utils/find-openapi-response-samples.d.ts +15 -0
- package/dist/client/app/markdoc/utils/find-openapi-response-samples.js +1 -0
- package/dist/client/app/markdoc/utils/openapi-panel-entry.d.ts +18 -0
- package/dist/client/app/markdoc/utils/openapi-panel-entry.js +1 -0
- package/dist/client/app/utils/resolveRouteBySlug.js +1 -1
- package/dist/client/app/utils/same-resolved-route.d.ts +5 -0
- package/dist/client/app/utils/same-resolved-route.js +1 -0
- package/dist/client/providers/post-message/PostMessageProvider.js +1 -1
- package/dist/client/providers/theme/ThemeDataProvider.js +1 -1
- package/dist/client/runtime/loader.js +1 -1
- package/dist/client/templates/api-docs/helpers.d.ts +10 -0
- package/dist/client/templates/api-docs/helpers.js +1 -0
- package/dist/client/templates/api-docs/template.d.ts +17 -0
- package/dist/client/templates/api-docs/template.js +14 -0
- package/dist/client/types/sidebar.d.ts +0 -1
- package/dist/client/utils/utils.d.ts +0 -2
- package/dist/client/utils/utils.js +1 -1
- package/dist/constants/common.d.ts +11 -1
- package/dist/constants/common.js +1 -1
- 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-schemas/feature-flags.d.ts +1 -1
- package/dist/server/constants/entitlements.js +1 -1
- package/dist/server/constants/plugins/api-docs.d.ts +3 -0
- package/dist/server/constants/plugins/api-docs.js +1 -0
- package/dist/server/esbuild/esbuild-logger.js +3 -3
- package/dist/server/esbuild/esbuild.js +3 -3
- package/dist/server/esbuild/plugins/api-docs-module-replacer/empty-check.d.ts +9 -0
- package/dist/server/esbuild/plugins/api-docs-module-replacer/empty-check.js +1 -0
- package/dist/server/esbuild/plugins/api-docs-module-replacer/empty-overlay.d.ts +2 -0
- package/dist/server/esbuild/plugins/api-docs-module-replacer/empty-overlay.js +1 -0
- package/dist/server/esbuild/plugins/api-docs-module-replacer/index.d.ts +6 -0
- package/dist/server/esbuild/plugins/api-docs-module-replacer/index.js +1 -0
- package/dist/server/plugins/api-docs/get-server-props.d.ts +4 -0
- package/dist/server/plugins/api-docs/get-server-props.js +1 -0
- package/dist/server/plugins/api-docs/get-template-path.d.ts +2 -0
- package/dist/server/plugins/api-docs/get-template-path.js +1 -0
- package/dist/server/plugins/api-docs/import-api-docs-builder.d.ts +8 -0
- package/dist/server/plugins/api-docs/import-api-docs-builder.js +1 -0
- package/dist/server/plugins/api-docs/index.d.ts +19 -0
- package/dist/server/plugins/api-docs/index.js +1 -0
- package/dist/server/plugins/api-docs/loader.d.ts +35 -0
- package/dist/server/plugins/api-docs/loader.js +3 -0
- package/dist/server/plugins/api-docs/options.d.ts +14 -0
- package/dist/server/plugins/api-docs/options.js +1 -0
- package/dist/server/plugins/api-docs/search/get-ai-search-documents.d.ts +20 -0
- package/dist/server/plugins/api-docs/search/get-ai-search-documents.js +105 -0
- package/dist/server/plugins/api-docs/search/search-facets.d.ts +10 -0
- package/dist/server/plugins/api-docs/search/search-facets.js +1 -0
- package/dist/server/plugins/api-docs/search/search-indexer.d.ts +9 -0
- package/dist/server/plugins/api-docs/search/search-indexer.js +1 -0
- package/dist/server/plugins/api-docs/search/search-resolver.d.ts +5 -0
- package/dist/server/plugins/api-docs/search/search-resolver.js +1 -0
- package/dist/server/plugins/api-docs/spec-download.api.d.ts +4 -0
- package/dist/server/plugins/api-docs/spec-download.api.js +1 -0
- package/dist/server/plugins/api-docs/store-definition-bundles.d.ts +3 -0
- package/dist/server/plugins/api-docs/store-definition-bundles.js +1 -0
- package/dist/server/plugins/api-docs/utils/build-item-positions.d.ts +17 -0
- package/dist/server/plugins/api-docs/utils/build-item-positions.js +1 -0
- package/dist/server/plugins/api-docs/utils/build-routes-mapping.d.ts +3 -0
- package/dist/server/plugins/api-docs/utils/build-routes-mapping.js +1 -0
- package/dist/server/plugins/api-docs/utils/collect-item-routes.d.ts +12 -0
- package/dist/server/plugins/api-docs/utils/collect-item-routes.js +1 -0
- package/dist/server/plugins/api-docs/utils/decorators.d.ts +26 -0
- package/dist/server/plugins/api-docs/utils/decorators.js +1 -0
- package/dist/server/plugins/api-docs/utils/format-bundle-error.d.ts +6 -0
- package/dist/server/plugins/api-docs/utils/format-bundle-error.js +5 -0
- package/dist/server/plugins/api-docs/utils/normalize-api-version.d.ts +2 -0
- package/dist/server/plugins/api-docs/utils/normalize-api-version.js +1 -0
- package/dist/server/plugins/api-docs/utils/normalize-feedback-options.d.ts +2 -0
- package/dist/server/plugins/api-docs/utils/normalize-feedback-options.js +1 -0
- package/dist/server/plugins/api-docs/utils/relative-path-to-base-slug.d.ts +20 -0
- package/dist/server/plugins/api-docs/utils/relative-path-to-base-slug.js +1 -0
- package/dist/server/plugins/api-docs/utils/replace-file-extension.d.ts +2 -0
- package/dist/server/plugins/api-docs/utils/replace-file-extension.js +1 -0
- package/dist/server/plugins/api-docs/utils/resolve-api-doc-title.d.ts +3 -0
- package/dist/server/plugins/api-docs/utils/resolve-api-doc-title.js +1 -0
- package/dist/server/plugins/api-docs/utils/resolve-config-rbac.d.ts +10 -0
- package/dist/server/plugins/api-docs/utils/resolve-config-rbac.js +1 -0
- package/dist/server/plugins/api-docs/utils/to-relative-slug.d.ts +2 -0
- package/dist/server/plugins/api-docs/utils/to-relative-slug.js +1 -0
- package/dist/server/plugins/api-functions/index.js +1 -1
- package/dist/server/plugins/arazzo-docs/index.js +1 -1
- package/dist/server/plugins/asyncapi-docs/index.js +1 -1
- package/dist/server/plugins/catalog-classic/index.js +1 -1
- package/dist/server/plugins/catalog-entities/extensions/extractors/api-description/arazzo-entities-extractor.js +1 -1
- package/dist/server/plugins/catalog-entities/extensions/extractors/api-description/asyncapi-entities-extractor.d.ts +13 -5
- package/dist/server/plugins/catalog-entities/extensions/extractors/api-description/asyncapi-entities-extractor.js +1 -1
- package/dist/server/plugins/catalog-entities/extensions/extractors/api-description/base.js +1 -1
- package/dist/server/plugins/catalog-entities/extensions/extractors/api-description/graphql-entities-extractor.d.ts +6 -5
- package/dist/server/plugins/catalog-entities/extensions/extractors/api-description/graphql-entities-extractor.js +2 -2
- package/dist/server/plugins/catalog-entities/extensions/extractors/api-description/openapi-entities-extractor.d.ts +12 -5
- package/dist/server/plugins/catalog-entities/extensions/extractors/api-description/openapi-entities-extractor.js +1 -1
- package/dist/server/plugins/catalog-entities/plugin.js +1 -1
- package/dist/server/plugins/catalog-entities/template/index.js +1 -1
- package/dist/server/plugins/catalog-entities/types/openapi.d.ts +1 -1
- package/dist/server/plugins/catalog-entities/utils/openapi-component-content-extractor.d.ts +3 -3
- package/dist/server/plugins/catalog-entities/utils/openapi-component-content-extractor.js +1 -1
- package/dist/server/plugins/catalog-entities/utils/openapi-schema-resolver.d.ts +4 -3
- package/dist/server/plugins/catalog-entities/utils/openapi-schema-resolver.js +1 -1
- package/dist/server/plugins/config-parser/index.js +1 -1
- package/dist/server/plugins/create-slugify.d.ts +17 -0
- package/dist/server/plugins/create-slugify.js +1 -0
- package/dist/server/plugins/default-theme/index.js +1 -1
- package/dist/server/plugins/dev-onboarding/index.js +1 -1
- package/dist/server/plugins/entitlements/index.js +1 -1
- package/dist/server/plugins/graphql-docs/index.js +1 -1
- package/dist/server/plugins/helpers/parse-partials.d.ts +3 -0
- package/dist/server/plugins/helpers/parse-partials.js +1 -0
- package/dist/server/plugins/l10n/index.js +1 -1
- package/dist/server/plugins/lifecycle.js +2 -2
- package/dist/server/plugins/markdown/attribute-resolvers/helpers/load-openapi-bundle.d.ts +5 -3
- package/dist/server/plugins/markdown/attribute-resolvers/helpers/load-openapi-bundle.js +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-json-example-ref.js +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-open-api-ref.js +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-openapi-code-samples.js +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-openapi-response-samples.js +1 -1
- package/dist/server/plugins/markdown/index.js +1 -1
- package/dist/server/plugins/markdown/search/walk-sections.js +1 -1
- package/dist/server/plugins/mcp/auth/auth-handlers.d.ts +1 -0
- package/dist/server/plugins/mcp/auth/auth-handlers.js +1 -1
- package/dist/server/plugins/mcp/codemode/constants.js +1 -1
- package/dist/server/plugins/mcp/codemode/tools/execute-schema.js +1 -1
- package/dist/server/plugins/mcp/codemode/tools/execute.d.ts +1 -0
- package/dist/server/plugins/mcp/constants.d.ts +1 -0
- package/dist/server/plugins/mcp/constants.js +1 -1
- package/dist/server/plugins/mcp/docs-mcp/tool-schemas.d.ts +1 -0
- package/dist/server/plugins/mcp/docs-mcp/tool-schemas.js +1 -1
- package/dist/server/plugins/mcp/docs-mcp/tools/core/create-anonymous-session.d.ts +11 -0
- package/dist/server/plugins/mcp/docs-mcp/tools/core/create-anonymous-session.js +1 -0
- package/dist/server/plugins/mcp/docs-mcp/tools/graphql/constants.d.ts +4 -0
- package/dist/server/plugins/mcp/docs-mcp/tools/graphql/constants.js +1 -0
- package/dist/server/plugins/mcp/docs-mcp/tools/graphql/get-graphql-type-list.js +1 -1
- package/dist/server/plugins/mcp/docs-mcp/tools/graphql/get-graphql-type.js +7 -4
- package/dist/server/plugins/mcp/docs-mcp/tools/graphql/types.d.ts +7 -1
- package/dist/server/plugins/mcp/docs-mcp/tools/graphql/types.js +0 -1
- package/dist/server/plugins/mcp/docs-mcp/tools/graphql/utils.d.ts +5 -1
- package/dist/server/plugins/mcp/docs-mcp/tools/graphql/utils.js +4 -2
- package/dist/server/plugins/mcp/docs-mcp/tools/index.d.ts +4 -0
- package/dist/server/plugins/mcp/docs-mcp/tools/index.js +1 -1
- package/dist/server/plugins/mcp/docs-mcp/tools/openapi/load-api-description.d.ts +1 -1
- package/dist/server/plugins/mcp/docs-mcp/tools/openapi/utils.d.ts +1 -1
- package/dist/server/plugins/mcp/docs-mcp/utils.d.ts +1 -1
- package/dist/server/plugins/mcp/gateway-mcp/elicitation.d.ts +4 -2
- package/dist/server/plugins/mcp/gateway-mcp/elicitation.js +2 -2
- package/dist/server/plugins/mcp/gateway-mcp/eligibility.d.ts +1 -2
- package/dist/server/plugins/mcp/gateway-mcp/fetch/allowed-hosts.d.ts +1 -1
- package/dist/server/plugins/mcp/gateway-mcp/fetch/fetch-bridge.d.ts +4 -2
- package/dist/server/plugins/mcp/gateway-mcp/fetch/fetch-bridge.js +1 -1
- package/dist/server/plugins/mcp/gateway-mcp/fetch/fetch-errors.d.ts +11 -0
- package/dist/server/plugins/mcp/gateway-mcp/fetch/fetch-errors.js +1 -0
- package/dist/server/plugins/mcp/gateway-mcp/fetch/fetch-telemetry.d.ts +13 -0
- package/dist/server/plugins/mcp/gateway-mcp/fetch/fetch-telemetry.js +1 -0
- package/dist/server/plugins/mcp/gateway-mcp/fetch/redact.d.ts +4 -0
- package/dist/server/plugins/mcp/gateway-mcp/fetch/redact.js +1 -0
- package/dist/server/plugins/mcp/gateway-mcp/fetch/ssrf-blocklist.d.ts +12 -0
- package/dist/server/plugins/mcp/gateway-mcp/fetch/ssrf-blocklist.js +1 -1
- package/dist/server/plugins/mcp/gateway-mcp/fetch/ssrf-guard.js +1 -1
- package/dist/server/plugins/mcp/gateway-mcp/fetch/ssrf-safe-lookup.d.ts +3 -1
- package/dist/server/plugins/mcp/gateway-mcp/fetch/ssrf-safe-lookup.js +1 -1
- package/dist/server/plugins/mcp/gateway-mcp/fetch-capability.js +1 -1
- package/dist/server/plugins/mcp/gateway-mcp/rate-limit/apply-edge-rate-limit.d.ts +3 -0
- package/dist/server/plugins/mcp/gateway-mcp/rate-limit/apply-edge-rate-limit.js +1 -0
- package/dist/server/plugins/mcp/gateway-mcp/rate-limit/edge-limiter.d.ts +16 -0
- package/dist/server/plugins/mcp/gateway-mcp/rate-limit/edge-limiter.js +1 -0
- package/dist/server/plugins/mcp/gateway-mcp/rate-limit/ip-key.d.ts +2 -0
- package/dist/server/plugins/mcp/gateway-mcp/rate-limit/ip-key.js +1 -0
- package/dist/server/plugins/mcp/gateway-mcp/rate-limit/limits.d.ts +7 -0
- package/dist/server/plugins/mcp/gateway-mcp/rate-limit/limits.js +1 -0
- package/dist/server/plugins/mcp/gateway-mcp/rate-limit/window-counter.d.ts +15 -0
- package/dist/server/plugins/mcp/gateway-mcp/rate-limit/window-counter.js +1 -0
- package/dist/server/plugins/mcp/gateway-mcp/secret-store.d.ts +8 -8
- package/dist/server/plugins/mcp/gateway-mcp/secret-store.js +1 -1
- package/dist/server/plugins/mcp/gateway-mcp/subject.d.ts +20 -0
- package/dist/server/plugins/mcp/gateway-mcp/subject.js +1 -0
- package/dist/server/plugins/mcp/handlers/docs-mcp-handler.js +1 -1
- 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 +26 -26
- package/dist/server/plugins/mcp/index.js +1 -1
- package/dist/server/plugins/mcp/servers/docs-server.d.ts +3 -1
- package/dist/server/plugins/mcp/servers/docs-server.js +1 -1
- package/dist/server/plugins/mcp/servers/mcp-server.d.ts +2 -0
- package/dist/server/plugins/mcp/servers/mcp-server.js +1 -1
- package/dist/server/plugins/mcp/servers/session-manager.js +1 -1
- package/dist/server/plugins/mcp/types.d.ts +4 -2
- package/dist/server/plugins/mcp/utils/mode.js +1 -1
- package/dist/server/plugins/mcp/utils/telemetry-attributes.d.ts +8 -0
- package/dist/server/plugins/mcp/utils/telemetry-attributes.js +1 -0
- package/dist/server/plugins/mcp/utils/xmcp-utils.d.ts +1 -1
- package/dist/server/plugins/mcp/utils.d.ts +17 -5
- package/dist/server/plugins/mcp/utils.js +1 -1
- package/dist/server/plugins/mcp/workers/mcp-tool-telemetry.js +1 -1
- package/dist/server/plugins/openapi-docs/index.js +1 -1
- package/dist/server/plugins/openapi-docs/utils.js +1 -1
- package/dist/server/plugins/pages/index.js +1 -1
- package/dist/server/plugins/scorecard-classic/compute-scorecard.js +4 -4
- package/dist/server/plugins/scorecard-classic/index.js +1 -1
- package/dist/server/plugins/scorecards/plugin.js +1 -1
- package/dist/server/plugins/search/ai-indexer/prepare-semantic-documents.js +2 -2
- package/dist/server/plugins/search/documents/search-documents.js +1 -1
- package/dist/server/plugins/search/index.js +1 -1
- package/dist/server/plugins/search/llmstxt/index.js +4 -4
- package/dist/server/plugins/sidebars/index.js +1 -1
- package/dist/server/plugins/sitemap/index.js +1 -1
- package/dist/server/plugins/sso/index.js +1 -1
- package/dist/server/ssr/render.js +1 -1
- package/dist/server/ssr/utils.d.ts +1 -0
- package/dist/server/ssr/utils.js +5 -5
- package/dist/server/store.d.ts +2 -6
- package/dist/server/store.js +1 -1
- package/dist/server/types/plugins/common.d.ts +3 -5
- package/dist/server/types/plugins/markdown.d.ts +1 -3
- package/dist/server/types/plugins/search.d.ts +1 -0
- package/dist/server/utils/catalog-classic/get-route-slug-to-catalog-slug-map.test.js +1 -1
- package/dist/server/utils/rbac.d.ts +4 -0
- package/dist/server/utils/rbac.js +1 -1
- package/dist/server/utils/report-all-errors.js +1 -1
- package/dist/server/utils/shared-data.js +1 -1
- package/dist/server/web-server/routes/resolve-route.js +1 -1
- package/dist/server/workers/worker-pool.js +1 -1
- package/dist/types/entitlements.d.ts +3 -0
- package/dist/types/markdoc.d.ts +2 -1
- package/dist/utils/url/get-shared-data-fetch-url.d.ts +17 -0
- package/dist/utils/url/get-shared-data-fetch-url.js +1 -0
- package/package.json +9 -8
- package/dist/markdoc/helpers/get-operation/get-operation-info-by-id.d.ts +0 -4
- package/dist/markdoc/helpers/get-operation/get-operation-info-by-id.js +0 -1
- package/dist/markdoc/helpers/get-operation/get-operation-info-by-pointer.d.ts +0 -4
- package/dist/markdoc/helpers/get-operation/get-operation-info-by-pointer.js +0 -1
- package/dist/markdoc/helpers/get-operation/get-operation.d.ts +0 -14
- package/dist/markdoc/helpers/get-operation/get-operation.js +0 -1
- package/dist/markdoc/helpers/get-operation/index.d.ts +0 -4
- package/dist/markdoc/helpers/get-operation/index.js +0 -1
- package/dist/markdoc/helpers/get-operation/types/index.d.ts +0 -4
- package/dist/markdoc/helpers/get-operation/types/index.js +0 -0
- package/dist/markdoc/helpers/get-operation/types/operation-identifier.d.ts +0 -5
- package/dist/markdoc/helpers/get-operation/types/operation-identifier.js +0 -0
- package/dist/markdoc/helpers/get-operation/types/operation-info.d.ts +0 -6
- package/dist/markdoc/helpers/get-operation/types/operation-info.js +0 -0
- package/dist/markdoc/helpers/get-operation/types/operation-parameters.d.ts +0 -3
- package/dist/markdoc/helpers/get-operation/types/operation-parameters.js +0 -0
- package/dist/server/plugins/markdown/attribute-resolvers/helpers/get-media-content-samples.d.ts +0 -4
- package/dist/server/plugins/markdown/attribute-resolvers/helpers/get-media-content-samples.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{shouldHandleMcpAuth as m}from"../auth/auth-handlers.js";import{GRAPHQL_TYPE_KINDS as o}from"./tools/graphql/types.js";import{OPERATION_METHODS as p}from"./tools/openapi/constants.js";const t={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>"},d={codemodeType:"OpenApiDocument"},h={codemodeType:"OpenApiOperation & { path: string; method: string }"},y={type:"object",additionalProperties:!1,required:[],properties:{filter:{type:"string",description:"API 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 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",minLength:1},version:{type:"string",description:"API version (required when multiple APIs share the same name but differ by version)",nullable:!0}}},g={type:"object",required:["name","path","method"],additionalProperties:!1,properties:{name:{type:"string",description:"API name",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}}},f={type:"object",required:[],additionalProperties:!1,properties:{}};function T(e){const i=[{name:"list-apis",description:"Lists available APIs with their context and purpose",schema:y,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:t,version:t,servers:r}}},...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:t,description:t,security:s}}}}}},{name:"get-endpoint-info",description:"Get comprehensive information about specific endpoint including parameters, security, and examples",schema:g,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:h,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:t,version:t,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:d}}},P(e.products,e.locales)];return m(e.requiresLogin,e.rbac)&&i.push({name:"whoami",description:"Get information about the currently authenticated user",schema:f,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&&i.push(...L()),i}const b={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}}},S={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",enum:[...o],nullable:!0},filter:{type:"string",description:'Optional: only members whose name contains this substring (e.g. "book")',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}}},v={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}}},H={type:"object",required:["name"],additionalProperties:!1,properties:{name:{type:"string",description:"GraphQL schema name",minLength:1}}};function L(){return[{name:"list-graphql-apis",description:"Lists available GraphQL schemas with their context and purpose",schema:b,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:t}}},...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` (member-name substring, 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.',schema:S,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:t,type:{type:"string"},args:{type:"string"}}}},...n}}},{name:"get-graphql-type",description:"Get the SDL for a single GraphQL type, operation (query/mutation/subscription field), or directive. Set includeReferencedTypes to also pull in every type it references transitively \u2014 the full 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:v,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:H,annotations:{title:"Get GraphQL Schema",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},outputSchema:{type:"string"}}]}function P(e,i){const c=e&&e.length>0,u=i&&i.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:i,nullable:!0}}:{}}},annotations:{title:"Search Documentation",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!1,openWorldHint:!1},outputSchema:{type:"string"}}}export{T as getDefaultToolSchemas};
|
|
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:"API 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 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",minLength:1},version:{type:"string",description:"API version (required when multiple APIs share the same name but differ by version)",nullable:!0}}},b={type:"object",required:["name","path","method"],additionalProperties:!1,properties:{name:{type:"string",description:"API name",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}}},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}}},...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}}},L={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}}},P={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}}},A={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:L,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:P,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:A,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};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { McpToolContext, McpToolHandler } from '../../../types.js';
|
|
2
|
+
export type CreateAnonymousSessionArgs = Record<string, never>;
|
|
3
|
+
export declare function isAnonymousSessionToolAvailable(context: McpToolContext): boolean;
|
|
4
|
+
declare const _default: {
|
|
5
|
+
createAnonymousSession: {
|
|
6
|
+
execute: McpToolHandler<CreateAnonymousSessionArgs>;
|
|
7
|
+
isAvailable: typeof isAnonymousSessionToolAvailable;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
export default _default;
|
|
11
|
+
//# sourceMappingURL=create-anonymous-session.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{CREATE_ANONYMOUS_SESSION_TOOL_NAME as t}from"../../../constants.js";import{createSessionHandle as n}from"../../../gateway-mcp/subject.js";const o=async()=>({content:[{type:"text",text:JSON.stringify({sessionHandle:n()})}],isError:!1});function i(e){return!!e.elicitationEnabled&&!e.user?.isAuthenticated}var a={[t]:{execute:o,isAvailable:i}};export{a as default,i as isAnonymousSessionToolAvailable};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const GRAPHQL_TYPE_KINDS: readonly ['queries', 'mutations', 'subscriptions', 'objects', 'interfaces', 'unions', 'enums', 'inputs', 'scalars', 'directives'];
|
|
2
|
+
export declare const GRAPHQL_LIST_SCOPES: readonly ['members', 'fields'];
|
|
3
|
+
export declare const FIELD_SCOPE_KINDS: readonly ['objects', 'interfaces', 'inputs'];
|
|
4
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const s=["queries","mutations","subscriptions","objects","interfaces","unions","enums","inputs","scalars","directives"],e=["members","fields"],t=["objects","interfaces","inputs"];export{t as FIELD_SCOPE_KINDS,e as GRAPHQL_LIST_SCOPES,s as GRAPHQL_TYPE_KINDS};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{GRAPHQL_TYPE_KINDS as
|
|
1
|
+
import{FIELD_SCOPE_KINDS as n,GRAPHQL_TYPE_KINDS as u}from"./constants.js";import{respondWithGraphqlSchema as g,paginate as d}from"./tool-helpers.js";import{groupSchemaTypes as h,fieldMembers as y,filterMembersReferencingType as S,matchesFilter as b}from"./utils.js";function T(r,p,t){if(p==="fields"){if(t&&!n.some(e=>e===t))throw new Error(`scope "fields" lists the fields of object, interface, and input types; kind must be ${n.map(e=>`"${e}"`).join(", ")}, or omitted.`);return y(r,t)}const o=h(r);return(t?[t]:u).flatMap(e=>o[e].map(s=>({kind:e,...s})))}const E=(r,p)=>g(r.name,p,({name:t,schema:o})=>{const{kind:e,scope:s="members",filter:f,referencesType:l,page:m=1,limit:a=300}=r;let i=T(o,s,e);return l&&(i=S(o,i,l)),f&&(i=i.filter(c=>b(c,f))),JSON.stringify({name:t,...d(i,m,a)},null,2)});var D={"get-graphql-type-list":E};export{D as default};
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import{respondWithGraphqlSchema as d}from"./tool-helpers.js";import{printTypeOrField as y,printTypeOrFieldWithReferences as
|
|
2
|
-
# Type: ${e} (+ ${
|
|
1
|
+
import{respondWithGraphqlSchema as d}from"./tool-helpers.js";import{printTypeOrField as y,printTypeOrFieldWithReferences as a,referencedTypeManifest as $}from"./utils.js";const m=(r,c)=>d(r.name,c,({name:p,schema:n})=>{const{type:e,includeReferencedTypes:l}=r;if(l){const{sdl:t,referencedCount:s}=a(n,e);return`# Schema: ${p}
|
|
2
|
+
# Type: ${e} (+ ${s} referenced types)
|
|
3
3
|
|
|
4
|
-
${
|
|
4
|
+
${t}`}const o=`# Schema: ${p}
|
|
5
5
|
# Type: ${e}
|
|
6
6
|
|
|
7
|
-
${y(
|
|
7
|
+
${y(n,e)}`,f=$(n,e);if(f.length===0)return o;const i=["# Referenced types (one level, names only; fetch a type or set includeReferencedTypes for full SDL):",...f.map(t=>`# ${t}`)].join(`
|
|
8
|
+
`);return`${o}
|
|
9
|
+
|
|
10
|
+
${i}`});var h={"get-graphql-type":m};export{h as default};
|
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
import type { GRAPHQL_LIST_SCOPES, GRAPHQL_TYPE_KINDS } from './constants.js';
|
|
2
2
|
export type GraphqlTypeKind = (typeof GRAPHQL_TYPE_KINDS)[number];
|
|
3
|
+
export type GraphqlListScope = (typeof GRAPHQL_LIST_SCOPES)[number];
|
|
3
4
|
export type SchemaMember = {
|
|
4
5
|
name: string;
|
|
5
6
|
description?: string;
|
|
6
7
|
type?: string;
|
|
7
8
|
args?: string;
|
|
9
|
+
directives?: string;
|
|
10
|
+
};
|
|
11
|
+
export type SchemaMemberWithKind = SchemaMember & {
|
|
12
|
+
kind: GraphqlTypeKind;
|
|
8
13
|
};
|
|
9
14
|
export type GroupedSchemaTypes = Record<GraphqlTypeKind, SchemaMember[]>;
|
|
10
15
|
export type ListGraphqlApisArgs = {
|
|
@@ -15,6 +20,7 @@ export type ListGraphqlApisArgs = {
|
|
|
15
20
|
export type GetGraphqlTypeListArgs = {
|
|
16
21
|
name: string;
|
|
17
22
|
kind?: GraphqlTypeKind;
|
|
23
|
+
scope?: GraphqlListScope;
|
|
18
24
|
filter?: string;
|
|
19
25
|
referencesType?: string;
|
|
20
26
|
page?: number;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const s=["queries","mutations","subscriptions","objects","interfaces","unions","enums","inputs","scalars","directives"];export{s as GRAPHQL_TYPE_KINDS};
|
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
import type { GraphQLSchema } from 'graphql';
|
|
2
2
|
import type { GraphqlDescriptionInfo } from '../../../types.js';
|
|
3
|
-
import type { GraphqlTypeKind, GroupedSchemaTypes } from './types.js';
|
|
3
|
+
import type { GraphqlTypeKind, GroupedSchemaTypes, SchemaMember, SchemaMemberWithKind } from './types.js';
|
|
4
4
|
export declare function findGraphqlSchemaByName(graphqlDescriptions: GraphqlDescriptionInfo[], name: string): GraphqlDescriptionInfo | undefined;
|
|
5
5
|
export declare function groupSchemaTypes(schema: GraphQLSchema): GroupedSchemaTypes;
|
|
6
|
+
export declare function fieldMembers(schema: GraphQLSchema, kind?: GraphqlTypeKind): SchemaMemberWithKind[];
|
|
7
|
+
/** Case-insensitive substring match against the member's name or description. */
|
|
8
|
+
export declare function matchesFilter(member: SchemaMember, filter: string): boolean;
|
|
6
9
|
export declare function filterMembersReferencingType<T extends {
|
|
7
10
|
kind: GraphqlTypeKind;
|
|
8
11
|
name: string;
|
|
9
12
|
}>(schema: GraphQLSchema, members: T[], targetName: string): T[];
|
|
10
13
|
export declare function referencedTypeClosure(schema: GraphQLSchema, name: string): string[];
|
|
11
14
|
export declare function printTypeOrField(schema: GraphQLSchema, name: string): string;
|
|
15
|
+
export declare function referencedTypeManifest(schema: GraphQLSchema, name: string): string[];
|
|
12
16
|
export declare function printTypeOrFieldWithReferences(schema: GraphQLSchema, name: string): {
|
|
13
17
|
sdl: string;
|
|
14
18
|
referencedCount: number;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
import{getNamedType as
|
|
1
|
+
import{getNamedType as u,isEnumType as j,isInputObjectType as d,isInterfaceType as p,isIntrospectionType as l,isObjectType as g,isScalarType as y,isSpecifiedScalarType as v,isUnionType as T,print as a,printType as L,specifiedDirectives as I}from"graphql";const D=new Set(["queries","mutations","subscriptions"]);function w(e){return e.toLowerCase().split(/[^a-z0-9_]+/).filter(Boolean)}function V(e,n){const t=n.toLowerCase(),r=e.find(s=>s.name.toLowerCase().includes(t));if(r)return r;const i=new Set(w(t));let o,f=0;for(const s of e){const c=w(s.name);c.length>f&&c.every(k=>i.has(k))&&(o=s,f=c.length)}return o}function m(e,n){return e.getQueryType()?.getFields()[n]??e.getMutationType()?.getFields()[n]??e.getSubscriptionType()?.getFields()[n]}function N(e){return[u(e.type).name,...(e.args??[]).map(n=>u(n.type).name)]}function S(e){const n=new Set;if(g(e)||p(e)){for(const t of Object.values(e.getFields())){n.add(u(t.type).name);for(const r of t.args)n.add(u(r.type).name)}for(const t of e.getInterfaces())n.add(t.name)}else if(T(e))for(const t of e.getTypes())n.add(t.name);else if(d(e))for(const t of Object.values(e.getFields()))n.add(u(t.type).name);return n}function O(e){return new Set([e.getQueryType(),e.getMutationType(),e.getSubscriptionType()].filter(n=>!!n).map(n=>n.name))}function A(e){const n=O(e),t={queries:b(e.getQueryType()),mutations:b(e.getMutationType()),subscriptions:b(e.getSubscriptionType()),objects:[],interfaces:[],unions:[],enums:[],inputs:[],scalars:[],directives:[]};for(const i of Object.values(e.getTypeMap())){if(l(i)||n.has(i.name))continue;const o=$(i);o&&t[o].push({name:i.name,description:i.description??void 0})}const r=new Set(I.map(i=>i.name));return t.directives=e.getDirectives().filter(i=>!r.has(i.name)).map(i=>({name:i.name,description:i.description??void 0})),t}function $(e){if(y(e))return v(e)?void 0:"scalars";if(g(e))return"objects";if(p(e))return"interfaces";if(T(e))return"unions";if(j(e))return"enums";if(d(e))return"inputs"}function F(e){return g(e)||p(e)||d(e)?e:void 0}function x(e){const n=e.astNode?.directives;return n?.length?n.map(t=>a(t)).join(" "):void 0}function b(e){return e?Object.values(e.getFields()).map(n=>({name:n.name,description:n.description??void 0,type:n.type.toString(),args:n.args.length?`(${n.args.map(t=>{const r=t.astNode?.defaultValue?` = ${a(t.astNode.defaultValue)}`:"";return`${t.name}: ${t.type}${r}`}).join(", ")})`:void 0,directives:x(n)})):[]}function G(e,n){const t=O(e),r=[];for(const i of Object.values(e.getTypeMap())){if(l(i)||t.has(i.name))continue;const o=F(i);if(!o)continue;const f=$(o);if(!(!f||n&&n!==f))for(const s of Object.values(o.getFields()))r.push({kind:f,name:`${o.name}.${s.name}`,description:s.description??void 0,type:s.type.toString(),directives:x(s)})}return r}function K(e,n){const t=n.toLowerCase();return e.name.toLowerCase().includes(t)||(e.description?.toLowerCase().includes(t)??!1)}function R(e,n){const t=n.indexOf(".");return t===-1?void 0:F(e.getType(n.slice(0,t)))?.getFields()[n.slice(t+1)]}function _(e,n,t){const r=B(e,t);if(!r)return[];const i=new Set([r,...q(e,r)]);return n.filter(o=>{if(o.name.includes(".")){const s=R(e,o.name);return s?N(s).some(c=>i.has(c)):!1}if(!D.has(o.kind))return i.has(o.name);const f=m(e,o.name);return f?N(f).some(s=>i.has(s)):!1})}function z(e,n){const t=new Set,r=[...M(e,n)];for(let i=0;i<r.length;i+=1){const o=r[i];if(t.has(o))continue;t.add(o);const f=e.getType(o);if(f)for(const s of S(f))t.has(s)||r.push(s)}return[...t].filter(i=>i!==n&&h(e,i))}function M(e,n){const t=e.getType(n);if(t)return S(t);const r=m(e,n);if(r)return new Set(N(r));const i=e.getDirective(n);return i?new Set(i.args.map(o=>u(o.type).name)):new Set}function q(e,n){const t=new Map;for(const o of Object.values(e.getTypeMap()))if(!l(o))for(const f of S(o)){let s=t.get(f);s||(s=new Set,t.set(f,s)),s.add(o.name)}const r=new Set,i=[n];for(let o=0;o<i.length;o+=1)for(const f of t.get(i[o])??[])r.has(f)||(r.add(f),i.push(f));return r}function B(e,n){const t=n.toLowerCase();return Object.keys(e.getTypeMap()).find(r=>r.toLowerCase()===t)}function h(e,n){const t=e.getType(n);return!t||l(t)?!1:!(y(t)&&v(t))}function C(e){return e.astNode?[e.astNode,...e.extensionASTNodes??[]].map(n=>a(n)).join(`
|
|
2
2
|
|
|
3
|
-
`),
|
|
3
|
+
`):L(e)}function Q(e,n){const t=e.getType(n);if(t)return C(t);const r=m(e,n);if(r?.astNode)return a(r.astNode);const i=e.getDirective(n);if(i?.astNode)return a(i.astNode);throw new Error(`No GraphQL type, operation, or directive named "${n}" found.`)}function P(e,n){const t=[];for(const r of M(e,n)){if(r===n||!h(e,r))continue;const i=e.getType(r);g(i)?t.push(`type ${r} { ${Object.keys(i.getFields()).join(", ")} }`):p(i)?t.push(`interface ${r} { ${Object.keys(i.getFields()).join(", ")} }`):d(i)?t.push(`input ${r} { ${Object.keys(i.getFields()).join(", ")} }`):j(i)?t.push(`enum ${r} { ${i.getValues().map(o=>o.name).join(", ")} }`):T(i)?t.push(`union ${r} = ${i.getTypes().map(o=>o.name).join(" | ")}`):y(i)&&t.push(`scalar ${r}`)}return t}function U(e,n){const t=Q(e,n),r=z(e,n).map(i=>e.getType(i)).filter(i=>!!i).map(i=>C(i));return{sdl:[t,...r].join(`
|
|
4
|
+
|
|
5
|
+
`),referencedCount:r.length}}export{G as fieldMembers,_ as filterMembersReferencingType,V as findGraphqlSchemaByName,A as groupSchemaTypes,K as matchesFilter,Q as printTypeOrField,U as printTypeOrFieldWithReferences,z as referencedTypeClosure,P as referencedTypeManifest};
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
declare const _default: {
|
|
2
|
+
createAnonymousSession: {
|
|
3
|
+
execute: import("../../types.js").McpToolHandler<import("./core/create-anonymous-session.js").CreateAnonymousSessionArgs>;
|
|
4
|
+
isAvailable: typeof import("./core/create-anonymous-session.js").isAnonymousSessionToolAvailable;
|
|
5
|
+
};
|
|
2
6
|
'list-apis': import("../../types.js").McpToolHandler<import("./openapi/types.js").ListApisArgs>;
|
|
3
7
|
'get-endpoints': import("../../types.js").McpToolHandler<import("./openapi/types.js").ApiNameVersionArgs>;
|
|
4
8
|
'get-endpoint-info': import("../../types.js").McpToolHandler<import("./openapi/types.js").GetEndpointInfoArgs>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import o from"./openapi/list-apis.js";import r from"./openapi/get-endpoints.js";import t from"./openapi/get-endpoint-info.js";import m from"./openapi/get-security-schemes.js";import i from"./openapi/get-full-api-description.js";import p from"./core/search.js";import e from"./core/whoami.js";import f from"./core/create-anonymous-session.js";import s from"./graphql/list-graphql-apis.js";import a from"./graphql/get-graphql-type-list.js";import l from"./graphql/get-graphql-type.js";import n from"./graphql/get-graphql-schema.js";var w={...o,...r,...t,...m,...i,...p,...e,...f,...s,...a,...l,...n};export{w as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { OpenAPIDefinition } from '@redocly/
|
|
1
|
+
import type { OpenAPIDefinition } from '@redocly/api-docs';
|
|
2
2
|
import type { McpToolContext } from '../../../types.js';
|
|
3
3
|
export declare function loadApiDescription(name: string, context: McpToolContext, version?: string): Promise<OpenAPIDefinition>;
|
|
4
4
|
//# sourceMappingURL=load-api-description.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { OpenAPIDefinition, OpenAPIOperation } from '@redocly/
|
|
1
|
+
import type { OpenAPIDefinition, OpenAPIOperation } from '@redocly/api-docs';
|
|
2
2
|
import type { ApiFunctionsUser, RbacConfig } from '@redocly/config';
|
|
3
3
|
import type { McpEndpoint } from '../../../types';
|
|
4
4
|
export declare function isMcpEndpoint(value: unknown): value is McpEndpoint;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { OpenAPISchema, OpenAPIParameter, OpenAPIResponse, OpenAPIRequestBody, Referenced, OpenAPIDefinition } from '@redocly/
|
|
1
|
+
import type { OpenAPISchema, OpenAPIParameter, OpenAPIResponse, OpenAPIRequestBody, Referenced, OpenAPIDefinition } from '@redocly/api-docs';
|
|
2
2
|
import type { ApiDescriptionInfo } from '../types.js';
|
|
3
3
|
export declare function findApiDescriptionByNameAndVersion(apiDescriptionsMap: Record<string, ApiDescriptionInfo>, name: string, version?: string): ApiDescriptionInfo | undefined;
|
|
4
4
|
export declare function filterApiDescriptionsByName(apiDescriptionsMap: ApiDescriptionInfo[], filter: string): ApiDescriptionInfo[];
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { UpstreamAuthRequiredEvent } from './upstream-auth.js';
|
|
2
2
|
import type { UpstreamAuthScheme } from './upstream-auth-scheme.js';
|
|
3
|
+
import type { KvService } from '@redocly/config';
|
|
3
4
|
export declare const ELICITATION_TIMEOUT_MS = 300000;
|
|
4
5
|
export type SendElicitRequest = (request: object, resultSchema: unknown, options: {
|
|
5
6
|
timeout: number;
|
|
@@ -14,12 +15,13 @@ export type ElicitationOutcome = {
|
|
|
14
15
|
} | {
|
|
15
16
|
status: 'skipped';
|
|
16
17
|
};
|
|
17
|
-
export declare function runUpstreamCredentialElicitation({ sendRequest, clientSupportsElicitation,
|
|
18
|
+
export declare function runUpstreamCredentialElicitation({ sendRequest, clientSupportsElicitation, subject, baseUrl, events, auth, kv, }: {
|
|
18
19
|
sendRequest: SendElicitRequest;
|
|
19
20
|
clientSupportsElicitation: boolean;
|
|
20
|
-
|
|
21
|
+
subject: string;
|
|
21
22
|
baseUrl: string;
|
|
22
23
|
events: UpstreamAuthRequiredEvent[];
|
|
23
24
|
auth: UpstreamAuthScheme;
|
|
25
|
+
kv: KvService;
|
|
24
26
|
}): Promise<ElicitationOutcome>;
|
|
25
27
|
//# sourceMappingURL=elicitation.d.ts.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{ElicitResultSchema as
|
|
2
|
-
`)}export{
|
|
1
|
+
import{ElicitResultSchema as p}from"@redocly/mcp-typescript-sdk/types.js";import{logger as f}from"../../../tools/notifiers/logger.js";import{secretStore as g,ELICITATION_TTL_MS as T}from"./secret-store.js";import{ANONYMOUS_SUBJECT_PREFIX as h}from"./subject.js";const I=3e5;async function A({sendRequest:t,clientSupportsElicitation:n,subject:e,baseUrl:s,events:r,auth:a,kv:c}){const i=e.startsWith(h)?e.slice(h.length):void 0,l=r[0],u=await g.createElicitation(c,{subject:e,api:l.api,name:l.name,auth:a}),d=k(s,u);if(!n)return{status:"fallback",text:m(r,d,i)};try{return(await t({method:"elicitation/create",params:{mode:"url",message:`The "${l.name}" API requires credentials. Open the link to provide them securely; they never pass through the chat.`,url:d,elicitationId:u}},p,{timeout:I})).action==="accept"?{status:"accepted"}:{status:"skipped"}}catch(o){return f.warn(`URL-mode elicitation failed, falling back to markdown link: ${o instanceof Error?o.message:String(o)}`),{status:"fallback",text:m(r,d,i)}}}function k(t,n){if(!t)return`/mcp/credentials?token=${n}`;try{const e=new URL("/mcp/credentials",t);return e.searchParams.set("token",n),e.toString()}catch{return`${t}/mcp/credentials?token=${n}`}}function m(t,n,e){const[s,...r]=t,a=[`The upstream API "${s.name}" returned 401 Unauthorized.`,"",`**Action required: show the user the link below and ask them to open it in a browser to provide the API credentials (valid ${Math.round(T/6e4)} minutes):**`,"",n,"",e?`Then call this tool again with sessionHandle: "${e}" - the credentials are stored against that handle, applied server-side, and never appear in the conversation.`:"Then call this tool again - the credentials are applied server-side and never appear in the conversation."];if(r.length>0){const c=r.map(i=>`"${i.name}"`).join(", ");a.push("",`The remaining APIs (${c}) will prompt for credentials on subsequent calls.`)}return a.join(`
|
|
2
|
+
`)}export{I as ELICITATION_TIMEOUT_MS,A as runUpstreamCredentialElicitation};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { OpenAPIDefinition } from '@redocly/
|
|
2
|
-
import type { OpenAPIMcp } from '@redocly/openapi-docs/lib/types/open-api.js';
|
|
1
|
+
import type { OpenAPIDefinition, OpenAPIMcp } from '@redocly/api-docs';
|
|
3
2
|
import type { RbacConfig, RedoclyConfig } from '@redocly/config';
|
|
4
3
|
/** Whether the gateway fetch capability is on: the feature flag plus none of mcp/docs hidden. */
|
|
5
4
|
export declare function isGatewayCapabilityEnabled(mcp?: RedoclyConfig['mcp']): boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { OpenAPIServer } from '@redocly/
|
|
1
|
+
import type { OpenAPIServer } from '@redocly/api-docs';
|
|
2
2
|
/**
|
|
3
3
|
* Build case-insensitive host matchers from an API's server URL templates. A server URL host
|
|
4
4
|
* may contain server-variable placeholders (e.g. a tenant `{subdomain}`); each placeholder
|
|
@@ -2,7 +2,7 @@ import { Agent, type Dispatcher } from 'undici';
|
|
|
2
2
|
import type { SandboxFetch } from '../../codemode/types.js';
|
|
3
3
|
import type { UpstreamAuthRequiredEvent } from '../upstream-auth.js';
|
|
4
4
|
import type { StoredSecret } from '../secret-store.js';
|
|
5
|
-
export declare
|
|
5
|
+
export declare function getDefaultAgent(): Agent;
|
|
6
6
|
export type FetchBridgeApi = {
|
|
7
7
|
slug: string;
|
|
8
8
|
name: string;
|
|
@@ -18,9 +18,11 @@ type FetchBridgeOptions = {
|
|
|
18
18
|
dispatcher?: Dispatcher;
|
|
19
19
|
timeoutMs?: number;
|
|
20
20
|
maxResponseBytes?: number;
|
|
21
|
+
maxFetchesPerExec?: number;
|
|
22
|
+
clientIp?: string;
|
|
21
23
|
};
|
|
22
24
|
/** Build the host-side `fetch` the gateway sandbox calls. */
|
|
23
|
-
export declare function buildFetchBridge({ allowedHosts, apis, authorization, onAuthRequired, fetchImpl, dispatcher, timeoutMs, maxResponseBytes, }: FetchBridgeOptions): SandboxFetch;
|
|
25
|
+
export declare function buildFetchBridge({ allowedHosts, apis, authorization, onAuthRequired, fetchImpl, dispatcher, timeoutMs, maxResponseBytes, maxFetchesPerExec, clientIp, }: FetchBridgeOptions): SandboxFetch;
|
|
24
26
|
export declare function readCappedBody(response: Response, maxBytes: number): Promise<string>;
|
|
25
27
|
export {};
|
|
26
28
|
//# sourceMappingURL=fetch-bridge.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Agent as
|
|
1
|
+
import{Agent as j}from"undici";import{envConfig as P}from"../../../../config/env-config.js";import{logger as _}from"../../../../tools/notifiers/logger.js";import{assertUrlAllowed as C}from"./ssrf-guard.js";import{createSsrfSafeLookup as W}from"./ssrf-safe-lookup.js";import{SsrfBlockedError as H}from"./ssrf-blocklist.js";import{GatewayFetchBlockedError as U,GatewayFetchSystemError as J,GatewayFetchUserError as L}from"./fetch-errors.js";import{redactHeaders as $,redactSecretsFromString as K}from"./redact.js";import{reportGatewayFetch as x}from"./fetch-telemetry.js";const O="x-forwarded-for",V=3e4,X=1024*1024;let A;function Y(){if(!A){const t=P.isDevelopMode;t&&_.warn("Gateway MCP SSRF guard: loopback upstreams are ALLOWED (develop mode only, never in runtime)."),A=new j({connect:{lookup:W({allowLoopback:t})}})}return A}function he({allowedHosts:t,apis:e=[],authorization:r,onAuthRequired:n,fetchImpl:s=fetch,dispatcher:d=Y(),timeoutMs:c=V,maxResponseBytes:h=X,maxFetchesPerExec:f,clientIp:m}){const k=[...t,...e.flatMap(o=>o.matchers)],B=[r,...e.map(o=>o.secret?.value)].filter(o=>!!o),v=e.map(o=>o.secret?.header).filter(o=>!!o);let D=0;return async o=>{const g=o.method??"GET",T=Date.now();let F,b,E={},M,S;try{if(f!==void 0){const l=Math.max(0,f);if(D+=1,D>l)throw new L(`Outbound fetch budget exceeded (max ${l} fetches per execute); split the work across calls`)}const u=C(o.url,k);F=u.hostname;const y=e.filter(l=>l.matchers.some(N=>N.test(u.hostname))),a=y.length===1?y[0]:void 0;b=a?.slug,E=re(o.headers,a?.secret,r,m);const w=new AbortController;S=setTimeout(()=>w.abort(),c);const i=await s(u,{method:g,headers:E,body:o.body,redirect:"manual",signal:w.signal,dispatcher:d});M=i.status,i.status===401&&a&&n&&n({api:a.slug,name:a.name});const R=await te(i,h);let p=oe(i.headers);if(z(i.status)){p=$(p,v);const{location:l}=p;l&&!q(l,u,k)&&delete p.location}return x({host:u.hostname,method:g,outcome:"success",durationMs:Date.now()-T,api:b,status:i.status,bytes:Buffer.byteLength(R,"utf8")}),{status:i.status,statusText:i.statusText,ok:i.ok,headers:p,bodyText:R}}catch(u){const{outcome:y,userSafe:a}=Q(u),w=F??(a instanceof U?a.host:void 0)??Z(o.url)??"invalid-url";throw x({host:w,method:g,outcome:y,durationMs:Date.now()-T,api:b,status:M}),a||(_.error(`Gateway MCP fetch failed [${g} ${w}]: ${K(ee(u),B)} headers=${JSON.stringify($(E,v))}`),new J("Upstream fetch failed due to an internal error"))}finally{S!==void 0&&clearTimeout(S)}}}function I(t){let e=t;for(let r=0;r<5&&e instanceof Error;r++){if(e instanceof L||e instanceof H)return e;e=e.cause}}function Q(t){const e=I(t);return{outcome:e instanceof U||e instanceof H?"blocked":e?"user_error":"system_error",userSafe:e}}function Z(t){try{return new URL(t).hostname||void 0}catch{return}}function z(t){return t>=300&&t<400}function q(t,e,r){try{return!!C(new URL(t,e).href,r)}catch{return!1}}function ee(t){if(!(t instanceof Error))return String(t);const e=t.cause;return e instanceof Error?`${t.message}: ${e.message}`:t.message}async function te(t,e){const r=Number(t.headers.get("content-length"));if(Number.isFinite(r)&&r>e)throw G(e,r);if(!t.body)return"";const n=t.body.getReader(),s=new TextDecoder;let d=0,c="";try{for(;;){const{done:h,value:f}=await n.read();if(h)break;if(d+=f.byteLength,d>e)throw G(e,d);c+=s.decode(f,{stream:!0})}return c+s.decode()}finally{await n.cancel().catch(()=>{})}}function G(t,e){return new L(`Response is too large (over ${t} bytes, got ${e}); request less data`)}function re(t,e,r,n){const s={},d=new Set;for(const[h,f]of Object.entries(t??{})){const m=h.toLowerCase();m==="host"||m==="content-length"||m!==O&&(d.add(m),s[h]=f)}n&&(s[O]=n);const c=e??(r?{header:"Authorization",value:r}:void 0);return c&&!d.has(c.header.toLowerCase())&&(s[c.header]=c.value),s}function oe(t){const e={};return t.forEach((r,n)=>{e[n.toLowerCase()]=r}),e}export{he as buildFetchBridge,Y as getDefaultAgent,te as readCappedBody};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare class GatewayFetchUserError extends Error {
|
|
2
|
+
constructor(message: string);
|
|
3
|
+
}
|
|
4
|
+
export declare class GatewayFetchBlockedError extends GatewayFetchUserError {
|
|
5
|
+
readonly host?: string;
|
|
6
|
+
constructor(message: string, host?: string);
|
|
7
|
+
}
|
|
8
|
+
export declare class GatewayFetchSystemError extends Error {
|
|
9
|
+
constructor(message: string);
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=fetch-errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
class s extends Error{constructor(r){super(r),this.name="GatewayFetchUserError"}}class o extends s{host;constructor(r,t){super(r),this.name="GatewayFetchBlockedError",this.host=t}}class a extends Error{constructor(r){super(r),this.name="GatewayFetchSystemError"}}export{o as GatewayFetchBlockedError,a as GatewayFetchSystemError,s as GatewayFetchUserError};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type GatewayFetchOutcome = 'success' | 'blocked' | 'user_error' | 'system_error';
|
|
2
|
+
type GatewayFetchEvent = {
|
|
3
|
+
host: string;
|
|
4
|
+
method: string;
|
|
5
|
+
outcome: GatewayFetchOutcome;
|
|
6
|
+
durationMs: number;
|
|
7
|
+
api?: string;
|
|
8
|
+
status?: number;
|
|
9
|
+
bytes?: number;
|
|
10
|
+
};
|
|
11
|
+
export declare function reportGatewayFetch({ host, method, outcome, durationMs, api, status, bytes, }: GatewayFetchEvent): void;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=fetch-telemetry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{telemetry as t}from"../../../../telemetry/index.js";import{logger as m}from"../../../../tools/notifiers/logger.js";import{McpServerType as c}from"../../constants.js";import{serverAttributes as p}from"../../utils/telemetry-attributes.js";function g({host:d,method:f,outcome:o,durationMs:i,api:e,status:r,bytes:n}){t.sendMcpGatewayFetchPerformedMessage([{...p(c.Docs),host:d,method:f,outcome:o,...e!==void 0&&{api:e},...r!==void 0&&{status:r},...n!==void 0&&{bytes:n},duration_ms:i}]),m.info(`Gateway MCP fetch [${f} ${d}] outcome=${o}`+(e!==void 0?` api=${e}`:"")+(r!==void 0?` status=${r}`:"")+(n!==void 0?` bytes=${n}`:"")+` durationMs=${i}`)}export{g as reportGatewayFetch};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const REDACTED = "\u00AB[redacted]\u00BB";
|
|
2
|
+
export declare function redactSecretsFromString(text: string, secretValues: readonly string[]): string;
|
|
3
|
+
export declare function redactHeaders(headers: Record<string, string>, extraSensitiveNames?: readonly string[]): Record<string, string>;
|
|
4
|
+
//# sourceMappingURL=redact.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const s="\xAB[redacted]\xBB",c=["authorization","proxy-authorization","cookie","set-cookie"];function a(r,n){let t=r;for(const e of n)e.trim()&&(t=t.split(e).join(s));return t}function u(r,n=[]){const t=new Set([...c,...n].map(o=>o.toLowerCase())),e={};for(const[o,i]of Object.entries(r))e[o]=t.has(o.toLowerCase())?s:i;return e}export{s as REDACTED,u as redactHeaders,a as redactSecretsFromString};
|
|
@@ -2,9 +2,21 @@ export declare class SsrfBlockedError extends Error {
|
|
|
2
2
|
code: string;
|
|
3
3
|
constructor(message: string);
|
|
4
4
|
}
|
|
5
|
+
/**
|
|
6
|
+
* If `ip` is an IPv4-mapped IPv6 address (`::ffff:0:0/96`), returns the
|
|
7
|
+
* embedded IPv4 in dotted form. Otherwise returns undefined.
|
|
8
|
+
*
|
|
9
|
+
* Examples:
|
|
10
|
+
* - `::ffff:1.2.3.4` -> `'1.2.3.4'`
|
|
11
|
+
* - `::ffff:a9fe:a9fe` -> `'169.254.169.254'`
|
|
12
|
+
* - `::1` -> `undefined`
|
|
13
|
+
*/
|
|
14
|
+
export declare function extractMappedIpv4(ip: string): string | undefined;
|
|
5
15
|
/**
|
|
6
16
|
* True if `ip` (a literal IPv4/IPv6 string) is in a range unsafe to reach. Non-IP input is
|
|
7
17
|
* treated as blocked (fail closed). Handles IPv4-mapped IPv6 by checking the embedded IPv4.
|
|
8
18
|
*/
|
|
9
19
|
export declare function isBlockedIp(ip: string): boolean;
|
|
20
|
+
/** True if `ip` (a literal IPv4/IPv6 string) is a loopback address. Non-IP input returns false. */
|
|
21
|
+
export declare function isLoopback(ip: string): boolean;
|
|
10
22
|
//# sourceMappingURL=ssrf-blocklist.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{BlockList as
|
|
1
|
+
import{BlockList as c,isIP as o}from"node:net";class g extends Error{code="SSRF_BLOCKED";constructor(t){super(t),this.name="SsrfBlockedError"}}const m=[["0.0.0.0",8],["10.0.0.0",8],["100.64.0.0",10],["127.0.0.0",8],["169.254.0.0",16],["172.16.0.0",12],["192.0.0.0",24],["192.0.2.0",24],["192.168.0.0",16],["198.18.0.0",15],["198.51.100.0",24],["203.0.113.0",24],["224.0.0.0",4],["240.0.0.0",4],["255.255.255.255",32]],S=[["::",128],["::1",128],["64:ff9b::",96],["64:ff9b:1::",48],["100::",64],["2001::",32],["2001:db8::",32],["2002::",16],["fc00::",7],["fe80::",10],["fec0::",10],["ff00::",8]],d=(()=>{const r=new c;for(const[t,e]of m)r.addSubnet(t,e,"ipv4");for(const[t,e]of S)r.addSubnet(t,e,"ipv6");return r})(),p=(()=>{const r=new c;return r.addSubnet("127.0.0.0",8,"ipv4"),r.addAddress("::1","ipv6"),r})();function u(r){if(o(r)!==6)return;const t=v(r);if(!(t.length===8&&t[0]===0&&t[1]===0&&t[2]===0&&t[3]===0&&t[4]===0&&t[5]===65535))return;const n=t[6]??0,f=t[7]??0;return[n>>8&255,n&255,f>>8&255,f&255].join(".")}function v(r){const e=r.replace(/:(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/,(i,a,l,x,h)=>`:${((+a&255)<<8|+l&255).toString(16)}:${((+x&255)<<8|+h&255).toString(16)}`).split("::");if(e.length>2)return[];const n=e[0]?e[0].split(":"):[],f=e[1]?e[1].split(":"):[],s=e.length===2?8-n.length-f.length:0;return s<0?[]:[...n,...Array(s).fill("0"),...f].map(i=>Number.parseInt(i,16))}function B(r){const t=o(r);if(t===0||d.check(r,t===4?"ipv4":"ipv6"))return!0;if(t===6){const e=u(r);if(e&&d.check(e,"ipv4"))return!0}return!1}function _(r){const t=o(r);if(t===0)return!1;if(p.check(r,t===4?"ipv4":"ipv6"))return!0;if(t===6){const e=u(r);if(e&&p.check(e,"ipv4"))return!0}return!1}export{g as SsrfBlockedError,u as extractMappedIpv4,B as isBlockedIp,_ as isLoopback};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{isIP as
|
|
1
|
+
import{isIP as l}from"node:net";import{isHostAllowed as i}from"./allowed-hosts.js";import{isBlockedIp as a}from"./ssrf-blocklist.js";import{GatewayFetchBlockedError as c,GatewayFetchUserError as s}from"./fetch-errors.js";function m(o,r){let t;try{t=new URL(o)}catch{throw new s(`Invalid URL: ${o}`)}if(t.protocol!=="http:"&&t.protocol!=="https:")throw new s(`Only http(s) URLs are allowed, got ${t.protocol}`);if(t.username||t.password)throw new s("URLs must not contain embedded credentials");const e=n(t.hostname);if(d(e)||!i(e,r))throw new c(`Host "${e}" is not allowed`,e);return t}function d(o){const r=n(o.toLowerCase()).split("%")[0];return r==="localhost"||r.endsWith(".localhost")?!0:l(r)!==0?a(r):!1}function n(o){return o.replace(/^\[|\]$/g,"")}export{m as assertUrlAllowed,d as isBlockedAddress};
|
|
@@ -7,5 +7,7 @@ import { type LookupFunction } from 'node:net';
|
|
|
7
7
|
* so that every socket connection — including those made while following redirects — is re-validated
|
|
8
8
|
* against the blocklist at connect time.
|
|
9
9
|
*/
|
|
10
|
-
export declare function createSsrfSafeLookup(
|
|
10
|
+
export declare function createSsrfSafeLookup({ allowLoopback, }?: {
|
|
11
|
+
allowLoopback?: boolean;
|
|
12
|
+
}): LookupFunction;
|
|
11
13
|
//# sourceMappingURL=ssrf-safe-lookup.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{lookup as
|
|
1
|
+
import{lookup as c}from"node:dns";import{isIP as k}from"node:net";import{isBlockedIp as v,isLoopback as w,SsrfBlockedError as n}from"./ssrf-blocklist.js";function L({allowLoopback:p=!1}={}){const f=o=>v(o)&&!(p&&w(o));return(o,m,r)=>{const s=m,l=t=>{if(s.all){r(null,t);return}const[e]=t;if(!e){r(new n(`Hostname "${o}" did not resolve`),"",0);return}r(null,e.address,e.family)},u=k(o);if(u!==0){if(f(o)){r(new n(`Hostname "${o}" is a blocked address`),"",0);return}l([{address:o,family:u}]);return}c(o,{...s,all:!0},(t,e)=>{if(t){r(t,"",0);return}const d=e.filter(({address:i})=>f(i));if(d.length>0){const i=d.map(({address:$})=>$).join(", ");r(new n(`Hostname "${o}" resolves to a blocked address: ${i}`),"",0);return}if(!e.length){r(new n(`Hostname "${o}" did not resolve`),"",0);return}l(e)})}}export{L as createSsrfSafeLookup};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{buildAllowedHostMatchers as
|
|
1
|
+
import{buildAllowedHostMatchers as a}from"./fetch/allowed-hosts.js";import{buildFetchBridge as s}from"./fetch/fetch-bridge.js";function i(e){return Object.values(e.apiDescriptionsMap??{}).filter(r=>r.fetchEligible)}function u(e){return i(e).length>0}function n(e,r){const l=i(e).map(t=>({slug:t.relativePath,name:t.name,matchers:a(t.servers??[]),secret:e.upstreamSecrets?.[t.relativePath]}));return s({allowedHosts:a([]),apis:l,authorization:e.upstreamAuthorization,onAuthRequired:r,maxFetchesPerExec:e.gatewayFetchBudgetPerExec,clientIp:e.clientIp})}export{n as buildExecuteHostFetch,i as getCallableApis,u as isFetchCapable};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{CacheService as a}from"../../../../persistence/cache/services/cache-service.js";import{logger as o}from"../../../../tools/notifiers/logger.js";import{ipRateLimitKey as s}from"./ip-key.js";import{checkEdgeRateLimit as c}from"./edge-limiter.js";import{resolveGatewayFetchLimits as d}from"./limits.js";async function g(i,n){const r=s(i);if(!r)return;let e;try{const t=await a.getInstance({baseDbDir:n.serverOutDir,databaseType:"local"});e=await c({cache:t,ip:r,limits:d(),now:Date.now()})}catch(t){o.warn(`gateway rate-limit init error, failing open: ${String(t)}`);return}if(!e.allowed)return new Response(JSON.stringify({jsonrpc:"2.0",error:{code:-32029,message:`Rate limit exceeded (${e.scope}); retry after ${e.retryAfterSeconds}s`},id:null}),{status:429,headers:{"Content-Type":"application/json","Retry-After":String(e.retryAfterSeconds)}})}export{g as applyEdgeRateLimit};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { CacheService } from '../../../../persistence/cache/services/cache-service.js';
|
|
2
|
+
import type { GatewayFetchLimits } from './limits.js';
|
|
3
|
+
export type EdgeDecision = {
|
|
4
|
+
allowed: true;
|
|
5
|
+
} | {
|
|
6
|
+
allowed: false;
|
|
7
|
+
retryAfterSeconds: number;
|
|
8
|
+
scope: 'rate' | 'quota';
|
|
9
|
+
};
|
|
10
|
+
export declare function checkEdgeRateLimit(params: {
|
|
11
|
+
cache: CacheService;
|
|
12
|
+
ip: string;
|
|
13
|
+
limits: GatewayFetchLimits;
|
|
14
|
+
now: number;
|
|
15
|
+
}): Promise<EdgeDecision>;
|
|
16
|
+
//# sourceMappingURL=edge-limiter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{checkAndIncrement as a}from"./window-counter.js";const s=60,d=86400;async function w(i){const{cache:e,ip:t,limits:o,now:r}=i,n=await a({cache:e,ip:t,windowSeconds:s,limit:o.ratePerMin,now:r});if(!n.allowed)return{allowed:!1,retryAfterSeconds:n.retryAfterSeconds,scope:"rate"};const c=await a({cache:e,ip:t,windowSeconds:d,limit:o.quotaPerDay,now:r});return c.allowed?{allowed:!0}:{allowed:!1,retryAfterSeconds:c.retryAfterSeconds,scope:"quota"}}export{w as checkEdgeRateLimit};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{isIP as l}from"node:net";import{getFeedbackClientIp as a}from"../../../../web-server/utils/feedback-ip.js";import{extractMappedIpv4 as c}from"../fetch/ssrf-blocklist.js";function I(t){const n=a(t);if(n)return f(n)}function f(t){if(l(t)===6){const n=c(t);return n||`${u(t)}::/64`}return t}function u(t){const n=t.split("%")[0],[e,i=""]=n.split("::"),r=e?e.split(":"):[],o=i?i.split(":"):[],s=8-r.length-o.length;return[...r,...Array(Math.max(0,s)).fill("0"),...o].slice(0,4).map(p=>parseInt(p||"0",16).toString(16)).join(":")}export{I as ipRateLimitKey};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{EntitlementsProvider as u}from"../../../../entitlements/entitlements-provider.js";import{FEATURE as r,GATEWAY_FETCH_LIMIT_DEFAULTS as a}from"../../../../../constants/common.js";function n(e,i,o){const t=e.entitlements?.[i];return typeof t=="number"&&Number.isFinite(t)?t:o}function P(){const e=u.instance();return{ratePerMin:n(e,r.gatewayFetchRatePerMin,a.ratePerMin),quotaPerDay:n(e,r.gatewayFetchQuotaPerDay,a.quotaPerDay),budgetPerExec:n(e,r.gatewayFetchBudgetPerExec,a.budgetPerExec)}}export{P as resolveGatewayFetchLimits};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { CacheService } from '../../../../persistence/cache/services/cache-service.js';
|
|
2
|
+
export type WindowCheck = {
|
|
3
|
+
allowed: false;
|
|
4
|
+
retryAfterSeconds: number;
|
|
5
|
+
} | {
|
|
6
|
+
allowed: true;
|
|
7
|
+
};
|
|
8
|
+
export declare function checkAndIncrement(params: {
|
|
9
|
+
cache: CacheService;
|
|
10
|
+
ip: string;
|
|
11
|
+
windowSeconds: number;
|
|
12
|
+
limit: number;
|
|
13
|
+
now: number;
|
|
14
|
+
}): Promise<WindowCheck>;
|
|
15
|
+
//# sourceMappingURL=window-counter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{logger as f}from"../../../../tools/notifiers/logger.js";const s="gateway-fetch-rl";async function m(i){const{cache:e,ip:l,windowSeconds:t,limit:w,now:d}=i,n=Math.floor(d/1e3),o=Math.floor(n/t),r=`${l}:${t}:${o}`;try{const a=(await e.get({key:r,namespace:s}))?.count??0;if(a>=w){const u=(o+1)*t-n;return{allowed:!1,retryAfterSeconds:Math.max(1,u)}}return await e.set({key:r,namespace:s,value:{count:a+1},ttlInSeconds:t}),{allowed:!0}}catch(c){return f.warn(`gateway rate-limit store error, failing open: ${String(c)}`),{allowed:!0}}}export{m as checkAndIncrement};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { KvService } from '@redocly/config';
|
|
1
2
|
import type { UpstreamAuthScheme } from './upstream-auth-scheme.js';
|
|
2
3
|
export declare const ELICITATION_TTL_MS: number;
|
|
3
4
|
export type StoredSecret = {
|
|
@@ -5,20 +6,19 @@ export type StoredSecret = {
|
|
|
5
6
|
value: string;
|
|
6
7
|
};
|
|
7
8
|
export type ElicitationTarget = {
|
|
8
|
-
|
|
9
|
+
subject: string;
|
|
9
10
|
api: string;
|
|
10
11
|
name: string;
|
|
11
12
|
auth: UpstreamAuthScheme;
|
|
12
13
|
};
|
|
13
14
|
export declare class SecretStore {
|
|
14
15
|
#private;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
consumeElicitation(token: string): ElicitationTarget | undefined;
|
|
16
|
+
setSecret(kv: KvService, subject: string, api: string, secret: StoredSecret): Promise<void>;
|
|
17
|
+
getSecretsForSubject(kv: KvService, subject: string): Promise<Record<string, StoredSecret>>;
|
|
18
|
+
deleteSubject(kv: KvService, subject: string): Promise<void>;
|
|
19
|
+
createElicitation(kv: KvService, target: ElicitationTarget): Promise<string>;
|
|
20
|
+
peekElicitation(kv: KvService, token: string): Promise<ElicitationTarget | undefined>;
|
|
21
|
+
consumeElicitation(kv: KvService, token: string): Promise<ElicitationTarget | undefined>;
|
|
22
22
|
}
|
|
23
23
|
export declare const secretStore: SecretStore;
|
|
24
24
|
//# sourceMappingURL=secret-store.d.ts.map
|