@redocly/realm 0.135.0-next.0 → 0.135.0-next.2

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.
Files changed (93) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/dist/client/app/DevModeFloatingBar/index.js +1 -1
  3. package/dist/client/app/Link.d.ts +1 -1
  4. package/dist/client/app/Link.js +1 -1
  5. package/dist/client/app/Sidebar/RequestAccessButton.js +2 -2
  6. package/dist/client/app/hooks/useLoginUrl.js +1 -1
  7. package/dist/client/app/hooks/useScrollTracker.js +1 -1
  8. package/dist/client/app/markdoc/custom-components/openapi/json-schema.d.ts +1 -0
  9. package/dist/client/app/markdoc/custom-components/openapi/json-schema.js +1 -1
  10. package/dist/client/app/search/useAiSearch.js +1 -1
  11. package/dist/client/app/utils/programmatic-scroll.d.ts +22 -0
  12. package/dist/client/app/utils/programmatic-scroll.js +1 -0
  13. package/dist/compiled/svgo/svgo-node.js +3 -3
  14. package/dist/markdoc/tags/json-schema.js +1 -1
  15. package/dist/server/constants/common.d.ts +4 -1
  16. package/dist/server/constants/common.js +1 -1
  17. package/dist/server/esbuild/esbuild-logger.js +1 -1
  18. package/dist/server/plugins/graphql-docs/graphql-doc-loader.d.ts +5 -0
  19. package/dist/server/plugins/graphql-docs/graphql-doc-loader.js +1 -1
  20. package/dist/server/plugins/graphql-docs/index.js +1 -1
  21. package/dist/server/plugins/markdown/search/to-markdown.js +14 -14
  22. package/dist/server/plugins/mcp/docs-mcp/tool-schemas.d.ts +1 -0
  23. package/dist/server/plugins/mcp/docs-mcp/tool-schemas.js +1 -1
  24. package/dist/server/plugins/mcp/docs-mcp/tools/core/search.d.ts +6 -0
  25. package/dist/server/plugins/mcp/docs-mcp/tools/core/search.js +6 -0
  26. package/dist/server/plugins/mcp/docs-mcp/tools/core/utils.d.ts +3 -0
  27. package/dist/server/plugins/mcp/docs-mcp/tools/core/utils.js +11 -0
  28. package/dist/server/plugins/mcp/docs-mcp/tools/core/whoami.d.ts +6 -0
  29. package/dist/server/plugins/mcp/docs-mcp/tools/graphql/get-graphql-schema.d.ts +8 -0
  30. package/dist/server/plugins/mcp/docs-mcp/tools/graphql/get-graphql-schema.js +3 -0
  31. package/dist/server/plugins/mcp/docs-mcp/tools/graphql/get-graphql-type-list.d.ts +14 -0
  32. package/dist/server/plugins/mcp/docs-mcp/tools/graphql/get-graphql-type-list.js +1 -0
  33. package/dist/server/plugins/mcp/docs-mcp/tools/graphql/get-graphql-type.d.ts +10 -0
  34. package/dist/server/plugins/mcp/docs-mcp/tools/graphql/get-graphql-type.js +7 -0
  35. package/dist/server/plugins/mcp/docs-mcp/tools/graphql/list-graphql-apis.d.ts +10 -0
  36. package/dist/server/plugins/mcp/docs-mcp/tools/graphql/list-graphql-apis.js +1 -0
  37. package/dist/server/plugins/mcp/docs-mcp/tools/graphql/load-graphql-schema.d.ts +7 -0
  38. package/dist/server/plugins/mcp/docs-mcp/tools/graphql/load-graphql-schema.js +1 -0
  39. package/dist/server/plugins/mcp/docs-mcp/tools/graphql/tool-helpers.d.ts +14 -0
  40. package/dist/server/plugins/mcp/docs-mcp/tools/graphql/tool-helpers.js +1 -0
  41. package/dist/server/plugins/mcp/docs-mcp/tools/graphql/types.d.ts +10 -0
  42. package/dist/server/plugins/mcp/docs-mcp/tools/graphql/types.js +1 -0
  43. package/dist/server/plugins/mcp/docs-mcp/tools/graphql/utils.d.ts +16 -0
  44. package/dist/server/plugins/mcp/docs-mcp/tools/graphql/utils.js +3 -0
  45. package/dist/server/plugins/mcp/docs-mcp/tools/index.d.ts +28 -7
  46. package/dist/server/plugins/mcp/docs-mcp/tools/index.js +1 -1
  47. package/dist/server/plugins/mcp/docs-mcp/tools/{get-endpoint-info.d.ts → openapi/get-endpoint-info.d.ts} +1 -1
  48. package/dist/server/plugins/mcp/docs-mcp/tools/openapi/get-endpoint-info.js +1 -0
  49. package/dist/server/plugins/mcp/docs-mcp/tools/{get-endpoints.d.ts → openapi/get-endpoints.d.ts} +1 -1
  50. package/dist/server/plugins/mcp/docs-mcp/tools/openapi/get-endpoints.js +1 -0
  51. package/dist/server/plugins/mcp/docs-mcp/tools/{get-full-api-description.d.ts → openapi/get-full-api-description.d.ts} +1 -1
  52. package/dist/server/plugins/mcp/docs-mcp/tools/openapi/get-full-api-description.js +1 -0
  53. package/dist/server/plugins/mcp/docs-mcp/tools/{get-security-schemes.d.ts → openapi/get-security-schemes.d.ts} +1 -1
  54. package/dist/server/plugins/mcp/docs-mcp/tools/openapi/get-security-schemes.js +1 -0
  55. package/dist/server/plugins/mcp/docs-mcp/tools/{list-apis.d.ts → openapi/list-apis.d.ts} +1 -1
  56. package/dist/server/plugins/mcp/docs-mcp/tools/openapi/list-apis.js +1 -0
  57. package/dist/server/plugins/mcp/docs-mcp/tools/openapi/load-api-description.js +1 -0
  58. package/dist/server/plugins/mcp/docs-mcp/tools/{utils.d.ts → openapi/utils.d.ts} +1 -3
  59. package/dist/server/plugins/mcp/docs-mcp/tools/openapi/utils.js +1 -0
  60. package/dist/server/plugins/mcp/handlers/docs-mcp-handler.js +1 -1
  61. package/dist/server/plugins/mcp/index.js +1 -1
  62. package/dist/server/plugins/mcp/servers/docs-server.js +1 -1
  63. package/dist/server/plugins/mcp/types.d.ts +7 -0
  64. package/dist/server/plugins/mcp/utils.d.ts +7 -17
  65. package/dist/server/plugins/mcp/utils.js +1 -1
  66. package/dist/server/providers/database/utils/retry-async-operation.js +1 -1
  67. package/dist/server/store.d.ts +2 -0
  68. package/dist/server/store.js +1 -1
  69. package/dist/server/tools/notifiers/formatter.js +1 -1
  70. package/dist/server/types/plugins/common.d.ts +2 -0
  71. package/dist/server/utils/envs/load-env-variables.js +1 -1
  72. package/dist/server/web-server/middleware/catalogAuthMiddleware.js +1 -1
  73. package/dist/server/web-server/routes/api-routes/api-routes.d.ts +0 -5
  74. package/dist/server/web-server/routes/api-routes/api-routes.js +1 -1
  75. package/dist/server/web-server/routes/app-data.js +1 -1
  76. package/dist/server/web-server/routes/dynamic-route.js +1 -1
  77. package/dist/server/web-server/routes/mcp-routes/mcp-routes.js +1 -1
  78. package/dist/server/web-server/routes/page-data.js +1 -1
  79. package/dist/server/web-server/routes/search.js +1 -1
  80. package/dist/server/web-server/utils.js +1 -1
  81. package/package.json +9 -9
  82. package/dist/server/plugins/mcp/docs-mcp/tools/get-endpoint-info.js +0 -1
  83. package/dist/server/plugins/mcp/docs-mcp/tools/get-endpoints.js +0 -1
  84. package/dist/server/plugins/mcp/docs-mcp/tools/get-full-api-description.js +0 -1
  85. package/dist/server/plugins/mcp/docs-mcp/tools/get-security-schemes.js +0 -1
  86. package/dist/server/plugins/mcp/docs-mcp/tools/helpers/load-api-description.js +0 -1
  87. package/dist/server/plugins/mcp/docs-mcp/tools/list-apis.js +0 -1
  88. package/dist/server/plugins/mcp/docs-mcp/tools/search.d.ts +0 -6
  89. package/dist/server/plugins/mcp/docs-mcp/tools/search.js +0 -6
  90. package/dist/server/plugins/mcp/docs-mcp/tools/utils.js +0 -11
  91. package/dist/server/plugins/mcp/docs-mcp/tools/whoami.d.ts +0 -6
  92. /package/dist/server/plugins/mcp/docs-mcp/tools/{whoami.js → core/whoami.js} +0 -0
  93. /package/dist/server/plugins/mcp/docs-mcp/tools/{helpers → openapi}/load-api-description.d.ts +0 -0
@@ -1,29 +1,29 @@
1
- import{isPrimitive as v}from"../../../../utils/guards/is-primitive.js";import{getNodeAttribute as c}from"../../../../markdoc/helpers/get-node-attribute.js";import{getVariable as T}from"../../../../markdoc/helpers/get-variable.js";import{isTag as C}from"../../../../markdoc/helpers/guards/is-tag.js";import{isNode as N}from"../../../../markdoc/helpers/guards/is-node.js";import{isConditionalNode as y}from"../../../../markdoc/helpers/guards/is-conditional-node.js";import{isVariable as A}from"../../../../markdoc/helpers/guards/is-variable.js";import{isExampleNode as B}from"../../../../markdoc/helpers/guards/is-example-node.js";import{isFenceNode as E}from"../../../../markdoc/helpers/guards/is-fence-node.js";function a(s,n={}){const r=[];for(const e of s){if(v(e)){const i=n.isTrim?u(String(e)):String(e);i&&r.push(i)}else if(N(e))switch(e.type){case"text":r.push(a([c(e,"content")],n));break;case"code":r.push(`\`${a([c(e,"content")],n)}\``);break;case"blockquote":r.push(`> ${a(e.children,n)}
2
- `);break;case"fence":const i=c(e,"process")===!1;r.push(f(e,n,i));break;case"list":const l=c(e,"ordered")||!1,o=c(e,"marker"),d=e.children.map((t,h)=>`${" ".repeat((n?.indent??0)*2)}${l?h+1:""}${o} ${a([t],{...n??{},indent:(n?.indent??0)+1})}`);r.push(`${d.join("")}
1
+ import{isPrimitive as S}from"../../../../utils/guards/is-primitive.js";import{getNodeAttribute as c}from"../../../../markdoc/helpers/get-node-attribute.js";import{getVariable as v}from"../../../../markdoc/helpers/get-variable.js";import{isTag as A}from"../../../../markdoc/helpers/guards/is-tag.js";import{isNode as C}from"../../../../markdoc/helpers/guards/is-node.js";import{isConditionalNode as N}from"../../../../markdoc/helpers/guards/is-conditional-node.js";import{isVariable as y}from"../../../../markdoc/helpers/guards/is-variable.js";import{isExampleNode as B}from"../../../../markdoc/helpers/guards/is-example-node.js";import{isFenceNode as E}from"../../../../markdoc/helpers/guards/is-fence-node.js";function a(s,n={}){const r=[];for(const e of s){if(S(e)){const i=n.isTrim?m(String(e)):String(e);i&&r.push(i)}else if(C(e))switch(e.type){case"text":r.push(a([c(e,"content")],n));break;case"code":r.push(`\`${a([c(e,"content")],n)}\``);break;case"blockquote":r.push(`> ${a(e.children,n)}
2
+ `);break;case"fence":const i=c(e,"process")===!1;r.push(g(e,n,i));break;case"list":const h=c(e,"ordered")||!1,l=c(e,"marker"),d=e.children.map((t,o)=>`${" ".repeat((n?.indent??0)*2)}${h?o+1:""}${l} ${a([t],{...n??{},indent:(n?.indent??0)+1})}`);r.push(`${d.join("")}
3
3
  `);break;case"item":r.push(e.children.map(t=>`${a([t],n).trimEnd()}
4
- `).join(""));break;case"thead":const p=e.children.map(t=>a([t],n));r.push(`${p}| ${" --- |".repeat(e.children?.[0]?.children.length)}
5
- `);break;case"tr":const $=e.children.map(t=>a([t],n));r.push(`| ${$.join(" | ")} |
4
+ `).join(""));break;case"thead":const u=e.children.map(t=>a([t],n));r.push(`${u}| ${" --- |".repeat(e.children?.[0]?.children.length)}
5
+ `);break;case"tr":const f=e.children.map(t=>a([t],n));r.push(`| ${f.join(" | ")} |
6
6
  `);break;case"em":r.push(`*${a(e.children,n)}*`);break;case"strong":r.push(`**${a(e.children,n)}**`);break;case"softbreak":case"hardbreak":r.push(`
7
7
  `);break;case"hr":r.push(`
8
8
 
9
9
  ---
10
10
 
11
- `);break;case"heading":const g=c(e,"level")??0;r.push(`${"#".repeat(g)} ${a(e.children,n)}
12
- `);break;case"image":const k=c(e,"alt")||"",b=c(e,"src")||"";r.push(`![${k}](${b})`);break;case"link":const j=c(e,"href")||"";r.push(`[${a(e.children,n)}](${j})`);break;case"paragraph":case"table":r.push(`${a(e.children,n)}
13
- `);break;case"tag":if(y(e)&&n.skipConditionals)continue;if(B(e)){r.push(...e.children.map(t=>{if(E(t)){const h=c(t,"process")!==!0;return f(t,n,h)}return a([t],n)}));continue}if(e.tag==="code-snippet"){const t=c(e,"rawContent");if(t){const h=c(e,"language"),m=c(e,"title"),S=`
14
- \`\`\`${`${h||""}${m?`${h?" ":""}${m}`:""}`}
11
+ `);break;case"heading":const p=c(e,"level")??0;r.push(`${"#".repeat(p)} ${a(e.children,n)}
12
+ `);break;case"image":const k=c(e,"alt")||"",b=c(e,"src")||"";r.push(`![${k}](${b})`);break;case"link":const T=c(e,"href")||"";r.push(`[${a(e.children,n)}](${T})`);break;case"paragraph":case"table":r.push(`${a(e.children,n)}
13
+ `);break;case"tag":if(N(e)&&n.skipConditionals)continue;if(B(e)){r.push(...e.children.map(t=>{if(E(t)){const o=c(t,"process")!==!0;return g(t,n,o)}return a([t],n)}));continue}if(e.tag==="code-snippet"){const t=c(e,"rawContent");if(t){const o=c(e,"language"),$=c(e,"title"),j=`
14
+ \`\`\`${`${o||""}${$?`${o?" ":""}${$}`:""}`}
15
15
  ${t.trimEnd()}
16
16
  \`\`\`
17
- `;r.push(S)}continue}if(e.tag==="json-example"){const t=w(e);t&&r.push(t);continue}if(e.tag==="json-schema"){const t=x(e);t&&r.push(t);continue}if(n.renderTag){const t=n.renderTag(e,{getBody:()=>a(e.children,n)});if(t!==void 0){r.push(t);continue}}r.push(`${a(e.children,n)}`);break;default:r.push(a(e.children,n));break}else C(e)&&r.push(a(e.children,n));A(e)&&r.push(a([T(e,n.variables)],n))}return n.isTrim?u(r.map(e=>u(e)).join("")):r.join("")}function u(s){return s.replace(/^[ \t\r\f]+|[ \t\r\f]+$/g,"")}function f(s,n={},r=!1){const e=c(s,"title"),i=c(s,"language"),l=`${i||""}${e?`${i?" ":""}${e}`:""}`,o=r?(c(s,"content")||"").trimEnd():a(s.children,n).trimEnd();return`
18
- \`\`\`${l}
19
- ${o}
17
+ `;r.push(j)}continue}if(e.tag==="json-example"){const t=w(e);t&&r.push(t);continue}if(e.tag==="json-schema"){const t=x(e);t&&r.push(t);continue}if(n.renderTag){const t=n.renderTag(e,{getBody:()=>a(e.children,n)});if(t!==void 0){r.push(t);continue}}r.push(`${a(e.children,n)}`);break;default:r.push(a(e.children,n));break}else A(e)&&r.push(a(e.children,n));y(e)&&r.push(a([v(e,n.variables)],n))}return n.isTrim?m(r.map(e=>m(e)).join("")):r.join("")}function m(s){return s.replace(/^[ \t\r\f]+|[ \t\r\f]+$/g,"")}function g(s,n={},r=!1){const e=c(s,"title"),i=c(s,"language"),h=`${i||""}${e?`${i?" ":""}${e}`:""}`,l=r?(c(s,"content")||"").trimEnd():a(s.children,n).trimEnd();return`
18
+ \`\`\`${h}
19
+ ${l}
20
20
  \`\`\`
21
21
  `}function w(s){const n=c(s,"json")??c(s,"valueResolved")??c(s,"schemaResolved"),r=c(s,"title");return n===null?null:`
22
22
  \`\`\`${`json${r?` ${r}`:""}`}
23
23
  ${JSON.stringify(n,null,2)}
24
24
  \`\`\`
25
- `}function x(s){const n=c(s,"schemaResolved");if(n===null)return null;const{components:r,openapi:e,...i}=n,{__root:l,...o}=r?.schemas||{},d=l?{...l,...Object.keys(o).length>0?{components:{schemas:o}}:{},...i}:n;return`
26
- \`\`\`json
27
- ${JSON.stringify(d,null,2)}
25
+ `}function x(s){const n=c(s,"schemaResolved");if(n===null)return null;const r=c(s,"title"),{components:e,openapi:i,...h}=n,{__root:l,...d}=e?.schemas||{},u=l?{...l,...Object.keys(d).length>0?{components:{schemas:d}}:{},...h}:n;return`
26
+ \`\`\`${`json${r?` ${r}`:""}`}
27
+ ${JSON.stringify(u,null,2)}
28
28
  \`\`\`
29
29
  `}export{a as toMarkdown};
@@ -3,5 +3,6 @@ export declare function getDefaultToolSchemas(config: {
3
3
  products?: string[];
4
4
  requiresLogin: boolean;
5
5
  rbac?: Record<string, unknown>;
6
+ hasGraphqlApis?: boolean;
6
7
  }): McpToolSchema[];
7
8
  //# sourceMappingURL=tool-schemas.d.ts.map
@@ -1 +1 @@
1
- import{shouldHandleMcpAuth as n}from"../auth/auth-handlers.js";const i=["GET","POST","PUT","DELETE","PATCH","OPTIONS","HEAD","TRACE"];function o(e){const t=[{name:"list-apis",description:"Lists available APIs with their context and purpose",schema:{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}}}},{name:"get-endpoints",description:"Get all endpoints for a specific API",schema:{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}}}},{name:"get-endpoint-info",description:"Get comprehensive information about specific endpoint including parameters, security, and examples",schema:{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:[...i,...i.map(r=>r.toLowerCase())],minLength:1},version:{type:"string",description:"API version (required when multiple APIs share the same name but differ by version)",nullable:!0}}}},{name:"get-security-schemes",description:"Get the security schemes for a specific API",schema:{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}}}},{name:"get-full-api-description",description:"Get the complete OpenAPI description",schema:{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}}}},s(e.products)];return n(e.requiresLogin,e.rbac)&&t.push({name:"whoami",description:"Get information about the currently authenticated user",schema:{type:"object",required:[],additionalProperties:!1,properties:{}}}),t}function s(e){const t=e&&e.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},...t?{product:{type:"string",description:"Optional product name to filter search results by specific product.",enum:e,nullable:!0}}:{}}}}}export{o as getDefaultToolSchemas};
1
+ import{shouldHandleMcpAuth as n}from"../auth/auth-handlers.js";import{GRAPHQL_TYPE_KINDS as a}from"./tools/graphql/types.js";const i=["GET","POST","PUT","DELETE","PATCH","OPTIONS","HEAD","TRACE"];function c(e){const t=[{name:"list-apis",description:"Lists available APIs with their context and purpose",schema:{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}}}},{name:"get-endpoints",description:"Get all endpoints for a specific API",schema:{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}}}},{name:"get-endpoint-info",description:"Get comprehensive information about specific endpoint including parameters, security, and examples",schema:{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:[...i,...i.map(r=>r.toLowerCase())],minLength:1},version:{type:"string",description:"API version (required when multiple APIs share the same name but differ by version)",nullable:!0}}}},{name:"get-security-schemes",description:"Get the security schemes for a specific API",schema:{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}}}},{name:"get-full-api-description",description:"Get the complete OpenAPI description",schema:{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}}}},o(e.products)];return n(e.requiresLogin,e.rbac)&&t.push({name:"whoami",description:"Get information about the currently authenticated user",schema:{type:"object",required:[],additionalProperties:!1,properties:{}}}),e.hasGraphqlApis&&t.push(...s()),t}function s(){const e={name:{type:"string",description:"GraphQL schema name",minLength:1}},t={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}};return[{name:"list-graphql-apis",description:"Lists available GraphQL schemas with their context and purpose",schema:{type:"object",required:[],additionalProperties:!1,properties:{filter:{type:"string",description:"GraphQL schema name (or part of it)",minLength:1,nullable:!0},...t}}},{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:{type:"object",required:["name"],additionalProperties:!1,properties:{...e,kind:{type:"string",description:"Optional: return only a single category of schema members",enum:[...a],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},...t}}},{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:{type:"object",required:["name","type"],additionalProperties:!1,properties:{...e,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}}}},{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:{type:"object",required:["name"],additionalProperties:!1,properties:e}}]}function o(e){const t=e&&e.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},...t?{product:{type:"string",description:"Optional product name to filter search results by specific product.",enum:e,nullable:!0}}:{}}}}}export{c as getDefaultToolSchemas};
@@ -0,0 +1,6 @@
1
+ import type { McpToolHandler } from '../../../types.js';
2
+ declare const _default: {
3
+ search: McpToolHandler;
4
+ };
5
+ export default _default;
6
+ //# sourceMappingURL=search.d.ts.map
@@ -0,0 +1,6 @@
1
+ import{withPathPrefix as p}from"@redocly/theme/core/utils";import{ServerRoutes as h}from"../../../../../../constants/common.js";const f=async(a,t)=>{const{query:c,product:u}=a,l=JSON.stringify({query:c,product:u});let e=`${t.baseUrl}${p(h.SEMANTIC_SEARCH)}`;e.startsWith("http://")&&(e=e.replace(/^http:\/\//,"https://"));const o=t.accessToken?`authorization=${String(t.accessToken).replace(/^Bearer /,"")}`:"";try{const s=await fetch(e,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json",...o?{Cookie:o}:{}},body:l});if(!s.ok)return{content:[{type:"text",text:"Error retrieving search results."}],isError:!0};const r=await s.json();if(!r||r.length===0)return{content:[{type:"text",text:"No results found."}]};const i=r.map(n=>`### [${n.title}](${new URL(n.url,t.baseUrl).toString()})
2
+
3
+ ${n.content}
4
+ `).join(`
5
+
6
+ `).trim();return{content:[{type:"text",text:i.length?i:"No results found."}]}}catch{return{content:[{type:"text",text:"Error retrieving search results."}],isError:!0}}};var m={search:f};export{m as default};
@@ -0,0 +1,3 @@
1
+ import type { SearchItemData } from '@redocly/theme/core/types';
2
+ export declare function processDocuments(documents: Record<string, SearchItemData[]>, outdir: string): string;
3
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1,11 @@
1
+ import c from"node:fs";import f from"node:path";import{MAX_DOCUMENTS_PER_CATEGORY as $}from"../../../constants.js";function j(m,u){return Object.entries(m).map(([h,s])=>{if(!s||s.length===0)return"";const x=s.slice(0,$).map(d=>{const{document:t,highlight:o}=d,p=o?.title||(Array.isArray(t.title)?t.title[0]:t.title);let n=`Document: ${t.title}`;n+=`### [${p}](${t.url})
2
+
3
+ `;let r;if(t.url)try{let e=t.url.startsWith("/")?t.url.slice(1):t.url;const i=e.indexOf("#");i!==-1&&(e=e.substring(0,i));const l=f.extname(e);l&&(e=e.slice(0,-l.length));let y=e+".md";const a=f.join(u,y);c.existsSync(a)&&(r=c.readFileSync(a,"utf8"))}catch{}return r||(r=o?.text||(Array.isArray(t.text)?t.text[0]:t.text)),n+=r,t.facets&&(n+=`
4
+
5
+ **Categories:**
6
+ `,Object.entries(t.facets).forEach(([e,i])=>{n+=`- ${e}: ${i}
7
+ `})),n});return`## ${h}
8
+
9
+ ${x}`}).join(`
10
+
11
+ `).trim()}export{j as processDocuments};
@@ -0,0 +1,6 @@
1
+ import type { McpToolHandler } from '../../../types.js';
2
+ declare const _default: {
3
+ whoami: McpToolHandler;
4
+ };
5
+ export default _default;
6
+ //# sourceMappingURL=whoami.d.ts.map
@@ -0,0 +1,8 @@
1
+ import type { McpToolHandler } from '../../../types.js';
2
+ declare const _default: {
3
+ 'get-graphql-schema': McpToolHandler<{
4
+ name: string;
5
+ }>;
6
+ };
7
+ export default _default;
8
+ //# sourceMappingURL=get-graphql-schema.d.ts.map
@@ -0,0 +1,3 @@
1
+ import{printSchema as h}from"graphql";import{respondWithGraphqlSchema as t}from"./tool-helpers.js";const p=(e,a)=>t(e.name,a,({name:m,schema:r})=>`# Schema: ${m}
2
+
3
+ ${h(r)}`);var n={"get-graphql-schema":p};export{n as default};
@@ -0,0 +1,14 @@
1
+ import type { McpToolHandler } from '../../../types.js';
2
+ import type { GraphqlTypeKind } from './types.js';
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
+ }>;
12
+ };
13
+ export default _default;
14
+ //# sourceMappingURL=get-graphql-type-list.d.ts.map
@@ -0,0 +1 @@
1
+ import{GRAPHQL_TYPE_KINDS as g}from"./types.js";import{respondWithGraphqlSchema as d,paginate as u}from"./tool-helpers.js";import{groupSchemaTypes as y,filterMembersReferencingType as h}from"./utils.js";const T=(i,a)=>d(i.name,a,({name:f,schema:o})=>{const{kind:p,filter:n,referencesType:l,page:s=1,limit:m=300}=i,c=y(o);let e=(p?[p]:g).flatMap(t=>c[t].map(r=>({kind:t,...r})));if(l&&(e=h(o,e,l)),n){const t=n.toLowerCase();e=e.filter(r=>r.name.toLowerCase().includes(t))}return JSON.stringify({name:f,...u(e,s,m)},null,2)});var G={"get-graphql-type-list":T};export{G as default};
@@ -0,0 +1,10 @@
1
+ import type { McpToolHandler } from '../../../types.js';
2
+ declare const _default: {
3
+ 'get-graphql-type': McpToolHandler<{
4
+ name: string;
5
+ type: string;
6
+ includeReferencedTypes?: boolean;
7
+ }>;
8
+ };
9
+ export default _default;
10
+ //# sourceMappingURL=get-graphql-type.d.ts.map
@@ -0,0 +1,7 @@
1
+ import{respondWithGraphqlSchema as d}from"./tool-helpers.js";import{printTypeOrField as y,printTypeOrFieldWithReferences as f}from"./utils.js";const l=(n,p)=>d(n.name,p,({name:r,schema:t})=>{const{type:e,includeReferencedTypes:i}=n;if(i){const{sdl:o,referencedCount:c}=f(t,e);return`# Schema: ${r}
2
+ # Type: ${e} (+ ${c} referenced types)
3
+
4
+ ${o}`}return`# Schema: ${r}
5
+ # Type: ${e}
6
+
7
+ ${y(t,e)}`});var m={"get-graphql-type":l};export{m as default};
@@ -0,0 +1,10 @@
1
+ import type { McpToolHandler } from '../../../types.js';
2
+ declare const _default: {
3
+ 'list-graphql-apis': McpToolHandler<{
4
+ filter?: string;
5
+ page?: number;
6
+ limit?: number;
7
+ }>;
8
+ };
9
+ export default _default;
10
+ //# sourceMappingURL=list-graphql-apis.d.ts.map
@@ -0,0 +1 @@
1
+ import{paginate as p,textResult as r}from"./tool-helpers.js";const c=async(l,n)=>{const{filter:a,page:o=1,limit:m=300}=l;let e=n.graphqlDescriptions;if(a){const s=a.toLowerCase();e=e.filter(i=>i.name.toLowerCase().includes(s))}const t=p(e,o,m);return t.items.length===0?r("No GraphQL schemas available"):r(JSON.stringify({...t,items:t.items.map(({name:s,description:i})=>({name:s,description:i}))}))};var f={"list-graphql-apis":c};export{f as default};
@@ -0,0 +1,7 @@
1
+ import type { GraphQLSchema } from 'graphql';
2
+ import type { McpToolContext } from '../../../types.js';
3
+ export declare function loadGraphqlSchema(name: string, context: McpToolContext): Promise<{
4
+ name: string;
5
+ schema: GraphQLSchema;
6
+ }>;
7
+ //# sourceMappingURL=load-graphql-schema.d.ts.map
@@ -0,0 +1 @@
1
+ import t from"node:path";import{existsSync as m}from"node:fs";import{readFile as h}from"node:fs/promises";import{buildSchema as e}from"graphql";import{PUBLIC_API_DEFINITIONS_FOLDER as n}from"../../../../../constants/common.js";import{findGraphqlSchemaByName as f}from"./utils.js";async function w(r,a){const o=f(a.graphqlDescriptions,r);if(!o)throw new Error(`No GraphQL schema found matching "${r}".`);const i=t.join(a.outdir||"",n,o.relativePath);if(!m(i))throw new Error(`No GraphQL schema found matching "${r}".`);return{name:o.name,schema:e(await h(i,"utf-8"))}}export{w as loadGraphqlSchema};
@@ -0,0 +1,14 @@
1
+ import type { McpToolContext, McpToolWorkerResponse } from '../../../types.js';
2
+ import { loadGraphqlSchema } from './load-graphql-schema.js';
3
+ type LoadedGraphqlSchema = Awaited<ReturnType<typeof loadGraphqlSchema>>;
4
+ export declare function textResult(text: string, isError?: boolean): McpToolWorkerResponse;
5
+ export declare function respondWithGraphqlSchema(name: string, context: McpToolContext, render: (loaded: LoadedGraphqlSchema) => string): Promise<McpToolWorkerResponse>;
6
+ export declare function paginate<T>(items: T[], page: number, limit: number): {
7
+ items: T[];
8
+ limit: number;
9
+ total: number;
10
+ page: number;
11
+ totalPages: number;
12
+ };
13
+ export {};
14
+ //# sourceMappingURL=tool-helpers.d.ts.map
@@ -0,0 +1 @@
1
+ import{loadGraphqlSchema as c}from"./load-graphql-schema.js";function o(t,e=!1){return{content:[{type:"text",text:t}],isError:e?!0:void 0}}async function u(t,e,r){try{return o(r(await c(t,e)))}catch(n){return o(n.message,!0)}}function h(t,e,r){const n=t.length,a=(e-1)*r;return{items:t.slice(a,a+r),limit:r,total:n,page:e,totalPages:Math.ceil(n/r)}}export{h as paginate,u as respondWithGraphqlSchema,o as textResult};
@@ -0,0 +1,10 @@
1
+ export declare const GRAPHQL_TYPE_KINDS: readonly ['queries', 'mutations', 'subscriptions', 'objects', 'interfaces', 'unions', 'enums', 'inputs', 'scalars', 'directives'];
2
+ export type GraphqlTypeKind = (typeof GRAPHQL_TYPE_KINDS)[number];
3
+ export type SchemaMember = {
4
+ name: string;
5
+ description?: string;
6
+ type?: string;
7
+ args?: string;
8
+ };
9
+ export type GroupedSchemaTypes = Record<GraphqlTypeKind, SchemaMember[]>;
10
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ const s=["queries","mutations","subscriptions","objects","interfaces","unions","enums","inputs","scalars","directives"];export{s as GRAPHQL_TYPE_KINDS};
@@ -0,0 +1,16 @@
1
+ import type { GraphQLSchema } from 'graphql';
2
+ import type { GraphqlDescriptionInfo } from '../../../types.js';
3
+ import type { GraphqlTypeKind, GroupedSchemaTypes } from './types.js';
4
+ export declare function findGraphqlSchemaByName(graphqlDescriptions: GraphqlDescriptionInfo[], name: string): GraphqlDescriptionInfo | undefined;
5
+ export declare function groupSchemaTypes(schema: GraphQLSchema): GroupedSchemaTypes;
6
+ export declare function filterMembersReferencingType<T extends {
7
+ kind: GraphqlTypeKind;
8
+ name: string;
9
+ }>(schema: GraphQLSchema, members: T[], targetName: string): T[];
10
+ export declare function referencedTypeClosure(schema: GraphQLSchema, name: string): string[];
11
+ export declare function printTypeOrField(schema: GraphQLSchema, name: string): string;
12
+ export declare function printTypeOrFieldWithReferences(schema: GraphQLSchema, name: string): {
13
+ sdl: string;
14
+ referencedCount: number;
15
+ };
16
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1,3 @@
1
+ import{getNamedType as p,isEnumType as v,isInputObjectType as y,isInterfaceType as g,isIntrospectionType as u,isObjectType as T,isScalarType as m,isSpecifiedScalarType as S,isUnionType as b,print as c,printType as N,specifiedDirectives as O}from"graphql";const j=new Set(["queries","mutations","subscriptions"]);function C(e,r){const t=r.toLowerCase();return e.find(i=>i.name.toLowerCase().includes(t))}function a(e,r){return e.getQueryType()?.getFields()[r]??e.getMutationType()?.getFields()[r]??e.getSubscriptionType()?.getFields()[r]}function w(e){return[p(e.type).name,...e.args.map(r=>p(r.type).name)]}function d(e){const r=new Set;if(T(e)||g(e)){for(const t of Object.values(e.getFields())){r.add(p(t.type).name);for(const i of t.args)r.add(p(i.type).name)}for(const t of e.getInterfaces())r.add(t.name)}else if(b(e))for(const t of e.getTypes())r.add(t.name);else if(y(e))for(const t of Object.values(e.getFields()))r.add(p(t.type).name);return r}function $(e){const r=new Set([e.getQueryType(),e.getMutationType(),e.getSubscriptionType()].filter(n=>!!n).map(n=>n.name)),t={queries:l(e.getQueryType()),mutations:l(e.getMutationType()),subscriptions:l(e.getSubscriptionType()),objects:[],interfaces:[],unions:[],enums:[],inputs:[],scalars:[],directives:[]};for(const n of Object.values(e.getTypeMap())){if(u(n)||r.has(n.name))continue;const o={name:n.name,description:n.description??void 0};m(n)?S(n)||t.scalars.push(o):T(n)?t.objects.push(o):g(n)?t.interfaces.push(o):b(n)?t.unions.push(o):v(n)?t.enums.push(o):y(n)&&t.inputs.push(o)}const i=new Set(O.map(n=>n.name));return t.directives=e.getDirectives().filter(n=>!i.has(n.name)).map(n=>({name:n.name,description:n.description??void 0})),t}function l(e){return e?Object.values(e.getFields()).map(r=>({name:r.name,description:r.description??void 0,type:r.type.toString(),args:r.args.length?`(${r.args.map(t=>{const i=t.astNode?.defaultValue?` = ${c(t.astNode.defaultValue)}`:"";return`${t.name}: ${t.type}${i}`}).join(", ")})`:void 0})):[]}function q(e,r,t){const i=h(e,t);if(!i)return[];const n=new Set([i,...x(e,i)]);return r.filter(o=>{if(!j.has(o.kind))return n.has(o.name);const s=a(e,o.name);return s?w(s).some(f=>n.has(f)):!1})}function F(e,r){const t=new Set,i=[...M(e,r)];for(let n=0;n<i.length;n+=1){const o=i[n];if(t.has(o))continue;t.add(o);const s=e.getType(o);if(s)for(const f of d(s))t.has(f)||i.push(f)}return[...t].filter(n=>n!==r&&D(e,n))}function M(e,r){const t=e.getType(r);if(t)return d(t);const i=a(e,r);if(i)return new Set(w(i));const n=e.getDirective(r);return n?new Set(n.args.map(o=>p(o.type).name)):new Set}function x(e,r){const t=new Map;for(const o of Object.values(e.getTypeMap()))if(!u(o))for(const s of d(o)){let f=t.get(s);f||(f=new Set,t.set(s,f)),f.add(o.name)}const i=new Set,n=[r];for(let o=0;o<n.length;o+=1)for(const s of t.get(n[o])??[])i.has(s)||(i.add(s),n.push(s));return i}function h(e,r){const t=r.toLowerCase();return Object.keys(e.getTypeMap()).find(i=>i.toLowerCase()===t)}function D(e,r){const t=e.getType(r);return!t||u(t)?!1:!(m(t)&&S(t))}function I(e,r){const t=e.getType(r);if(t)return N(t);const i=a(e,r);if(i?.astNode)return c(i.astNode);const n=e.getDirective(r);if(n?.astNode)return c(n.astNode);throw new Error(`No GraphQL type, operation, or directive named "${r}" found.`)}function L(e,r){const t=I(e,r),i=F(e,r).map(n=>e.getType(n)).filter(n=>!!n).map(n=>N(n));return{sdl:[t,...i].join(`
2
+
3
+ `),referencedCount:i.length}}export{q as filterMembersReferencingType,C as findGraphqlSchemaByName,$ as groupSchemaTypes,I as printTypeOrField,L as printTypeOrFieldWithReferences,F as referencedTypeClosure};
@@ -1,11 +1,20 @@
1
1
  declare const _default: {
2
+ 'list-apis': import("../../types.js").McpToolHandler<{
3
+ filter?: string;
4
+ page?: number;
5
+ limit?: number;
6
+ }>;
7
+ 'get-endpoints': import("../../types.js").McpToolHandler<{
8
+ name: string;
9
+ version?: string;
10
+ }>;
2
11
  'get-endpoint-info': import("../../types.js").McpToolHandler<{
3
12
  name: string;
4
13
  path: string;
5
14
  method: string;
6
15
  version?: string;
7
16
  }>;
8
- 'get-endpoints': import("../../types.js").McpToolHandler<{
17
+ 'get-security-schemes': import("../../types.js").McpToolHandler<{
9
18
  name: string;
10
19
  version?: string;
11
20
  }>;
@@ -13,17 +22,29 @@ declare const _default: {
13
22
  name: string;
14
23
  version?: string;
15
24
  }>;
16
- 'get-security-schemes': import("../../types.js").McpToolHandler<{
17
- name: string;
18
- version?: string;
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;
19
31
  }>;
20
- 'list-apis': import("../../types.js").McpToolHandler<{
32
+ 'get-graphql-type-list': import("../../types.js").McpToolHandler<{
33
+ name: string;
34
+ kind?: import("./graphql/types.js").GraphqlTypeKind;
21
35
  filter?: string;
36
+ referencesType?: string;
22
37
  page?: number;
23
38
  limit?: number;
24
39
  }>;
25
- search: import("../../types.js").McpToolHandler;
26
- whoami: import("../../types.js").McpToolHandler;
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
+ }>;
27
48
  };
28
49
  export default _default;
29
50
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- import o from"./list-apis.js";import r from"./get-endpoints.js";import t from"./get-endpoint-info.js";import i from"./get-security-schemes.js";import m from"./get-full-api-description.js";import p from"./search.js";import e from"./whoami.js";var d={...o,...r,...t,...i,...m,...p,...e};export{d as default};
1
+ import r from"./openapi/list-apis.js";import o from"./openapi/get-endpoints.js";import t from"./openapi/get-endpoint-info.js";import m from"./openapi/get-security-schemes.js";import p from"./openapi/get-full-api-description.js";import i from"./core/search.js";import e from"./core/whoami.js";import f from"./graphql/list-graphql-apis.js";import l from"./graphql/get-graphql-type-list.js";import s from"./graphql/get-graphql-type.js";import a from"./graphql/get-graphql-schema.js";var E={...r,...o,...t,...m,...p,...i,...e,...f,...l,...s,...a};export{E as default};
@@ -1,4 +1,4 @@
1
- import type { McpToolHandler } from '../../types.js';
1
+ import type { McpToolHandler } from '../../../types.js';
2
2
  declare const _default: {
3
3
  'get-endpoint-info': McpToolHandler<{
4
4
  name: string;
@@ -0,0 +1 @@
1
+ import{resolveParameters as h,resolveRequestBody as v,resolveResponses as x}from"../../utils.js";import{isMcpEndpoint as E}from"./utils.js";import{loadApiDescription as g}from"./load-api-description.js";import{checkEndpointAndDeleteXMcp as P}from"../../../utils/xmcp-utils.js";const S=async(s,i)=>{const{name:p,path:o,method:n,version:a}=s;let t;try{t=await g(p,i,a)}catch(y){return{content:[{type:"text",text:y.message}],isError:!0}}const c=o.startsWith("/")?o:`/${o}`,{title:d=""}=t.info||{},r=t.paths?.[c],m=n.toLowerCase();if(!r)return{content:[{type:"text",text:"Endpoint not found"}],isError:!0};const e=r[m];if(!E(e)||!P(e,"docs"))return{content:[{type:"text",text:"Endpoint not found"}],isError:!0};const u=r?.parameters||[],l=e.parameters||[],f={...e,parameters:h({pathParams:u,opParams:l,definition:t}),requestBody:v(e.requestBody,t),responses:x(e.responses,t)};return{content:[{type:"text",text:JSON.stringify({api:d,version:t.info?.version||"",servers:t.servers||[],endpoint:{path:o,method:n.toUpperCase(),...f},globalSecurity:t.security||[],securitySchemes:t.components?.securitySchemes||[]},null,2)}]}};var M={"get-endpoint-info":S};export{M as default};
@@ -1,4 +1,4 @@
1
- import type { McpToolHandler } from '../../types.js';
1
+ import type { McpToolHandler } from '../../../types.js';
2
2
  declare const _default: {
3
3
  'get-endpoints': McpToolHandler<{
4
4
  name: string;
@@ -0,0 +1 @@
1
+ import{loadApiDescription as p}from"./load-api-description.js";import{getEndpointsFromPaths as c}from"./utils.js";const a=async(n,r)=>{const{name:o,version:i}=n;let t;try{t=await p(o,r,i)}catch(s){return{content:[{type:"text",text:s.message}],isError:!0}}const e=c(t);return e.length===0?{content:[{type:"text",text:"No endpoints found"}]}:{content:[{type:"text",text:JSON.stringify({api:t.info?.title||"",version:t.info?.version||"",servers:t.servers||[],endpoints:e},null,2)}]}};var l={"get-endpoints":a};export{l as default};
@@ -1,4 +1,4 @@
1
- import type { McpToolHandler } from '../../types.js';
1
+ import type { McpToolHandler } from '../../../types.js';
2
2
  declare const _default: {
3
3
  'get-full-api-description': McpToolHandler<{
4
4
  name: string;
@@ -0,0 +1 @@
1
+ import{loadApiDescription as s}from"./load-api-description.js";const p=async(e,i)=>{const{name:n,version:r}=e;let t;try{t=await s(n,i,r)}catch(o){return{content:[{type:"text",text:o.message}],isError:!0}}return{content:[{type:"text",text:JSON.stringify({api:t.info?.title||"",version:t.info?.version||"",definition:t},null,2)}]}};var a={"get-full-api-description":p};export{a as default};
@@ -1,4 +1,4 @@
1
- import type { McpToolHandler } from '../../types.js';
1
+ import type { McpToolHandler } from '../../../types.js';
2
2
  declare const _default: {
3
3
  'get-security-schemes': McpToolHandler<{
4
4
  name: string;
@@ -0,0 +1 @@
1
+ import{loadApiDescription as c}from"./load-api-description.js";const o=async(t,r)=>{const{name:s,version:i}=t;let e;try{e=await c(s,r,i)}catch(n){return{content:[{type:"text",text:n.message}],isError:!0}}return{content:[{type:"text",text:JSON.stringify({name:e.info?.title,version:e.info?.version,securitySchemes:e.components?.securitySchemes||[],security:e.security||[]},null,2)}]}};var y={"get-security-schemes":o};export{y as default};
@@ -1,4 +1,4 @@
1
- import type { McpToolHandler } from '../../types.js';
1
+ import type { McpToolHandler } from '../../../types.js';
2
2
  declare const _default: {
3
3
  'list-apis': McpToolHandler<{
4
4
  filter?: string;
@@ -0,0 +1 @@
1
+ import{filterApiDescriptionsByName as f}from"../../utils.js";const x=async(a,l)=>{const{filter:i,page:n=1,limit:e=300}=a;let t=Object.values(l.apiDescriptionsMap);i&&(t=f(t,i));const s=(n-1)*e,o=s+e,r=Math.ceil(t.length/e),c=t.length;return t=t.slice(s,o),t.length===0?{content:[{type:"text",text:"No APIs available"}]}:{content:[{type:"text",text:JSON.stringify({items:t.map(({relativePath:g,...p})=>p),limit:e,total:c,page:n,totalPages:r})}]}};var m={"list-apis":x};export{m as default};
@@ -0,0 +1 @@
1
+ import{findApiDescriptionByNameAndVersion as t}from"../../utils.js";import{getApiDescriptionFromFs as a}from"./utils.js";async function u(r,i,s){const o=t(i.apiDescriptionsMap,r,s);if(!o)throw new Error(`No API found matching "${r}".`);const e=!!i?.config?.access?.requiresLogin,c=i?.config?.access?.rbac||{},n=await a({relativePath:o.relativePath||"",outdir:i.outdir||"",user:i.user,rbac:c,requiresLogin:e});if(!n)throw new Error(`No API found matching "${r}".`);return n}export{u as loadApiDescription};
@@ -1,14 +1,12 @@
1
1
  import type { OpenAPIDefinition, OpenAPIOperation } from '@redocly/openapi-docs';
2
- import type { SearchItemData } from '@redocly/theme/core/types';
3
2
  import type { ApiFunctionsUser, RbacConfig } from '@redocly/config';
4
- import type { McpEndpoint } from '../../types';
3
+ import type { McpEndpoint } from '../../../types';
5
4
  export declare function isMcpEndpoint(value: unknown): value is McpEndpoint;
6
5
  type EndpointInfo = Pick<OpenAPIOperation, 'summary' | 'description' | 'security'> & {
7
6
  method: string;
8
7
  path: string;
9
8
  };
10
9
  export declare function getEndpointsFromPaths(def: OpenAPIDefinition): EndpointInfo[];
11
- export declare function processDocuments(documents: Record<string, SearchItemData[]>, outdir: string): string;
12
10
  export declare function getApiDescriptionFromFs({ relativePath, outdir, user, rbac, requiresLogin }: {
13
11
  relativePath: string;
14
12
  outdir: string;
@@ -0,0 +1 @@
1
+ import a from"node:path";import{existsSync as f}from"node:fs";import{readFile as d}from"node:fs/promises";import{replaceFileExtension as h}from"../../../../../plugins/openapi-docs/store-definition-bundles";import{PUBLIC_API_DEFINITIONS_FOLDER as l}from"../../../../../constants/common";import{filterDataByAccessDeep as u}from"../../../../../utils/rbac";import{checkEndpointAndDeleteXMcp as c}from"../../../utils/xmcp-utils.js";function I(t){return typeof t=="object"&&t!==null&&"responses"in t&&typeof t.responses=="object"}function O(t){const{paths:n={}}=t,e=[];for(const[r,i]of Object.entries(n)){const s=!c(i,"docs");for(const[p,o]of Object.entries(i))s||!c(o,"docs")||e.push({path:r,method:p.toUpperCase(),summary:o.summary,description:o.description,security:o.security})}return e}async function P({relativePath:t,outdir:n,user:e,rbac:r={},requiresLogin:i=!1}){const s=a.join(n||"",l,h(t,".json"));if(!f(s))return;const o=await d(s,"utf-8"),m=JSON.parse(o);return u(m,{isAuthenticated:e?.isAuthenticated,email:e?.email,teams:e?.teams},r,i)}export{P as getApiDescriptionFromFs,O as getEndpointsFromPaths,I as isMcpEndpoint};
@@ -1 +1 @@
1
- import{toFetchResponse as C,toReqRes as S}from"fetch-to-node";import{logger as m}from"../../../tools/notifiers/logger.js";import{isObject as b}from"../../../../utils/guards/is-object.js";import{createDocsMcpServer as N}from"../servers/docs-server.js";import{filterApiDescriptionsByRbac as k}from"../utils.js";import{createMethodNotAllowedError as O,withErrorHandling as U}from"./errors.js";import{attachSseKeepalive as E}from"./sse-keepalive.js";import{McpServerType as H}from"../constants.js";import{constructInvalidTokenResponse as I,constructUnauthorizedResponse as j,handleMcpAuth as L,shouldHandleMcpAuth as J}from"../auth/auth-handlers.js";import{extractTokenFromAuthHeader as P}from"../utils/jwt.js";const d="X-Redocly-AI-Metadata";function $(r){if(r)try{const e=JSON.parse(r);if(b(e))return e;m.warn(`Ignoring ${d} header: not a JSON object.`)}catch{m.warn(`Ignoring ${d} header: invalid JSON.`)}}const z=async(r,e,h)=>{const u=!!e?.config?.access?.requiresLogin,f=e?.config?.access?.rbac||{};let s;const l=r.headers.get("Authorization");if(J(u,f)){const{isAuthenticated:t,isTokenValid:a,currentUser:n,accessToken:i}=await L(r,e);if(!t)return j(new URL(r.url).origin);if(!a)return I();n&&(e.user=n),s=i}else l&&(s=P(l||"")??void 0);let o;const g=async()=>{o&&(await o.cleanup(),o=void 0)};return await U(async()=>{if(r.method==="GET")return new Response(JSON.stringify({error:"Method Not Allowed",message:`In order to use this MCP server, you need register it in your MCP Client (VS Code, Cursor, Claude Code, etc.) using that URL: ${r.url}`}),{status:405,headers:{"Content-Type":"application/json"}});if(r.method!=="POST")return O();const t=h,a=t?.props?.config?.apiDescriptionsMap||{},n=t?.props?.config?.mcpDocsServerName||"Docs MCP server",{config:{mcp:i={}}}=e,M=k(a,e.user,f,u),A=e.config.products?Object.values(e.config.products).map(p=>p?.name):[],R=i.docs?.name||n,w=$(r.headers.get(d)),y=t?.props?.tools||[];o=await N({name:R,tools:y,context:{...e,accessToken:s,outdir:e.outdir||"",baseUrl:e.baseUrl||new URL(r.url).origin,apiDescriptionsMap:M,products:A,metadata:w}});const D=await r.json(),{req:T,res:c}=S(r),v=E(c);try{await o.transport.handleRequest(T,c,D)}catch(p){throw v.stop(),p}return C(c)},H.Docs,g)};var Z=z;export{Z as default};
1
+ import{toFetchResponse as b,toReqRes as N}from"fetch-to-node";import{logger as m}from"../../../tools/notifiers/logger.js";import{isObject as k}from"../../../../utils/guards/is-object.js";import{createDocsMcpServer as O}from"../servers/docs-server.js";import{filterApiDescriptionsByRbac as U,filterGraphqlDescriptionsByRbac as E}from"../utils.js";import{createMethodNotAllowedError as H,withErrorHandling as I}from"./errors.js";import{attachSseKeepalive as j}from"./sse-keepalive.js";import{McpServerType as L}from"../constants.js";import{constructInvalidTokenResponse as J,constructUnauthorizedResponse as P,handleMcpAuth as q,shouldHandleMcpAuth as B}from"../auth/auth-handlers.js";import{extractTokenFromAuthHeader as G}from"../utils/jwt.js";const u="X-Redocly-AI-Metadata";function $(r){if(r)try{const e=JSON.parse(r);if(k(e))return e;m.warn(`Ignoring ${u} header: not a JSON object.`)}catch{m.warn(`Ignoring ${u} header: invalid JSON.`)}}const z=async(r,e,h)=>{const n=!!e?.config?.access?.requiresLogin,i=e?.config?.access?.rbac||{};let a;const f=r.headers.get("Authorization");if(B(n,i)){const{isAuthenticated:o,isTokenValid:c,currentUser:t,accessToken:p}=await q(r,e);if(!o)return P(new URL(r.url).origin);if(!c)return J();t&&(e.user=t),a=p}else f&&(a=G(f||"")??void 0);let s;const g=async()=>{s&&(await s.cleanup(),s=void 0)};return await I(async()=>{if(r.method==="GET")return new Response(JSON.stringify({error:"Method Not Allowed",message:`In order to use this MCP server, you need register it in your MCP Client (VS Code, Cursor, Claude Code, etc.) using that URL: ${r.url}`}),{status:405,headers:{"Content-Type":"application/json"}});if(r.method!=="POST")return H();const o=h,c=o?.props?.config?.apiDescriptionsMap||{},t=o?.props?.config?.graphqlDescriptions||[],p=o?.props?.config?.mcpDocsServerName||"Docs MCP server",{config:{mcp:D={}}}=e,M=U(c,e.user,i,n),R=E(t,e.user,i,n),y=e.config.products?Object.values(e.config.products).map(l=>l?.name):[],A=D.docs?.name||p,w=$(r.headers.get(u)),T=o?.props?.tools||[];s=await O({name:A,tools:T,context:{...e,accessToken:a,outdir:e.outdir||"",baseUrl:e.baseUrl||new URL(r.url).origin,apiDescriptionsMap:M,graphqlDescriptions:R,products:y,metadata:w}});const v=await r.json(),{req:C,res:d}=N(r),S=j(d);try{await s.transport.handleRequest(C,d,v)}catch(l){throw S.stop(),l}return b(d)},L.Docs,g)};var ee=z;export{ee as default};
@@ -1 +1 @@
1
- import{fileURLToPath as y}from"node:url";import{dirname as S,join as m}from"node:path";import{logger as f}from"../../tools/notifiers/logger.js";import{reporter as b}from"../../tools/notifiers/reporter.js";import{isDefined as R}from"../../../utils/guards/is-defined.js";import{filterIgnoredApiDescriptions as w,getCleanedUpApiDescriptions as O,isMcpInRedirects as A}from"./utils.js";import{getDefaultToolSchemas as T}from"./docs-mcp/tool-schemas.js";import{telemetryTraceStep as j}from"../../../cli/telemetry/helpers/trace-step.js";const l="mcp-docs-server-handler",u=S(y(import.meta.url));async function E(){let e=!1;return{id:"mcp",async processContent(r,o){e||await j("build.plugin.mcp",async c=>{const t=await r.loadOpenApiDefinitions(o),n=await o.getConfig(),{mcp:s,redirects:g}=n;if(c?.setAttribute("config",JSON.stringify(s||{})),!(s?.hide||s?.docs?.hide)&&(A(g)&&await b.panicOnBuildContentError('The reserved route "/mcp" cannot be used in redirect configuration. Please remove any redirects involving "/mcp" from your redocly.yaml config.'),!s?.docs?.hide)){f.info("Configuring MCP servers...");const D=m(u,"./handlers/docs-mcp-handler.js"),h=O(w(t,s?.docs?.ignore||[])),a=new Map;for(const i of h){const p=i.definition.info?.title||"",d=i.definition.info?.version||"";a.set(`${p.toLowerCase()}@${d}`,{name:p,description:i.definition.info?.description||"",version:d,servers:i.definition.servers||[],relativePath:i.relativePath})}const v=Object.values(n.products||{}).map(i=>i?.name).filter(R),C=!!n?.access?.requiresLogin,M=n?.access?.rbac||{},P=T({products:v,requiresLogin:C,rbac:M});r.addMcpTools(m(u,"./docs-mcp/tools/index.js"),P),await L({actions:r,handlerPath:D,apiDescriptionsMap:Object.fromEntries(a),mcpConfig:s}),e=!0}})},async afterRoutesCreated(r,o){const c=await o.getConfig(),{mcp:t}=c;r.setGlobalData({mcpData:{docs:{enabled:!t?.hide&&!t?.docs?.hide,name:t?.docs?.name}}})}}}var B=E;async function L({actions:e,handlerPath:r,apiDescriptionsMap:o,mcpConfig:c}){e.createRequestHandler(l,r),e.addApiRoute({slug:"/mcp",requestHandlerId:l,httpMethod:"all",getStaticData:async()=>({props:{config:{apiDescriptionsMap:o,mcpDocsServerName:c?.docs?.name||"Docs MCP Server"},serverOutDir:e.serverOutDir,tools:e.getMcpTools().map(({importPath:t,...n})=>n)}})}),f.info("Registered Docs MCP Server endpoint at /mcp")}export{l as MCP_DOCS_SERVER_HANDLER_ID,B as default,E as mcpServerPlugin};
1
+ import{fileURLToPath as R}from"node:url";import{dirname as q,join as m}from"node:path";import{logger as g}from"../../tools/notifiers/logger.js";import{reporter as w}from"../../tools/notifiers/reporter.js";import{isDefined as A}from"../../../utils/guards/is-defined.js";import{buildGraphqlDescriptions as O,filterIgnoredApiDescriptions as u,getCleanedUpApiDescriptions as T,isMcpInRedirects as j}from"./utils.js";import{getDefaultToolSchemas as E}from"./docs-mcp/tool-schemas.js";import{telemetryTraceStep as G}from"../../../cli/telemetry/helpers/trace-step.js";const h="mcp-docs-server-handler",D=q(R(import.meta.url));async function L(){let i=!1;return{id:"mcp",async processContent(e,r){i||await G("build.plugin.mcp",async c=>{const o=await e.loadOpenApiDefinitions(r),a=await e.loadGraphqlDefinitions(r),s=await r.getConfig(),{mcp:t,redirects:v}=s;if(c?.setAttribute("config",JSON.stringify(t||{})),!(t?.hide||t?.docs?.hide)&&(j(v)&&await w.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)){g.info("Configuring MCP servers...");const C=m(D,"./handlers/docs-mcp-handler.js"),M=T(u(o,t?.docs?.ignore||[])),p=new Map;for(const n of M){const l=n.definition.info?.title||"",f=n.definition.info?.version||"";p.set(`${l.toLowerCase()}@${f}`,{name:l,description:n.definition.info?.description||"",version:f,servers:n.definition.servers||[],relativePath:n.relativePath})}const d=O(u(a,t?.docs?.ignore||[])),P=Object.values(s.products||{}).map(n=>n?.name).filter(A),y=!!s?.access?.requiresLogin,S=s?.access?.rbac||{},b=E({products:P,requiresLogin:y,rbac:S,hasGraphqlApis:d.length>0});e.addMcpTools(m(D,"./docs-mcp/tools/index.js"),b),await _({actions:e,handlerPath:C,apiDescriptionsMap:Object.fromEntries(p),graphqlDescriptions:d,mcpConfig:t}),i=!0}})},async afterRoutesCreated(e,r){const c=await r.getConfig(),{mcp:o}=c;e.setGlobalData({mcpData:{docs:{enabled:!o?.hide&&!o?.docs?.hide,name:o?.docs?.name}}})}}}var V=L;async function _({actions:i,handlerPath:e,apiDescriptionsMap:r,graphqlDescriptions:c,mcpConfig:o}){i.createRequestHandler(h,e),i.addApiRoute({slug:"/mcp",requestHandlerId:h,httpMethod:"all",getStaticData:async()=>({props:{config:{apiDescriptionsMap:r,graphqlDescriptions:c,mcpDocsServerName:o?.docs?.name||"Docs MCP Server"},serverOutDir:i.serverOutDir,tools:i.getMcpTools().map(({importPath:a,...s})=>s)}})}),g.info("Registered Docs MCP Server endpoint at /mcp")}export{h as MCP_DOCS_SERVER_HANDLER_ID,V as default,L as mcpServerPlugin};
@@ -1 +1 @@
1
- import{McpServer as b}from"@redocly/mcp-typescript-sdk/server/mcp.js";import{StreamableHTTPServerTransport as g}from"@redocly/mcp-typescript-sdk/server/streamableHttp.js";import{logger as n}from"../../../tools/notifiers/logger.js";import{mcpToolWorkers as c,MCP_TOOL_WORKER_KEY as S,MCP_TOOL_IS_AVAILABLE_KEY as _}from"../../../workers/mcp-tool-worker-pool.js";async function w({name:e,tools:l,context:m}){const a=new b({name:e,version:new Date().toISOString().slice(0,10)},{capabilities:{logging:{}}}),t=new g({sessionIdGenerator:void 0}),i=M(m);for(const o of l){const u=async(r,d)=>{n.info(`MCP tool called: ${o.name}`);const I={toolName:o.name,args:r,context:i,extra:q(d)};return await c.exec(S,[I],{timeout:6e4})},f=a.tool(o.name,o.description,o.schema,u),p={toolName:o.name,context:i};let s=!1;try{s=await c.exec(_,[p],{timeout:1e4})}catch(r){n.error(`Failed to check MCP tool availability for "${o.name}": ${r instanceof Error?r.message:String(r)}`),s=!1}s||f.disable()}return await a.connect(t),{server:a,transport:t,cleanup:async()=>{t.close()}}}function q(e){return{sessionId:e.sessionId,authInfo:e.authInfo,requestId:e.requestId,requestInfo:e.requestInfo,_meta:e._meta}}function M(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,products:e.products,accessToken:e.accessToken,metadata:e.metadata}}export{w as createDocsMcpServer};
1
+ import{McpServer as I}from"@redocly/mcp-typescript-sdk/server/mcp.js";import{StreamableHTTPServerTransport as b}from"@redocly/mcp-typescript-sdk/server/streamableHttp.js";import{logger as n}from"../../../tools/notifiers/logger.js";import{mcpToolWorkers as c,MCP_TOOL_WORKER_KEY as q,MCP_TOOL_IS_AVAILABLE_KEY as S}from"../../../workers/mcp-tool-worker-pool.js";async function y({name:e,tools:l,context:m}){const a=new I({name:e,version:new Date().toISOString().slice(0,10)},{capabilities:{logging:{}}}),s=new b({sessionIdGenerator:void 0}),i=M(m);for(const r of l){const p=async(o,d)=>{n.info(`MCP tool called: ${r.name}`);const g={toolName:r.name,args:o,context:i,extra:_(d)};return await c.exec(q,[g],{timeout:6e4})},u=a.tool(r.name,r.description,r.schema,p),f={toolName:r.name,context:i};let t=!1;try{t=await c.exec(S,[f],{timeout:1e4})}catch(o){n.error(`Failed to check MCP tool availability for "${r.name}": ${o instanceof Error?o.message:String(o)}`),t=!1}t||u.disable()}return await a.connect(s),{server:a,transport:s,cleanup:async()=>{s.close()}}}function _(e){return{sessionId:e.sessionId,authInfo:e.authInfo,requestId:e.requestId,requestInfo:e.requestInfo,_meta:e._meta}}function M(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{y as createDocsMcpServer};
@@ -15,9 +15,15 @@ export type ApiDescriptionInfo = {
15
15
  version?: string;
16
16
  servers?: OpenAPIServer[];
17
17
  };
18
+ export type GraphqlDescriptionInfo = {
19
+ name: string;
20
+ relativePath: string;
21
+ description?: string;
22
+ };
18
23
  export type McpDocsStaticDataPropsConfig = {
19
24
  mcpDocsServerName: string;
20
25
  apiDescriptionsMap: Record<string, ApiDescriptionInfo>;
26
+ graphqlDescriptions: GraphqlDescriptionInfo[];
21
27
  };
22
28
  export type McpDocsStaticData = PageStaticData & {
23
29
  props: {
@@ -76,6 +82,7 @@ export type McpToolExtra = {
76
82
  };
77
83
  export type McpToolContext = Omit<ApiFunctionsContext, 'telemetry' | 'getKv' | keyof ApiFunctionsContextMethods> & {
78
84
  apiDescriptionsMap: Record<string, ApiDescriptionInfo>;
85
+ graphqlDescriptions: GraphqlDescriptionInfo[];
79
86
  products?: string[];
80
87
  accessToken?: string;
81
88
  metadata?: Record<string, unknown>;
@@ -1,6 +1,7 @@
1
1
  import type { ApiFunctionsUser, RbacConfig, RedirectConfig } from '@redocly/config';
2
2
  import type { ProcessContentActions } from '../../types';
3
- import type { ApiDescriptionInfo } from './types.js';
3
+ import type { BundledDefinition as GraphqlBundledDefinition } from '../../plugins/graphql-docs/graphql-doc-loader';
4
+ import type { ApiDescriptionInfo, GraphqlDescriptionInfo } from './types.js';
4
5
  export type ApiDescriptions = Awaited<ReturnType<ProcessContentActions['loadOpenApiDefinitions']>>;
5
6
  /**
6
7
  * Filters out localizations and definitions with no public paths.
@@ -37,22 +38,11 @@ export declare function getCleanedUpApiDescriptions(apiDescriptions: ApiDescript
37
38
  * // Returns only definitions the user can access with filtered content
38
39
  */
39
40
  export declare function filterApiDescriptionsByRbac(apiDescriptions: Record<string, ApiDescriptionInfo>, user: ApiFunctionsUser, rbac: RbacConfig, requiresLogin: boolean): Record<string, ApiDescriptionInfo>;
40
- /**
41
- * Filters out definitions that match ignored paths from redocly.yaml config.
42
- *
43
- * This function uses picomatch to check if any definition's relative path matches
44
- * any of the ignored path patterns specified in the redocly configuration.
45
- * Definitions matching these patterns will be excluded from the result.
46
- *
47
- * @param apiDescriptions - Array of OpenAPI definitions to filter.
48
- * @param ignoredPaths - Array of glob patterns for paths to ignore.
49
- * @returns Array of definitions that don't match any ignored path patterns.
50
- *
51
- * @example
52
- * filterIgnoredApiDescriptions(apiDescriptions, ['path/to/ignore']);
53
- * // Returns definitions not matching test or internal path patterns
54
- */
55
- export declare function filterIgnoredApiDescriptions(apiDescriptions: ApiDescriptions, ignoredPaths: string[]): ApiDescriptions;
41
+ export declare function filterGraphqlDescriptionsByRbac(graphqlDescriptions: GraphqlDescriptionInfo[], user: ApiFunctionsUser, rbac: RbacConfig, requiresLogin: boolean): GraphqlDescriptionInfo[];
42
+ export declare function buildGraphqlDescriptions(definitions: GraphqlBundledDefinition[]): GraphqlDescriptionInfo[];
43
+ export declare function filterIgnoredApiDescriptions<T extends {
44
+ relativePath: string;
45
+ }>(apiDescriptions: T[], ignoredPaths: string[]): T[];
56
46
  /**
57
47
  * Checks if the MCP route (/mcp) appears in redirect configuration.
58
48
  *
@@ -1 +1 @@
1
- import{join as f}from"node:path";import a from"picomatch";import{PUBLIC_API_DEFINITIONS_FOLDER as u,L10N_DIR_NAME as h,I18N_DIR_NAME as l}from"../../constants/common.js";import{RESERVED_ROUTES as p}from"../../plugins/get-reserved-routes.js";import{canDownloadApiDefinition as m}from"../../utils/rbac.js";function n(i){if(typeof i!="object"||i===null)return i;if(Array.isArray(i))return i.map(n);const r={};for(const t in i)if(Object.hasOwn(i,t)){if(t.toString().startsWith("x-parsed-"))continue;r[t]=n(i[t])}return r}function d(i){return i.reduce((r,t)=>(t.relativePath.startsWith(h)||t.relativePath.startsWith(l)||t.definition?.paths&&Object.keys(t.definition.paths).length>0&&r.push({...t,definition:n(t.definition)}),r),[])}function y(i,r,t,e){const o={};for(const[c,s]of Object.entries(i))m(f(u,s.relativePath),t,e,r)&&(o[c]=s);return o}function E(i,r){return i.filter(({relativePath:t})=>!a(r||[])(t))}function R(i={}){for(const[r,t]of Object.entries(i))if(r===p.mcp||(typeof t=="string"?t:t.to)===p.mcp)return!0;return!1}export{y as filterApiDescriptionsByRbac,E as filterIgnoredApiDescriptions,d as getCleanedUpApiDescriptions,R as isMcpInRedirects};
1
+ import p,{join as c}from"node:path";import D from"picomatch";import{PUBLIC_API_DEFINITIONS_FOLDER as f,L10N_DIR_NAME as a,I18N_DIR_NAME as u}from"../../constants/common.js";import{RESERVED_ROUTES as l}from"../../plugins/get-reserved-routes.js";import{canDownloadApiDefinition as h}from"../../utils/rbac.js";function o(r){if(typeof r!="object"||r===null)return r;if(Array.isArray(r))return r.map(o);const i={};for(const t in r)if(Object.hasOwn(r,t)){if(t.toString().startsWith("x-parsed-"))continue;i[t]=o(r[t])}return i}function R(r){return r.reduce((i,t)=>(t.relativePath.startsWith(a)||t.relativePath.startsWith(u)||t.definition?.paths&&Object.keys(t.definition.paths).length>0&&i.push({...t,definition:o(t.definition)}),i),[])}function x(r,i,t,e){const n={};for(const[m,s]of Object.entries(r))h(c(f,s.relativePath),t,e,i)&&(n[m]=s);return n}function E(r,i,t,e){return r.filter(n=>h(c(f,n.relativePath),t,e,i))}function P(r){return r.filter(({relativePath:i})=>!i.startsWith(a)&&!i.startsWith(u)).map(({relativePath:i,settings:t})=>({name:t.info?.title||p.basename(i,p.extname(i)),description:t.info?.description,relativePath:i}))}function _(r,i){return r.filter(({relativePath:t})=>!D(i||[])(t))}function g(r={}){for(const[i,t]of Object.entries(r))if(i===l.mcp||(typeof t=="string"?t:t.to)===l.mcp)return!0;return!1}export{P as buildGraphqlDescriptions,x as filterApiDescriptionsByRbac,E as filterGraphqlDescriptionsByRbac,_ as filterIgnoredApiDescriptions,R as getCleanedUpApiDescriptions,g as isMcpInRedirects};
@@ -1 +1 @@
1
- const R=3,g=1e3;function w(a,t){switch(a){case"fixed":return async()=>{await new Promise(e=>setTimeout(e,t))};case"exponential":return async e=>{const s=t*Math.pow(2,e-1);await new Promise(n=>setTimeout(n,s))};case"none":default:return async()=>{}}}const m=async(a,t={})=>{const{maxRetries:e=3,retryStrategy:s="exponential",delay:n=1e3,logger:r,messages:o={retry:"Operation failed. Retrying...",maxRetriesReached:"Max retries reached"}}=t,y=w(s,n);let i=0;for(;;)try{return await a()}catch(c){if(i++,r&&r.warn(`${o.retry}: ${c.message}`),i>e)throw r&&r.error(`${o.maxRetriesReached}: ${c.message}`),c;await y(i)}};export{m as retryAsyncOperation};
1
+ const R=3,g=1e3;function w(a,t){switch(a){case"fixed":return async()=>{await new Promise(e=>setTimeout(e,t))};case"exponential":return async e=>{const s=t*Math.pow(2,e-1);await new Promise(n=>setTimeout(n,s))};default:return async()=>{}}}const m=async(a,t={})=>{const{maxRetries:e=3,retryStrategy:s="exponential",delay:n=1e3,logger:r,messages:o={retry:"Operation failed. Retrying...",maxRetriesReached:"Max retries reached"}}=t,y=w(s,n);let i=0;for(;;)try{return await a()}catch(c){if(i++,r&&r.warn(`${o.retry}: ${c.message}`),i>e)throw r&&r.error(`${o.maxRetriesReached}: ${c.message}`),c;await y(i)}};export{m as retryAsyncOperation};
@@ -6,6 +6,7 @@ import type { RedoclyConfig, RedirectConfig, CompilationError, PageStaticData }
6
6
  import type { SearchFacet } from '@redocly/theme/core/types';
7
7
  import type { BundledDefinition as OpenApiBundledDefinition } from './plugins/openapi-docs/load-definition.js';
8
8
  import type { BundledDefinition as AsyncApiBundledDefinition } from './plugins/asyncapi-docs/asyncapi-doc-loader.js';
9
+ import type { BundledDefinition as GraphqlBundledDefinition } from './plugins/graphql-docs/graphql-doc-loader.js';
9
10
  import type { SearchEngine } from './plugins/search/engines/search-engine.js';
10
11
  import { KvService } from './persistence/kv/services/kv-service.js';
11
12
  export declare const MARKDOC_PARTIALS_DATA_KEY = "markdown/partials";
@@ -106,6 +107,7 @@ export declare class Store {
106
107
  }>;
107
108
  loadOpenApiDefinitions(context: LifecycleContext): Promise<OpenApiBundledDefinition[]>;
108
109
  loadAsyncApiDefinitions(context: LifecycleContext): Promise<AsyncApiBundledDefinition[]>;
110
+ loadGraphqlDefinitions(context: LifecycleContext): Promise<GraphqlBundledDefinition[]>;
109
111
  setSearchEngine(engine: SearchEngine): void;
110
112
  setSearchFacets: (searchFacets: Map<string, SearchFacet>) => void;
111
113
  setGlobalConfig: (data: Partial<RedoclyConfig>) => void;