@senvenli/mcp 0.3.3 → 0.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/server.js CHANGED
@@ -18,7 +18,7 @@ const themeInputShape = {
18
18
  secondary: z.string().optional().describe("A second brand color, same formats."),
19
19
  tertiary: z.string().optional().describe("A third brand color, same formats."),
20
20
  primaryDark: z.string().optional().describe(`A hand-picked brand color for dark mode, same formats. Leave out to derive it from primary.`),
21
- radius: z.number().min(0).max(2).optional().describe("Base corner radius in rem (default 0.625)."),
21
+ radius: z.number().min(0).max(2).optional().describe("Base corner radius in rem (default 0.375)."),
22
22
  controlShape: z.enum(["rounded", "pill"]).optional().describe('Single-line controls (buttons, fields, badges, segmented controls) follow the radius ("rounded", default) or are fully round ("pill"); cards keep the radius.'),
23
23
  density: z.enum(["compact", "default", "comfortable"]).optional(),
24
24
  borderWidth: z.union([z.literal(0), z.literal(1), z.literal(2)]).optional(),
@@ -1 +1 @@
1
- {"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAC;AACtF,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,YAAY,EAAE,YAAY,EAAE,SAAS,EAAE,UAAU,EAAE,KAAK,EAAE,QAAQ,EAAmD,MAAM,kBAAkB,CAAC;AACnL,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,QAAQ,EAAkB,MAAM,eAAe,CAAC;AACjF,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,MAAM,IAAI,GAAG,6BAA6B,CAAC;AAE3C,MAAM,IAAI,GAAG,CAAC,KAAa,EAAE,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,KAAK,EA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{ McpServer, ResourceTemplate } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport { checkThemeCss, createTheme, decodePreset, encodePreset, formatHex, parseColor, toCSS, toNative, type ContrastCheck, type Theme, type ThemeInput } from \"@senvenli/tokens\";\nimport { z } from \"zod\";\nimport { findComponent, findDoc, registry, type Component } from \"./registry.js\";\nimport { searchComponents } from \"./search.js\";\n\nconst SITE = \"https://design.senvenli.com\";\n\nconst text = (value: string) => ({ content: [{ type: \"text\" as const, text: value }] });\nconst fail = (value: string) => ({ content: [{ type: \"text\" as const, text: value }], isError: true });\n\n/** A component that does not exist: say so, and name the closest ones so the agent can retry. */\nfunction unknownComponent(name: string) {\n const near = searchComponents(registry().components, name, 5).map((hit) => hit.component.name);\n return fail(`No component named \"${name}\".${near.length ? ` Did you mean: ${near.join(\", \")}?` : \" Use search_components or list_components.\"}`);\n}\n\nconst COLOR_FORMATS = 'a hex \"#rrggbb\" (or \"#rgb\") or \"oklch(L C H)\", like \"oklch(0.55 0.15 250)\"';\n\nconst themeInputShape = {\n preset: z.string().optional().describe(\"A preset code from the theme builder (the ?p= value). The other fields override it.\"),\n primary: z.string().optional().describe(`The brand color: ${COLOR_FORMATS}. Leave out for the neutral default.`),\n secondary: z.string().optional().describe(\"A second brand color, same formats.\"),\n tertiary: z.string().optional().describe(\"A third brand color, same formats.\"),\n primaryDark: z.string().optional().describe(`A hand-picked brand color for dark mode, same formats. Leave out to derive it from primary.`),\n radius: z.number().min(0).max(2).optional().describe(\"Base corner radius in rem (default 0.625).\"),\n controlShape: z.enum([\"rounded\", \"pill\"]).optional().describe('Single-line controls (buttons, fields, badges, segmented controls) follow the radius (\"rounded\", default) or are fully round (\"pill\"); cards keep the radius.'),\n density: z.enum([\"compact\", \"default\", \"comfortable\"]).optional(),\n borderWidth: z.union([z.literal(0), z.literal(1), z.literal(2)]).optional(),\n};\ntype ThemeArgs = { preset?: string; primary?: string; secondary?: string; tertiary?: string; primaryDark?: string; radius?: number; controlShape?: ThemeInput[\"controlShape\"]; density?: ThemeInput[\"density\"]; borderWidth?: ThemeInput[\"borderWidth\"] };\n\n/** The engine's input from the tool's arguments, or why it cannot be made (a bad preset code, a color it cannot read). */\nfunction themeInput(args: ThemeArgs): ThemeInput | string {\n let input: ThemeInput = {};\n if (args.preset) {\n const decoded = decodePreset(args.preset);\n if (!decoded) return `Invalid preset code \"${args.preset}\". Copy it from the builder's address (?p=…), or pass the colors instead.`;\n input = decoded;\n }\n for (const key of [\"primary\", \"secondary\", \"tertiary\"] as const) {\n const value = args[key];\n if (value === undefined) continue;\n if (!parseColor(value)) return `${key} \"${value}\" is not a color the engine reads. Use ${COLOR_FORMATS}; names, rgb() and hsl() are not read.`;\n input[key] = value;\n }\n if (args.primaryDark !== undefined) {\n if (!parseColor(args.primaryDark)) return `primaryDark \"${args.primaryDark}\" is not a color the engine reads. Use ${COLOR_FORMATS}.`;\n input.darkColors = { ...input.darkColors, primary: args.primaryDark };\n }\n for (const key of [\"radius\", \"controlShape\", \"density\", \"borderWidth\"] as const) {\n if (args[key] !== undefined) (input as Record<string, unknown>)[key] = args[key];\n }\n return input;\n}\n\nconst failLine = (check: ContrastCheck) => `- FAIL ${check.mode}: ${check.foreground} on ${check.background} = ${check.ratio.toFixed(2)} (needs ${check.required})`;\n\n/** The contrast summary: the count, the failing pairs, and the colors the engine moved. */\nfunction report(theme: Theme): string {\n const failing = theme.checks.filter((check) => !check.pass);\n const lines = [`Contrast: ${theme.checks.length - failing.length} of ${theme.checks.length} pairs pass WCAG AA (light and dark).`, ...failing.map(failLine)];\n for (const role of theme.adjusted) {\n lines.push(`- ${role} was moved to ${formatHex(theme.light[role === \"primary\" ? \"ds-background-brand-bold\" : `ds-background-${role === \"info\" ? \"information\" : role}-bold`]!)} so text on it passes AA.`);\n }\n return lines.join(\"\\n\");\n}\n\n/** The most one component answer should cost an agent's context, in characters (about 5k tokens). */\nconst PAGE_BUDGET = 20_000;\n\n/** The sections of a component page, by the `## ` heading that opens each. The title and intro always come first. */\nconst SECTIONS = {\n example: /^## Example:/,\n examples: /^## Examples(\\n|$)/,\n guidelines: /^## Guidelines(\\n|$)/,\n accessibility: /^## Accessibility(\\n|$)/,\n api: /^## API reference(\\n|$)/,\n related: /^## Related(\\n|$)/,\n} as const;\ntype Section = keyof typeof SECTIONS;\n\nfunction pageSections(markdown: string, wanted: Section[]): string {\n const parts = markdown.split(/\\n(?=## )/);\n const keep = parts.filter((part, index) => index === 0 || wanted.some((section) => SECTIONS[section].test(part)));\n return keep.join(\"\\n\");\n}\n\n/** A manifest's props by export, with the React Aria behavior props or the DOM attributes left out, as asked. */\nfunction manifestFor(manifest: Component[\"manifest\"], props: \"own\" | \"own+aria\" | \"all\", minified: boolean) {\n const origins = props === \"own\" ? [\"own\"] : props === \"own+aria\" ? [\"own\", \"aria\"] : [\"own\", \"aria\", \"dom\"];\n const byExport = (manifest.props ?? {}) as Record<string, (Record<string, unknown> & { origin?: string })[]>;\n const kept: Record<string, unknown[]> = {};\n let dropped = 0;\n for (const [name, list] of Object.entries(byExport)) {\n const shown = list.filter((prop) => origins.includes(prop.origin ?? \"own\"));\n dropped += list.length - shown.length;\n kept[name] = minified ? shown.map(({ schema: _schema, ...rest }) => rest) : shown;\n }\n const { quality: _quality, source: _source, ...rest } = manifest as Record<string, unknown>;\n const out = { ...(minified ? rest : manifest), props: kept, ...(dropped ? { propsLeftOut: `${dropped} ${props === \"own\" ? \"React Aria and DOM\" : \"DOM and ARIA attribute\"} props; pass props: \"all\" for them.` } : {}) };\n return minified ? JSON.stringify(out) : JSON.stringify(out, null, 2);\n}\n\n/**\n * The Senvenli UI MCP server: components (search, pages, manifests, examples), docs and themes, from data bundled at\n * build time. Read-only: it never touches files or the network. One definition serves stdio and Streamable HTTP.\n */\nexport function createServer(): McpServer {\n const data = registry();\n const docSlugs = data.docs.map((doc) => doc.slug) as [string, ...string[]];\n const server = new McpServer(\n { name: \"senvenli-ui\", version: data.reactVersion },\n {\n instructions:\n \"Senvenli UI is a React design system on React Aria (`npm i @senvenli/react`). Find components with search_components, \" +\n \"then read one with get_component before writing code: it has the import, example code, guidelines, accessibility and props. \" +\n \"Use only the props it lists. Setup is get_doc('getting-started'). Themes: create_theme from up to three colors, \" +\n \"validate_theme to check a theme.css for WCAG AA contrast.\",\n },\n );\n\n server.registerTool(\n \"list_components\",\n {\n title: \"List components\",\n description: \"List every Senvenli UI component (name, family, one-line description), or one family's. To browse; search_components finds one by purpose.\",\n inputSchema: { family: z.string().optional().describe(`A family: ${[...new Set(data.components.map((item) => item.family))].join(\", \")}.`) },\n annotations: { readOnlyHint: true },\n },\n async ({ family }) => {\n const items = data.components.filter((item) => !family || item.family === family.trim().toLowerCase());\n if (!items.length) return fail(`No family \"${family}\". Families: ${[...new Set(data.components.map((item) => item.family))].join(\", \")}.`);\n return text(items.map((item) => `${item.name} (${item.family}): ${item.description}`).join(\"\\n\"));\n },\n );\n\n server.registerTool(\n \"search_components\",\n {\n title: \"Search components\",\n description: 'Find components by what they are for (\"date range\", \"upload a file\", \"confirm a delete\") or by export name (\"DatePicker\"). Returns names for get_component, with the import.',\n inputSchema: { query: z.string().min(1), limit: z.number().int().min(1).max(20).optional().describe(\"Default 8.\") },\n annotations: { readOnlyHint: true },\n },\n async ({ query, limit }) => {\n const hits = searchComponents(data.components, query, limit ?? 8);\n if (!hits.length) return text(`No component matches \"${query}\". Try a shorter phrase of what it is for, or list_components.`);\n return text(hits.map(({ component }) => `${component.name} (${component.family}): ${component.description}\\n import { ${component.exports.join(\", \")} } from \"${component.import}\";`).join(\"\\n\"));\n },\n );\n\n server.registerTool(\n \"get_component\",\n {\n title: \"Get a component\",\n description:\n \"Read one component's page as Markdown: import, example code, when to use it (and what instead), do and avoid, accessibility, and props. \" +\n \"Read it before using a component. Pass sections to read less of a long page.\",\n inputSchema: {\n name: z.string().describe('The component name, as search_components gives it: \"date-picker\".'),\n sections: z\n .array(z.enum(Object.keys(SECTIONS) as [Section, ...Section[]]))\n .optional()\n .describe(\"Only these parts (the title, import and intro always come): example (the main one), examples, guidelines, accessibility, api, related. Default: all.\"),\n },\n annotations: { readOnlyHint: true },\n },\n async ({ name, sections }) => {\n const component = findComponent(name);\n if (!component) return unknownComponent(name);\n if (sections?.length) return text(pageSections(component.markdown, sections));\n // A page too long for one answer (a component with several shapes, such as Input) comes without its API\n // reference, and says how to read it; nothing is cut silently.\n if (component.markdown.length <= PAGE_BUDGET) return text(component.markdown);\n const rest = (Object.keys(SECTIONS) as Section[]).filter((section) => section !== \"api\");\n return text(\n `${pageSections(component.markdown, rest)}\\n\\n> The API reference is long: read it with get_component({ name: \"${component.name}\", sections: [\"api\"] }) or get_component_manifest.`,\n );\n },\n );\n\n server.registerTool(\n \"get_component_manifest\",\n {\n title: \"Get a component's manifest\",\n description:\n \"The component's manifest as JSON: exports, usage, a11y, every prop with type, default and origin, tokens and strings. For tools that need structured data; to read, prefer get_component.\",\n inputSchema: {\n name: z.string(),\n props: z.enum([\"own\", \"own+aria\", \"all\"]).optional().describe('Which props: own; own+aria (default: also React Aria behavior props like onPress); all (also DOM and ARIA attributes).'),\n minified: z.boolean().optional().describe(\"Default true: one line, without the JSON Schema of each prop or the build fields.\"),\n },\n annotations: { readOnlyHint: true },\n },\n async ({ name, props, minified }) => {\n const component = findComponent(name);\n if (!component) return unknownComponent(name);\n const answer = manifestFor(component.manifest, props ?? \"own+aria\", minified ?? true);\n // Over the budget by default (a component with several shapes): its own props only, and the note in the JSON\n // (propsLeftOut) says how to ask for the rest.\n if (props === undefined && answer.length > PAGE_BUDGET) return text(manifestFor(component.manifest, \"own\", minified ?? true));\n return text(answer);\n },\n );\n\n server.registerTool(\n \"get_doc\",\n {\n title: \"Get a doc\",\n description: `Read a doc as Markdown. ${data.docs.map((doc) => `${doc.slug}: ${doc.description}`).join(\" \")}`,\n inputSchema: { name: z.enum(docSlugs) },\n annotations: { readOnlyHint: true },\n },\n async ({ name }) => {\n const doc = findDoc(name);\n return doc ? text(doc.markdown) : fail(`No doc \"${name}\". Docs: ${docSlugs.join(\", \")}.`);\n },\n );\n\n server.registerTool(\n \"create_theme\",\n {\n title: \"Create a theme\",\n description:\n \"Make a theme from up to three colors (all optional) and layout settings. Every text pair is checked against WCAG AA in light and dark, \" +\n \"and the engine moves a color that would fail. The default answer is the contrast report and the CLI command that writes theme.css; \" +\n \"ask for format tailwind, css or native to get the file's contents instead.\",\n inputSchema: {\n ...themeInputShape,\n format: z\n .enum([\"command\", \"tailwind\", \"css\", \"native\"])\n .optional()\n .describe(\"command (default): the report and a command to run; tailwind: the CSS with a Tailwind v4 @theme block; css: the variables only; native: hex JSON for React Native.\"),\n },\n annotations: { readOnlyHint: true },\n },\n async (args) => {\n const input = themeInput(args);\n if (typeof input === \"string\") return fail(input);\n const theme = createTheme(input);\n const code = encodePreset(input);\n const format = args.format ?? \"command\";\n const head = [report(theme), `Preset code: ${code}\\nBuilder: ${SITE}/create?p=${code}`];\n if (format === \"command\") {\n return text(\n [...head, `Write theme.css (with the Tailwind block) in the app:\\n\\nnpx @senvenli/cli theme ${code} --tailwind`, \"Then import it after Tailwind: get_doc('getting-started').\"].join(\"\\n\\n\"),\n );\n }\n const output = format === \"native\" ? JSON.stringify(toNative(theme), null, 2) : toCSS(theme, { tailwind: format === \"tailwind\" });\n return text([...head, format === \"native\" ? \"Save as theme.json:\" : \"Save as theme.css and import it after Tailwind (get_doc('getting-started')):\", output].join(\"\\n\\n\"));\n },\n );\n\n server.registerTool(\n \"validate_theme\",\n {\n title: \"Validate a theme\",\n description:\n \"Check a theme.css (as create_theme or the CLI wrote it, edited or not) against WCAG AA: every text, icon and border pair, light and dark. \" +\n \"Lists the failing pairs and any token the CSS lacks.\",\n inputSchema: { css: z.string().min(1).describe(\"The theme's CSS: the :root block and the [data-theme=\\\"dark\\\"] block.\") },\n annotations: { readOnlyHint: true },\n },\n async ({ css }) => {\n const { checks, missing } = checkThemeCss(css);\n if (!checks.length && missing.length) return fail(\"No Senvenli UI tokens (--ds-…) found in this CSS. Pass the theme.css that create_theme or the CLI wrote.\");\n const failing = checks.filter((check) => !check.pass);\n const lines = [`Contrast: ${checks.length - failing.length} of ${checks.length} checked pairs pass WCAG AA.`, ...failing.map(failLine)];\n if (missing.length) lines.push(`Missing or not a color (${missing.length}), so their pairs were not checked: ${missing.map((item) => `${item.token} (${item.mode})`).join(\", \")}.`);\n if (failing.length) lines.push(\"Fix: regenerate with create_theme from the brand colors, or darken (light) / lighten (dark) the failing foreground.\");\n return text(lines.join(\"\\n\"));\n },\n );\n\n server.registerPrompt(\n \"build_form\",\n {\n title: \"Build a form\",\n description: \"Build a form with Senvenli UI components, the way the system wants it: labels, validation, errors and the submit flow.\",\n argsSchema: { form: z.string().describe('What the form is for: \"sign up with email and password\", \"shipping address\".') },\n },\n ({ form }) => ({\n messages: [\n {\n role: \"user\",\n content: {\n type: \"text\",\n text:\n `Build this form with Senvenli UI (@senvenli/react): ${form}\\n\\n` +\n \"1. get_component('form') and get_component('field'), then search_components for each input it needs (dates, phone, password, choices).\\n\" +\n \"2. Read every component you use with get_component before writing it; use only the props it lists.\\n\" +\n \"3. Every field has a visible label; required fields say so; errors are shown on the field and announced, not only in color.\\n\" +\n \"4. One primary submit button; it shows pending state while submitting.\\n\" +\n \"5. Use the design tokens (ds- classes), never raw colors or pixel sizes.\",\n },\n },\n ],\n }),\n );\n\n server.registerPrompt(\n \"theme_app\",\n {\n title: \"Theme an app\",\n description: \"Set up Senvenli UI's theme in an app from its brand colors, checked against WCAG AA.\",\n argsSchema: { colors: z.string().optional().describe('The brand colors, \"#1268ae\" or \"oklch(…)\", up to three. Leave out for the neutral default.') },\n },\n ({ colors }) => ({\n messages: [\n {\n role: \"user\",\n content: {\n type: \"text\",\n text:\n `Theme this app with Senvenli UI${colors ? ` from these brand colors: ${colors}` : \"\"}.\\n\\n` +\n \"1. get_doc('getting-started') for install and where the theme CSS goes; get_doc('theming') for what the colors drive.\\n\" +\n \"2. create_theme with the colors (primary first); run the command it gives, or save its CSS.\\n\" +\n \"3. If a color was moved for contrast, say which and why.\\n\" +\n \"4. If the app's theme.css is edited by hand later, check it with validate_theme.\",\n },\n },\n ],\n }),\n );\n\n server.registerResource(\n \"component\",\n new ResourceTemplate(\"senvenli://components/{name}\", {\n list: async () => ({ resources: data.components.map((item) => ({ uri: `senvenli://components/${item.name}`, name: item.title, description: item.description, mimeType: \"text/markdown\" })) }),\n }),\n { title: \"Component page\", description: \"A component's page as Markdown.\", mimeType: \"text/markdown\" },\n async (uri, { name }) => {\n const component = findComponent(String(name));\n return { contents: [{ uri: uri.href, mimeType: \"text/markdown\", text: component?.markdown ?? `No component named \"${name}\".` }] };\n },\n );\n\n server.registerResource(\n \"doc\",\n new ResourceTemplate(\"senvenli://docs/{name}\", {\n list: async () => ({ resources: data.docs.map((doc) => ({ uri: `senvenli://docs/${doc.slug}`, name: doc.title, description: doc.description, mimeType: \"text/markdown\" })) }),\n }),\n { title: \"Doc\", description: \"A doc as Markdown.\", mimeType: \"text/markdown\" },\n async (uri, { name }) => {\n const doc = findDoc(String(name));\n return { contents: [{ uri: uri.href, mimeType: \"text/markdown\", text: doc?.markdown ?? `No doc named \"${name}\".` }] };\n },\n );\n\n return server;\n}\n"]}
1
+ {"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAC;AACtF,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,YAAY,EAAE,YAAY,EAAE,SAAS,EAAE,UAAU,EAAE,KAAK,EAAE,QAAQ,EAAmD,MAAM,kBAAkB,CAAC;AACnL,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,QAAQ,EAAkB,MAAM,eAAe,CAAC;AACjF,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,MAAM,IAAI,GAAG,6BAA6B,CAAC;AAE3C,MAAM,IAAI,GAAG,CAAC,KAAa,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AAI,EAAE,CAAC,EAAE,CAAC;IACxH,CAAC,CACF,CAAC;IAEF,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import { McpServer, ResourceTemplate } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport { checkThemeCss, createTheme, decodePreset, encodePreset, formatHex, parseColor, toCSS, toNative, type ContrastCheck, type Theme, type ThemeInput } from \"@senvenli/tokens\";\nimport { z } from \"zod\";\nimport { findComponent, findDoc, registry, type Component } from \"./registry.js\";\nimport { searchComponents } from \"./search.js\";\n\nconst SITE = \"https://design.senvenli.com\";\n\nconst text = (value: string) => ({ content: [{ type: \"text\" as const, text: value }] });\nconst fail = (value: string) => ({ content: [{ type: \"text\" as const, text: value }], isError: true });\n\n/** A component that does not exist: say so, and name the closest ones so the agent can retry. */\nfunction unknownComponent(name: string) {\n const near = searchComponents(registry().components, name, 5).map((hit) => hit.component.name);\n return fail(`No component named \"${name}\".${near.length ? ` Did you mean: ${near.join(\", \")}?` : \" Use search_components or list_components.\"}`);\n}\n\nconst COLOR_FORMATS = 'a hex \"#rrggbb\" (or \"#rgb\") or \"oklch(L C H)\", like \"oklch(0.55 0.15 250)\"';\n\nconst themeInputShape = {\n preset: z.string().optional().describe(\"A preset code from the theme builder (the ?p= value). The other fields override it.\"),\n primary: z.string().optional().describe(`The brand color: ${COLOR_FORMATS}. Leave out for the neutral default.`),\n secondary: z.string().optional().describe(\"A second brand color, same formats.\"),\n tertiary: z.string().optional().describe(\"A third brand color, same formats.\"),\n primaryDark: z.string().optional().describe(`A hand-picked brand color for dark mode, same formats. Leave out to derive it from primary.`),\n radius: z.number().min(0).max(2).optional().describe(\"Base corner radius in rem (default 0.375).\"),\n controlShape: z.enum([\"rounded\", \"pill\"]).optional().describe('Single-line controls (buttons, fields, badges, segmented controls) follow the radius (\"rounded\", default) or are fully round (\"pill\"); cards keep the radius.'),\n density: z.enum([\"compact\", \"default\", \"comfortable\"]).optional(),\n borderWidth: z.union([z.literal(0), z.literal(1), z.literal(2)]).optional(),\n};\ntype ThemeArgs = { preset?: string; primary?: string; secondary?: string; tertiary?: string; primaryDark?: string; radius?: number; controlShape?: ThemeInput[\"controlShape\"]; density?: ThemeInput[\"density\"]; borderWidth?: ThemeInput[\"borderWidth\"] };\n\n/** The engine's input from the tool's arguments, or why it cannot be made (a bad preset code, a color it cannot read). */\nfunction themeInput(args: ThemeArgs): ThemeInput | string {\n let input: ThemeInput = {};\n if (args.preset) {\n const decoded = decodePreset(args.preset);\n if (!decoded) return `Invalid preset code \"${args.preset}\". Copy it from the builder's address (?p=…), or pass the colors instead.`;\n input = decoded;\n }\n for (const key of [\"primary\", \"secondary\", \"tertiary\"] as const) {\n const value = args[key];\n if (value === undefined) continue;\n if (!parseColor(value)) return `${key} \"${value}\" is not a color the engine reads. Use ${COLOR_FORMATS}; names, rgb() and hsl() are not read.`;\n input[key] = value;\n }\n if (args.primaryDark !== undefined) {\n if (!parseColor(args.primaryDark)) return `primaryDark \"${args.primaryDark}\" is not a color the engine reads. Use ${COLOR_FORMATS}.`;\n input.darkColors = { ...input.darkColors, primary: args.primaryDark };\n }\n for (const key of [\"radius\", \"controlShape\", \"density\", \"borderWidth\"] as const) {\n if (args[key] !== undefined) (input as Record<string, unknown>)[key] = args[key];\n }\n return input;\n}\n\nconst failLine = (check: ContrastCheck) => `- FAIL ${check.mode}: ${check.foreground} on ${check.background} = ${check.ratio.toFixed(2)} (needs ${check.required})`;\n\n/** The contrast summary: the count, the failing pairs, and the colors the engine moved. */\nfunction report(theme: Theme): string {\n const failing = theme.checks.filter((check) => !check.pass);\n const lines = [`Contrast: ${theme.checks.length - failing.length} of ${theme.checks.length} pairs pass WCAG AA (light and dark).`, ...failing.map(failLine)];\n for (const role of theme.adjusted) {\n lines.push(`- ${role} was moved to ${formatHex(theme.light[role === \"primary\" ? \"ds-background-brand-bold\" : `ds-background-${role === \"info\" ? \"information\" : role}-bold`]!)} so text on it passes AA.`);\n }\n return lines.join(\"\\n\");\n}\n\n/** The most one component answer should cost an agent's context, in characters (about 5k tokens). */\nconst PAGE_BUDGET = 20_000;\n\n/** The sections of a component page, by the `## ` heading that opens each. The title and intro always come first. */\nconst SECTIONS = {\n example: /^## Example:/,\n examples: /^## Examples(\\n|$)/,\n guidelines: /^## Guidelines(\\n|$)/,\n accessibility: /^## Accessibility(\\n|$)/,\n api: /^## API reference(\\n|$)/,\n related: /^## Related(\\n|$)/,\n} as const;\ntype Section = keyof typeof SECTIONS;\n\nfunction pageSections(markdown: string, wanted: Section[]): string {\n const parts = markdown.split(/\\n(?=## )/);\n const keep = parts.filter((part, index) => index === 0 || wanted.some((section) => SECTIONS[section].test(part)));\n return keep.join(\"\\n\");\n}\n\n/** A manifest's props by export, with the React Aria behavior props or the DOM attributes left out, as asked. */\nfunction manifestFor(manifest: Component[\"manifest\"], props: \"own\" | \"own+aria\" | \"all\", minified: boolean) {\n const origins = props === \"own\" ? [\"own\"] : props === \"own+aria\" ? [\"own\", \"aria\"] : [\"own\", \"aria\", \"dom\"];\n const byExport = (manifest.props ?? {}) as Record<string, (Record<string, unknown> & { origin?: string })[]>;\n const kept: Record<string, unknown[]> = {};\n let dropped = 0;\n for (const [name, list] of Object.entries(byExport)) {\n const shown = list.filter((prop) => origins.includes(prop.origin ?? \"own\"));\n dropped += list.length - shown.length;\n kept[name] = minified ? shown.map(({ schema: _schema, ...rest }) => rest) : shown;\n }\n const { quality: _quality, source: _source, ...rest } = manifest as Record<string, unknown>;\n const out = { ...(minified ? rest : manifest), props: kept, ...(dropped ? { propsLeftOut: `${dropped} ${props === \"own\" ? \"React Aria and DOM\" : \"DOM and ARIA attribute\"} props; pass props: \"all\" for them.` } : {}) };\n return minified ? JSON.stringify(out) : JSON.stringify(out, null, 2);\n}\n\n/**\n * The Senvenli UI MCP server: components (search, pages, manifests, examples), docs and themes, from data bundled at\n * build time. Read-only: it never touches files or the network. One definition serves stdio and Streamable HTTP.\n */\nexport function createServer(): McpServer {\n const data = registry();\n const docSlugs = data.docs.map((doc) => doc.slug) as [string, ...string[]];\n const server = new McpServer(\n { name: \"senvenli-ui\", version: data.reactVersion },\n {\n instructions:\n \"Senvenli UI is a React design system on React Aria (`npm i @senvenli/react`). Find components with search_components, \" +\n \"then read one with get_component before writing code: it has the import, example code, guidelines, accessibility and props. \" +\n \"Use only the props it lists. Setup is get_doc('getting-started'). Themes: create_theme from up to three colors, \" +\n \"validate_theme to check a theme.css for WCAG AA contrast.\",\n },\n );\n\n server.registerTool(\n \"list_components\",\n {\n title: \"List components\",\n description: \"List every Senvenli UI component (name, family, one-line description), or one family's. To browse; search_components finds one by purpose.\",\n inputSchema: { family: z.string().optional().describe(`A family: ${[...new Set(data.components.map((item) => item.family))].join(\", \")}.`) },\n annotations: { readOnlyHint: true },\n },\n async ({ family }) => {\n const items = data.components.filter((item) => !family || item.family === family.trim().toLowerCase());\n if (!items.length) return fail(`No family \"${family}\". Families: ${[...new Set(data.components.map((item) => item.family))].join(\", \")}.`);\n return text(items.map((item) => `${item.name} (${item.family}): ${item.description}`).join(\"\\n\"));\n },\n );\n\n server.registerTool(\n \"search_components\",\n {\n title: \"Search components\",\n description: 'Find components by what they are for (\"date range\", \"upload a file\", \"confirm a delete\") or by export name (\"DatePicker\"). Returns names for get_component, with the import.',\n inputSchema: { query: z.string().min(1), limit: z.number().int().min(1).max(20).optional().describe(\"Default 8.\") },\n annotations: { readOnlyHint: true },\n },\n async ({ query, limit }) => {\n const hits = searchComponents(data.components, query, limit ?? 8);\n if (!hits.length) return text(`No component matches \"${query}\". Try a shorter phrase of what it is for, or list_components.`);\n return text(hits.map(({ component }) => `${component.name} (${component.family}): ${component.description}\\n import { ${component.exports.join(\", \")} } from \"${component.import}\";`).join(\"\\n\"));\n },\n );\n\n server.registerTool(\n \"get_component\",\n {\n title: \"Get a component\",\n description:\n \"Read one component's page as Markdown: import, example code, when to use it (and what instead), do and avoid, accessibility, and props. \" +\n \"Read it before using a component. Pass sections to read less of a long page.\",\n inputSchema: {\n name: z.string().describe('The component name, as search_components gives it: \"date-picker\".'),\n sections: z\n .array(z.enum(Object.keys(SECTIONS) as [Section, ...Section[]]))\n .optional()\n .describe(\"Only these parts (the title, import and intro always come): example (the main one), examples, guidelines, accessibility, api, related. Default: all.\"),\n },\n annotations: { readOnlyHint: true },\n },\n async ({ name, sections }) => {\n const component = findComponent(name);\n if (!component) return unknownComponent(name);\n if (sections?.length) return text(pageSections(component.markdown, sections));\n // A page too long for one answer (a component with several shapes, such as Input) comes without its API\n // reference, and says how to read it; nothing is cut silently.\n if (component.markdown.length <= PAGE_BUDGET) return text(component.markdown);\n const rest = (Object.keys(SECTIONS) as Section[]).filter((section) => section !== \"api\");\n return text(\n `${pageSections(component.markdown, rest)}\\n\\n> The API reference is long: read it with get_component({ name: \"${component.name}\", sections: [\"api\"] }) or get_component_manifest.`,\n );\n },\n );\n\n server.registerTool(\n \"get_component_manifest\",\n {\n title: \"Get a component's manifest\",\n description:\n \"The component's manifest as JSON: exports, usage, a11y, every prop with type, default and origin, tokens and strings. For tools that need structured data; to read, prefer get_component.\",\n inputSchema: {\n name: z.string(),\n props: z.enum([\"own\", \"own+aria\", \"all\"]).optional().describe('Which props: own; own+aria (default: also React Aria behavior props like onPress); all (also DOM and ARIA attributes).'),\n minified: z.boolean().optional().describe(\"Default true: one line, without the JSON Schema of each prop or the build fields.\"),\n },\n annotations: { readOnlyHint: true },\n },\n async ({ name, props, minified }) => {\n const component = findComponent(name);\n if (!component) return unknownComponent(name);\n const answer = manifestFor(component.manifest, props ?? \"own+aria\", minified ?? true);\n // Over the budget by default (a component with several shapes): its own props only, and the note in the JSON\n // (propsLeftOut) says how to ask for the rest.\n if (props === undefined && answer.length > PAGE_BUDGET) return text(manifestFor(component.manifest, \"own\", minified ?? true));\n return text(answer);\n },\n );\n\n server.registerTool(\n \"get_doc\",\n {\n title: \"Get a doc\",\n description: `Read a doc as Markdown. ${data.docs.map((doc) => `${doc.slug}: ${doc.description}`).join(\" \")}`,\n inputSchema: { name: z.enum(docSlugs) },\n annotations: { readOnlyHint: true },\n },\n async ({ name }) => {\n const doc = findDoc(name);\n return doc ? text(doc.markdown) : fail(`No doc \"${name}\". Docs: ${docSlugs.join(\", \")}.`);\n },\n );\n\n server.registerTool(\n \"create_theme\",\n {\n title: \"Create a theme\",\n description:\n \"Make a theme from up to three colors (all optional) and layout settings. Every text pair is checked against WCAG AA in light and dark, \" +\n \"and the engine moves a color that would fail. The default answer is the contrast report and the CLI command that writes theme.css; \" +\n \"ask for format tailwind, css or native to get the file's contents instead.\",\n inputSchema: {\n ...themeInputShape,\n format: z\n .enum([\"command\", \"tailwind\", \"css\", \"native\"])\n .optional()\n .describe(\"command (default): the report and a command to run; tailwind: the CSS with a Tailwind v4 @theme block; css: the variables only; native: hex JSON for React Native.\"),\n },\n annotations: { readOnlyHint: true },\n },\n async (args) => {\n const input = themeInput(args);\n if (typeof input === \"string\") return fail(input);\n const theme = createTheme(input);\n const code = encodePreset(input);\n const format = args.format ?? \"command\";\n const head = [report(theme), `Preset code: ${code}\\nBuilder: ${SITE}/create?p=${code}`];\n if (format === \"command\") {\n return text(\n [...head, `Write theme.css (with the Tailwind block) in the app:\\n\\nnpx @senvenli/cli theme ${code} --tailwind`, \"Then import it after Tailwind: get_doc('getting-started').\"].join(\"\\n\\n\"),\n );\n }\n const output = format === \"native\" ? JSON.stringify(toNative(theme), null, 2) : toCSS(theme, { tailwind: format === \"tailwind\" });\n return text([...head, format === \"native\" ? \"Save as theme.json:\" : \"Save as theme.css and import it after Tailwind (get_doc('getting-started')):\", output].join(\"\\n\\n\"));\n },\n );\n\n server.registerTool(\n \"validate_theme\",\n {\n title: \"Validate a theme\",\n description:\n \"Check a theme.css (as create_theme or the CLI wrote it, edited or not) against WCAG AA: every text, icon and border pair, light and dark. \" +\n \"Lists the failing pairs and any token the CSS lacks.\",\n inputSchema: { css: z.string().min(1).describe(\"The theme's CSS: the :root block and the [data-theme=\\\"dark\\\"] block.\") },\n annotations: { readOnlyHint: true },\n },\n async ({ css }) => {\n const { checks, missing } = checkThemeCss(css);\n if (!checks.length && missing.length) return fail(\"No Senvenli UI tokens (--ds-…) found in this CSS. Pass the theme.css that create_theme or the CLI wrote.\");\n const failing = checks.filter((check) => !check.pass);\n const lines = [`Contrast: ${checks.length - failing.length} of ${checks.length} checked pairs pass WCAG AA.`, ...failing.map(failLine)];\n if (missing.length) lines.push(`Missing or not a color (${missing.length}), so their pairs were not checked: ${missing.map((item) => `${item.token} (${item.mode})`).join(\", \")}.`);\n if (failing.length) lines.push(\"Fix: regenerate with create_theme from the brand colors, or darken (light) / lighten (dark) the failing foreground.\");\n return text(lines.join(\"\\n\"));\n },\n );\n\n server.registerPrompt(\n \"build_form\",\n {\n title: \"Build a form\",\n description: \"Build a form with Senvenli UI components, the way the system wants it: labels, validation, errors and the submit flow.\",\n argsSchema: { form: z.string().describe('What the form is for: \"sign up with email and password\", \"shipping address\".') },\n },\n ({ form }) => ({\n messages: [\n {\n role: \"user\",\n content: {\n type: \"text\",\n text:\n `Build this form with Senvenli UI (@senvenli/react): ${form}\\n\\n` +\n \"1. get_component('form') and get_component('field'), then search_components for each input it needs (dates, phone, password, choices).\\n\" +\n \"2. Read every component you use with get_component before writing it; use only the props it lists.\\n\" +\n \"3. Every field has a visible label; required fields say so; errors are shown on the field and announced, not only in color.\\n\" +\n \"4. One primary submit button; it shows pending state while submitting.\\n\" +\n \"5. Use the design tokens (ds- classes), never raw colors or pixel sizes.\",\n },\n },\n ],\n }),\n );\n\n server.registerPrompt(\n \"theme_app\",\n {\n title: \"Theme an app\",\n description: \"Set up Senvenli UI's theme in an app from its brand colors, checked against WCAG AA.\",\n argsSchema: { colors: z.string().optional().describe('The brand colors, \"#1268ae\" or \"oklch(…)\", up to three. Leave out for the neutral default.') },\n },\n ({ colors }) => ({\n messages: [\n {\n role: \"user\",\n content: {\n type: \"text\",\n text:\n `Theme this app with Senvenli UI${colors ? ` from these brand colors: ${colors}` : \"\"}.\\n\\n` +\n \"1. get_doc('getting-started') for install and where the theme CSS goes; get_doc('theming') for what the colors drive.\\n\" +\n \"2. create_theme with the colors (primary first); run the command it gives, or save its CSS.\\n\" +\n \"3. If a color was moved for contrast, say which and why.\\n\" +\n \"4. If the app's theme.css is edited by hand later, check it with validate_theme.\",\n },\n },\n ],\n }),\n );\n\n server.registerResource(\n \"component\",\n new ResourceTemplate(\"senvenli://components/{name}\", {\n list: async () => ({ resources: data.components.map((item) => ({ uri: `senvenli://components/${item.name}`, name: item.title, description: item.description, mimeType: \"text/markdown\" })) }),\n }),\n { title: \"Component page\", description: \"A component's page as Markdown.\", mimeType: \"text/markdown\" },\n async (uri, { name }) => {\n const component = findComponent(String(name));\n return { contents: [{ uri: uri.href, mimeType: \"text/markdown\", text: component?.markdown ?? `No component named \"${name}\".` }] };\n },\n );\n\n server.registerResource(\n \"doc\",\n new ResourceTemplate(\"senvenli://docs/{name}\", {\n list: async () => ({ resources: data.docs.map((doc) => ({ uri: `senvenli://docs/${doc.slug}`, name: doc.title, description: doc.description, mimeType: \"text/markdown\" })) }),\n }),\n { title: \"Doc\", description: \"A doc as Markdown.\", mimeType: \"text/markdown\" },\n async (uri, { name }) => {\n const doc = findDoc(String(name));\n return { contents: [{ uri: uri.href, mimeType: \"text/markdown\", text: doc?.markdown ?? `No doc named \"${name}\".` }] };\n },\n );\n\n return server;\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@senvenli/mcp",
3
- "version": "0.3.3",
3
+ "version": "0.3.4",
4
4
  "description": "MCP server for building with Senvenli UI from AI coding agents: components, examples, docs and themes.",
5
5
  "license": "MIT",
6
6
  "author": "Senvenli",
@@ -40,7 +40,7 @@
40
40
  "dependencies": {
41
41
  "@modelcontextprotocol/sdk": "1.32.2",
42
42
  "zod": "4.6.7",
43
- "@senvenli/tokens": "^0.3.3"
43
+ "@senvenli/tokens": "^0.3.4"
44
44
  },
45
45
  "engines": {
46
46
  "node": ">=20"