Sign In

@zeroheight/mcp-server

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@zeroheight/mcp-server - npm Package Compare versions

Comparing version
2.3.0
to
2.4.0
+5
-0
CHANGELOG.md
## Release notes
## [2.4.0](https://www.npmjs.com/package/@zeroheight/mcp-server/v/2.4.0) - 16th March 2026
- Remove `get-styleguide-tree` tool
- Change `list-pages` tool to return styleguide tree with page names, links and IDs
## [2.3.0](https://www.npmjs.com/package/@zeroheight/mcp-server/v/2.3.0) - 13th March 2026

@@ -4,0 +9,0 @@

+6
-6
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="3d4cd722-6043-5c3e-a421-a6f2511a55b0")}catch(e){}}();
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="297bbf44-22a9-5899-b2be-ac6d0428ee04")}catch(e){}}();
import { request } from "./api.js";

@@ -25,6 +25,6 @@ import { UnknownError } from "./errors.js";

export async function getStyleguideTree(credentials, id, clientUserAgent) {
const searchParams = new URLSearchParams({
show_hidden: "false",
});
try {
const searchParams = new URLSearchParams({
show_hidden: "false",
});
const response = await request(`/styleguides/${id}/tree`, credentials, {

@@ -41,6 +41,6 @@ method: "GET",

captureException(e);
return [];
throw e;
}
}
//# sourceMappingURL=styleguide.js.map
//# debugId=3d4cd722-6043-5c3e-a421-a6f2511a55b0
//# debugId=297bbf44-22a9-5899-b2be-ac6d0428ee04

@@ -1,1 +0,1 @@

{"version":3,"file":"styleguide.js","sources":["api/styleguide.ts"],"sourceRoot":"/","sourcesContent":["import { APIResponse, request } from \"./api.js\";\nimport { UnknownError } from \"./errors.js\";\nimport { Credentials } from \"../common/credentials.js\";\nimport {\n CategoryNode,\n NavigationNode,\n PageNode,\n Styleguide,\n} from \"./types/styleguide.js\";\nimport { captureException } from \"../common/errors.js\";\n\ninterface StyleguideListSuccessResponse {\n styleguides: Styleguide[];\n}\n\nexport async function listStyleguides(credentials: Credentials, clientUserAgent?: string) {\n try {\n const response = await request<\n APIResponse<StyleguideListSuccessResponse, {}, {}>\n >(\"/styleguides\", credentials, {\n method: \"GET\",\n }, undefined, undefined, { clientUserAgent });\n\n if (\"styleguides\" in response.data) {\n if (credentials.type === \"jwt\") {\n return response.data.styleguides.filter(\n (sg) => sg.id === credentials.styleguideId,\n );\n }\n\n return response.data.styleguides;\n }\n\n throw new UnknownError();\n } catch (e) {\n captureException(e);\n return [];\n }\n}\n\ninterface SyleguideTreeSuccessResponse {\n tree: (PageNode | CategoryNode | NavigationNode)[];\n}\n\nexport async function getStyleguideTree(credentials: Credentials, id: number, clientUserAgent?: string) {\n try {\n const searchParams = new URLSearchParams({\n show_hidden: \"false\",\n });\n\n const response = await request<\n APIResponse<SyleguideTreeSuccessResponse, {}, {}>\n >(\n `/styleguides/${id}/tree`,\n credentials,\n {\n method: \"GET\",\n },\n searchParams,\n undefined,\n { clientUserAgent },\n );\n\n if (\"tree\" in response.data) {\n return response.data.tree;\n }\n\n console.error(response);\n\n throw new UnknownError();\n } catch (e) {\n captureException(e);\n return [];\n }\n}\n"],"names":[],"mappings":";;AAAA,OAAO,EAAe,OAAO,EAAE,MAAM,UAAU,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAQ3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAMvD,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,WAAwB,EAAE,eAAwB;IACtF,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,OAAO,CAE5B,cAAc,EAAE,WAAW,EAAE;YAC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C;IACZ,CAAC;AACH,CAAC","debug_id":"3d4cd722-6043-5c3e-a421-a6f2511a55b0"}
{"version":3,"file":"styleguide.js","sources":["api/styleguide.ts"],"sourceRoot":"/","sourcesContent":["import { APIResponse, request } from \"./api.js\";\nimport { UnknownError } from \"./errors.js\";\nimport { Credentials } from \"../common/credentials.js\";\nimport {\n CategoryNode,\n NavigationNode,\n PageNode,\n Styleguide,\n} from \"./types/styleguide.js\";\nimport { captureException } from \"../common/errors.js\";\n\ninterface StyleguideListSuccessResponse {\n styleguides: Styleguide[];\n}\n\nexport async function listStyleguides(credentials: Credentials, clientUserAgent?: string) {\n try {\n const response = await request<\n APIResponse<StyleguideListSuccessResponse, {}, {}>\n >(\"/styleguides\", credentials, {\n method: \"GET\",\n }, undefined, undefined, { clientUserAgent });\n\n if (\"styleguides\" in response.data) {\n if (credentials.type === \"jwt\") {\n return response.data.styleguides.filter(\n (sg) => sg.id === credentials.styleguideId,\n );\n }\n\n return response.data.styleguides;\n }\n\n throw new UnknownError();\n } catch (e) {\n captureException(e);\n return [];\n }\n}\n\ninterface SyleguideTreeSuccessResponse {\n tree: (PageNode | CategoryNode | NavigationNode)[];\n}\n\nexport async function getStyleguideTree(credentials: Credentials, id: number, clientUserAgent?: string) {\n const searchParams = new URLSearchParams({\n show_hidden: \"false\",\n });\n\n try {\n const response = await request<\n APIResponse<SyleguideTreeSuccessResponse, {}, {}>\n >(\n `/styleguides/${id}/tree`,\n credentials,\n {\n method: \"GET\",\n },\n searchParams,\n undefined,\n { clientUserAgent },\n );\n\n if (\"tree\" in response.data) {\n return response.data.tree;\n }\n\n console.error(response);\n throw new UnknownError();\n } catch (e) {\n captureException(e);\n throw e;\n }\n}\n"],"names":[],"mappings":";;AAAA,OAAO,EAAe,OAAO,EAAE,MAAM,UAAU,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAQ3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAMvD,MAAM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C;QACxB,MAAM,IAAI,YAAY,EAAE,CAAC;IAC3B,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,gBAAgB,CAAC,CAAC,CAAC,CAAC;QACpB,MAAM,CAAC,CAAC;IACV,CAAC;AACH,CAAC","debug_id":"297bbf44-22a9-5899-b2be-ac6d0428ee04"}
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="79d00c02-3a81-5343-9bcb-d29014c5753f")}catch(e){}}();
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="c25e9b7c-243a-5e35-a054-46ee2133d638")}catch(e){}}();
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import packageJson from "../package.json" with { type: "json" };
import { registerGetStyleguideTreeTool, registerListStyleguidesTool, } from "./tools/styleguide.js";
import { registerGetPageTool, registerGetPageImagesTool, registerListPagesTool, registerSearchPagesTool, } from "./tools/page.js";
import { registerListPagesTool, registerListStyleguidesTool, } from "./tools/styleguide.js";
import { registerGetPageTool, registerGetPageImagesTool, registerSearchPagesTool, } from "./tools/page.js";
import { registerGetTokensTool, registerListTokenSetsTool, } from "./tools/token.js";

@@ -22,7 +22,6 @@ import { registerLintCodeTool } from "./tools/lint.js";

[
registerListStyleguidesTool,
registerListPagesTool,
registerGetPageTool,
registerGetPageImagesTool,
registerListStyleguidesTool,
registerGetStyleguideTreeTool,
registerSearchPagesTool,

@@ -38,2 +37,2 @@ registerListTokenSetsTool,

//# sourceMappingURL=mcp-server.js.map
//# debugId=79d00c02-3a81-5343-9bcb-d29014c5753f
//# debugId=c25e9b7c-243a-5e35-a054-46ee2133d638

@@ -1,1 +0,1 @@

{"version":3,"file":"mcp-server.js","sources":["mcp-server.ts"],"sourceRoot":"/","sourcesContent":["import { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\n\nimport packageJson from \"../package.json\" with { type: \"json\" };\nimport {\n registerGetStyleguideTreeTool,\n registerListStyleguidesTool,\n} from \"./tools/styleguide.js\";\nimport {\n registerGetPageTool,\n registerGetPageImagesTool,\n registerListPagesTool,\n registerSearchPagesTool,\n} from \"./tools/page.js\";\nimport {\n registerGetTokensTool,\n registerListTokenSetsTool,\n} from \"./tools/token.js\";\nimport { registerLintCodeTool } from \"./tools/lint.js\";\nimport { recommendSummarizePagePrompt } from \"./prompts/page.js\";\nimport { registerRecommendPagesPrompt } from \"./prompts/styleguide.js\";\nimport { ServerContext } from \"./types/server.js\";\n\nexport function createServer(context: ServerContext = { features: {} }) {\n const server = new McpServer({\n name: \"zeroheight\",\n version: packageJson.version,\n capabilities: {\n resources: {},\n tools: {},\n },\n });\n\n // Register tools\n [\n registerListPagesTool,\n registerGetPageTool,\n registerGetPageImagesTool,\n registerListStyleguidesTool,\n registerGetStyleguideTreeTool,\n registerSearchPagesTool,\n registerListTokenSetsTool,\n registerGetTokensTool,\n registerLintCodeTool,\n ].forEach((fn) => fn(server, context));\n\n // Register all prompts\n [registerRecommendPagesPrompt, recommendSummarizePagePrompt].forEach((fn) =>\n fn(server),\n );\n\n return server;\n}\n"],"names":[],"mappings":";;AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEpE,OAAO,WAAW,MAAM,iBAAiB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AAChE,OAAO,EACL,6BAA6B,EAC7B,2BAA2B,GAC5B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,mBAAmB,EACnB,yBAAyB,EACzB,qBAAqB,EACrB,uBAAuB,GACxB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,qBAAqB,EACrB,yBAAyB,GAC1B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,4BAA4B,EAAE,MAAM,mBAAmB,CAAC;AACjE,OAAO,EAAE,4BAA4B,EAAE,MAAM,yBAAyB,CAAC;AAGvE,MAAM,UAAU,YAAY,CAAC,UAAyB,EAAE,QAAQ,EAAE,EAAE,EAAE;IACpE,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC;QAC3B,IAAI,EAAE,YAAY;QAClB,OAAO,EAAE,WAAW,CAAC,OAAO;QAC5B,YAAY,EAAE;YACZ,SAAS,EAAE,EAAE;YACb,KAAK,EAAE,EAAE;SACV;KACF,CAAC,CAAC;IAEH,iBAAiB;IACjB;QACE,qBAAqB;QACrB,mBAAmB;QACnB,yBAAyB;QACzB,2BAA2B;QAC3B,6BAA6B;QAC7B,uBAAuB;QACvB,yBAAyB;QACzB,qBAAqB;QACrB,oBAAoB;KACrB,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAEvC,uBAAuB;IACvB,CAAC,4BAA4B,EAAE,4BAA4B,CAAC,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE,CAC1E,EAAE,CAAC,MAAM,CAAC,CACX,CAAC;IAEF,OAAO,MAAM,CAAC;AAChB,CAAC","debug_id":"79d00c02-3a81-5343-9bcb-d29014c5753f"}
{"version":3,"file":"mcp-server.js","sources":["mcp-server.ts"],"sourceRoot":"/","sourcesContent":["import { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\n\nimport packageJson from \"../package.json\" with { type: \"json\" };\nimport {\n registerListPagesTool,\n registerListStyleguidesTool,\n} from \"./tools/styleguide.js\";\nimport {\n registerGetPageTool,\n registerGetPageImagesTool,\n registerSearchPagesTool,\n} from \"./tools/page.js\";\nimport {\n registerGetTokensTool,\n registerListTokenSetsTool,\n} from \"./tools/token.js\";\nimport { registerLintCodeTool } from \"./tools/lint.js\";\nimport { recommendSummarizePagePrompt } from \"./prompts/page.js\";\nimport { registerRecommendPagesPrompt } from \"./prompts/styleguide.js\";\nimport { ServerContext } from \"./types/server.js\";\n\nexport function createServer(context: ServerContext = { features: {} }) {\n const server = new McpServer({\n name: \"zeroheight\",\n version: packageJson.version,\n capabilities: {\n resources: {},\n tools: {},\n },\n });\n\n // Register tools\n [\n registerListStyleguidesTool,\n registerListPagesTool,\n registerGetPageTool,\n registerGetPageImagesTool,\n registerSearchPagesTool,\n registerListTokenSetsTool,\n registerGetTokensTool,\n registerLintCodeTool,\n ].forEach((fn) => fn(server, context));\n\n // Register all prompts\n [registerRecommendPagesPrompt, recommendSummarizePagePrompt].forEach((fn) =>\n fn(server),\n );\n\n return server;\n}\n"],"names":[],"mappings":";;AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEpE,OAAO,WAAW,MAAM,iBAAiB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AAChE,OAAO,EACL,qBAAqB,EACrB,2BAA2B,GAC5B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,mBAAmB,EACnB,yBAAyB,EACzB,uBAAuB,GACxB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,qBAAqB,EACrB,yBAAyB,GAC1B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,4BAA4B,EAAE,MAAM,mBAAmB,CAAC;AACjE,OAAO,EAAE,4BAA4B,EAAE,MAAM,yBAAyB,CAAC;AAGvE,MAAM,UAAU,YAAY,CAAC,UAAyB,EAAE,QAAQ,EAAE,EAAE,EAAE;IACpE,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC;QAC3B,IAAI,EAAE,YAAY;QAClB,OAAO,EAAE,WAAW,CAAC,OAAO;QAC5B,YAAY,EAAE;YACZ,SAAS,EAAE,EAAE;YACb,KAAK,EAAE,EAAE;SACV;KACF,CAAC,CAAC;IAEH,iBAAiB;IACjB;QACE,2BAA2B;QAC3B,qBAAqB;QACrB,mBAAmB;QACnB,yBAAyB;QACzB,uBAAuB;QACvB,yBAAyB;QACzB,qBAAqB;QACrB,oBAAoB;KACrB,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAEvC,uBAAuB;IACvB,CAAC,4BAA4B,EAAE,4BAA4B,CAAC,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE,CAC1E,EAAE,CAAC,MAAM,CAAC,CACX,CAAC;IAEF,OAAO,MAAM,CAAC;AAChB,CAAC","debug_id":"c25e9b7c-243a-5e35-a054-46ee2133d638"}

@@ -5,72 +5,8 @@ /**

!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="4b7ad593-ae75-5c6a-8904-6365d53e7984")}catch(e){}}();
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="f6a95e05-9471-5fe8-a72b-de2187d3b8d1")}catch(e){}}();
import z from "zod";
import { getPage, listPages, searchPages } from "../api/page.js";
import { getPage, searchPages } from "../api/page.js";
import { formatPageAsMarkdown, formatPageListItemsAsMarkdown, extractImageUrlsFromPage, } from "../common/formatters/page.js";
import { getCredentials } from "../common/credentials.js";
import { registerTrackedToolCall } from "../logging.js";
export function registerListPagesTool(server, _context) {
registerTrackedToolCall(server, "list-pages", {
title: "List pages for a styleguide",
description: "Explore the pages within a design system to find guidance relevant to the task.\n\n*Useful when generating UI that should align with documented component usage, patterns, or interaction recommendations rather than inferred solutions.*",
inputSchema: {
styleguideId: z
.number()
.int()
.min(1)
.describe("The design system to reference. Use `list-styleguides` to discover available systems"),
releaseId: z
.number()
.int()
.min(1)
.describe("Optional. Returns guidelines for the default release if omitted. User can specify when a particular release is relevant.")
.optional(),
searchTerm: z
.string()
.describe("Optional. Filters pages by name and is helpful when looking for guidance related to a specific component, pattern, or concept.")
.optional(),
},
annotations: {
readOnlyHint: true,
},
}, async ({ styleguideId, releaseId, searchTerm }, { authInfo }, clientUserAgent) => {
const credentials = await getCredentials(authInfo);
if (credentials.type === "jwt" &&
credentials.styleguideId !== styleguideId) {
return {
isError: true,
content: [
{
type: "text",
text: "You do not have access to this styleguide",
},
],
};
}
const pages = await listPages(credentials, styleguideId, {
releaseId,
searchTerm,
}, clientUserAgent);
if (pages.length === 0) {
return {
isError: true,
content: [
{
type: "text",
text: "There are no pages in this styleguide, check you have the correct styleguide ID",
},
],
};
}
return {
content: [
{
type: "text",
text: formatPageListItemsAsMarkdown(pages),
mimeType: "text/markdown",
},
],
};
});
}
export function registerGetPageTool(server, _context) {

@@ -83,3 +19,3 @@ registerTrackedToolCall(server, "get-page", {

.string()
.describe("Identifies the page containing relevant guidance. Use `list-pages` or `get-styleguide-tree` to locate it."),
.describe("Identifies the page containing relevant guidance. Use `list-pages` to locate it."),
releaseId: z

@@ -103,3 +39,3 @@ .number()

type: "text",
text: "Could not find the page, check you have the correct page ID and release ID.",
text: `Could not find the page, check you have the correct page ID${releaseId ? ` and release ID` : ""}.`,
},

@@ -147,3 +83,3 @@ ],

type: "text",
text: "Could not find the page, check you have the correct page ID and release ID.",
text: `Could not find the page, check you have the correct page ID${releaseId ? ` and release ID` : ""}.`,
},

@@ -235,2 +171,2 @@ ],

//# sourceMappingURL=page.js.map
//# debugId=4b7ad593-ae75-5c6a-8904-6365d53e7984
//# debugId=f6a95e05-9471-5fe8-a72b-de2187d3b8d1

@@ -1,1 +0,1 @@

{"version":3,"file":"page.js","sources":["tools/page.ts"],"sourceRoot":"/","sourcesContent":["/**\n * Page Tools\n */\n\nimport { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport z from \"zod\";\n\nimport { getPage, listPages, searchPages } from \"../api/page.js\";\nimport {\n formatPageAsMarkdown,\n formatPageListItemsAsMarkdown,\n extractImageUrlsFromPage,\n} from \"../common/formatters/page.js\";\nimport { getCredentials } from \"../common/credentials.js\";\nimport { registerTrackedToolCall } from \"../logging.js\";\nimport { ServerContext } from \"../types/server.js\";\n\nexport function registerListPagesTool(\n server: McpServer,\n _context: ServerContext,\n) {\n registerTrackedToolCall(\n server,\n \"list-pages\",\n {\n title: \"List pages for a styleguide\",\n description:\n \"Explore the pages within a design system to find guidance relevant to the task.\\n\\n*Useful when generating UI that should align with documented component usage, patterns, or interaction recommendations rather than inferred solutions.*\",\n inputSchema: {\n styleguideId: z\n .number()\n .int()\n .min(1)\n .describe(\n \"The design system to reference. Use `list-styleguides` to discover available systems\",\n ),\n releaseId: z\n .number()\n .int()\n .min(1)\n .describe(\n \"Optional. Returns guidelines for the default release if omitted. User can specify when a particular release is relevant.\",\n )\n .optional(),\n searchTerm: z\n .string()\n .describe(\n \"Optional. Filters pages by name and is helpful when looking for guidance related to a specific component, pattern, or concept.\",\n )\n .optional(),\n },\n annotations: {\n readOnlyHint: true,\n },\n },\n async (\n { styleguideId, releaseId, searchTerm },\n { authInfo },\n clientUserAgent,\n ) => {\n const credentials = await getCredentials(authInfo);\n if (\n credentials.type === \"jwt\" &&\n credentials.styleguideId !== styleguideId\n ) {\n return {\n isError: true,\n content: [\n {\n type: \"text\",\n text: \"You do not have access to this styleguide\",\n },\n ],\n };\n }\n\n const pages = await listPages(\n credentials,\n styleguideId,\n {\n releaseId,\n searchTerm,\n },\n clientUserAgent,\n );\n\n if (pages.length === 0) {\n return {\n isError: true,\n content: [\n {\n type: \"text\",\n text: \"There are no pages in this styleguide, check you have the correct styleguide ID\",\n },\n ],\n };\n }\n\n return {\n content: [\n {\n type: \"text\",\n text: formatPageListItemsAsMarkdown(pages),\n mimeType: \"text/markdown\",\n },\n ],\n };\n },\n );\n}\n\nexport function registerGetPageTool(\n server: McpServer,\n _context: ServerContext,\n) {\n registerTrackedToolCall(\n server,\n \"get-page\",\n {\n title: \"Get a styleguide page\",\n description:\n \"Fetch guidance from a specific design system page, including usage notes, recommendations, and supporting context.\\n\\n*Particularly helpful ahead of UI generation to increase the likelihood that outputs reflect the intent of the design system.*\\n\\n*If images from the page are needed, call `get-page-images` afterwards with the same page ID to retrieve them as base64-encoded content.*\",\n inputSchema: {\n pageId: z\n .string()\n .describe(\n \"Identifies the page containing relevant guidance. Use `list-pages` or `get-styleguide-tree` to locate it.\",\n ),\n releaseId: z\n .number()\n .int()\n .describe(\n \"Optional. Returns guidelines for the default release if omitted. User can specify when a particular release is relevant.\",\n )\n .optional(),\n },\n annotations: {\n readOnlyHint: true,\n },\n },\n async ({ pageId, releaseId }, { authInfo }, clientUserAgent) => {\n const credentials = await getCredentials(authInfo);\n const page = await getPage(\n credentials,\n pageId,\n { releaseId },\n clientUserAgent,\n );\n\n if (!page) {\n return {\n isError: true,\n content: [\n {\n type: \"text\",\n text: \"Could not find the page, check you have the correct page ID and release ID.\",\n },\n ],\n };\n }\n\n const textContent = formatPageAsMarkdown(page);\n\n return {\n content: [\n {\n type: \"text\",\n text: textContent,\n mimeType: \"text/markdown\",\n },\n ],\n };\n },\n );\n}\n\nexport function registerGetPageImagesTool(\n server: McpServer,\n _context: ServerContext,\n) {\n registerTrackedToolCall(\n server,\n \"get-page-images\",\n {\n title: \"Get images from a styleguide page\",\n description:\n \"Fetch all images from a specific design system page as base64-encoded content.\\n\\n*Call this after `get-page` with the same page ID if images are needed for the task — for example, when referencing visual examples, screenshots, or diagrams from the page.*\",\n inputSchema: {\n pageId: z\n .string()\n .describe(\n \"The page to fetch images from. Use the same page ID as a previous `get-page` call.\",\n ),\n releaseId: z\n .number()\n .int()\n .describe(\n \"Optional. Returns images for the default release if omitted. Should match the release ID used with `get-page`.\",\n )\n .optional(),\n },\n annotations: {\n readOnlyHint: true,\n },\n },\n async ({ pageId, releaseId }, { authInfo }, clientUserAgent) => {\n const credentials = await getCredentials(authInfo);\n const page = await getPage(\n credentials,\n pageId,\n { releaseId },\n clientUserAgent,\n );\n\n if (!page) {\n return {\n isError: true,\n content: [\n {\n type: \"text\",\n text: \"Could not find the page, check you have the correct page ID and release ID.\",\n },\n ],\n };\n }\n\n const textContent = formatPageAsMarkdown(page);\n const images = await extractImageUrlsFromPage(textContent);\n\n if (images.length === 0) {\n return {\n content: [\n {\n type: \"text\",\n text: \"No images found on this page.\",\n },\n ],\n };\n }\n\n return {\n content: images,\n };\n },\n );\n}\n\nexport function registerSearchPagesTool(\n server: McpServer,\n context: ServerContext,\n) {\n if (context.features[\"SKI_2466_bedrock_indexing\"] !== true) {\n return;\n }\n registerTrackedToolCall(\n server,\n \"search-pages\",\n {\n title: \"Search pages in a styleguide\",\n description: \"Search for pages in a styleguide by a search term\",\n inputSchema: {\n styleguideId: z.number().int().min(1),\n releaseId: z.number().int().min(1).optional(),\n searchTerm: z.string(),\n responseFormat: z.enum([\"markdown\", \"json\"]).default(\"json\"),\n },\n annotations: {\n readOnlyHint: true,\n },\n },\n async (\n { styleguideId, searchTerm, releaseId, responseFormat },\n { authInfo },\n clientUserAgent,\n ) => {\n const credentials = await getCredentials(authInfo);\n if (\n credentials.type === \"jwt\" &&\n credentials.styleguideId !== styleguideId\n ) {\n return {\n isError: true,\n content: [\n {\n type: \"text\",\n text: \"You do not have access to this styleguide\",\n },\n ],\n };\n }\n\n const results = await searchPages(\n credentials,\n styleguideId,\n searchTerm,\n releaseId,\n clientUserAgent,\n );\n\n if (results.length === 0) {\n return {\n isError: true,\n content: [\n {\n type: \"text\",\n text: \"No pages match that search term, try something else.\",\n },\n ],\n };\n }\n\n if (responseFormat === \"markdown\") {\n return {\n content: [\n {\n type: \"text\",\n text: formatPageListItemsAsMarkdown(results),\n mimeType: \"text/markdown\",\n },\n ],\n };\n }\n\n return {\n content: [\n {\n type: \"text\",\n text: JSON.stringify(results, null, 2),\n mimeType: \"application/json\",\n },\n ],\n };\n },\n );\n}\n"],"names":[],"mappings":"AAAA;;GAEG;;;AAGH,OAAO,CAAC,MAAM,KAAK,CAAC;AAEpB,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AACjE,OAAO,EACL,oBAAoB,EACpB,6BAA6B,EAC7B,wBAAwB,GACzB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAGxD,MAAM,UAAU,qBAAqB,CACnC,MAAiB,EACjB,QAAuB;IAEvB,uBAAuB,CACrB,MAAM,EACN,YAAY,EACZ;QACE,KAAK,EAAE,6BAA6B;QACpC,WAAW,EACT,4OAA4O;QAC9O,WAAW,EAAE;YACX,YAAY,EAAE,CAAC;iBACZ,MAAM,EAAE;iBACR,GAAG,EAAE;iBACL,GAAG,CAAC,CAAC,CAAC;iBACN,QAAQ,CACP,sFAAsF,CACvF;YACH,SAAS,EAAE,CAAC;iBACT,MAAM,EAAE;iBACR,GAAG,EAAE;iBACL,GAAG,CAAC,CAAC,CAAC;iBACN,QAAQ,CACP,0HAA0H,CAC3H;iBACA,QAAQ,EAAE;YACb,UAAU,EAAE,CAAC;iBACV,MAAM,EAAE;iBACR,QAAQ,CACP,gIAAgI,CACjI;iBACA,QAAQ,EAAE;SACd;QACD,WAAW,EAAE;YACX,YAAY,EAAE,IAAI;SACnB;KACF,EACD,KAAK,EACH,EAAE,YAAY,EAAE,SAAS,EAAE,UAAU,EAAE,EACvC,EAAE,QAAQ,EAAE,EACZ,eAAe,EACf,EAAE;QACF,MAAM,WAAW,GAAG,MAAM,cAAc,CAAC,QAAQ,CAAC,CAAC;QACnD,IACE,WAAW,CAAC,IAAI,KAAK,KAAK;YAC1B,WAAW,CAAC,YAAY,KAAK,Y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EAAE,SAAS,EAAE,cAAc,EAAE,EACvD,EAAE,QAAQ,EAAE,EACZ,eAAe,EACf,EAAE;QACF,MAAM,WAAW,GAAG,MAAM,cAAc,CAAC,QAAQ,CAAC,CAAC;QACnD,IACE,WAAW,CAAC,IAAI,KAAK,KAAK;YAC1B,WAAW,CAAC,YAAY,KAAK,YAAY,EACzC,CAAC;YACD,OAAO;gBACL,OAAO,EAAE,IAAI;gBACb,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE,2CAA2C;qBAClD;iBACF;aACF,CAAC;QACJ,CAAC;QAED,MAAM,OAAO,GAAG,MAAM,WAAW,CAC/B,WAAW,EACX,YAAY,EACZ,UAAU,EACV,SAAS,EACT,eAAe,CAChB,CAAC;QAEF,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACzB,OAAO;gBACL,OAAO,EAAE,IAAI;gBACb,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE,sDAAsD;qBAC7D;iBACF;aACF,CAAC;QACJ,CAAC;QAED,IAAI,cAAc,KAAK,UAAU,EAAE,CAAC;YAClC,OAAO;gBACL,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE,6BAA6B,CAAC,OAAO,CAAC;wBAC5C,QAAQ,EAAE,eAAe;qBAC1B;iBACF;aACF,CAAC;QACJ,CAAC;QAED,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;oBACtC,QAAQ,EAAE,kBAAkB;iBAC7B;aACF;SACF,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC","debug_id":"4b7ad593-ae75-5c6a-8904-6365d53e7984"}
{"version":3,"file":"page.js","sources":["tools/page.ts"],"sourceRoot":"/","sourcesContent":["/**\n * Page Tools\n */\n\nimport { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport z from \"zod\";\n\nimport { getPage, searchPages } from \"../api/page.js\";\nimport {\n formatPageAsMarkdown,\n formatPageListItemsAsMarkdown,\n extractImageUrlsFromPage,\n} from \"../common/formatters/page.js\";\nimport { getCredentials } from \"../common/credentials.js\";\nimport { registerTrackedToolCall } from \"../logging.js\";\nimport { ServerContext } from \"../types/server.js\";\n\nexport function registerGetPageTool(\n server: McpServer,\n _context: ServerContext,\n) {\n registerTrackedToolCall(\n server,\n \"get-page\",\n {\n title: \"Get a styleguide page\",\n description:\n \"Fetch guidance from a specific design system page, including usage notes, recommendations, and supporting context.\\n\\n*Particularly helpful ahead of UI generation to increase the likelihood that outputs reflect the intent of the design system.*\\n\\n*If images from the page are needed, call `get-page-images` afterwards with the same page ID to retrieve them as base64-encoded content.*\",\n inputSchema: {\n pageId: z\n .string()\n .describe(\n \"Identifies the page containing relevant guidance. Use `list-pages` to locate it.\",\n ),\n releaseId: z\n .number()\n .int()\n .describe(\n \"Optional. Returns guidelines for the default release if omitted. User can specify when a particular release is relevant.\",\n )\n .optional(),\n },\n annotations: {\n readOnlyHint: true,\n },\n },\n async ({ pageId, releaseId }, { authInfo }, clientUserAgent) => {\n const credentials = await getCredentials(authInfo);\n const page = await getPage(\n credentials,\n pageId,\n { releaseId },\n clientUserAgent,\n );\n\n if (!page) {\n return {\n isError: true,\n content: [\n {\n type: \"text\",\n text: `Could not find the page, check you have the correct page ID${releaseId ? ` and release ID` : \"\"}.`,\n },\n ],\n };\n }\n\n const textContent = formatPageAsMarkdown(page);\n\n return {\n content: [\n {\n type: \"text\",\n text: textContent,\n mimeType: \"text/markdown\",\n },\n ],\n };\n },\n );\n}\n\nexport function registerGetPageImagesTool(\n server: McpServer,\n _context: ServerContext,\n) {\n registerTrackedToolCall(\n server,\n \"get-page-images\",\n {\n title: \"Get images from a styleguide page\",\n description:\n \"Fetch all images from a specific design system page as base64-encoded content.\\n\\n*Call this after `get-page` with the same page ID if images are needed for the task — for example, when referencing visual examples, screenshots, or diagrams from the page.*\",\n inputSchema: {\n pageId: z\n .string()\n .describe(\n \"The page to fetch images from. Use the same page ID as a previous `get-page` call.\",\n ),\n releaseId: z\n .number()\n .int()\n .describe(\n \"Optional. Returns images for the default release if omitted. Should match the release ID used with `get-page`.\",\n )\n .optional(),\n },\n annotations: {\n readOnlyHint: true,\n },\n },\n async ({ pageId, releaseId }, { authInfo }, clientUserAgent) => {\n const credentials = await getCredentials(authInfo);\n const page = await getPage(\n credentials,\n pageId,\n { releaseId },\n clientUserAgent,\n );\n\n if (!page) {\n return {\n isError: true,\n content: [\n {\n type: \"text\",\n text: `Could not find the page, check you have the correct page ID${releaseId ? ` and release ID` : \"\"}.`,\n },\n ],\n };\n }\n\n const textContent = formatPageAsMarkdown(page);\n const images = await extractImageUrlsFromPage(textContent);\n\n if (images.length === 0) {\n return {\n content: [\n {\n type: \"text\",\n text: \"No images found on this page.\",\n },\n ],\n };\n }\n\n return {\n content: images,\n };\n },\n );\n}\n\nexport function registerSearchPagesTool(\n server: McpServer,\n context: ServerContext,\n) {\n if (context.features[\"SKI_2466_bedrock_indexing\"] !== true) {\n return;\n }\n registerTrackedToolCall(\n server,\n \"search-pages\",\n {\n title: \"Search pages in a styleguide\",\n description: \"Search for pages in a styleguide by a search term\",\n inputSchema: {\n styleguideId: z.number().int().min(1),\n releaseId: z.number().int().min(1).optional(),\n searchTerm: z.string(),\n responseFormat: z.enum([\"markdown\", \"json\"]).default(\"json\"),\n },\n annotations: {\n readOnlyHint: true,\n },\n },\n async (\n { styleguideId, searchTerm, releaseId, responseFormat },\n { authInfo },\n clientUserAgent,\n ) => {\n const credentials = await getCredentials(authInfo);\n if (\n credentials.type === \"jwt\" &&\n credentials.styleguideId !== styleguideId\n ) {\n return {\n isError: true,\n content: [\n {\n type: \"text\",\n text: \"You do not have access to this styleguide\",\n },\n ],\n };\n }\n\n const results = await searchPages(\n credentials,\n styleguideId,\n searchTerm,\n releaseId,\n clientUserAgent,\n );\n\n if (results.length === 0) {\n return {\n isError: true,\n content: [\n {\n type: \"text\",\n text: \"No pages match that search term, try something else.\",\n },\n ],\n };\n }\n\n if (responseFormat === \"markdown\") {\n return {\n content: [\n {\n type: \"text\",\n text: formatPageListItemsAsMarkdown(results),\n mimeType: \"text/markdown\",\n },\n ],\n };\n }\n\n return {\n content: [\n {\n type: \"text\",\n text: JSON.stringify(results, null, 2),\n mimeType: \"application/json\",\n },\n ],\n };\n },\n );\n}\n"],"names":[],"mappings":"AAAA;;GAEG;;;AAGH,OAAO,CAAC,MAAM,KAAK,CAAC;AAEpB,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EACL,oBAAoB,EACpB,6BAA6B,EAC7B,wBAAwB,GACzB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAGxD,MAAM,UAAU,mBAAmB,CACjC,MAAiB,EACjB,QAAuB;IAEvB,uBAAuB,CACrB,MAAM,EACN,UAAU,EACV;QACE,KAAK,EAAE,uBAAuB;QAC9B,WAAW,EACT,mYAAmY;QACrY,WAAW,EAAE;YACX,MAAM,EAAE,CAAC;iBACN,MAAM,EAAE;iBACR,QAAQ,CACP,kFAAkF,CACnF;YACH,SAAS,EAAE,CAAC;iBACT,MAAM,EAAE;iBACR,GAAG,EAAE;iBACL,QAAQ,CACP,0HAA0H,CAC3H;iBACA,QAAQ,EAAE;SACd;QACD,WAAW,EAAE;YACX,YAAY,EAAE,IAAI;SACnB;KACF,EACD,KAAK,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,eAAe,EAAE,EAAE;QAC7D,MAAM,WAAW,GAAG,MAAM,cAAc,CAAC,QAAQ,CAAC,CAAC;QACnD,MAAM,IAAI,GAAG,MAAM,OAA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e8-a72b-de2187d3b8d1"}

@@ -5,3 +5,3 @@ /**

!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="ac7b3567-e927-57fc-9ca1-250c0ff89baa")}catch(e){}}();
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="ea2c8fde-6617-5c57-82c6-20a72b823372")}catch(e){}}();
import z from "zod";

@@ -15,3 +15,3 @@ import { getStyleguideTree, listStyleguides } from "../api/styleguide.js";

title: "List styleguides",
description: "Discover available design systems that provide documented guidance for components, patterns, and styles. If multiple systems are available, confirm with the user which should be used.\n\n*Helpful to reference before generating UI so decisions can reflect established design approaches.*",
description: "Discover available design systems that provide documented guidance for components, patterns, and styles. Call this tool first. If multiple systems are available, confirm with the user which should be used.\n\n*Helpful to reference before generating UI so decisions can reflect established design approaches.*",
inputSchema: {},

@@ -46,6 +46,15 @@ annotations: {

}
export function registerGetStyleguideTreeTool(server) {
registerTrackedToolCall(server, "get-styleguide-tree", {
title: "Get styleguide tree",
description: "View the navigation hierarchy of a design system — including categories, pages, and tabs — to better understand how guidance is organized.\n\n*Helpful when determining where to look for component or pattern documentation before generating UI.*",
const pageNodeSchema = z.lazy(() => z.union([
z.object({
id: z
.number()
.describe("The page ID. Use with `get-page` to fetch its content."),
url: z.string().describe("The URL of the page."),
}),
z.record(z.string(), pageNodeSchema),
]));
export function registerListPagesTool(server) {
registerTrackedToolCall(server, "list-pages", {
title: "List pages in a styleguide",
description: "View the navigation hierarchy of a design system — including categories, pages, and tabs — to better understand how guidance is organized. Call this tool immediately after list-styleguides with the desired styleguide ID.\n\n*Helpful when determining where to look for component or pattern documentation before generating UI.*",
inputSchema: {

@@ -58,2 +67,7 @@ styleguideId: z

},
outputSchema: {
pages: z
.record(z.string(), pageNodeSchema)
.describe("A hierarchical navigation tree of the design system. Keys are category or page names. Page leaf nodes have { id, url } properties; category nodes contain further nested objects."),
},
annotations: {

@@ -66,3 +80,7 @@ readOnlyHint: true,

const tree = await getStyleguideTree(credentials, styleguideId, clientUserAgent);
if (tree.length === 0) {
throw new Error("Empty styleguide tree");
}
const formattedTree = formatTreeAsJson(tree);
const structuredContent = { pages: formattedTree };
return {

@@ -72,5 +90,6 @@ content: [

type: "text",
text: JSON.stringify(formattedTree, null, 2),
text: JSON.stringify(structuredContent, null, 2),
},
],
structuredContent,
};

@@ -92,2 +111,2 @@ }

//# sourceMappingURL=styleguide.js.map
//# debugId=ac7b3567-e927-57fc-9ca1-250c0ff89baa
//# debugId=ea2c8fde-6617-5c57-82c6-20a72b823372

@@ -1,1 +0,1 @@

{"version":3,"file":"styleguide.js","sources":["tools/styleguide.ts"],"sourceRoot":"/","sourcesContent":["/**\n * Styleguide Tools\n */\n\nimport { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport z from \"zod\";\n\nimport { getStyleguideTree, listStyleguides } from \"../api/styleguide.js\";\nimport {\n DEFAULT_NAME,\n formatStyleguideListAsMarkdown,\n formatTreeAsJson,\n} from \"../common/formatters/styleguide.js\";\nimport { getCredentials } from \"../common/credentials.js\";\nimport { registerTrackedToolCall } from \"../logging.js\";\n\nexport function registerListStyleguidesTool(server: McpServer) {\n registerTrackedToolCall(\n server,\n \"list-styleguides\",\n {\n title: \"List styleguides\",\n description:\n \"Discover available design systems that provide documented guidance for components, patterns, and styles. If multiple systems are available, confirm with the user which should be used.\\n\\n*Helpful to reference before generating UI so decisions can reflect established design approaches.*\",\n inputSchema: {},\n annotations: {\n readOnlyHint: true,\n },\n },\n async (_, { authInfo }, clientUserAgent) => {\n const credentials = await getCredentials(authInfo);\n const styleguides = await listStyleguides(credentials, clientUserAgent);\n\n if (styleguides.length === 0) {\n return {\n isError: true,\n content: [\n {\n type: \"text\",\n text: \"There are no accessible styleguides. Check your auth credentials and make sure you have at least one styleguide in zeroheight.\",\n },\n ],\n };\n }\n\n return {\n content: [\n {\n type: \"text\",\n text: formatStyleguideListAsMarkdown(styleguides),\n mimeType: \"text/markdown\",\n },\n ],\n };\n }\n );\n}\n\nexport function registerGetStyleguideTreeTool(server: McpServer) {\n registerTrackedToolCall(\n server,\n \"get-styleguide-tree\",\n {\n title: \"Get styleguide tree\",\n description:\n \"View the navigation hierarchy of a design system — including categories, pages, and tabs — to better understand how guidance is organized.\\n\\n*Helpful when determining where to look for component or pattern documentation before generating UI.*\",\n inputSchema: {\n styleguideId: z\n .number()\n .int()\n .min(1)\n .describe(\n \"The design system to reference. Use `list-styleguides` to discover available systems.\",\n ),\n },\n annotations: {\n readOnlyHint: true,\n },\n },\n async ({ styleguideId }, { authInfo }, clientUserAgent) => {\n try {\n const credentials = await getCredentials(authInfo);\n const tree = await getStyleguideTree(credentials, styleguideId, clientUserAgent);\n const formattedTree = formatTreeAsJson(tree);\n\n return {\n content: [\n {\n type: \"text\",\n text: JSON.stringify(formattedTree, null, 2),\n },\n ],\n };\n } catch {\n return {\n isError: true,\n content: [\n {\n type: \"text\",\n text: \"Could not get the navigation tree for this styleguide.\",\n },\n ],\n };\n }\n },\n );\n}\n"],"names":[],"mappings":"AAAA;;GAEG;;;AAGH,OAAO,CAAC,MAAM,KAAK,CAAC;AAEpB,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC1E,OAAO,EAEL,8BAA8B,EAC9B,gBAAgB,GACjB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAExD,MAAM,UAAU,2BAA2B,CAAC,MAAiB;IAC3D,uBAAuB,CACrB,MAAM,EACN,kBAAkB,EAClB;QACE,KA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AAG,MAAM,iBAAiB,CAAC,WAAW,EAAE,YAAY,EAAE,eAAe,CAAC,CAAC;YACjF,MAAM,aAAa,GAAG,gBAAgB,CAAC,IAAI,CAAC,CAAC;YAE7C,OAAO;gBACL,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC;qBAC7C;iBACF;aACF,CAAC;QACJ,CAAC;QAAC,MAAM,CAAC;YACP,OAAO;gBACL,OAAO,EAAE,IAAI;gBACb,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE,wDAAwD;qBAC/D;iBACF;aACF,CAAC;QACJ,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC","debug_id":"ac7b3567-e927-57fc-9ca1-250c0ff89baa"}
{"version":3,"file":"styleguide.js","sources":["tools/styleguide.ts"],"sourceRoot":"/","sourcesContent":["/**\n * Styleguide Tools\n */\n\nimport { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport z from \"zod\";\n\nimport { getStyleguideTree, listStyleguides } from \"../api/styleguide.js\";\nimport {\n DEFAULT_NAME,\n formatStyleguideListAsMarkdown,\n formatTreeAsJson,\n} from \"../common/formatters/styleguide.js\";\nimport { getCredentials } from \"../common/credentials.js\";\nimport { registerTrackedToolCall } from \"../logging.js\";\n\nexport function registerListStyleguidesTool(server: McpServer) {\n registerTrackedToolCall(\n server,\n \"list-styleguides\",\n {\n title: \"List styleguides\",\n description:\n \"Discover available design systems that provide documented guidance for components, patterns, and styles. Call this tool first. If multiple systems are available, confirm with the user which should be used.\\n\\n*Helpful to reference before generating UI so decisions can reflect established design approaches.*\",\n inputSchema: {},\n annotations: {\n readOnlyHint: true,\n },\n },\n async (_, { authInfo }, clientUserAgent) => {\n const credentials = await getCredentials(authInfo);\n const styleguides = await listStyleguides(credentials, clientUserAgent);\n\n if (styleguides.length === 0) {\n return {\n isError: true,\n content: [\n {\n type: \"text\",\n text: \"There are no accessible styleguides. Check your auth credentials and make sure you have at least one styleguide in zeroheight.\",\n },\n ],\n };\n }\n\n return {\n content: [\n {\n type: \"text\",\n text: formatStyleguideListAsMarkdown(styleguides),\n mimeType: \"text/markdown\",\n },\n ],\n };\n },\n );\n}\n\nconst pageNodeSchema: z.ZodType = z.lazy(() =>\n z.union([\n z.object({\n id: z\n .number()\n .describe(\"The page ID. Use with `get-page` to fetch its content.\"),\n url: z.string().describe(\"The URL of the page.\"),\n }),\n z.record(z.string(), pageNodeSchema),\n ]),\n);\n\nexport function registerListPagesTool(server: McpServer) {\n registerTrackedToolCall(\n server,\n \"list-pages\",\n {\n title: \"List pages in a styleguide\",\n description:\n \"View the navigation hierarchy of a design system — including categories, pages, and tabs — to better understand how guidance is organized. Call this tool immediately after list-styleguides with the desired styleguide ID.\\n\\n*Helpful when determining where to look for component or pattern documentation before generating UI.*\",\n inputSchema: {\n styleguideId: z\n .number()\n .int()\n .min(1)\n .describe(\n \"The design system to reference. Use `list-styleguides` to discover available systems.\",\n ),\n },\n outputSchema: {\n pages: z\n .record(z.string(), pageNodeSchema)\n .describe(\n \"A hierarchical navigation tree of the design system. Keys are category or page names. Page leaf nodes have { id, url } properties; category nodes contain further nested objects.\",\n ),\n },\n annotations: {\n readOnlyHint: true,\n },\n },\n async ({ styleguideId }, { authInfo }, clientUserAgent) => {\n try {\n const credentials = await getCredentials(authInfo);\n const tree = await getStyleguideTree(\n credentials,\n styleguideId,\n clientUserAgent,\n );\n\n if (tree.length === 0) {\n throw new Error(\"Empty styleguide tree\");\n }\n\n const formattedTree = formatTreeAsJson(tree);\n const structuredContent = { pages: formattedTree };\n\n return {\n content: [\n {\n type: \"text\",\n text: JSON.stringify(structuredContent, null, 2),\n },\n ],\n structuredContent,\n };\n } catch {\n return {\n isError: true,\n content: [\n {\n type: \"text\",\n text: \"Could not get the navigation tree for this styleguide.\",\n },\n ],\n };\n }\n },\n );\n}\n"],"names":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O,EAAE;oBACP;wBACE,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,iBAAiB,EAAE,IAAI,EAAE,CAAC,CAAC;qBACjD;iBACF;gBACD,iBAAiB;aAClB,CAAC;QACJ,CAAC;QAAC,MAAM,CAAC;YACP,OAAO;gBACL,OAAO,EAAE,IAAI;gBACb,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE,wDAAwD;qBAC/D;iBACF;aACF,CAAC;QACJ,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC","debug_id":"ea2c8fde-6617-5c57-82c6-20a72b823372"}
{
"name": "@zeroheight/mcp-server",
"version": "2.3.0",
"version": "2.4.0",
"description": "MCP server for zeroheight",

@@ -5,0 +5,0 @@ "mcpName": "com.zeroheight/zeroheight",

@@ -46,16 +46,11 @@ # zeroheight MCP Server

**list-styleguides**
Discover available design systems that provide documented guidance for components, patterns, and styles. If multiple systems are available, confirm with the user which should be used.
Discover available design systems that provide documented guidance for components, patterns, and styles. Call this tool first. If multiple systems are available, confirm with the user which should be used.
*Helpful to reference before generating UI so decisions can reflect established design approaches.*
**get-styleguide-tree**
View the navigation hierarchy of a design system — including categories, pages, and tabs — to better understand how guidance is organized.
**list-pages**
View the navigation hierarchy of a design system — including categories, pages, and tabs — to better understand how guidance is organized. Call this tool immediately after list-styleguides with the desired styleguide ID.
*Helpful when determining where to look for component or pattern documentation before generating UI.*
**list-pages**
Explore the pages within a design system to find guidance relevant to the task.
*Useful when generating UI that should align with documented component usage, patterns, or interaction recommendations rather than inferred solutions.*
**get-page**

@@ -62,0 +57,0 @@ Fetch guidance from a specific design system page, including usage notes, recommendations, and supporting context.