@santi020k/lumen-mcp 0.1.0
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/LICENSE +21 -0
- package/README.md +216 -0
- package/bin/lumen-mcp-local.mjs +56 -0
- package/bin/lumen-mcp.mjs +8 -0
- package/data/lumen-data.json +21480 -0
- package/dist/data.d.ts +99 -0
- package/dist/data.d.ts.map +1 -0
- package/dist/data.js +11 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +11 -0
- package/dist/server.d.ts +3 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +215 -0
- package/dist/tools.d.ts +136 -0
- package/dist/tools.d.ts.map +1 -0
- package/dist/tools.js +346 -0
- package/package.json +82 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Santiago Molina
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
# @santi020k/lumen-mcp
|
|
2
|
+
|
|
3
|
+
A [Model Context Protocol](https://modelcontextprotocol.io) server for the Lumen
|
|
4
|
+
multi-framework primitive UI system. It gives AI agents structured access to
|
|
5
|
+
components, real framework contracts, recipes, design tokens, accessibility
|
|
6
|
+
behavior, runtime events, and Lumen's generation rules.
|
|
7
|
+
|
|
8
|
+
The published server ships a self-contained catalog snapshot, so consumers do
|
|
9
|
+
not need a checkout of the Lumen repository.
|
|
10
|
+
|
|
11
|
+
## Tools
|
|
12
|
+
|
|
13
|
+
| Tool | Purpose |
|
|
14
|
+
| --- | --- |
|
|
15
|
+
| `lumen_list_components` | List components with descriptions, categories, framework availability, collections, and recipe membership. Filter by `framework`, `recipe`, or natural-language `query`. |
|
|
16
|
+
| `lumen_get_component` | Get a component for `astro`, `react`, or `elements` at `summary`, `usage`, or `source` detail. Usage includes imports, styles, props or attributes, examples, accessibility, guidance, and events. |
|
|
17
|
+
| `lumen_get_recipe` | Get a recipe or component set with its purpose, components, files, categories, and framework-specific install command. |
|
|
18
|
+
| `lumen_search` | Rank natural-language matches across component descriptions, curated collections, props, attributes, recipes, tokens, and agent rules. |
|
|
19
|
+
| `lumen_get_tokens` | Return semantic token names, base colors, glass tokens, and the theme attribute. |
|
|
20
|
+
| `lumen_get_rules` | Return the Lumen agent rules from `llms.txt`. |
|
|
21
|
+
|
|
22
|
+
Every tool returns both readable text and validated `structuredContent`.
|
|
23
|
+
|
|
24
|
+
## Resources
|
|
25
|
+
|
|
26
|
+
| Resource | Contents |
|
|
27
|
+
| --- | --- |
|
|
28
|
+
| `lumen://rules` | Agent rules as Markdown. |
|
|
29
|
+
| `lumen://tokens` | Structured design tokens. |
|
|
30
|
+
| `lumen://components` | Compact component catalog. |
|
|
31
|
+
| `lumen://components/{name}` | Component metadata and default Astro usage. |
|
|
32
|
+
| `lumen://recipes/{name}` | Recipe metadata and install commands. |
|
|
33
|
+
|
|
34
|
+
## Install and connect
|
|
35
|
+
|
|
36
|
+
The stdio command for any MCP client is:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
npx -y @santi020k/lumen-mcp
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Codex
|
|
43
|
+
|
|
44
|
+
Register it from the Codex CLI:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
codex mcp add lumen -- npx -y @santi020k/lumen-mcp
|
|
48
|
+
codex mcp list
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Or add a project-scoped `.codex/config.toml`:
|
|
52
|
+
|
|
53
|
+
```toml
|
|
54
|
+
[mcp_servers.lumen]
|
|
55
|
+
enabled = true
|
|
56
|
+
command = "npx"
|
|
57
|
+
args = ["-y", "@santi020k/lumen-mcp"]
|
|
58
|
+
startup_timeout_sec = 10.0
|
|
59
|
+
tool_timeout_sec = 30.0
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Start or resume a Codex task after changing MCP configuration so the new tools
|
|
63
|
+
are loaded.
|
|
64
|
+
|
|
65
|
+
### Claude Desktop
|
|
66
|
+
|
|
67
|
+
Add this server to `claude_desktop_config.json`:
|
|
68
|
+
|
|
69
|
+
```json
|
|
70
|
+
{
|
|
71
|
+
"mcpServers": {
|
|
72
|
+
"lumen": {
|
|
73
|
+
"command": "npx",
|
|
74
|
+
"args": ["-y", "@santi020k/lumen-mcp"]
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Cursor
|
|
81
|
+
|
|
82
|
+
Add this server to `.cursor/mcp.json`:
|
|
83
|
+
|
|
84
|
+
```json
|
|
85
|
+
{
|
|
86
|
+
"mcpServers": {
|
|
87
|
+
"lumen": {
|
|
88
|
+
"command": "npx",
|
|
89
|
+
"args": ["-y", "@santi020k/lumen-mcp"]
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### Any stdio MCP client
|
|
96
|
+
|
|
97
|
+
Use the equivalent of this generic configuration:
|
|
98
|
+
|
|
99
|
+
```json
|
|
100
|
+
{
|
|
101
|
+
"name": "lumen",
|
|
102
|
+
"transport": "stdio",
|
|
103
|
+
"command": "npx",
|
|
104
|
+
"args": ["-y", "@santi020k/lumen-mcp"]
|
|
105
|
+
}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Client configuration envelopes differ, but the command and arguments remain
|
|
109
|
+
the same.
|
|
110
|
+
|
|
111
|
+
## Recommended agent workflow
|
|
112
|
+
|
|
113
|
+
1. Read `lumen://rules`.
|
|
114
|
+
2. Call `lumen_search` with the requested use case and target framework.
|
|
115
|
+
3. Call `lumen_get_component` with `detail: "usage"`.
|
|
116
|
+
4. Inspect a related recipe with `lumen_get_recipe` when the UI needs multiple primitives.
|
|
117
|
+
5. Request `detail: "source"` only when the usage contract is insufficient.
|
|
118
|
+
6. Use `lumen_get_tokens` before adding custom styling.
|
|
119
|
+
|
|
120
|
+
Example calls:
|
|
121
|
+
|
|
122
|
+
```json
|
|
123
|
+
{ "name": "lumen_search", "arguments": { "query": "accessible date input", "limit": 5 } }
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
```json
|
|
127
|
+
{
|
|
128
|
+
"name": "lumen_get_component",
|
|
129
|
+
"arguments": {
|
|
130
|
+
"name": "DateRangePicker",
|
|
131
|
+
"framework": "react",
|
|
132
|
+
"detail": "usage"
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
```json
|
|
138
|
+
{
|
|
139
|
+
"name": "lumen_get_recipe",
|
|
140
|
+
"arguments": {
|
|
141
|
+
"name": "advanced-fields",
|
|
142
|
+
"framework": "react"
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
## Local repository usage
|
|
148
|
+
|
|
149
|
+
This repository includes a project-scoped Codex configuration that launches:
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
pnpm --filter @santi020k/lumen-mcp local
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
The local launcher builds the MCP package when `dist` is missing or older than
|
|
156
|
+
the TypeScript source, then starts the server without writing build logs to the
|
|
157
|
+
MCP stdout channel.
|
|
158
|
+
|
|
159
|
+
Useful development commands:
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
pnpm --filter @santi020k/lumen-mcp generate
|
|
163
|
+
pnpm --filter @santi020k/lumen-mcp build
|
|
164
|
+
pnpm --filter @santi020k/lumen-mcp test
|
|
165
|
+
pnpm --filter @santi020k/lumen-mcp test:coverage
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
## Programmatic use
|
|
169
|
+
|
|
170
|
+
The reusable handlers return readable text plus typed data:
|
|
171
|
+
|
|
172
|
+
```ts
|
|
173
|
+
import {
|
|
174
|
+
getComponent,
|
|
175
|
+
getRecipe,
|
|
176
|
+
search
|
|
177
|
+
} from '@santi020k/lumen-mcp/tools'
|
|
178
|
+
|
|
179
|
+
const matches = search({ limit: 5, query: 'date input' }).data.results
|
|
180
|
+
|
|
181
|
+
const component = getComponent({
|
|
182
|
+
detail: 'usage',
|
|
183
|
+
framework: 'react',
|
|
184
|
+
name: 'DateRangePicker'
|
|
185
|
+
}).data.component
|
|
186
|
+
|
|
187
|
+
const recipe = getRecipe({
|
|
188
|
+
framework: 'react',
|
|
189
|
+
name: 'advanced-fields'
|
|
190
|
+
}).data.recipe
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
You can also embed the server:
|
|
194
|
+
|
|
195
|
+
```ts
|
|
196
|
+
import { createLumenServer } from '@santi020k/lumen-mcp'
|
|
197
|
+
|
|
198
|
+
const server = createLumenServer()
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
## Snapshot generation
|
|
202
|
+
|
|
203
|
+
`scripts/generate-data.mjs` builds `data/lumen-data.json` from:
|
|
204
|
+
|
|
205
|
+
- The shared component catalog and registry metadata.
|
|
206
|
+
- Astro and React component declarations.
|
|
207
|
+
- The Web Component definition registry.
|
|
208
|
+
- Documentation examples, API rows, guidance, keyboard interactions, and runtime events.
|
|
209
|
+
- Design tokens, recipes, `docs/ai-usage.md`, and `llms.txt`.
|
|
210
|
+
|
|
211
|
+
The output is deterministic and carries the package version used by the MCP
|
|
212
|
+
initialization response.
|
|
213
|
+
|
|
214
|
+
## License
|
|
215
|
+
|
|
216
|
+
MIT © Santiago Molina
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
|
|
2
|
+
import { spawnSync } from 'node:child_process'
|
|
3
|
+
import { access, readdir as readDirectory, stat as getStat } from 'node:fs/promises'
|
|
4
|
+
import { dirname, join, resolve } from 'node:path'
|
|
5
|
+
import { fileURLToPath } from 'node:url'
|
|
6
|
+
|
|
7
|
+
const packageRoot = resolve(dirname(fileURLToPath(import.meta.url)), '..')
|
|
8
|
+
const repoRoot = resolve(packageRoot, '../..')
|
|
9
|
+
const distEntry = join(packageRoot, 'dist/index.js')
|
|
10
|
+
|
|
11
|
+
const filesIn = async (directory) => {
|
|
12
|
+
const entries = await readDirectory(directory, { withFileTypes: true })
|
|
13
|
+
|
|
14
|
+
const nested = await Promise.all(entries.map((entry) => {
|
|
15
|
+
const path = join(directory, entry.name)
|
|
16
|
+
|
|
17
|
+
return entry.isDirectory() ? filesIn(path) : [path]
|
|
18
|
+
}))
|
|
19
|
+
|
|
20
|
+
return nested.flat()
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const needsBuild = async () => {
|
|
24
|
+
try {
|
|
25
|
+
await access(distEntry)
|
|
26
|
+
} catch {
|
|
27
|
+
return true
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const outputTime = (await getStat(distEntry)).mtimeMs
|
|
31
|
+
const sourceFiles = await filesIn(join(packageRoot, 'src'))
|
|
32
|
+
const sourceTimes = await Promise.all(sourceFiles.map(async (path) => (await getStat(path)).mtimeMs))
|
|
33
|
+
|
|
34
|
+
return sourceTimes.some((modifiedTime) => modifiedTime > outputTime)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (await needsBuild()) {
|
|
38
|
+
const build = spawnSync(
|
|
39
|
+
'pnpm',
|
|
40
|
+
['--filter', '@santi020k/lumen-mcp', 'build'],
|
|
41
|
+
{
|
|
42
|
+
cwd: repoRoot,
|
|
43
|
+
stdio: ['ignore', process.stderr, process.stderr]
|
|
44
|
+
}
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
if (build.status !== 0) {
|
|
48
|
+
process.exitCode = build.status ?? 1
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (!process.exitCode) {
|
|
53
|
+
const { startLumenMcp } = await import('../dist/index.js')
|
|
54
|
+
|
|
55
|
+
await startLumenMcp()
|
|
56
|
+
}
|