@redocly/redoc-revel 0.135.0-next.4 → 0.135.0-next.5
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 +26 -0
- package/dist/client/app/Sidebar/helpers/filter-out-versioned-items.d.ts +5 -2
- package/dist/client/app/Sidebar/helpers/filter-out-versioned-items.js +1 -1
- package/dist/client/providers/theme/ThemeDataProvider.js +1 -1
- package/dist/server/config/env-config.d.ts +2 -0
- package/dist/server/config/env-schema.d.ts +5 -0
- package/dist/server/config/env-schemas/feature-flags.d.ts +4 -0
- package/dist/server/config/env-schemas/feature-flags.js +1 -1
- package/dist/server/constants/plugins/search.js +1 -1
- package/dist/server/plugins/markdown/extract-frontmatter.d.ts +6 -0
- package/dist/server/plugins/markdown/extract-frontmatter.js +1 -0
- package/dist/server/plugins/markdown/markdown-frontmatter-loader.js +1 -1
- package/dist/server/plugins/mcp/docs-mcp/codemode/build-execute-tool-description.d.ts +4 -0
- package/dist/server/plugins/mcp/docs-mcp/codemode/build-execute-tool-description.js +4 -0
- package/dist/server/plugins/mcp/docs-mcp/codemode/sandbox.d.ts +3 -0
- package/dist/server/plugins/mcp/docs-mcp/codemode/sandbox.js +7 -0
- package/dist/server/plugins/mcp/docs-mcp/codemode/types.d.ts +9 -0
- package/dist/server/plugins/mcp/docs-mcp/codemode/types.js +0 -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.d.ts +2 -1
- package/dist/server/plugins/mcp/docs-mcp/tools/core/types.d.ts +6 -0
- package/dist/server/plugins/mcp/docs-mcp/tools/core/types.js +0 -0
- package/dist/server/plugins/mcp/docs-mcp/tools/core/whoami.d.ts +2 -1
- package/dist/server/plugins/mcp/docs-mcp/tools/execute.d.ts +9 -0
- package/dist/server/plugins/mcp/docs-mcp/tools/execute.js +1 -0
- package/dist/server/plugins/mcp/docs-mcp/tools/graphql/get-graphql-schema.d.ts +2 -3
- package/dist/server/plugins/mcp/docs-mcp/tools/graphql/get-graphql-type-list.d.ts +2 -9
- package/dist/server/plugins/mcp/docs-mcp/tools/graphql/get-graphql-type.d.ts +2 -5
- package/dist/server/plugins/mcp/docs-mcp/tools/graphql/list-graphql-apis.d.ts +2 -5
- package/dist/server/plugins/mcp/docs-mcp/tools/graphql/types.d.ts +21 -0
- package/dist/server/plugins/mcp/docs-mcp/tools/index.d.ts +11 -46
- package/dist/server/plugins/mcp/docs-mcp/tools/openapi/get-endpoint-info.d.ts +2 -6
- package/dist/server/plugins/mcp/docs-mcp/tools/openapi/get-endpoints.d.ts +2 -4
- package/dist/server/plugins/mcp/docs-mcp/tools/openapi/get-full-api-description.d.ts +2 -4
- package/dist/server/plugins/mcp/docs-mcp/tools/openapi/get-security-schemes.d.ts +2 -4
- package/dist/server/plugins/mcp/docs-mcp/tools/openapi/list-apis.d.ts +2 -5
- package/dist/server/plugins/mcp/docs-mcp/tools/openapi/types.d.ts +16 -0
- package/dist/server/plugins/mcp/docs-mcp/tools/openapi/types.js +0 -0
- package/dist/server/plugins/mcp/handlers/errors.js +1 -1
- package/dist/server/plugins/mcp/index.js +1 -1
- package/dist/server/plugins/mcp/mode.d.ts +9 -0
- package/dist/server/plugins/mcp/mode.js +1 -0
- package/dist/server/plugins/mcp/servers/docs-server.js +1 -1
- package/dist/server/plugins/mcp/types.d.ts +1 -0
- package/dist/server/plugins/mcp/workers/execute-mcp-tool.js +1 -1
- package/dist/server/plugins/mcp/workers/mcp-tool-telemetry.d.ts +4 -0
- package/dist/server/plugins/mcp/workers/mcp-tool-telemetry.js +1 -0
- package/dist/server/types/plugins/common.d.ts +3 -0
- package/package.json +11 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# @redocly/redoc-revel
|
|
2
2
|
|
|
3
|
+
## 0.135.0-next.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 7e9f8d8c9e7: Updated `@redocly/openapi-core` to version `2.34.0`.
|
|
8
|
+
- 23c1666e2ac: Fixed security vulnerability `GHSA-cmwh-pvxp-8882` by upgrading `dompurify` to version `3.4.11`.
|
|
9
|
+
- 63244207e95: Fixed an issue where search results prioritized matches in page text over matches in page titles.
|
|
10
|
+
- 054f8d0400e: Fixed issues in the breadcrumbs dropdown component where the chevron icon did not change when opened and a focus outline was added on click.
|
|
11
|
+
- 413e45fabee: Fixed an issue where the selected version persisted across versioned content sets instead of resetting to each set's default version.
|
|
12
|
+
- a614929940f: Added annotations to the MCP tools.
|
|
13
|
+
- 9042008046d: Fixed security vulnerability `CVE-2026-53550` by removing `gray-matter`.
|
|
14
|
+
- 5af80849dfe: Updated `@redocly/openapi-core` to version `2.33.1`.
|
|
15
|
+
- Updated dependencies [7e9f8d8c9e7]
|
|
16
|
+
- Updated dependencies [5f5fcd52f7a]
|
|
17
|
+
- Updated dependencies [23c1666e2ac]
|
|
18
|
+
- Updated dependencies [63244207e95]
|
|
19
|
+
- Updated dependencies [054f8d0400e]
|
|
20
|
+
- Updated dependencies [7e9f8d8c9e7]
|
|
21
|
+
- Updated dependencies [5af80849dfe]
|
|
22
|
+
- @redocly/openapi-docs@3.23.0-next.5
|
|
23
|
+
- @redocly/theme@0.67.0-next.4
|
|
24
|
+
- @redocly/realm-asyncapi-sdk@0.13.0-next.3
|
|
25
|
+
- @redocly/portal-plugin-mock-server@0.20.0-next.5
|
|
26
|
+
- @redocly/asyncapi-docs@1.12.0-next.5
|
|
27
|
+
- @redocly/graphql-docs@1.12.0-next.5
|
|
28
|
+
|
|
3
29
|
## 0.135.0-next.4
|
|
4
30
|
|
|
5
31
|
### Minor Changes
|
|
@@ -16,8 +16,11 @@ import type { ResolvedNavItem, Version } from '@redocly/config';
|
|
|
16
16
|
* /@latest
|
|
17
17
|
*
|
|
18
18
|
* So we foolow these rules:
|
|
19
|
-
* -
|
|
20
|
-
* -
|
|
19
|
+
* - only the active version's own folder follows the active version
|
|
20
|
+
* - every other folder keeps its own default version, even if it happens to
|
|
21
|
+
* contain a version with the same name as the active version
|
|
22
|
+
* - if the active version name doesn't exist in its own folder, that folder
|
|
23
|
+
* falls back to its default version
|
|
21
24
|
*/
|
|
22
25
|
export declare function filterOutVersionedItems(items: ResolvedNavItem[], activeVersion?: Version | null, versionNamesByFolderId?: Record<string, Set<string>>): ResolvedNavItem[];
|
|
23
26
|
//# sourceMappingURL=filter-out-versioned-items.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function f(o,n,e={}){for(const r of o)r.versionFolderId&&r.version&&(e[r.versionFolderId]=e[r.versionFolderId]??new Set).add(r.version);return o.filter(r=>r.version==null?r:!n||r.versionFolderId!==n.folderId?r.isDefault:r.versionFolderId&&e[r.versionFolderId]?.has(n.version)?r.version===n.version:r.isDefault).map(r=>{if(Array.isArray(r.items)&&r.items.length){const s=f(r.items,n,e);return s.length===0?null:{...r,items:s}}return r}).filter(r=>r!==null)}export{f as filterOutVersionedItems};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"react";import{ThemeDataContext as
|
|
1
|
+
import e from"react";import{ThemeDataContext as l,SearchSessionProvider as d}from"@redocly/theme/core/contexts";import{useAnchorPositioning as g,useBreadcrumbs as p,useBanner as b,useCatalogClassic as f,useCurrentProduct as h,useGlobalData as s,useI18n as C,useI18nConfig as P,useL10n as S,useL10nConfig as T,usePageData as r,usePageSharedData as D,usePageVersions as M,usePreloadHistory as k,useProducts as v,useUserMenu as F,useSubmitFeedback as E,useTranslate as L,useSidebarSiblingsData as R,usePageProps as y,useUserTeams as O,useMarkdownText as A,useMarkdocRenderer as w,useCodeHighlight as x,useLoadAndNavigate as I,useCatalog as j,useCatalogSort as B,useCatalogSearch as H,useFetchCatalogEntities as N,useFetchCatalogEntitiesRelations as U,useFetchCatalogEntityRevisions as _,useTelemetry as n,useMcpData as G}from"../../app/hooks";import{Link as Q}from"../../app/Link";import{useFacetQuery as V,useSearch as W,useAiSearch as q}from"../../app/search";import{useSidebarItems as z}from"../../app/Sidebar/useSidebarItems";import{deepMerge as J}from"../../../utils/object/deep-merge";import{allowlistObject as K}from"../../../utils/object/allowlist-object";const X=["title","description","seo","sidebar","excludeFromSearch","template","redirects","rbac","metadata","slug","codeSnippet","breadcrumbs","markdown","seo","navbar","footer","colorMode","feedback","navigation"],Y={useAnchorPositioning:g,useBreadcrumbs:p,useBanner:b,useCatalog:j,useCatalogSort:B,useCatalogSearch:H,useFetchCatalogEntities:N,useFetchCatalogEntitiesRelations:U,useFetchCatalogEntityRevisions:_,useCatalogClassic:f,useCurrentProduct:h,useGlobalData:s,useSearch:W,useAiSearch:q,useFacetQuery:V,useI18n:C,useI18nConfig:P,useL10n:S,useL10nConfig:T,usePageData:r,usePageSharedData:D,usePageVersions:M,usePreloadHistory:k,useProducts:v,useUserMenu:F,useSidebarItems:z,useSidebarSiblingsData:R,useSubmitFeedback:E,useTranslate:L,useUserTeams:O,usePageProps:y,useMarkdownText:A,useMarkdocRenderer:w,useCodeHighlight:x,useLoadAndNavigate:I,useTelemetry:n,useOtelTelemetry:n,useMcpData:G},Z={LinkComponent:Q};function ue({children:u}){const{props:t}=r()||{},a=s(),o=e.useMemo(()=>a||{},[a]),i=e.useMemo(()=>{const m=K(t?.frontmatter||{},X);return J(o,m)},[o,t?.frontmatter]),c={hooks:Y,components:Z,config:i};return e.createElement(d,null,e.createElement(l.Provider,{value:c},u))}export{ue as ThemeDataProvider};
|
|
@@ -52,6 +52,7 @@ declare function loadEnvConfig(): {
|
|
|
52
52
|
REDOCLY_EXP_LLMSTXT_AGENT_FEEDBACK_ENABLED?: boolean | undefined;
|
|
53
53
|
REDOCLY_EXP_LLMSTXT_AGENT_FEEDBACK_URL?: string | undefined;
|
|
54
54
|
REDOCLY_EXP_LLMSTXT_AGENT_ENDPOINT?: string | undefined;
|
|
55
|
+
REDOCLY_EXP_MCP_CODE_MODE_ENABLED?: boolean | undefined;
|
|
55
56
|
SEARCH_DEV_REINIT?: string | undefined;
|
|
56
57
|
SEARCH_DEV_DEBUG: boolean;
|
|
57
58
|
TYPESENSE_API_URL?: string | undefined;
|
|
@@ -130,6 +131,7 @@ export declare const envConfig: {
|
|
|
130
131
|
REDOCLY_EXP_LLMSTXT_AGENT_FEEDBACK_ENABLED?: boolean | undefined;
|
|
131
132
|
REDOCLY_EXP_LLMSTXT_AGENT_FEEDBACK_URL?: string | undefined;
|
|
132
133
|
REDOCLY_EXP_LLMSTXT_AGENT_ENDPOINT?: string | undefined;
|
|
134
|
+
REDOCLY_EXP_MCP_CODE_MODE_ENABLED?: boolean | undefined;
|
|
133
135
|
SEARCH_DEV_REINIT?: string | undefined;
|
|
134
136
|
SEARCH_DEV_DEBUG: boolean;
|
|
135
137
|
TYPESENSE_API_URL?: string | undefined;
|
|
@@ -56,6 +56,7 @@ export declare const envSchema: z.ZodEffects<z.ZodObject<{
|
|
|
56
56
|
REDOCLY_EXP_LLMSTXT_AGENT_FEEDBACK_ENABLED: z.ZodEffects<z.ZodOptional<z.ZodEnum<["true", "false"]>>, boolean | undefined, "false" | "true" | undefined>;
|
|
57
57
|
REDOCLY_EXP_LLMSTXT_AGENT_FEEDBACK_URL: z.ZodOptional<z.ZodString>;
|
|
58
58
|
REDOCLY_EXP_LLMSTXT_AGENT_ENDPOINT: z.ZodOptional<z.ZodString>;
|
|
59
|
+
REDOCLY_EXP_MCP_CODE_MODE_ENABLED: z.ZodEffects<z.ZodOptional<z.ZodEnum<["true", "false"]>>, boolean | undefined, "false" | "true" | undefined>;
|
|
59
60
|
} & {
|
|
60
61
|
SEARCH_DEV_REINIT: z.ZodOptional<z.ZodString>;
|
|
61
62
|
SEARCH_DEV_DEBUG: z.ZodEffects<z.ZodDefault<z.ZodEnum<["true", "false"]>>, boolean, "false" | "true" | undefined>;
|
|
@@ -131,6 +132,7 @@ export declare const envSchema: z.ZodEffects<z.ZodObject<{
|
|
|
131
132
|
REDOCLY_EXP_LLMSTXT_AGENT_FEEDBACK_ENABLED?: boolean | undefined;
|
|
132
133
|
REDOCLY_EXP_LLMSTXT_AGENT_FEEDBACK_URL?: string | undefined;
|
|
133
134
|
REDOCLY_EXP_LLMSTXT_AGENT_ENDPOINT?: string | undefined;
|
|
135
|
+
REDOCLY_EXP_MCP_CODE_MODE_ENABLED?: boolean | undefined;
|
|
134
136
|
SEARCH_DEV_REINIT?: string | undefined;
|
|
135
137
|
SEARCH_DEV_DEBUG: boolean;
|
|
136
138
|
TYPESENSE_API_URL?: string | undefined;
|
|
@@ -199,6 +201,7 @@ export declare const envSchema: z.ZodEffects<z.ZodObject<{
|
|
|
199
201
|
REDOCLY_EXP_LLMSTXT_AGENT_FEEDBACK_ENABLED?: "false" | "true" | undefined;
|
|
200
202
|
REDOCLY_EXP_LLMSTXT_AGENT_FEEDBACK_URL?: string | undefined;
|
|
201
203
|
REDOCLY_EXP_LLMSTXT_AGENT_ENDPOINT?: string | undefined;
|
|
204
|
+
REDOCLY_EXP_MCP_CODE_MODE_ENABLED?: "false" | "true" | undefined;
|
|
202
205
|
SEARCH_DEV_REINIT?: string | undefined;
|
|
203
206
|
SEARCH_DEV_DEBUG?: "false" | "true" | undefined;
|
|
204
207
|
TYPESENSE_API_URL?: string | undefined;
|
|
@@ -267,6 +270,7 @@ export declare const envSchema: z.ZodEffects<z.ZodObject<{
|
|
|
267
270
|
REDOCLY_EXP_LLMSTXT_AGENT_FEEDBACK_ENABLED?: boolean | undefined;
|
|
268
271
|
REDOCLY_EXP_LLMSTXT_AGENT_FEEDBACK_URL?: string | undefined;
|
|
269
272
|
REDOCLY_EXP_LLMSTXT_AGENT_ENDPOINT?: string | undefined;
|
|
273
|
+
REDOCLY_EXP_MCP_CODE_MODE_ENABLED?: boolean | undefined;
|
|
270
274
|
SEARCH_DEV_REINIT?: string | undefined;
|
|
271
275
|
SEARCH_DEV_DEBUG: boolean;
|
|
272
276
|
TYPESENSE_API_URL?: string | undefined;
|
|
@@ -335,6 +339,7 @@ export declare const envSchema: z.ZodEffects<z.ZodObject<{
|
|
|
335
339
|
REDOCLY_EXP_LLMSTXT_AGENT_FEEDBACK_ENABLED?: "false" | "true" | undefined;
|
|
336
340
|
REDOCLY_EXP_LLMSTXT_AGENT_FEEDBACK_URL?: string | undefined;
|
|
337
341
|
REDOCLY_EXP_LLMSTXT_AGENT_ENDPOINT?: string | undefined;
|
|
342
|
+
REDOCLY_EXP_MCP_CODE_MODE_ENABLED?: "false" | "true" | undefined;
|
|
338
343
|
SEARCH_DEV_REINIT?: string | undefined;
|
|
339
344
|
SEARCH_DEV_DEBUG?: "false" | "true" | undefined;
|
|
340
345
|
TYPESENSE_API_URL?: string | undefined;
|
|
@@ -15,6 +15,8 @@ export declare const featureFlagsSchema: z.ZodObject<{
|
|
|
15
15
|
REDOCLY_EXP_LLMSTXT_AGENT_FEEDBACK_URL: z.ZodOptional<z.ZodString>;
|
|
16
16
|
/** (Optional) API endpoint for the agent feedback endpoint;**/
|
|
17
17
|
REDOCLY_EXP_LLMSTXT_AGENT_ENDPOINT: z.ZodOptional<z.ZodString>;
|
|
18
|
+
/** Experimental: serve the Docs MCP server in codemode (a single `execute` tool). */
|
|
19
|
+
REDOCLY_EXP_MCP_CODE_MODE_ENABLED: z.ZodEffects<z.ZodOptional<z.ZodEnum<["true", "false"]>>, boolean | undefined, "false" | "true" | undefined>;
|
|
18
20
|
}, "strip", z.ZodTypeAny, {
|
|
19
21
|
NEW_CATALOG_ENABLED?: boolean | undefined;
|
|
20
22
|
NEW_SCORECARDS_ENABLED?: boolean | undefined;
|
|
@@ -25,6 +27,7 @@ export declare const featureFlagsSchema: z.ZodObject<{
|
|
|
25
27
|
REDOCLY_EXP_LLMSTXT_AGENT_FEEDBACK_ENABLED?: boolean | undefined;
|
|
26
28
|
REDOCLY_EXP_LLMSTXT_AGENT_FEEDBACK_URL?: string | undefined;
|
|
27
29
|
REDOCLY_EXP_LLMSTXT_AGENT_ENDPOINT?: string | undefined;
|
|
30
|
+
REDOCLY_EXP_MCP_CODE_MODE_ENABLED?: boolean | undefined;
|
|
28
31
|
}, {
|
|
29
32
|
NEW_CATALOG_ENABLED?: "false" | "true" | undefined;
|
|
30
33
|
NEW_SCORECARDS_ENABLED?: "false" | "true" | undefined;
|
|
@@ -35,5 +38,6 @@ export declare const featureFlagsSchema: z.ZodObject<{
|
|
|
35
38
|
REDOCLY_EXP_LLMSTXT_AGENT_FEEDBACK_ENABLED?: "false" | "true" | undefined;
|
|
36
39
|
REDOCLY_EXP_LLMSTXT_AGENT_FEEDBACK_URL?: string | undefined;
|
|
37
40
|
REDOCLY_EXP_LLMSTXT_AGENT_ENDPOINT?: string | undefined;
|
|
41
|
+
REDOCLY_EXP_MCP_CODE_MODE_ENABLED?: "false" | "true" | undefined;
|
|
38
42
|
}>;
|
|
39
43
|
//# sourceMappingURL=feature-flags.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{z as
|
|
1
|
+
import{z as _}from"zod";import{envBooleanStringOptional as E}from"../../utils/envs/env-boolean-string.js";const o=_.object({NEW_CATALOG_ENABLED:E(),NEW_SCORECARDS_ENABLED:E(),ENABLE_COMMENTS:_.string().optional(),REDOCLY_EXP_DISABLE_MD_VALIDATION:E(),ENABLE_SOURCE_MAPS:E(),PLAN_GATES:_.string().optional(),REDOCLY_EXP_LLMSTXT_AGENT_FEEDBACK_ENABLED:E(),REDOCLY_EXP_LLMSTXT_AGENT_FEEDBACK_URL:_.string().optional(),REDOCLY_EXP_LLMSTXT_AGENT_ENDPOINT:_.string().optional(),REDOCLY_EXP_MCP_CODE_MODE_ENABLED:E()});export{o as featureFlagsSchema};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{DEFAULT_ANONYMOUS_VISITOR_TEAM as e,DEFAULT_AUTHENTICATED_TEAM as t}from"../../../constants/common.js";const _="flexsearch",A=["
|
|
1
|
+
import{DEFAULT_ANONYMOUS_VISITOR_TEAM as e,DEFAULT_AUTHENTICATED_TEAM as t}from"../../../constants/common.js";const _="flexsearch",A=["title","text","path","httpPath","parameters[]:name","parameters[]:description","parameters[]:place","parameters[]:path"],o="Documentation",r="API Reference",p="search",T=100,a=10,n=20,s=100,c=150,I="ai-search",S=50,C=250,R=Symbol("metadata"),D={id:"",url:"",title:"",text:"",security:[],parameters:[{place:"",mediaType:void 0,name:"",description:"",path:[],type:"object",required:!1,example:void 0,enum:void 0}],rbacTeams:[e,t]},N=!0,x=["title"];export{I as AI_INDEX_EXPORT_FOLDER,S as AI_SEARCH_CHUNK_SIZE,C as AI_SEARCH_DOCUMENT_CHUNK_SIZE,D as BASE_SEARCH_DOCUMENT,N as DEFAULT_AI_SEARCH_ENABLED,_ as DEFAULT_SEARCH_ENGINE,x as DISABLE_DEEP_LINK_IF_FIELDS_EXIST,c as HIGHLIGHTED_TEXT_MAX_LENGTH,p as SEARCH_DATA_EXPORT_FOLDER,R as SEARCH_DOCUMENT_METADATA_KEY,a as SEARCH_GROUP_LIMIT,r as SEARCH_GROUP_NAME_API,o as SEARCH_GROUP_NAME_DOCUMENTATION,A as SEARCH_INDEX_FIELDS,T as SEARCH_LIMIT,n as SEARCH_MAX_FACET_VALUES,s as SEARCH_MAX_INMEMORY_DOCUMENTS_COUNT};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import a from"js-yaml";const c=/^---\r?\n(?:([\s\S]*?)\r?\n)?---\r?\n?/;function m(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function f(t){const n=t.match(c);if(!n)return{frontmatter:{}};const o=n[1]??"";try{const r=a.load(o);return{frontmatter:m(r)?r:{}}}catch(r){const e=r instanceof Error?r.message:String(r);return{frontmatter:{},frontmatterError:e}}}export{f as extractFrontmatter};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import{extractFrontmatter as m}from"./extract-frontmatter.js";import{ensureFrontmatterThemeCompatibility as f}from"../ensure-frontmatter-theme-compatibility.js";const w=async(r,t,a)=>{const n=await t.fs.read(r),{frontmatter:e,frontmatterError:o}=m(n);return o&&a(new Error(o)),{frontmatter:await f(e,r,t.fs)}};export{w as markdownFrontmatterLoader};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
const c=/^[A-Za-z_$][\w$]*$/;function p(e){const n=e.split(/[^A-Za-z0-9]+/).filter(Boolean).map((o,r)=>r===0?o:o[0].toUpperCase()+o.slice(1)).join("");return c.test(n)?n:`_${n}`}function y(e){return["Execute JavaScript in a sandbox to call the documentation tools below.","","Each tool is an async function on the global `tools` object.","","Do everything one request needs in a SINGLE execution: call as many tools as you need,","pass one call's output into the next, and branch or loop on intermediate results, then","`return` the final value. Each `execute` call is a full round-trip, so one script that","gathers everything is far cheaper and faster than several sequential calls. Only make","another `execute` call when you must react to something you genuinely could not","anticipate, and never repeat discovery you have already done.","","Example \u2014 one call that lists APIs, then drills into an endpoint:","","```ts","const { items } = await tools.listApis({ filter: 'billing' });","const { endpoints } = await tools.getEndpoints({ name: items[0].name });","return tools.getEndpointInfo({"," name: items[0].name,"," path: endpoints[0].path,"," method: endpoints[0].method,","});","```","","Available tools:","","Types named `OpenApi\u2026` are the standard OpenAPI Specification objects.","","```ts","declare const tools: {",e.map(n=>{const o=n.schema,r=s(o),u=n.outputSchema?s(n.outputSchema):"unknown",a=o.required?.length?"input":"input?";return` /** ${n.description} */
|
|
2
|
+
${p(n.name)}(${a}: ${r}): Promise<${u}>;`}).join(`
|
|
3
|
+
`),"};","```"].join(`
|
|
4
|
+
`)}function s(e){if(!e||typeof e!="object")return"unknown";const t=e.nullable?" | null":"";if(typeof e.codemodeType=="string")return e.codemodeType+t;if(Array.isArray(e.enum))return e.enum.map(d).join(" | ")+t;switch(e.type){case"string":return"string"+t;case"number":case"integer":return"number"+t;case"boolean":return"boolean"+t;case"array":return`Array<${s(e.items)}>`+t;case"object":return f(e)+t;default:return"unknown"}}function d(e){return typeof e=="string"?`'${e}'`:String(e)}function f(e){const t=e.properties??{},n=Object.keys(t),o=e.additionalProperties,r=o?o===!0?"unknown":s(o):void 0;if(n.length===0)return o===!1?"{}":`Record<string, ${r??"unknown"}>`;const u=new Set(e.required??[]),a=n.map(i=>{const l=u.has(i)?"":"?";return`${c.test(i)?i:JSON.stringify(i)}${l}: ${s(t[i])}`});return r&&a.push(`[key: string]: ${r}`),`{ ${a.join("; ")} }`}export{y as buildExecuteToolDescription,p as sanitizeToolName};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import J from"@jitl/quickjs-singlefile-mjs-release-sync";import{newQuickJSWASMModuleFromVariant as A,shouldInterruptAfterDeadline as I}from"quickjs-emscripten-core";const $=1e4,C=64*1024*1024,L=256*1024,w=100,N=1024*1024,R=1024*1024;let O;function x(){return O??=A(J)}function Y(t){return`(() => {
|
|
2
|
+
const invoke = globalThis.__invoke;
|
|
3
|
+
delete globalThis.__invoke;
|
|
4
|
+
globalThis.tools = Object.freeze({ ${t.map(r=>`${JSON.stringify(r)}: (input) => invoke(${JSON.stringify(r)}, JSON.stringify(input ?? {})).then(JSON.parse)`).join(", ")} });
|
|
5
|
+
})();`}async function F(t,n,r={}){const{timeoutMs:s=$}=r,m=new Set;let M=0,f=0;const e=(await x()).newContext();let l,g=()=>{};const y=new Promise((o,c)=>{g=()=>c(new Error(`Execution timed out after ${s}ms`))}),S=()=>e.runtime.setInterruptHandler(I(Date.now()+s)),p=()=>{clearTimeout(l),l=setTimeout(g,s)};let u;try{e.runtime.setMemoryLimit(C),e.runtime.setMaxStackSize(L),S(),p(),B(e,"__invoke",(E,b)=>{const P=e.getString(E),j=JSON.parse(e.getString(b)),i=e.newPromise();return m.add(i),f++,clearTimeout(l),(++M>w?Promise.reject(new Error(`Exceeded the limit of ${w} tool calls`)):Promise.resolve().then(()=>n[P](j))).then(a=>{if(!e.alive)return;const d=JSON.stringify(a??null);if(d.length>N){const k=`Tool output is too large (${d.length} bytes); request narrower data instead`;e.newError(k).consume(i.reject)}else e.newString(d).consume(i.resolve)},a=>{e.alive&&e.newError(h(a)).consume(i.reject)}),i.settled.then(()=>{e.alive&&(S(),--f===0&&p(),e.runtime.executePendingJobs())}),i.handle}),U(e,Y(Object.keys(n))),u=e.unwrapResult(e.evalCode(`(async () => {
|
|
6
|
+
${t}
|
|
7
|
+
})()`));const o=e.resolvePromise(u);e.runtime.executePendingJobs();const c=await Promise.race([o,y]),T=e.unwrapResult(c),_=e.dump(T);T.dispose();const v=JSON.stringify(_??null).length;return v>R?{error:`Result is too large (${v} bytes); return less data`}:{result:_}}catch(o){return{error:h(o)}}finally{clearTimeout(l),u?.dispose();for(const o of m)o.alive&&o.dispose();try{e.dispose()}catch{O=void 0}}}function B(t,n,r){t.newFunction(n,r).consume(s=>t.setProp(t.global,n,s))}function U(t,n){t.unwrapResult(t.evalCode(n)).dispose()}function h(t){return t instanceof Error?t.message:String(t)}export{F as runInSandbox};
|
|
File without changes
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { McpToolSchema } from '../../../types';
|
|
2
|
+
export declare const EXECUTE_TOOL_NAME = "execute";
|
|
3
|
+
export declare const EXECUTE_TOOL_SCHEMA: McpToolSchema;
|
|
2
4
|
export declare function getDefaultToolSchemas(config: {
|
|
3
5
|
products?: string[];
|
|
4
6
|
requiresLogin: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{shouldHandleMcpAuth as
|
|
1
|
+
import{shouldHandleMcpAuth as p}from"../auth/auth-handlers.js";import{GRAPHQL_TYPE_KINDS as l}from"./tools/graphql/types.js";const s=["GET","POST","PUT","DELETE","PATCH","OPTIONS","HEAD","TRACE"],t={type:"string",nullable:!0},n={codemodeType:"OpenApiServer[]"},r={codemodeType:"OpenApiSecurityRequirement[]"},o={codemodeType:"Record<string, OpenApiSecurityScheme>"},c={codemodeType:"OpenApiDocument"},u={codemodeType:"OpenApiOperation & { path: string; method: string }"},m="execute",P={name:m,description:"Run JavaScript in a sandbox to orchestrate multiple documentation tools in one call.",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 (shown to users in place of the raw call).",minLength:1}}}},d={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}}},h={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:[...s,...s.map(e=>e.toLowerCase())],minLength:1},version:{type:"string",description:"API version (required when multiple APIs share the same name but differ by version)",nullable:!0}}},y={type:"object",required:[],additionalProperties:!1,properties:{}};function q(e){const i=[{name:"list-apis",description:"Lists available APIs with their context and purpose",schema:d,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:n}}},limit:{type:"number"},total:{type:"number"},page:{type:"number"},totalPages:{type:"number"}}}},{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:n,endpoints:{type:"array",items:{type:"object",properties:{path:{type:"string"},method:{type:"string"},summary:t,description:t,security:r}}}}}},{name:"get-endpoint-info",description:"Get comprehensive information about specific endpoint including parameters, security, and examples",schema:h,annotations:{title:"Get Endpoint Info",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},outputSchema:{type:"object",properties:{api:{type:"string"},version:{type:"string"},servers:n,endpoint:u,globalSecurity:r,securitySchemes:o}}},{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:o,security:r}}},{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:c}}},v(e.products)];return p(e.requiresLogin,e.rbac)&&i.push({name:"whoami",description:"Get information about the currently authenticated user",schema:y,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(...H()),i}const g={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}}},f={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:[...l],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}}},b={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}}},S={type:"object",required:["name"],additionalProperties:!1,properties:{name:{type:"string",description:"GraphQL schema name",minLength:1}}};function H(){return[{name:"list-graphql-apis",description:"Lists available GraphQL schemas with their context and purpose",schema:g,annotations:{title:"List GraphQL APIs",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1}},{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) and/or `filter` (member-name substring, e.g. "book") to explore a domain cheaply instead of pulling the full schema.',schema:f,annotations:{title:"Get GraphQL Type List",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1}},{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).",schema:b,annotations:{title:"Get GraphQL Type",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1}},{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:S,annotations:{title:"Get GraphQL Schema",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1}}]}function v(e){return{name:"search",description:"Search across the documentation to fetch relevant content for a given query",schema:e&&e.length>0?{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},product:{type:"string",description:"Optional product name to filter search results by specific product.",enum:e,nullable:!0}}}:{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}}},annotations:{title:"Search Documentation",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!1,openWorldHint:!1},outputSchema:{type:"string"}}}export{m as EXECUTE_TOOL_NAME,P as EXECUTE_TOOL_SCHEMA,q as getDefaultToolSchemas};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { McpToolHandler } from '../../../types.js';
|
|
2
|
+
import type { SearchArgs } from './types.js';
|
|
2
3
|
declare const _default: {
|
|
3
|
-
search: McpToolHandler
|
|
4
|
+
search: McpToolHandler<SearchArgs>;
|
|
4
5
|
};
|
|
5
6
|
export default _default;
|
|
6
7
|
//# sourceMappingURL=search.d.ts.map
|
|
File without changes
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { McpToolHandler } from '../../../types.js';
|
|
2
|
+
import type { WhoamiArgs } from './types.js';
|
|
2
3
|
declare const _default: {
|
|
3
|
-
whoami: McpToolHandler
|
|
4
|
+
whoami: McpToolHandler<WhoamiArgs>;
|
|
4
5
|
};
|
|
5
6
|
export default _default;
|
|
6
7
|
//# sourceMappingURL=whoami.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{mcpToolHandlers as s}from"../../../../../client/mcp-tool-handlers-entry.js";import{EXECUTE_TOOL_NAME as c}from"../tool-schemas.js";import{sanitizeToolName as u}from"../codemode/build-execute-tool-description.js";import{runInSandbox as f}from"../codemode/sandbox.js";import{executeMcpTool as l,isMcpToolAvailable as m}from"../../workers/execute-mcp-tool.js";const p=async(t,r,n)=>{const o=await y(r,n),{result:i,error:e}=await f(t.code,o);return{content:[{type:"text",text:JSON.stringify({result:i,error:e})}],isError:e!==void 0}};async function y(t,r){const n={};for(const o of Object.keys(s))o!==c&&await d(o,t)&&(n[u(o)]=async i=>{const e=await l({toolName:o,args:i,context:t,extra:r}),a=x(e);if(e.isError)throw new Error(a);return T(a)});return n}async function d(t,r){try{return await m({toolName:t,context:r})}catch{return!1}}function x(t){return t.content.filter(r=>r.type==="text").map(r=>r.text).join("")}function T(t){try{return JSON.parse(t)}catch{return t}}var g={[c]:p};export{g as default};
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import type { McpToolHandler } from '../../../types.js';
|
|
2
|
+
import type { GetGraphqlSchemaArgs } from './types.js';
|
|
2
3
|
declare const _default: {
|
|
3
|
-
'get-graphql-schema': McpToolHandler<
|
|
4
|
-
name: string;
|
|
5
|
-
}>;
|
|
4
|
+
'get-graphql-schema': McpToolHandler<GetGraphqlSchemaArgs>;
|
|
6
5
|
};
|
|
7
6
|
export default _default;
|
|
8
7
|
//# sourceMappingURL=get-graphql-schema.d.ts.map
|
|
@@ -1,14 +1,7 @@
|
|
|
1
1
|
import type { McpToolHandler } from '../../../types.js';
|
|
2
|
-
import type {
|
|
2
|
+
import type { GetGraphqlTypeListArgs } from './types.js';
|
|
3
3
|
declare const _default: {
|
|
4
|
-
'get-graphql-type-list': McpToolHandler<
|
|
5
|
-
name: string;
|
|
6
|
-
kind?: GraphqlTypeKind;
|
|
7
|
-
filter?: string;
|
|
8
|
-
referencesType?: string;
|
|
9
|
-
page?: number;
|
|
10
|
-
limit?: number;
|
|
11
|
-
}>;
|
|
4
|
+
'get-graphql-type-list': McpToolHandler<GetGraphqlTypeListArgs>;
|
|
12
5
|
};
|
|
13
6
|
export default _default;
|
|
14
7
|
//# sourceMappingURL=get-graphql-type-list.d.ts.map
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import type { McpToolHandler } from '../../../types.js';
|
|
2
|
+
import type { GetGraphqlTypeArgs } from './types.js';
|
|
2
3
|
declare const _default: {
|
|
3
|
-
'get-graphql-type': McpToolHandler<
|
|
4
|
-
name: string;
|
|
5
|
-
type: string;
|
|
6
|
-
includeReferencedTypes?: boolean;
|
|
7
|
-
}>;
|
|
4
|
+
'get-graphql-type': McpToolHandler<GetGraphqlTypeArgs>;
|
|
8
5
|
};
|
|
9
6
|
export default _default;
|
|
10
7
|
//# sourceMappingURL=get-graphql-type.d.ts.map
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import type { McpToolHandler } from '../../../types.js';
|
|
2
|
+
import type { ListGraphqlApisArgs } from './types.js';
|
|
2
3
|
declare const _default: {
|
|
3
|
-
'list-graphql-apis': McpToolHandler<
|
|
4
|
-
filter?: string;
|
|
5
|
-
page?: number;
|
|
6
|
-
limit?: number;
|
|
7
|
-
}>;
|
|
4
|
+
'list-graphql-apis': McpToolHandler<ListGraphqlApisArgs>;
|
|
8
5
|
};
|
|
9
6
|
export default _default;
|
|
10
7
|
//# sourceMappingURL=list-graphql-apis.d.ts.map
|
|
@@ -7,4 +7,25 @@ export type SchemaMember = {
|
|
|
7
7
|
args?: string;
|
|
8
8
|
};
|
|
9
9
|
export type GroupedSchemaTypes = Record<GraphqlTypeKind, SchemaMember[]>;
|
|
10
|
+
export type ListGraphqlApisArgs = {
|
|
11
|
+
filter?: string;
|
|
12
|
+
page?: number;
|
|
13
|
+
limit?: number;
|
|
14
|
+
};
|
|
15
|
+
export type GetGraphqlTypeListArgs = {
|
|
16
|
+
name: string;
|
|
17
|
+
kind?: GraphqlTypeKind;
|
|
18
|
+
filter?: string;
|
|
19
|
+
referencesType?: string;
|
|
20
|
+
page?: number;
|
|
21
|
+
limit?: number;
|
|
22
|
+
};
|
|
23
|
+
export type GetGraphqlTypeArgs = {
|
|
24
|
+
name: string;
|
|
25
|
+
type: string;
|
|
26
|
+
includeReferencedTypes?: boolean;
|
|
27
|
+
};
|
|
28
|
+
export type GetGraphqlSchemaArgs = {
|
|
29
|
+
name: string;
|
|
30
|
+
};
|
|
10
31
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1,50 +1,15 @@
|
|
|
1
1
|
declare const _default: {
|
|
2
|
-
'list-apis': import("../../types.js").McpToolHandler<
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
'get-
|
|
12
|
-
|
|
13
|
-
path: string;
|
|
14
|
-
method: string;
|
|
15
|
-
version?: string;
|
|
16
|
-
}>;
|
|
17
|
-
'get-security-schemes': import("../../types.js").McpToolHandler<{
|
|
18
|
-
name: string;
|
|
19
|
-
version?: string;
|
|
20
|
-
}>;
|
|
21
|
-
'get-full-api-description': import("../../types.js").McpToolHandler<{
|
|
22
|
-
name: string;
|
|
23
|
-
version?: string;
|
|
24
|
-
}>;
|
|
25
|
-
search: import("../../types.js").McpToolHandler;
|
|
26
|
-
whoami: import("../../types.js").McpToolHandler;
|
|
27
|
-
'list-graphql-apis': import("../../types.js").McpToolHandler<{
|
|
28
|
-
filter?: string;
|
|
29
|
-
page?: number;
|
|
30
|
-
limit?: number;
|
|
31
|
-
}>;
|
|
32
|
-
'get-graphql-type-list': import("../../types.js").McpToolHandler<{
|
|
33
|
-
name: string;
|
|
34
|
-
kind?: import("./graphql/types.js").GraphqlTypeKind;
|
|
35
|
-
filter?: string;
|
|
36
|
-
referencesType?: string;
|
|
37
|
-
page?: number;
|
|
38
|
-
limit?: number;
|
|
39
|
-
}>;
|
|
40
|
-
'get-graphql-type': import("../../types.js").McpToolHandler<{
|
|
41
|
-
name: string;
|
|
42
|
-
type: string;
|
|
43
|
-
includeReferencedTypes?: boolean;
|
|
44
|
-
}>;
|
|
45
|
-
'get-graphql-schema': import("../../types.js").McpToolHandler<{
|
|
46
|
-
name: string;
|
|
47
|
-
}>;
|
|
2
|
+
'list-apis': import("../../types.js").McpToolHandler<import("./openapi/types.js").ListApisArgs>;
|
|
3
|
+
'get-endpoints': import("../../types.js").McpToolHandler<import("./openapi/types.js").ApiNameVersionArgs>;
|
|
4
|
+
'get-endpoint-info': import("../../types.js").McpToolHandler<import("./openapi/types.js").GetEndpointInfoArgs>;
|
|
5
|
+
'get-security-schemes': import("../../types.js").McpToolHandler<import("./openapi/types.js").ApiNameVersionArgs>;
|
|
6
|
+
'get-full-api-description': import("../../types.js").McpToolHandler<import("./openapi/types.js").ApiNameVersionArgs>;
|
|
7
|
+
search: import("../../types.js").McpToolHandler<import("./core/types.js").SearchArgs>;
|
|
8
|
+
whoami: import("../../types.js").McpToolHandler<import("./core/types.js").WhoamiArgs>;
|
|
9
|
+
'list-graphql-apis': import("../../types.js").McpToolHandler<import("./graphql/types.js").ListGraphqlApisArgs>;
|
|
10
|
+
'get-graphql-type-list': import("../../types.js").McpToolHandler<import("./graphql/types.js").GetGraphqlTypeListArgs>;
|
|
11
|
+
'get-graphql-type': import("../../types.js").McpToolHandler<import("./graphql/types.js").GetGraphqlTypeArgs>;
|
|
12
|
+
'get-graphql-schema': import("../../types.js").McpToolHandler<import("./graphql/types.js").GetGraphqlSchemaArgs>;
|
|
48
13
|
};
|
|
49
14
|
export default _default;
|
|
50
15
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
import type { McpToolHandler } from '../../../types.js';
|
|
2
|
+
import type { GetEndpointInfoArgs } from './types.js';
|
|
2
3
|
declare const _default: {
|
|
3
|
-
'get-endpoint-info': McpToolHandler<
|
|
4
|
-
name: string;
|
|
5
|
-
path: string;
|
|
6
|
-
method: string;
|
|
7
|
-
version?: string;
|
|
8
|
-
}>;
|
|
4
|
+
'get-endpoint-info': McpToolHandler<GetEndpointInfoArgs>;
|
|
9
5
|
};
|
|
10
6
|
export default _default;
|
|
11
7
|
//# sourceMappingURL=get-endpoint-info.d.ts.map
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import type { McpToolHandler } from '../../../types.js';
|
|
2
|
+
import type { ApiNameVersionArgs } from './types.js';
|
|
2
3
|
declare const _default: {
|
|
3
|
-
'get-endpoints': McpToolHandler<
|
|
4
|
-
name: string;
|
|
5
|
-
version?: string;
|
|
6
|
-
}>;
|
|
4
|
+
'get-endpoints': McpToolHandler<ApiNameVersionArgs>;
|
|
7
5
|
};
|
|
8
6
|
export default _default;
|
|
9
7
|
//# sourceMappingURL=get-endpoints.d.ts.map
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import type { McpToolHandler } from '../../../types.js';
|
|
2
|
+
import type { ApiNameVersionArgs } from './types.js';
|
|
2
3
|
declare const _default: {
|
|
3
|
-
'get-full-api-description': McpToolHandler<
|
|
4
|
-
name: string;
|
|
5
|
-
version?: string;
|
|
6
|
-
}>;
|
|
4
|
+
'get-full-api-description': McpToolHandler<ApiNameVersionArgs>;
|
|
7
5
|
};
|
|
8
6
|
export default _default;
|
|
9
7
|
//# sourceMappingURL=get-full-api-description.d.ts.map
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import type { McpToolHandler } from '../../../types.js';
|
|
2
|
+
import type { ApiNameVersionArgs } from './types.js';
|
|
2
3
|
declare const _default: {
|
|
3
|
-
'get-security-schemes': McpToolHandler<
|
|
4
|
-
name: string;
|
|
5
|
-
version?: string;
|
|
6
|
-
}>;
|
|
4
|
+
'get-security-schemes': McpToolHandler<ApiNameVersionArgs>;
|
|
7
5
|
};
|
|
8
6
|
export default _default;
|
|
9
7
|
//# sourceMappingURL=get-security-schemes.d.ts.map
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import type { McpToolHandler } from '../../../types.js';
|
|
2
|
+
import type { ListApisArgs } from './types.js';
|
|
2
3
|
declare const _default: {
|
|
3
|
-
'list-apis': McpToolHandler<
|
|
4
|
-
filter?: string;
|
|
5
|
-
page?: number;
|
|
6
|
-
limit?: number;
|
|
7
|
-
}>;
|
|
4
|
+
'list-apis': McpToolHandler<ListApisArgs>;
|
|
8
5
|
};
|
|
9
6
|
export default _default;
|
|
10
7
|
//# sourceMappingURL=list-apis.d.ts.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type ListApisArgs = {
|
|
2
|
+
filter?: string;
|
|
3
|
+
page?: number;
|
|
4
|
+
limit?: number;
|
|
5
|
+
};
|
|
6
|
+
export type ApiNameVersionArgs = {
|
|
7
|
+
name: string;
|
|
8
|
+
version?: string;
|
|
9
|
+
};
|
|
10
|
+
export type GetEndpointInfoArgs = {
|
|
11
|
+
name: string;
|
|
12
|
+
path: string;
|
|
13
|
+
method: string;
|
|
14
|
+
version?: string;
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=types.d.ts.map
|
|
File without changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{telemetry as c}from"../../../telemetry/index.js";import{McpErrorCodes as o,McpServerType as
|
|
1
|
+
import{telemetry as c}from"../../../telemetry/index.js";import{McpErrorCodes as o,McpServerType as i}from"../constants.js";import{getMcpMode as d}from"../mode.js";class n extends Error{code;data;requestId;constructor(r,t,s,a){super(t),this.name="McpError",this.code=r,this.data=s,this.requestId=a}createErrorResponse(){const r={jsonrpc:"2.0",error:{code:this.code,message:this.message,...this.data?{data:this.data}:{}},id:this.requestId??null},t=u(this.code);return new Response(JSON.stringify(r),{status:t,headers:{"Content-Type":"application/json"}})}}function u(e){switch(e){case o.InvalidRequest:case o.InvalidParams:return 400;case o.MethodNotFound:return 404;case o.ServerError:return 405;case o.InternalError:default:return 500}}function h(e){return new n(o.ServerError,"Method not allowed",void 0,e).createErrorResponse()}function p(e,r=i.Docs,t){const s=e instanceof Error?e.message:String(e),a=e instanceof Error?e.stack:void 0;return c.sendMcpErrorMessage([{id:r,object:"mcpServer",uri:`urn:redocly:realm:mcp:server:${r}`,server_type:r,message:s,stack:a||"",mode:d()}]),new n(o.InternalError,"Internal server error mcp",s,t).createErrorResponse()}function v(e="Invalid request",r){return new n(o.InvalidRequest,e,void 0,r).createErrorResponse()}function I(e="Invalid parameters",r){return new n(o.InvalidParams,e,void 0,r).createErrorResponse()}async function M(e,r,t){try{return await e()}catch(s){return c.sendMcpErrorMessage([{id:r,object:"mcpServer",uri:`urn:redocly:realm:mcp:server:${r}`,server_type:r,message:s?.message||"",stack:s?.stack||"",mode:d()}]),t&&t(),p(s,r)}}export{n as McpError,p as createInternalServerError,I as createInvalidParamsError,v as createInvalidRequestError,h as createMethodNotAllowedError,M as withErrorHandling};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{fileURLToPath as
|
|
1
|
+
import{fileURLToPath as E}from"node:url";import{dirname as O,join as a}from"node:path";import{logger as u}from"../../tools/notifiers/logger.js";import{reporter as R}from"../../tools/notifiers/reporter.js";import{isDefined as q}from"../../../utils/guards/is-defined.js";import{buildGraphqlDescriptions as w,filterIgnoredApiDescriptions as h,getCleanedUpApiDescriptions as A,isMcpInRedirects as T}from"./utils.js";import{isMcpCodeModeEnabled as _}from"./mode.js";import{getDefaultToolSchemas as j,EXECUTE_TOOL_SCHEMA as L}from"./docs-mcp/tool-schemas.js";import{telemetryTraceStep as G}from"../../../cli/telemetry/helpers/trace-step.js";const D="mcp-docs-server-handler",p=O(E(import.meta.url));async function H(){let o=!1;return{id:"mcp",async processContent(e,i){o||await G("build.plugin.mcp",async c=>{const r=await e.loadOpenApiDefinitions(i),d=await e.loadGraphqlDefinitions(i),n=await i.getConfig(),{mcp:t,redirects:v}=n;if(c?.setAttribute("config",JSON.stringify(t||{})),!(t?.hide||t?.docs?.hide)&&(T(v)&&await R.panicOnBuildContentError('The reserved route "/mcp" cannot be used in redirect configuration. Please remove any redirects involving "/mcp" from your redocly.yaml config.'),!t?.docs?.hide)){u.info("Configuring MCP servers...");const C=a(p,"./handlers/docs-mcp-handler.js"),M=A(h(r,t?.docs?.ignore||[])),l=new Map;for(const s of M){const f=s.definition.info?.title||"",g=s.definition.info?.version||"";l.set(`${f.toLowerCase()}@${g}`,{name:f,description:s.definition.info?.description||"",version:g,servers:s.definition.servers||[],relativePath:s.relativePath})}const m=w(h(d,t?.docs?.ignore||[])),P=Object.values(n.products||{}).map(s=>s?.name).filter(q),S=!!n?.access?.requiresLogin,b=n?.access?.rbac||{},y=j({products:P,requiresLogin:S,rbac:b,hasGraphqlApis:m.length>0});e.addMcpTools(a(p,"./docs-mcp/tools/index.js"),y),_()&&e.addMcpTools(a(p,"./docs-mcp/tools/execute.js"),[L]),await I({actions:e,handlerPath:C,apiDescriptionsMap:Object.fromEntries(l),graphqlDescriptions:m,mcpConfig:t}),o=!0}})},async afterRoutesCreated(e,i){const c=await i.getConfig(),{mcp:r}=c;e.setGlobalData({mcpData:{docs:{enabled:!r?.hide&&!r?.docs?.hide,name:r?.docs?.name}}})}}}var z=H;async function I({actions:o,handlerPath:e,apiDescriptionsMap:i,graphqlDescriptions:c,mcpConfig:r}){o.createRequestHandler(D,e),o.addApiRoute({slug:"/mcp",requestHandlerId:D,httpMethod:"all",getStaticData:async()=>({props:{config:{apiDescriptionsMap:i,graphqlDescriptions:c,mcpDocsServerName:r?.docs?.name||"Docs MCP Server"},serverOutDir:o.serverOutDir,tools:o.getMcpTools().map(({importPath:d,...n})=>n)}})}),u.info("Registered Docs MCP Server endpoint at /mcp")}export{D as MCP_DOCS_SERVER_HANDLER_ID,z as default,H as mcpServerPlugin};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { McpMode } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Codemode (a single `execute` tool) is gated by a feature flag, not client config, so
|
|
4
|
+
* only we control the rollout. Kept in its own module so the worker / telemetry path
|
|
5
|
+
* does not pull in the heavier `utils.js` dependencies.
|
|
6
|
+
*/
|
|
7
|
+
export declare function isMcpCodeModeEnabled(): boolean;
|
|
8
|
+
export declare function getMcpMode(): McpMode;
|
|
9
|
+
//# sourceMappingURL=mode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{envConfig as o}from"../../config/env-config.js";function e(){return o.REDOCLY_EXP_MCP_CODE_MODE_ENABLED??!1}function t(){return e()?"code":"tools"}export{t as getMcpMode,e as isMcpCodeModeEnabled};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{McpServer as
|
|
1
|
+
import{McpServer as T}from"@redocly/mcp-typescript-sdk/server/mcp.js";import{StreamableHTTPServerTransport as b}from"@redocly/mcp-typescript-sdk/server/streamableHttp.js";import{logger as m}from"../../../tools/notifiers/logger.js";import{mcpToolWorkers as u,MCP_TOOL_WORKER_KEY as _,MCP_TOOL_IS_AVAILABLE_KEY as g}from"../../../workers/mcp-tool-worker-pool.js";import{EXECUTE_TOOL_NAME as i,EXECUTE_TOOL_SCHEMA as I}from"../docs-mcp/tool-schemas.js";import{buildExecuteToolDescription as M}from"../docs-mcp/codemode/build-execute-tool-description.js";import{isMcpCodeModeEnabled as S}from"../mode.js";async function A({name:e,tools:f,context:d}){const a=new T({name:e,version:new Date().toISOString().slice(0,10)},{capabilities:{logging:{}}}),s=new b({sessionIdGenerator:void 0}),n=C(d),c=o=>async(r,t)=>{m.info(`MCP tool called: ${o}`);const E={toolName:o,args:r,context:n,extra:h(t)};return await u.exec(_,[E],{timeout:6e4})},l=async o=>{try{return await u.exec(g,[{toolName:o,context:n}],{timeout:1e4})}catch(r){return m.error(`Failed to check MCP tool availability for "${o}": ${r instanceof Error?r.message:String(r)}`),!1}},p=f.filter(o=>o.name!==i);if(S()){const o=[];for(const r of p)await l(r.name)&&o.push(r);a.tool(i,M(o),I.schema,c(i))}else for(const o of p){const r=o.annotations||{title:o.name},t=a.tool(o.name,o.description,o.schema,r,c(o.name));await l(o.name)||t.disable()}return await a.connect(s),{server:a,transport:s,cleanup:async()=>{s.close()}}}function h(e){return{sessionId:e.sessionId,authInfo:e.authInfo,requestId:e.requestId,requestInfo:e.requestInfo,_meta:e._meta}}function C(e){return{user:e.user,config:e.config,outdir:e.outdir,baseUrl:e.baseUrl,params:e.params,query:e.query,cookies:e.cookies,apiDescriptionsMap:e.apiDescriptionsMap,graphqlDescriptions:e.graphqlDescriptions,products:e.products,accessToken:e.accessToken,metadata:e.metadata}}export{A as createDocsMcpServer};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{telemetry as
|
|
1
|
+
import{telemetry as u}from"../../../telemetry/index.js";import{mcpToolHandlers as p}from"../../../../client/mcp-tool-handlers-entry.js";import{getMcpMode as m}from"../mode.js";import{reportMcpToolCalled as w,reportMcpToolError as f}from"./mcp-tool-telemetry.js";async function b(n){u.initialize();const{toolName:t,args:c,context:o,extra:l}=n,r=m();try{const e=p[t];if(!e)throw new Error(`Unknown MCP tool: ${t}`);const{default:d}=await e(),i=d[t];if(!i)throw new Error(`MCP tool module does not export a handler for "${t}". Expected \`export default { '${t}': handler }\`.`);const a=await(typeof i=="function"?i:i.execute)(c,o,l);if(!x(a))throw new Error(`MCP tool "${t}" returned an invalid result.`);if(a.isError)f(t,a.content.map(({text:s})=>s).join(" "),r);else{const s=a.content.map(({text:h})=>h).join("").length;w(t,r,s)}return a}catch(e){throw f(t,e instanceof Error?e.message:String(e),r,e instanceof Error&&e.stack||""),e}}function x(n){return!n||typeof n!="object"?!1:Array.isArray(n.content)}async function T(n){u.initialize();const{toolName:t,context:c}=n;try{const o=p[t];if(!o)return!1;const{default:l}=await o(),r=l[t];return r?typeof r=="object"&&typeof r.isAvailable=="function"?await r.isAvailable(c):!0:!1}catch(o){throw f(t,"Failed to check if MCP tool is available: "+(o instanceof Error?o.message:String(o)),m(),o instanceof Error&&o.stack||""),o}}export{b as executeMcpTool,T as isMcpToolAvailable};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { McpMode } from '../types.js';
|
|
2
|
+
export declare function reportMcpToolCalled(tool: string, mode: McpMode, outputLength: number): void;
|
|
3
|
+
export declare function reportMcpToolError(tool: string, message: string, mode: McpMode, stack?: string): void;
|
|
4
|
+
//# sourceMappingURL=mcp-tool-telemetry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{telemetry as p}from"../../../telemetry/index.js";import{McpServerType as t}from"../constants.js";const c={id:t.Docs,object:"mcpServer",uri:`urn:redocly:realm:mcp:server:${t.Docs}`,server_type:t.Docs};function m(e,r,o){p.sendMcpToolCalledMessage([{...c,tool:e,mode:r,output_length:o}])}function i(e,r,o,s=""){p.sendMcpErrorMessage([{...c,tool:e,message:r,stack:s,mode:o}])}export{m as reportMcpToolCalled,i as reportMcpToolError};
|
|
@@ -17,6 +17,7 @@ import type { Logger } from '../../tools/notifiers/logger.js';
|
|
|
17
17
|
import type { AiDocumentsStore } from '../../plugins/search/types';
|
|
18
18
|
import type { ParseMarkdocOpts } from '../../types/plugins/markdown';
|
|
19
19
|
import type { MarkdocConfigProps } from '../../plugins/markdown/compiler';
|
|
20
|
+
import type { ToolAnnotations } from '@redocly/mcp-typescript-sdk/types.js';
|
|
20
21
|
export type ResolveItemsOptions = {
|
|
21
22
|
groupCustomSidebars?: boolean;
|
|
22
23
|
locale?: string;
|
|
@@ -124,6 +125,8 @@ export type McpToolSchema = {
|
|
|
124
125
|
name: string;
|
|
125
126
|
description: string;
|
|
126
127
|
schema: Record<string, unknown>;
|
|
128
|
+
outputSchema?: Record<string, unknown>;
|
|
129
|
+
annotations?: ToolAnnotations;
|
|
127
130
|
};
|
|
128
131
|
export type McpToolRegistration = McpToolSchema & {
|
|
129
132
|
importPath: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@redocly/redoc-revel",
|
|
3
|
-
"version": "0.135.0-next.
|
|
3
|
+
"version": "0.135.0-next.5",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
"@dr.pogodin/react-helmet": "3.0.2",
|
|
19
19
|
"@emotion/is-prop-valid": "^1.3.1",
|
|
20
20
|
"@hono/zod-validator": "0.8.0",
|
|
21
|
+
"@jitl/quickjs-singlefile-mjs-release-sync": "0.32.0",
|
|
21
22
|
"@libsql/client": "0.17.3",
|
|
22
23
|
"@markdoc/markdoc": "0.5.2",
|
|
23
24
|
"@opentelemetry/api": "1.9.0",
|
|
@@ -31,12 +32,12 @@
|
|
|
31
32
|
"@opentelemetry/sdk-trace-web": "2.8.0",
|
|
32
33
|
"@opentelemetry/semantic-conventions": "1.40.0",
|
|
33
34
|
"@redocly/ajv": "8.18.0",
|
|
34
|
-
"@redocly/
|
|
35
|
+
"@redocly/mcp-typescript-sdk": "1.18.1",
|
|
36
|
+
"@redocly/openapi-core": "2.34.0",
|
|
35
37
|
"@shikijs/transformers": "3.21.0",
|
|
36
38
|
"@tanstack/react-query": "5.62.3",
|
|
37
39
|
"@tanstack/react-table": "8.21.3",
|
|
38
40
|
"@tanstack/react-virtual": "3.13.0",
|
|
39
|
-
"@redocly/mcp-typescript-sdk": "1.18.1",
|
|
40
41
|
"@wojtekmaj/react-datetimerange-picker": "6.0.0",
|
|
41
42
|
"@xmldom/xmldom": "0.9.10",
|
|
42
43
|
"ajv-formats": "^3.0.1",
|
|
@@ -54,7 +55,6 @@
|
|
|
54
55
|
"fflate": "0.7.4",
|
|
55
56
|
"flexsearch": "0.7.43",
|
|
56
57
|
"graphql": "16.12.0",
|
|
57
|
-
"gray-matter": "4.0.3",
|
|
58
58
|
"hono": "4.12.25",
|
|
59
59
|
"htmlparser2": "8.0.2",
|
|
60
60
|
"i18next": "22.4.15",
|
|
@@ -69,6 +69,7 @@
|
|
|
69
69
|
"os-browserify": "0.3.0",
|
|
70
70
|
"path-browserify": "1.0.1",
|
|
71
71
|
"picomatch": "2.3.2",
|
|
72
|
+
"quickjs-emscripten-core": "0.32.0",
|
|
72
73
|
"react": "^19.2.4",
|
|
73
74
|
"react-calendar": "5.1.0",
|
|
74
75
|
"react-date-picker": "11.0.0",
|
|
@@ -92,14 +93,14 @@
|
|
|
92
93
|
"xpath": "0.0.34",
|
|
93
94
|
"yaml-ast-parser": "0.0.43",
|
|
94
95
|
"zod": "^3.25.76",
|
|
95
|
-
"@redocly/asyncapi-docs": "1.12.0-next.
|
|
96
|
+
"@redocly/asyncapi-docs": "1.12.0-next.5",
|
|
96
97
|
"@redocly/config": "0.49.0",
|
|
97
|
-
"@redocly/graphql-docs": "1.12.0-next.
|
|
98
|
-
"@redocly/openapi-docs": "3.23.0-next.
|
|
98
|
+
"@redocly/graphql-docs": "1.12.0-next.5",
|
|
99
|
+
"@redocly/openapi-docs": "3.23.0-next.5",
|
|
99
100
|
"@redocly/portal-legacy-ui": "0.18.0-next.0",
|
|
100
|
-
"@redocly/portal-plugin-mock-server": "0.20.0-next.
|
|
101
|
-
"@redocly/realm-asyncapi-sdk": "0.13.0-next.
|
|
102
|
-
"@redocly/theme": "0.67.0-next.
|
|
101
|
+
"@redocly/portal-plugin-mock-server": "0.20.0-next.5",
|
|
102
|
+
"@redocly/realm-asyncapi-sdk": "0.13.0-next.3",
|
|
103
|
+
"@redocly/theme": "0.67.0-next.4"
|
|
103
104
|
},
|
|
104
105
|
"peerDependencies": {
|
|
105
106
|
"react": "^19.2.4",
|