@efolusi/meridian-mcp 0.1.2 → 0.1.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/README.md +2 -2
- package/package.json +3 -2
- package/server.mjs +14 -6
package/README.md
CHANGED
|
@@ -11,7 +11,7 @@ UI instead of guessing. It exposes the same generated registry the docs site use
|
|
|
11
11
|
| `list_components` | Every UI component with a one-line description and categories. Optional `category` filter. |
|
|
12
12
|
| `get_component` | One component's full detail: description, Meridian dependencies, and each file's real content — the `.jsx` source, the `.d.ts` types, and the `.prompt.md` usage guide. |
|
|
13
13
|
| `search_components` | Components matching a keyword across name, title, description and category. |
|
|
14
|
-
| `get_tokens` | Design tokens (colour, typography, spacing, effects)
|
|
14
|
+
| `get_tokens` | Design tokens (colour, typography, spacing, effects) as DTCG JSON. `$value` is the light theme at default density; tokens that change carry their `dark`, `compact` and `coarse` (touch pointer) values under `$extensions["com.efolusi.meridian"].modes`, and references are `{group.leaf}` aliases. Optional `group` filter; an unknown group returns the list of groups. |
|
|
15
15
|
|
|
16
16
|
## Data source
|
|
17
17
|
|
|
@@ -48,7 +48,7 @@ claude mcp add meridian -- npx -y @efolusi/meridian-mcp
|
|
|
48
48
|
```
|
|
49
49
|
|
|
50
50
|
Then ask your agent things like *"list Meridian form components"*, *"show me the
|
|
51
|
-
|
|
51
|
+
Calendar props and date-picker composition"*, or *"build an Efolusi settings page with Meridian"* —
|
|
52
52
|
it will pull the real source and tokens before writing code.
|
|
53
53
|
|
|
54
54
|
## Run locally / develop
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@efolusi/meridian-mcp",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "MCP server exposing the Meridian design system registry (components, source, types, usage guides, tokens) to AI coding agents.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://meridian.efolusi.com",
|
|
@@ -18,7 +18,8 @@
|
|
|
18
18
|
"README.md"
|
|
19
19
|
],
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@modelcontextprotocol/sdk": "^1.
|
|
21
|
+
"@modelcontextprotocol/sdk": "^1.32.2",
|
|
22
|
+
"zod": "^4.6.6"
|
|
22
23
|
},
|
|
23
24
|
"keywords": [
|
|
24
25
|
"mcp",
|
package/server.mjs
CHANGED
|
@@ -40,11 +40,15 @@ async function index() {
|
|
|
40
40
|
async function components() {
|
|
41
41
|
return (await index()).items.filter((it) => it.type === 'registry:ui');
|
|
42
42
|
}
|
|
43
|
+
// The name becomes a file path, so only registry item names get through.
|
|
44
|
+
const COMPONENT_NAME = /^[a-z][a-z0-9-]*$/i;
|
|
43
45
|
async function component(name) {
|
|
44
|
-
|
|
46
|
+
if (!COMPONENT_NAME.test(name)) throw new Error(`invalid component name ${JSON.stringify(name)}`);
|
|
47
|
+
return readJSON(`site/registry/${name.toLowerCase()}.json`);
|
|
45
48
|
}
|
|
46
49
|
|
|
47
|
-
const
|
|
50
|
+
const { version } = JSON.parse(await fs.readFile(new URL('./package.json', import.meta.url), 'utf8'));
|
|
51
|
+
const server = new McpServer({ name: 'meridian', version });
|
|
48
52
|
|
|
49
53
|
server.registerTool(
|
|
50
54
|
'list_components',
|
|
@@ -66,7 +70,7 @@ server.registerTool(
|
|
|
66
70
|
{
|
|
67
71
|
title: 'Get a Meridian component',
|
|
68
72
|
description: "Full detail for one component by name: description, dependencies, and every file's real content — the .jsx source, the .d.ts types, and the .prompt.md usage guide. Use this before writing code that uses the component.",
|
|
69
|
-
inputSchema: { name: z.string().describe('Component name, e.g. "Button", "
|
|
73
|
+
inputSchema: { name: z.string().describe('Component name, e.g. "Button", "Calendar", "NumberInput".') },
|
|
70
74
|
},
|
|
71
75
|
async ({ name }) => {
|
|
72
76
|
let c;
|
|
@@ -104,12 +108,16 @@ server.registerTool(
|
|
|
104
108
|
'get_tokens',
|
|
105
109
|
{
|
|
106
110
|
title: 'Get Meridian design tokens',
|
|
107
|
-
description: 'The design tokens (colors, typography, spacing, effects)
|
|
108
|
-
inputSchema: { group: z.string().optional().describe('Optional group
|
|
111
|
+
description: 'The design tokens (colors, typography, spacing, effects) as DTCG JSON. Each $value is the light theme at default density; a token that changes elsewhere also carries $extensions["com.efolusi.meridian"].modes with its dark, compact and coarse (touch pointer) values. References between tokens are DTCG aliases, {group.leaf}: the CSS custom property is --group-leaf (e.g. {surface.page} is --surface-page). In generated CSS use the custom property so the theme, density and pointer modes all apply; never hardcode hex.',
|
|
112
|
+
inputSchema: { group: z.string().optional().describe('Optional top-level group, e.g. "brand", "surface", "text", "space", "radius", "font". An unknown group returns the list of groups.') },
|
|
109
113
|
},
|
|
110
114
|
async ({ group }) => {
|
|
111
115
|
const tokens = await readJSON('tokens.json');
|
|
112
|
-
const
|
|
116
|
+
const groups = Object.keys(tokens).filter(k => !k.startsWith('$'));
|
|
117
|
+
if (group && !groups.includes(group)) {
|
|
118
|
+
return { content: [{ type: 'text', text: `No token group "${group}". groups: ${groups.join(', ')}` }], isError: true };
|
|
119
|
+
}
|
|
120
|
+
const text = JSON.stringify(group ? { [group]: tokens[group] } : tokens, null, 2);
|
|
113
121
|
return { content: [{ type: 'text', text }] };
|
|
114
122
|
}
|
|
115
123
|
);
|