@public-ui/mcp 4.0.0-alpha.2 → 4.0.0-alpha.8
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 +339 -139
- package/dist/cli.cjs +37 -42
- package/dist/cli.d.cts +1 -0
- package/dist/cli.d.mts +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.mjs +36 -42
- package/dist/data.cjs +88 -0
- package/dist/data.d.cts +34 -0
- package/dist/data.d.mts +34 -0
- package/dist/data.d.ts +34 -0
- package/dist/data.mjs +83 -0
- package/dist/mcp.cjs +298 -0
- package/dist/mcp.d.cts +9 -0
- package/dist/mcp.d.mts +9 -0
- package/dist/mcp.d.ts +9 -0
- package/dist/mcp.mjs +291 -0
- package/dist/search.cjs +52 -0
- package/dist/search.d.cts +16 -0
- package/dist/search.d.mts +16 -0
- package/dist/search.d.ts +16 -0
- package/dist/search.mjs +46 -0
- package/package.json +48 -6
- package/shared/.gitkeep +1 -0
- package/shared/sample-index.json +1860 -0
- package/dist/api-handler.cjs +0 -269
- package/dist/api-handler.mjs +0 -265
- package/dist/chunks/sample-index-runtime.cjs +0 -327
- package/dist/chunks/sample-index-runtime.mjs +0 -320
- package/dist/index.cjs +0 -71
- package/dist/index.mjs +0 -66
- package/dist/sample-index.cjs +0 -117
- package/dist/sample-index.mjs +0 -109
- package/dist/samples.json +0 -1428
- package/dist/samples.mjs +0 -1430
package/README.md
CHANGED
|
@@ -1,238 +1,438 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @public-ui/mcp
|
|
2
2
|
|
|
3
|
-
[](https://www.npmjs.com/package/@public-ui/components)
|
|
4
|
+
[](https://github.com/public-ui/kolibri/blob/main/LICENSE)
|
|
5
|
+
[](https://www.npmjs.com/package/@public-ui/mcp)
|
|
6
|
+
[](https://github.com/public-ui/kolibri/issues)
|
|
7
|
+
[](https://github.com/public-ui/kolibri/pulls)
|
|
8
|
+
[](https://bundlephobia.com/result?p=@public-ui/kolibri-cli)
|
|
9
|
+

|
|
5
10
|
|
|
6
|
-
|
|
11
|
+
> **Model Context Protocol Server for KoliBri – Access 200+ Component Examples**
|
|
7
12
|
|
|
8
|
-
|
|
13
|
+
Provides AI agents and MCP clients direct access to KoliBri component samples, specifications, scenarios, and documentation through the Model Context Protocol (MCP).
|
|
9
14
|
|
|
10
|
-
|
|
15
|
+
**Primary Usage**: Remote HTTP endpoint (StreamableHTTP transport) – zero installation required
|
|
16
|
+
**Alternative**: Local stdio transport for Claude Desktop, VS Code, and other MCP clients
|
|
11
17
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
+
## Quick Start
|
|
19
|
+
|
|
20
|
+
### Recommended: Use Remote HTTP Server
|
|
21
|
+
|
|
22
|
+
No installation needed! Use the hosted MCP server directly:
|
|
23
|
+
|
|
24
|
+
```json
|
|
25
|
+
{
|
|
26
|
+
"servers": {
|
|
27
|
+
"kolibri": {
|
|
28
|
+
"url": "https://public-ui-kolibri-mcp.vercel.app/mcp",
|
|
29
|
+
"type": "http"
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
18
33
|
```
|
|
19
34
|
|
|
20
|
-
|
|
35
|
+
Add this to:
|
|
36
|
+
|
|
37
|
+
- **VS Code**: `mcp.json` in workspace root or `~/.config/mcp/mcp.json`
|
|
38
|
+
- **Claude Desktop**: `claude_desktop_config.json` (see below)
|
|
21
39
|
|
|
22
|
-
|
|
40
|
+
### Alternative: Local Installation
|
|
41
|
+
|
|
42
|
+
For offline use or local development:
|
|
23
43
|
|
|
24
44
|
```bash
|
|
25
|
-
|
|
45
|
+
npm install -g @public-ui/mcp
|
|
26
46
|
```
|
|
27
47
|
|
|
28
|
-
|
|
48
|
+
After installation, run with:
|
|
29
49
|
|
|
30
|
-
|
|
31
|
-
-
|
|
32
|
-
|
|
33
|
-
- `GET /mcp/docs` - List Markdown documentation
|
|
34
|
-
- `GET /mcp/doc?id=doc/README` - Get a specific documentation entry
|
|
50
|
+
```bash
|
|
51
|
+
kolibri-mcp
|
|
52
|
+
```
|
|
35
53
|
|
|
36
|
-
|
|
54
|
+
## Usage
|
|
37
55
|
|
|
38
|
-
###
|
|
56
|
+
### Recommended: Remote HTTP Server
|
|
39
57
|
|
|
40
|
-
|
|
58
|
+
**Zero installation required!** Use the hosted endpoint directly:
|
|
41
59
|
|
|
42
|
-
|
|
60
|
+
#### VS Code Copilot
|
|
61
|
+
|
|
62
|
+
Create `mcp.json` in workspace root or `~/.config/mcp/mcp.json`:
|
|
63
|
+
|
|
64
|
+
```json
|
|
65
|
+
{
|
|
66
|
+
"servers": {
|
|
67
|
+
"kolibri": {
|
|
68
|
+
"url": "https://public-ui-kolibri-mcp.vercel.app/mcp",
|
|
69
|
+
"type": "http"
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
"inputs": []
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
#### Claude Desktop
|
|
77
|
+
|
|
78
|
+
Add to `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS):
|
|
79
|
+
|
|
80
|
+
```json
|
|
81
|
+
{
|
|
82
|
+
"mcpServers": {
|
|
83
|
+
"kolibri": {
|
|
84
|
+
"url": "https://public-ui-kolibri-mcp.vercel.app/mcp",
|
|
85
|
+
"type": "http"
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
**Benefits:**
|
|
92
|
+
|
|
93
|
+
- ✅ No installation needed
|
|
94
|
+
- ✅ Always up-to-date with latest samples
|
|
95
|
+
- ✅ Works from any device
|
|
96
|
+
- ✅ Zero maintenance
|
|
97
|
+
|
|
98
|
+
### Alternative: Local stdio Transport
|
|
99
|
+
|
|
100
|
+
For offline use, local development, or when you prefer local execution:
|
|
101
|
+
|
|
102
|
+
#### Running via CLI
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
# With npx (no installation needed)
|
|
106
|
+
npx @public-ui/mcp
|
|
107
|
+
|
|
108
|
+
# Or after global installation
|
|
109
|
+
kolibri-mcp
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
#### VS Code Copilot (Local)
|
|
113
|
+
|
|
114
|
+
````json
|
|
115
|
+
{
|
|
116
|
+
"servers": {
|
|
117
|
+
"kolibri": {
|
|
118
|
+
"command": "kolibri-mcp"
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
"inputs": []
|
|
122
|
+
}
|
|
123
|
+
```#### Claude Desktop (Local)
|
|
43
124
|
|
|
44
125
|
```json
|
|
45
126
|
{
|
|
46
127
|
"mcpServers": {
|
|
47
128
|
"kolibri": {
|
|
48
129
|
"command": "npx",
|
|
49
|
-
"args": ["@public-ui/mcp"]
|
|
50
|
-
"env": {}
|
|
130
|
+
"args": ["@public-ui/mcp"]
|
|
51
131
|
}
|
|
52
132
|
}
|
|
53
133
|
}
|
|
134
|
+
````
|
|
135
|
+
|
|
136
|
+
### Self-Hosted HTTP Server
|
|
137
|
+
|
|
138
|
+
To run your own HTTP server instance:
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
# Start on default port 3000
|
|
142
|
+
node dist/mcp.mjs
|
|
143
|
+
|
|
144
|
+
# Or specify a custom port
|
|
145
|
+
PORT=8080 node dist/mcp.mjs
|
|
54
146
|
```
|
|
55
147
|
|
|
56
|
-
|
|
148
|
+
The server provides a StreamableHTTP endpoint at `POST /mcp`.
|
|
57
149
|
|
|
58
|
-
|
|
59
|
-
import { spawn } from 'child_process';
|
|
150
|
+
### Programmatically (stdio)
|
|
60
151
|
|
|
61
|
-
|
|
62
|
-
|
|
152
|
+
```typescript
|
|
153
|
+
import { createKolibriMcpServer } from '@public-ui/mcp';
|
|
154
|
+
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
63
155
|
|
|
64
|
-
|
|
65
|
-
const
|
|
66
|
-
|
|
156
|
+
const server = createKolibriMcpServer();
|
|
157
|
+
const transport = new StdioServerTransport();
|
|
158
|
+
|
|
159
|
+
await server.connect(transport);
|
|
67
160
|
```
|
|
68
161
|
|
|
69
|
-
##
|
|
162
|
+
## Logging
|
|
163
|
+
|
|
164
|
+
The MCP server supports optional request logging for debugging and monitoring. Logging is **disabled by default** and outputs to stderr to avoid interfering with the stdio protocol.
|
|
70
165
|
|
|
71
|
-
|
|
166
|
+
### Enable Logging
|
|
72
167
|
|
|
73
|
-
|
|
74
|
-
- **Form Components**: Form, Select, Textarea, Checkbox, Radio, etc.
|
|
75
|
-
- **Layout Components**: Card, Accordion, Tabs, Modal, etc.
|
|
76
|
-
- **Navigation**: Breadcrumb, Pagination, Navigation, etc.
|
|
77
|
-
- **Data Display**: Table, Alert, Toast, Progress, etc.
|
|
78
|
-
- **Advanced Components**: Tree, Tooltip, Popover, etc.
|
|
79
|
-
- **Docs**: `README.md`, `docs/*.md`, migration guides, security guidelines, and more.
|
|
168
|
+
Set the environment variable `MCP_LOGGING=true` or `MCP_LOGGING=1`:
|
|
80
169
|
|
|
81
|
-
|
|
170
|
+
```bash
|
|
171
|
+
# stdio mode with logging (for debugging)
|
|
172
|
+
MCP_LOGGING=true npx @public-ui/mcp
|
|
173
|
+
|
|
174
|
+
# Or after global installation
|
|
175
|
+
MCP_LOGGING=true kolibri-mcp
|
|
176
|
+
|
|
177
|
+
# HTTP Server with logging
|
|
178
|
+
MCP_LOGGING=true node dist/mcp.mjs
|
|
179
|
+
|
|
180
|
+
# Custom port with logging
|
|
181
|
+
MCP_LOGGING=true PORT=8080 node dist/mcp.mjs
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
### Note for stdio Mode
|
|
82
185
|
|
|
83
|
-
|
|
84
|
-
- ✅ **Component usage examples**
|
|
85
|
-
- ✅ **Accessibility implementations**
|
|
86
|
-
- ✅ **Responsive design patterns**
|
|
186
|
+
All logs are written to **stderr** to ensure they don't interfere with the JSON-RPC communication on stdout. This allows you to debug stdio sessions without breaking the protocol.
|
|
87
187
|
|
|
88
|
-
|
|
188
|
+
### Log Types
|
|
89
189
|
|
|
90
|
-
|
|
190
|
+
When enabled, logs include:
|
|
91
191
|
|
|
92
|
-
|
|
192
|
+
- **[TOOL]** - Tool invocations (search, fetch) with parameters and results
|
|
193
|
+
- **[RESOURCE]** - Resource accesses (info, best-practices)
|
|
194
|
+
- **[ERROR]** - Error conditions and failures
|
|
195
|
+
|
|
196
|
+
### Log Format
|
|
197
|
+
|
|
198
|
+
```
|
|
199
|
+
[timestamp] [TYPE] message {json_data}
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
**Example:**
|
|
203
|
+
|
|
204
|
+
```
|
|
205
|
+
[2025-11-06T09:45:23.456Z] [TOOL] search called {
|
|
206
|
+
"query": "button",
|
|
207
|
+
"kind": "sample",
|
|
208
|
+
"limit": 10
|
|
209
|
+
}
|
|
210
|
+
[2025-11-06T09:45:23.478Z] [TOOL] search completed {
|
|
211
|
+
"query": "button",
|
|
212
|
+
"resultCount": 5,
|
|
213
|
+
"options": { "limit": 10, "kind": "sample" }
|
|
214
|
+
}
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
## Available Tools
|
|
218
|
+
|
|
219
|
+
### 1. `hello_kolibri`
|
|
220
|
+
|
|
221
|
+
A simple greeting tool for testing the connection and getting server metadata.
|
|
222
|
+
|
|
223
|
+
**Parameters:**
|
|
224
|
+
|
|
225
|
+
- `name` (string, optional): Name to greet
|
|
226
|
+
|
|
227
|
+
**Example:**
|
|
93
228
|
|
|
94
229
|
```json
|
|
95
230
|
{
|
|
96
|
-
"
|
|
97
|
-
"
|
|
98
|
-
"totalEntries": 154,
|
|
99
|
-
"totalSamples": 136,
|
|
100
|
-
"totalDocs": 18,
|
|
101
|
-
"message": "System healthy with 154 entries available",
|
|
102
|
-
"generatedAt": "2024-05-28T08:15:30.000Z",
|
|
103
|
-
"ai-hints": [
|
|
104
|
-
"Always register KoliBri Web Components in the browser runtime before rendering them.",
|
|
105
|
-
"Choose the integration guide that matches your project setup to load and bundle the components correctly."
|
|
106
|
-
]
|
|
231
|
+
"name": "hello_kolibri",
|
|
232
|
+
"arguments": { "name": "World" }
|
|
107
233
|
}
|
|
108
234
|
```
|
|
109
235
|
|
|
110
|
-
###
|
|
236
|
+
### 2. `search`
|
|
111
237
|
|
|
112
|
-
|
|
238
|
+
Search for KoliBri component samples, scenarios, and documentation using fuzzy search powered by Fuse.js.
|
|
113
239
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
240
|
+
**Parameters:**
|
|
241
|
+
|
|
242
|
+
- `query` (string, optional): Search query (leave empty to return all entries)
|
|
243
|
+
- `kind` (string, optional): Filter by "doc", "sample", or "scenario"
|
|
244
|
+
- `limit` (number, optional): Maximum results (default: 10)
|
|
117
245
|
|
|
118
|
-
|
|
119
|
-
|
|
246
|
+
**Example:**
|
|
247
|
+
|
|
248
|
+
```json
|
|
249
|
+
{
|
|
250
|
+
"name": "search",
|
|
251
|
+
"arguments": {
|
|
252
|
+
"query": "button",
|
|
253
|
+
"kind": "sample",
|
|
254
|
+
"limit": 5
|
|
255
|
+
}
|
|
256
|
+
}
|
|
120
257
|
```
|
|
121
258
|
|
|
122
|
-
###
|
|
259
|
+
### 3. `fetch`
|
|
123
260
|
|
|
124
|
-
|
|
261
|
+
Get a specific sample or documentation entry by its ID.
|
|
125
262
|
|
|
126
|
-
|
|
127
|
-
|
|
263
|
+
**Parameters:**
|
|
264
|
+
|
|
265
|
+
- `id` (string, required): Entry ID (e.g., "button/basic")
|
|
266
|
+
|
|
267
|
+
**Example:**
|
|
268
|
+
|
|
269
|
+
```json
|
|
270
|
+
{
|
|
271
|
+
"name": "fetch",
|
|
272
|
+
"arguments": { "id": "button/basic" }
|
|
273
|
+
}
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
## Available Resources
|
|
277
|
+
|
|
278
|
+
### 1. `info`
|
|
279
|
+
|
|
280
|
+
Get information about the KoliBri MCP Server and available samples.
|
|
281
|
+
|
|
282
|
+
**Resource URI:** `kolibri://info`
|
|
283
|
+
|
|
284
|
+
**Example:**
|
|
285
|
+
|
|
286
|
+
```json
|
|
287
|
+
{
|
|
288
|
+
"method": "resources/read",
|
|
289
|
+
"params": { "uri": "kolibri://info" }
|
|
290
|
+
}
|
|
128
291
|
```
|
|
129
292
|
|
|
130
|
-
|
|
293
|
+
### 2. `best-practices`
|
|
294
|
+
|
|
295
|
+
Essential guidelines for working with KoliBri Web Components. This resource provides base knowledge that AI agents should always consider when working with KoliBri components.
|
|
296
|
+
|
|
297
|
+
**Resource URI:** `kolibri://best-practices`
|
|
298
|
+
|
|
299
|
+
**Includes:**
|
|
300
|
+
|
|
301
|
+
1. Always register KoliBri Web Components in the browser runtime before rendering them
|
|
302
|
+
2. Choose the integration guide that matches your project setup to load and bundle the components correctly
|
|
303
|
+
3. Bundle the KoliBri icon font assets (for example codicon.css and codicon.ttf) so kol-icon glyphs can render
|
|
304
|
+
4. Wrap input elements with `<kol-form>` and feed its `_errorList` to surface validation issues via the generated error summary
|
|
305
|
+
|
|
306
|
+
**Example:**
|
|
131
307
|
|
|
132
308
|
```json
|
|
133
309
|
{
|
|
134
|
-
"
|
|
135
|
-
"
|
|
136
|
-
"name": "basic",
|
|
137
|
-
"path": "packages/samples/react/src/components/button/basic.tsx",
|
|
138
|
-
"code": "import React from 'react';\nimport { KolButton } from '@public-ui/react';\n...",
|
|
139
|
-
"kind": "sample",
|
|
140
|
-
"ai-hints": [
|
|
141
|
-
"Always register KoliBri Web Components in the browser runtime before rendering them.",
|
|
142
|
-
"Choose the integration guide that matches your project setup to load and bundle the components correctly."
|
|
143
|
-
]
|
|
310
|
+
"method": "resources/read",
|
|
311
|
+
"params": { "uri": "kolibri://best-practices" }
|
|
144
312
|
}
|
|
145
313
|
```
|
|
146
314
|
|
|
147
|
-
|
|
315
|
+
## Example Usage
|
|
316
|
+
|
|
317
|
+
### With MCP Clients (Recommended)
|
|
318
|
+
|
|
319
|
+
The easiest way to use the MCP server is through an MCP-compatible client:
|
|
320
|
+
|
|
321
|
+
- **Claude Desktop**: Ask "@kolibri show me a button example"
|
|
322
|
+
- **VS Code Copilot**: Ask "@kolibri how do I use KolButton?"
|
|
323
|
+
- **MCP Inspector**: Visual debugging tool for testing tools and resources
|
|
324
|
+
|
|
325
|
+
### Direct stdio Testing (Advanced)
|
|
326
|
+
|
|
327
|
+
For testing the stdio transport directly with JSON-RPC messages:
|
|
148
328
|
|
|
149
|
-
|
|
329
|
+
**Search for button components:**
|
|
150
330
|
|
|
151
331
|
```bash
|
|
152
|
-
|
|
332
|
+
echo '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"search","arguments":{"query":"button"}}}' | kolibri-mcp
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
**Search for accessibility documentation:**
|
|
336
|
+
|
|
337
|
+
```bash
|
|
338
|
+
echo '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"search","arguments":{"query":"accessibility","kind":"doc"}}}' | kolibri-mcp
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
**Get a specific sample:**
|
|
153
342
|
|
|
154
|
-
|
|
155
|
-
|
|
343
|
+
```bash
|
|
344
|
+
echo '{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"fetch","arguments":{"id":"sample/button/basic"}}}' | kolibri-mcp
|
|
156
345
|
```
|
|
157
346
|
|
|
158
|
-
###
|
|
347
|
+
### Testing with MCP Inspector
|
|
159
348
|
|
|
160
|
-
|
|
349
|
+
For visual testing and debugging:
|
|
161
350
|
|
|
162
351
|
```bash
|
|
163
|
-
|
|
352
|
+
# Install MCP Inspector globally
|
|
353
|
+
npm install -g @modelcontextprotocol/inspector
|
|
354
|
+
|
|
355
|
+
# Run the server with inspector
|
|
356
|
+
mcp-inspector kolibri-mcp
|
|
164
357
|
```
|
|
165
358
|
|
|
166
|
-
|
|
359
|
+
This opens a web interface where you can test all tools and resources interactively.
|
|
167
360
|
|
|
168
|
-
|
|
361
|
+
## Development
|
|
169
362
|
|
|
170
|
-
|
|
363
|
+
```bash
|
|
364
|
+
# Install dependencies
|
|
365
|
+
pnpm install
|
|
366
|
+
|
|
367
|
+
# Generate sample index (required before build)
|
|
368
|
+
pnpm generate-index
|
|
171
369
|
|
|
172
|
-
|
|
370
|
+
# Build
|
|
371
|
+
pnpm build
|
|
173
372
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
- **Best Practices**: Learn accessibility and responsive design implementations
|
|
177
|
-
- **Debugging**: Find working examples for troubleshooting
|
|
373
|
+
# Start stdio mode (for local MCP clients)
|
|
374
|
+
pnpm run start:stdio
|
|
178
375
|
|
|
179
|
-
|
|
376
|
+
# Start HTTP server (for remote access)
|
|
377
|
+
pnpm start
|
|
180
378
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
- **Learning Resource**: Understand KoliBri design system patterns
|
|
184
|
-
- **Integration Guide**: See how components work together
|
|
379
|
+
# Development with inspector
|
|
380
|
+
pnpm run inspect
|
|
185
381
|
|
|
186
|
-
|
|
382
|
+
# Format
|
|
383
|
+
pnpm format
|
|
187
384
|
|
|
188
|
-
|
|
385
|
+
# Test
|
|
386
|
+
pnpm test
|
|
387
|
+
```
|
|
189
388
|
|
|
190
|
-
|
|
191
|
-
- Interactive sample browser
|
|
192
|
-
- Real-time health status
|
|
193
|
-
- Direct API access
|
|
389
|
+
## Deployment
|
|
194
390
|
|
|
195
|
-
|
|
391
|
+
### Vercel
|
|
196
392
|
|
|
197
|
-
|
|
393
|
+
This package can be deployed to Vercel as a serverless API:
|
|
198
394
|
|
|
199
395
|
```bash
|
|
200
|
-
|
|
201
|
-
|
|
396
|
+
# Quick start
|
|
397
|
+
pnpm run generate-index
|
|
398
|
+
pnpm run build
|
|
399
|
+
vercel --prod
|
|
202
400
|
```
|
|
203
401
|
|
|
204
|
-
|
|
402
|
+
After deployment, the following endpoints are available:
|
|
205
403
|
|
|
206
|
-
|
|
207
|
-
|
|
404
|
+
- `GET /` - Landing page with API documentation
|
|
405
|
+
- `POST /mcp` - MCP server endpoint (StreamableHTTP transport)
|
|
208
406
|
|
|
209
|
-
|
|
210
|
-
const server = require('http').createServer((req, res) => {
|
|
211
|
-
handleApiRequest(req, res);
|
|
212
|
-
});
|
|
407
|
+
For detailed deployment instructions:
|
|
213
408
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
});
|
|
217
|
-
```
|
|
409
|
+
- **Quick Start**: See [QUICK_START_VERCEL.md](./QUICK_START_VERCEL.md)
|
|
410
|
+
- **Full Guide**: See [VERCEL_DEPLOYMENT.md](./VERCEL_DEPLOYMENT.md)
|
|
218
411
|
|
|
219
|
-
|
|
412
|
+
### Local stdio mode
|
|
413
|
+
|
|
414
|
+
```bash
|
|
415
|
+
# Start server locally (stdio)
|
|
416
|
+
pnpm run start:stdio
|
|
417
|
+
# or
|
|
418
|
+
kolibri-mcp
|
|
419
|
+
```
|
|
220
420
|
|
|
221
|
-
|
|
421
|
+
## Sample Data
|
|
222
422
|
|
|
223
|
-
|
|
224
|
-
- 🎨 **Themeable** components with design tokens
|
|
225
|
-
- 🔧 **Framework-agnostic** (React, Angular, Vue, etc.)
|
|
226
|
-
- 🏛️ **Government-ready** (developed by ITZBund)
|
|
423
|
+
Currently includes example entries for:
|
|
227
424
|
|
|
228
|
-
|
|
425
|
+
- **Samples**: button/basic, input/text, table/basic
|
|
426
|
+
- **Docs**: getting-started, accessibility
|
|
229
427
|
|
|
230
|
-
|
|
428
|
+
In production, this would be replaced with actual KoliBri component data.
|
|
231
429
|
|
|
232
|
-
##
|
|
430
|
+
## Dependencies
|
|
233
431
|
|
|
234
|
-
|
|
432
|
+
- `@modelcontextprotocol/sdk`: ^1.21.0 - Official MCP SDK
|
|
433
|
+
- `fuse.js`: ^7.1.0 - Fuzzy search library
|
|
434
|
+
- `zod`: ^3.23.8 - Schema validation
|
|
235
435
|
|
|
236
|
-
|
|
436
|
+
## License
|
|
237
437
|
|
|
238
|
-
|
|
438
|
+
EUPL-1.2
|
package/dist/cli.cjs
CHANGED
|
@@ -1,48 +1,43 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
require('
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
require('
|
|
8
|
-
require('
|
|
9
|
-
require('node:fs/promises');
|
|
10
|
-
require('node:path');
|
|
4
|
+
const stdio_js = require('@modelcontextprotocol/sdk/server/stdio.js');
|
|
5
|
+
const node_module = require('node:module');
|
|
6
|
+
const data = require('./data.cjs');
|
|
7
|
+
const mcp = require('./mcp.cjs');
|
|
8
|
+
require('node:fs');
|
|
11
9
|
require('node:url');
|
|
10
|
+
require('@modelcontextprotocol/sdk/server/mcp.js');
|
|
11
|
+
require('@modelcontextprotocol/sdk/server/streamableHttp.js');
|
|
12
|
+
require('express');
|
|
13
|
+
require('zod');
|
|
14
|
+
require('./search.cjs');
|
|
15
|
+
require('fuse.js');
|
|
12
16
|
|
|
13
|
-
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
18
|
+
const require$1 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli.cjs', document.baseURI).href)));
|
|
19
|
+
const { version: PACKAGE_VERSION = "0.0.0" } = require$1("../package.json");
|
|
20
|
+
const ENABLE_LOGGING = process.env.MCP_LOGGING === "true" || process.env.MCP_LOGGING === "1";
|
|
21
|
+
async function main() {
|
|
22
|
+
const server = mcp.createKolibriMcpServer();
|
|
23
|
+
const transport = new stdio_js.StdioServerTransport();
|
|
24
|
+
await server.connect(transport);
|
|
25
|
+
const metadata = data.getSampleIndexMetadata();
|
|
26
|
+
console.error(`
|
|
27
|
+
\u{1F680} KoliBri MCP Server v${PACKAGE_VERSION}`);
|
|
28
|
+
console.error("\u2501".repeat(50));
|
|
29
|
+
console.error(`\u{1F4CA} Loaded ${metadata.counts.total} entries:`);
|
|
30
|
+
console.error(` \u2022 ${metadata.counts.totalSamples} samples`);
|
|
31
|
+
console.error(` \u2022 ${metadata.counts.totalSpecs ?? 0} specs`);
|
|
32
|
+
console.error(` \u2022 ${metadata.counts.totalScenarios ?? 0} scenarios`);
|
|
33
|
+
console.error(` \u2022 ${metadata.counts.totalDocs} docs`);
|
|
34
|
+
console.error("\u2501".repeat(50));
|
|
35
|
+
if (ENABLE_LOGGING) {
|
|
36
|
+
console.error("\u{1F50D} Logging: ENABLED (MCP_LOGGING=true)");
|
|
37
|
+
} else {
|
|
38
|
+
console.error("\u{1F4A1} Logging: disabled (set MCP_LOGGING=true to enable)");
|
|
22
39
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
console.log(`\u{1F4CA} API endpoints:`);
|
|
28
|
-
console.log(` GET /mcp/health - Server status`);
|
|
29
|
-
console.log(` GET /mcp/samples - List all samples`);
|
|
30
|
-
console.log(` GET /mcp/sample - Get specific sample`);
|
|
31
|
-
console.log(` GET /mcp/docs - List docs`);
|
|
32
|
-
console.log(` GET /mcp/doc - Get specific doc`);
|
|
33
|
-
console.log(`\u{1F4DA} Documentation: https://www.npmjs.com/package/@public-ui/mcp`);
|
|
34
|
-
});
|
|
35
|
-
process.on("SIGTERM", () => {
|
|
36
|
-
console.log("\u{1F6D1} Received SIGTERM, shutting down gracefully...");
|
|
37
|
-
server.close(() => {
|
|
38
|
-
console.log("\u2705 Server closed");
|
|
39
|
-
process.exit(0);
|
|
40
|
-
});
|
|
41
|
-
});
|
|
42
|
-
process.on("SIGINT", () => {
|
|
43
|
-
console.log("\u{1F6D1} Received SIGINT, shutting down gracefully...");
|
|
44
|
-
server.close(() => {
|
|
45
|
-
console.log("\u2705 Server closed");
|
|
46
|
-
process.exit(0);
|
|
47
|
-
});
|
|
48
|
-
});
|
|
40
|
+
console.error("\u{1F50C} Transport: stdio");
|
|
41
|
+
console.error("\u2705 Ready for MCP requests\n");
|
|
42
|
+
}
|
|
43
|
+
void main();
|
package/dist/cli.d.cts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
package/dist/cli.d.mts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|