@keystoneui/mcp 0.2.0-beta.8 → 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` \| `hook` \| `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
|
|
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
|
|
492
|
-
if (!
|
|
534
|
+
const fields = matchThemeCode(code);
|
|
535
|
+
if (!fields) {
|
|
493
536
|
return null;
|
|
494
537
|
}
|
|
495
|
-
const
|
|
496
|
-
|
|
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
|
|
507
|
-
if (!
|
|
557
|
+
const fields = matchThemeCode(code);
|
|
558
|
+
if (!fields) {
|
|
508
559
|
return null;
|
|
509
560
|
}
|
|
510
|
-
const
|
|
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(
|
|
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
|
|
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) &&
|
|
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 = "") {
|
|
@@ -863,6 +920,7 @@ var ITEM_TYPES = [
|
|
|
863
920
|
"hook",
|
|
864
921
|
"style",
|
|
865
922
|
"theme",
|
|
923
|
+
"font",
|
|
866
924
|
"item"
|
|
867
925
|
];
|
|
868
926
|
function registryType(type) {
|
|
@@ -878,7 +936,7 @@ var listComponentsSchema = z.object({
|
|
|
878
936
|
limit: z.number().min(1).max(100).default(20).describe("Maximum number of items to return"),
|
|
879
937
|
offset: z.number().min(0).default(0).describe("Number of items to skip"),
|
|
880
938
|
type: z.enum(ITEM_TYPES).optional().describe(
|
|
881
|
-
"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', 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"
|
|
882
940
|
),
|
|
883
941
|
category: z.string().optional().describe(
|
|
884
942
|
"Filter by category (e.g. 'authentication', 'login', 'signup', 'navigation', 'data', 'dashboard', 'admin', 'betting'). Blocks and kits carry categories; components and examples do not."
|
|
@@ -903,7 +961,7 @@ var searchComponentsSchema = z.object({
|
|
|
903
961
|
query: z.string().describe("Search query (name, description, or keywords)"),
|
|
904
962
|
limit: z.number().min(1).max(50).default(10).describe("Maximum number of results"),
|
|
905
963
|
type: z.enum(ITEM_TYPES).optional().describe(
|
|
906
|
-
"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, 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"
|
|
907
965
|
),
|
|
908
966
|
category: z.string().optional().describe(
|
|
909
967
|
"Filter by category (e.g. 'authentication', 'login'). Blocks and kits carry categories; components and examples do not."
|
|
@@ -1217,7 +1275,10 @@ ${commandBlock(defaultStyleUrl)}
|
|
|
1217
1275
|
|
|
1218
1276
|
The theme builder (${shown(config.docsUrl)}/theme-builder) encodes a theme as a code,
|
|
1219
1277
|
\`k1_<base>_<L>_<C>_<H>_<radius>_<font>\`, served as a \`registry:theme\` item.
|
|
1220
|
-
|
|
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\`):
|
|
1221
1282
|
${commandBlock(themeUrl, themeProbeUrl)}
|
|
1222
1283
|
\`keystoneui theme <code>\` prints the decoded settings and this command.`;
|
|
1223
1284
|
}
|
package/dist/index.js
CHANGED
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
themeInstallCommand,
|
|
23
23
|
themeInstallUrl,
|
|
24
24
|
viewComponentTool
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-UE7WY4AA.js";
|
|
26
26
|
|
|
27
27
|
// src/cli.ts
|
|
28
28
|
import { existsSync as existsSync3, readFileSync as readFileSync3 } from "fs";
|
|
@@ -532,6 +532,7 @@ var TYPES = [
|
|
|
532
532
|
"hook",
|
|
533
533
|
"style",
|
|
534
534
|
"theme",
|
|
535
|
+
"font",
|
|
535
536
|
"item"
|
|
536
537
|
];
|
|
537
538
|
function parseType(value) {
|
|
@@ -599,8 +600,9 @@ function printUsage2() {
|
|
|
599
600
|
console.log(
|
|
600
601
|
" blocks [<filter>] [--category C] List or filter full-page blocks; an exact block name views it (kits: list --type kit)"
|
|
601
602
|
);
|
|
603
|
+
console.log(" theme <code> [--only theme,font,density]");
|
|
602
604
|
console.log(
|
|
603
|
-
"
|
|
605
|
+
" Install a theme-builder code via shadcn"
|
|
604
606
|
);
|
|
605
607
|
console.log("");
|
|
606
608
|
console.log("Without a verb, launches the MCP stdio server.");
|
|
@@ -609,7 +611,7 @@ async function runSearch(args) {
|
|
|
609
611
|
const { flags, positional } = parseArgs2(args);
|
|
610
612
|
if (positional.length === 0) {
|
|
611
613
|
console.error(
|
|
612
|
-
"Usage: keystoneui search <query> [--type ui|block|example|kit|hook|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]"
|
|
613
615
|
);
|
|
614
616
|
process.exitCode = 1;
|
|
615
617
|
return;
|
|
@@ -776,16 +778,18 @@ function runTheme(args) {
|
|
|
776
778
|
const fields = code ? parseThemeCode(code) : null;
|
|
777
779
|
if (!(code && fields)) {
|
|
778
780
|
console.error(
|
|
779
|
-
"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)."
|
|
780
782
|
);
|
|
781
783
|
process.exitCode = 1;
|
|
782
784
|
return;
|
|
783
785
|
}
|
|
784
786
|
const siteUrl = process.env.KEYSTONEUI_URL ?? "https://keystoneui.io";
|
|
785
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}`;
|
|
786
790
|
console.log(`Theme ${code}`);
|
|
787
791
|
console.log(
|
|
788
|
-
` 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}`
|
|
789
793
|
);
|
|
790
794
|
console.log("");
|
|
791
795
|
console.log("Install (writes the tokens into your global CSS):");
|
|
@@ -858,6 +862,6 @@ if (isCliVerb(verbCandidate)) {
|
|
|
858
862
|
process.exit();
|
|
859
863
|
}
|
|
860
864
|
var { StdioServerTransport } = await import("@modelcontextprotocol/sdk/server/stdio.js");
|
|
861
|
-
var { server } = await import("./server-
|
|
865
|
+
var { server } = await import("./server-N64R44KT.js");
|
|
862
866
|
var transport = new StdioServerTransport();
|
|
863
867
|
await server.connect(transport);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@keystoneui/mcp",
|
|
3
|
-
"version": "0.2.0-beta.
|
|
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",
|