@keystoneui/mcp 0.2.0-beta.7 → 0.2.0-beta.9

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/README.md CHANGED
@@ -54,13 +54,13 @@ npx @keystoneui/mcp theme k1_slate_0.55_0.2_262.5_large_inter
54
54
  |---|---|
55
55
  | `init [--client <name>]` | Configure MCP client |
56
56
  | `search <query> [--type T] [--limit N]` | Fuzzy search components, blocks, kits, named examples |
57
- | `list [--type T] [--limit N] [--offset N]` | List items (`T` = `ui` \| `block` \| `example` \| `kit` \| `style` \| `theme` \| `item`) |
57
+ | `list [--type T] [--limit N] [--offset N]` | List items (`T` = `ui` \| `block` \| `example` \| `kit` \| `hook` \| `style` \| `theme` \| `font` \| `item`) |
58
58
  | `view <name> [<name>...]` | Show the source of components, blocks, kits or package flavours |
59
59
  | `examples <name>` | All demo files for a component or block |
60
60
  | `docs <name> [--type component\|block]` | Fetch the LLM-resolved MDX page (`/llms.mdx/docs/{components\|blocks}/<name>`); a kit or package flavour resolves to the section that documents it |
61
61
  | `audit [--theme [css]] [--strict]` | Print the post-install checklist, or measure every text/surface token pair in your theme against WCAG AA |
62
62
  | `blocks [<filter>]` | List or filter full-page blocks; an exact block name views it. Kits are listed with `list --type kit` |
63
- | `theme <code> [--only theme,font]` | Decode a theme-builder code and print its `shadcn add` command |
63
+ | `theme <code> [--only theme,font,density]` | Decode a theme-builder code (`k1_…`, or `k2_…` with a heading font or compact density) and print its `shadcn add` command, optionally for some parts only |
64
64
 
65
65
  Run `keystoneui help` for the full list. Without any verb the binary launches the MCP stdio server.
66
66
 
@@ -486,14 +486,65 @@ function metaLines(item, docsUrl, flavours) {
486
486
  }
487
487
 
488
488
  // src/theme.ts
489
- var THEME_CODE_RE = /^k1_([a-z]+)_(\d+(?:\.\d+)?)_(\d+(?:\.\d+)?)_(\d+(?:\.\d+)?)_([a-z]+)_([a-z-]+)$/;
489
+ var K1_CODE_RE = /^k1_([a-z]+)_(\d+(?:\.\d+)?)_(\d+(?:\.\d+)?)_(\d+(?:\.\d+)?)_([a-z]+)_([a-z-]+)$/;
490
+ var K2_CODE_RE = /^k2_([a-z]+)_(\d+(?:\.\d+)?)_(\d+(?:\.\d+)?)_(\d+(?:\.\d+)?)_([a-z]+)_([a-z-]+)_([a-z-]+)_([a-z]+)$/;
491
+ var THEME_PARTS = ["theme", "font", "density"];
492
+ function matchThemeCode(code) {
493
+ const k1 = K1_CODE_RE.exec(code);
494
+ if (k1) {
495
+ const [, base, primaryL, primaryC, primaryH, radius, font] = k1;
496
+ return {
497
+ base,
498
+ density: "default",
499
+ font,
500
+ heading: font,
501
+ primaryC,
502
+ primaryH,
503
+ primaryL,
504
+ radius
505
+ };
506
+ }
507
+ const k2 = K2_CODE_RE.exec(code);
508
+ if (k2) {
509
+ const [
510
+ ,
511
+ base,
512
+ primaryL,
513
+ primaryC,
514
+ primaryH,
515
+ radius,
516
+ font,
517
+ heading,
518
+ density
519
+ ] = k2;
520
+ return {
521
+ base,
522
+ density,
523
+ font,
524
+ heading,
525
+ primaryC,
526
+ primaryH,
527
+ primaryL,
528
+ radius
529
+ };
530
+ }
531
+ return null;
532
+ }
490
533
  function parseThemeCode(code) {
491
- const match = THEME_CODE_RE.exec(code);
492
- if (!match) {
534
+ const fields = matchThemeCode(code);
535
+ if (!fields) {
493
536
  return null;
494
537
  }
495
- const [, base, l, c, h, radius, font] = match;
496
- return { base, font, primary: `oklch(${l} ${c} ${h})`, radius };
538
+ const { base, density, font, heading, radius } = fields;
539
+ const { primaryL: l, primaryC: c, primaryH: h } = fields;
540
+ return {
541
+ base,
542
+ density,
543
+ font,
544
+ heading,
545
+ primary: `oklch(${l} ${c} ${h})`,
546
+ radius
547
+ };
497
548
  }
498
549
  function themeInstallUrl(code, siteUrl, only = []) {
499
550
  const query = only.length > 0 ? `?only=${only.join(",")}` : "";
@@ -503,11 +554,11 @@ function themeInstallCommand(code, siteUrl, only = []) {
503
554
  return `npx shadcn@latest add ${shellWord(themeInstallUrl(code, siteUrl, only))}`;
504
555
  }
505
556
  function themeBuilderUrl(code, siteUrl) {
506
- const match = THEME_CODE_RE.exec(code);
507
- if (!match) {
557
+ const fields = matchThemeCode(code);
558
+ if (!fields) {
508
559
  return null;
509
560
  }
510
- const [, base, primaryL, primaryC, primaryH, radius, font] = match;
561
+ const { base, primaryL, primaryC, primaryH, radius, font } = fields;
511
562
  const params = new URLSearchParams({
512
563
  base,
513
564
  primaryL,
@@ -516,13 +567,19 @@ function themeBuilderUrl(code, siteUrl) {
516
567
  radius,
517
568
  font
518
569
  });
570
+ if (K2_CODE_RE.test(code)) {
571
+ params.set("heading", fields.heading);
572
+ params.set("density", fields.density);
573
+ }
519
574
  return `${siteUrl}/theme-builder?${params}`;
520
575
  }
521
576
  function parseThemeParts(value) {
522
577
  if (!value) {
523
578
  return [];
524
579
  }
525
- return value.split(",").map((part) => part.trim()).filter((part) => part === "theme" || part === "font");
580
+ return value.split(",").map((part) => part.trim()).filter(
581
+ (part) => THEME_PARTS.includes(part)
582
+ );
526
583
  }
527
584
 
528
585
  // src/item-name.ts
@@ -531,7 +588,7 @@ var ENCODED_DOT = /%2e/gi;
531
588
  var TRAILING_SPACES = / +$/;
532
589
  var ONLY_PARAM = /^(.*?)\?only=([^&#]*)/s;
533
590
  var THEME_CODE = /^theme\/(.+)$/s;
534
- var THEME_PARTS = /* @__PURE__ */ new Set(["theme", "font", "theme,font", "font,theme"]);
591
+ var THEME_PARTS2 = /^(?:theme|font|density)(?:,(?:theme|font|density)){0,2}$/;
535
592
  function shownName(name) {
536
593
  return shown(name);
537
594
  }
@@ -578,7 +635,7 @@ function onlyMessage(name) {
578
635
  }
579
636
  const [, base, only] = match;
580
637
  const code = THEME_CODE.exec(base)?.[1];
581
- const cli = code && parseThemeCode(code) && THEME_PARTS.has(only) ? ` (CLI: keystoneui theme ${shellWord(code)} --only ${shellWord(only)})` : "";
638
+ const cli = code && parseThemeCode(code) && THEME_PARTS2.test(only) ? ` (CLI: keystoneui theme ${shellWord(code)} --only ${shellWord(only)})` : "";
582
639
  return `**${shown(name)}**: ?only is not part of a name: get the command for ${shown(base)}, then append ?only=${shown(only)} to the printed URL${cli}.`;
583
640
  }
584
641
  function nameRefusal(name, label = "") {
@@ -860,8 +917,10 @@ var ITEM_TYPES = [
860
917
  "block",
861
918
  "example",
862
919
  "kit",
920
+ "hook",
863
921
  "style",
864
922
  "theme",
923
+ "font",
865
924
  "item"
866
925
  ];
867
926
  function registryType(type) {
@@ -877,7 +936,7 @@ var listComponentsSchema = z.object({
877
936
  limit: z.number().min(1).max(100).default(20).describe("Maximum number of items to return"),
878
937
  offset: z.number().min(0).default(0).describe("Number of items to skip"),
879
938
  type: z.enum(ITEM_TYPES).optional().describe(
880
- "Filter by item type: 'ui' for components, 'block' for full-page blocks, 'example' for named demo variants like 'table-with-pagination', 'kit' for pieces taken from a block and installable on their own (such as 'sidebar' or 'filter-pills'), and 'style' | 'theme' | 'item' for those registry types"
939
+ "Filter by item type: 'ui' for components, 'block' for full-page blocks, 'example' for named demo variants like 'table-with-pagination', 'kit' for pieces taken from a block and installable on their own (such as 'sidebar' or 'filter-pills'), 'hook' for React hooks such as 'use-media-query', 'font' for font items such as 'font-inter' (body font) and 'font-heading-inter' (heading font), and 'style' | 'theme' | 'item' for those registry types"
881
940
  ),
882
941
  category: z.string().optional().describe(
883
942
  "Filter by category (e.g. 'authentication', 'login', 'signup', 'navigation', 'data', 'dashboard', 'admin', 'betting'). Blocks and kits carry categories; components and examples do not."
@@ -902,7 +961,7 @@ var searchComponentsSchema = z.object({
902
961
  query: z.string().describe("Search query (name, description, or keywords)"),
903
962
  limit: z.number().min(1).max(50).default(10).describe("Maximum number of results"),
904
963
  type: z.enum(ITEM_TYPES).optional().describe(
905
- "Filter by item type: 'ui' for components, 'block' for full-page blocks, 'example' for named demo variants, 'kit' for pieces taken from a block and installable on their own, and 'style' | 'theme' | 'item' for those registry types"
964
+ "Filter by item type: 'ui' for components, 'block' for full-page blocks, 'example' for named demo variants, 'kit' for pieces taken from a block and installable on their own, 'hook' for React hooks, 'font' for font items, and 'style' | 'theme' | 'item' for those registry types"
906
965
  ),
907
966
  category: z.string().optional().describe(
908
967
  "Filter by category (e.g. 'authentication', 'login'). Blocks and kits carry categories; components and examples do not."
@@ -1216,7 +1275,10 @@ ${commandBlock(defaultStyleUrl)}
1216
1275
 
1217
1276
  The theme builder (${shown(config.docsUrl)}/theme-builder) encodes a theme as a code,
1218
1277
  \`k1_<base>_<L>_<C>_<H>_<radius>_<font>\`, served as a \`registry:theme\` item.
1219
- Install one, or only its colours (\`?only=theme\`) or font (\`?only=font\`):
1278
+ A theme with a heading font (\`--font-heading\`) or compact density gets a k2 code,
1279
+ \`k2_<base>_<L>_<C>_<H>_<radius>_<font>_<heading>_<density>\`.
1280
+ Install one, or only its colours (\`?only=theme\`), fonts (\`?only=font\`) or
1281
+ density (\`?only=density\`, the same \`--ks-control-*\` values as \`density/compact\`):
1220
1282
  ${commandBlock(themeUrl, themeProbeUrl)}
1221
1283
  \`keystoneui theme <code>\` prints the decoded settings and this command.`;
1222
1284
  }
package/dist/index.js CHANGED
@@ -22,7 +22,7 @@ import {
22
22
  themeInstallCommand,
23
23
  themeInstallUrl,
24
24
  viewComponentTool
25
- } from "./chunk-NRQEEI2I.js";
25
+ } from "./chunk-UE7WY4AA.js";
26
26
 
27
27
  // src/cli.ts
28
28
  import { existsSync as existsSync3, readFileSync as readFileSync3 } from "fs";
@@ -529,8 +529,10 @@ var TYPES = [
529
529
  "block",
530
530
  "example",
531
531
  "kit",
532
+ "hook",
532
533
  "style",
533
534
  "theme",
535
+ "font",
534
536
  "item"
535
537
  ];
536
538
  function parseType(value) {
@@ -598,8 +600,9 @@ function printUsage2() {
598
600
  console.log(
599
601
  " blocks [<filter>] [--category C] List or filter full-page blocks; an exact block name views it (kits: list --type kit)"
600
602
  );
603
+ console.log(" theme <code> [--only theme,font,density]");
601
604
  console.log(
602
- " theme <code> [--only theme,font] Install a theme-builder code via shadcn"
605
+ " Install a theme-builder code via shadcn"
603
606
  );
604
607
  console.log("");
605
608
  console.log("Without a verb, launches the MCP stdio server.");
@@ -608,7 +611,7 @@ async function runSearch(args) {
608
611
  const { flags, positional } = parseArgs2(args);
609
612
  if (positional.length === 0) {
610
613
  console.error(
611
- "Usage: keystoneui search <query> [--type ui|block|example|kit|style|theme|item] [--category C] [--limit N]"
614
+ "Usage: keystoneui search <query> [--type ui|block|example|kit|hook|style|theme|font|item] [--category C] [--limit N]"
612
615
  );
613
616
  process.exitCode = 1;
614
617
  return;
@@ -775,16 +778,18 @@ function runTheme(args) {
775
778
  const fields = code ? parseThemeCode(code) : null;
776
779
  if (!(code && fields)) {
777
780
  console.error(
778
- "Usage: keystoneui theme <code> [--only theme,font]\nCopy a code from https://keystoneui.io/theme-builder (Code panel)."
781
+ "Usage: keystoneui theme <code> [--only theme,font,density]\nCopy a code from https://keystoneui.io/theme-builder (Code panel)."
779
782
  );
780
783
  process.exitCode = 1;
781
784
  return;
782
785
  }
783
786
  const siteUrl = process.env.KEYSTONEUI_URL ?? "https://keystoneui.io";
784
787
  const only = parseThemeParts(flags.only);
788
+ const heading = fields.heading === fields.font ? "" : ` \xB7 heading ${fields.heading}`;
789
+ const density = fields.density === "default" ? "" : ` \xB7 density ${fields.density}`;
785
790
  console.log(`Theme ${code}`);
786
791
  console.log(
787
- ` base ${fields.base} \xB7 primary ${fields.primary} \xB7 radius ${fields.radius} \xB7 font ${fields.font}`
792
+ ` base ${fields.base} \xB7 primary ${fields.primary} \xB7 radius ${fields.radius} \xB7 font ${fields.font}${heading}${density}`
788
793
  );
789
794
  console.log("");
790
795
  console.log("Install (writes the tokens into your global CSS):");
@@ -857,6 +862,6 @@ if (isCliVerb(verbCandidate)) {
857
862
  process.exit();
858
863
  }
859
864
  var { StdioServerTransport } = await import("@modelcontextprotocol/sdk/server/stdio.js");
860
- var { server } = await import("./server-PR27VI6G.js");
865
+ var { server } = await import("./server-N64R44KT.js");
861
866
  var transport = new StdioServerTransport();
862
867
  await server.connect(transport);
@@ -12,7 +12,7 @@ import {
12
12
  readPackageVersion,
13
13
  searchComponentsTool,
14
14
  viewComponentTool
15
- } from "./chunk-NRQEEI2I.js";
15
+ } from "./chunk-UE7WY4AA.js";
16
16
 
17
17
  // src/server.ts
18
18
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@keystoneui/mcp",
3
- "version": "0.2.0-beta.7",
3
+ "version": "0.2.0-beta.9",
4
4
  "description": "MCP server and CLI for Keystone UI — lets AI agents and shell users discover, search, view, and install components, blocks, and named examples.",
5
5
  "type": "module",
6
6
  "license": "MIT",