@public-ui/mcp 4.0.0-alpha.2 → 4.0.0-alpha.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
@@ -1,238 +1,438 @@
1
- # KoliBri MCP Server
1
+ # @public-ui/mcp
2
2
 
3
- [![npm version](https://badge.fury.io/js/@public-ui%2Fmcp.svg)](https://www.npmjs.com/package/@public-ui/mcp)
4
- [![License: EUPL-1.2](https://img.shields.io/badge/License-EUPL--1.2-blue.svg)](https://opensource.org/licenses/EUPL-1.2)
3
+ [![npm](https://img.shields.io/npm/v/@public-ui/mcp)](https://www.npmjs.com/package/@public-ui/components)
4
+ [![license](https://img.shields.io/npm/l/@public-ui/mcp)](https://github.com/public-ui/kolibri/blob/main/LICENSE)
5
+ [![downloads](https://img.shields.io/npm/dt/@public-ui/mcp)](https://www.npmjs.com/package/@public-ui/mcp)
6
+ [![issues](https://img.shields.io/github/issues/public-ui/kolibri)](https://github.com/public-ui/kolibri/issues)
7
+ [![pull requests](https://img.shields.io/github/issues-pr/public-ui/kolibri)](https://github.com/public-ui/kolibri/pulls)
8
+ [![size](https://img.shields.io/bundlephobia/min/@public-ui/mcp)](https://bundlephobia.com/result?p=@public-ui/kolibri-cli)
9
+ ![contributors](https://img.shields.io/github/contributors/public-ui/kolibri)
5
10
 
6
- A **Model Context Protocol (MCP) server** that provides AI agents with access to **136+ KoliBri component examples** and their source code. This enables LLMs to understand and generate code using the KoliBri design system components.
11
+ > **Model Context Protocol Server for KoliBri Access 200+ Component Examples**
7
12
 
8
- ## 🚀 Quick Start
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
- ### Installation
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
- ```bash
13
- npm install @public-ui/mcp
14
- # or
15
- pnpm add @public-ui/mcp
16
- # or
17
- yarn add @public-ui/mcp
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
- ### Usage as MCP Server
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
- Start the MCP server for AI agents:
40
+ ### Alternative: Local Installation
41
+
42
+ For offline use or local development:
23
43
 
24
44
  ```bash
25
- npx @public-ui/mcp
45
+ npm install -g @public-ui/mcp
26
46
  ```
27
47
 
28
- The server will start on `http://localhost:3030` and provide the following endpoints:
48
+ After installation, run with:
29
49
 
30
- - `GET /mcp/health` - Server status and content counts
31
- - `GET /mcp/samples` - List all available component examples
32
- - `GET /mcp/sample?id=sample/button/basic` - Get specific sample source code
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
- The sample and doc indexes are prebuilt for deployments, therefore no manual refresh endpoint is exposed in production.
54
+ ## Usage
37
55
 
38
- ### Integration with AI Tools
56
+ ### Recommended: Remote HTTP Server
39
57
 
40
- #### Claude Desktop (Anthropic)
58
+ **Zero installation required!** Use the hosted endpoint directly:
41
59
 
42
- Add to your Claude Desktop configuration:
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
- #### Custom MCP Client
148
+ The server provides a StreamableHTTP endpoint at `POST /mcp`.
57
149
 
58
- ```javascript
59
- import { spawn } from 'child_process';
150
+ ### Programmatically (stdio)
60
151
 
61
- // Start MCP server
62
- const mcpServer = spawn('npx', ['@public-ui/mcp']);
152
+ ```typescript
153
+ import { createKolibriMcpServer } from '@public-ui/mcp';
154
+ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
63
155
 
64
- // Make requests to the server
65
- const response = await fetch('http://localhost:3030/mcp/samples');
66
- const samples = await response.json();
156
+ const server = createKolibriMcpServer();
157
+ const transport = new StdioServerTransport();
158
+
159
+ await server.connect(transport);
67
160
  ```
68
161
 
69
- ## 📚 What's Included
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
- This MCP server provides access to **136+ KoliBri component examples** and the core **Markdown documentation** of the project, including:
166
+ ### Enable Logging
72
167
 
73
- - **Basic Components**: Button, Input, Link, Icon, Badge, etc.
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
- Each sample includes:
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
- - **Complete source code** (React/TypeScript)
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
- ## 🔌 API Reference
188
+ ### Log Types
89
189
 
90
- ### GET /mcp/health
190
+ When enabled, logs include:
91
191
 
92
- Returns server status and metadata:
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
- "status": "ok",
97
- "healthy": true,
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
- ### GET /mcp/docs
236
+ ### 2. `search`
111
237
 
112
- List Markdown-based documentation entries:
238
+ Search for KoliBri component samples, scenarios, and documentation using fuzzy search powered by Fuse.js.
113
239
 
114
- ```bash
115
- # Get all docs
116
- curl http://localhost:3030/mcp/docs
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
- # Filter by term
119
- curl "http://localhost:3030/mcp/docs?q=theme"
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
- ### GET /mcp/doc?id={docId}
259
+ ### 3. `fetch`
123
260
 
124
- Fetch Markdown documentation by referencing its `docs/...` identifier:
261
+ Get a specific sample or documentation entry by its ID.
125
262
 
126
- ```bash
127
- curl "http://localhost:3030/mcp/doc?id=doc/README"
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
- Returns the Markdown content together with metadata. Every sample or doc response exposes a `kind` field so that clients can distinguish between component examples and documentation entries.
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
- "id": "sample/button/basic",
135
- "group": "button",
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
- ### GET /mcp/docs
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
- List Markdown-based documentation entries:
329
+ **Search for button components:**
150
330
 
151
331
  ```bash
152
- curl http://localhost:3030/mcp/docs
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
- # Filter by term
155
- curl "http://localhost:3030/mcp/docs?q=theme"
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
- ### GET /mcp/doc?id={docId}
347
+ ### Testing with MCP Inspector
159
348
 
160
- Fetch Markdown documentation by referencing its `docs/...` identifier:
349
+ For visual testing and debugging:
161
350
 
162
351
  ```bash
163
- curl "http://localhost:3030/mcp/doc?id=doc/README"
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
- Returns the Markdown content together with metadata. Every sample or doc response exposes a `kind` field so that clients can distinguish between component examples and documentation entries.
359
+ This opens a web interface where you can test all tools and resources interactively.
167
360
 
168
- All JSON responses contain an `ai-hints` string array that reiterates in English that KoliBri Web Components must be registered in the browser and that integration steps vary with the chosen project setup.
361
+ ## Development
169
362
 
170
- ## 🛠️ Use Cases
363
+ ```bash
364
+ # Install dependencies
365
+ pnpm install
366
+
367
+ # Generate sample index (required before build)
368
+ pnpm generate-index
171
369
 
172
- ### For AI Agents
370
+ # Build
371
+ pnpm build
173
372
 
174
- - **Code Generation**: Generate KoliBri components with proper usage patterns
175
- - **Documentation**: Understand component APIs and props
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
- ### For Developers
376
+ # Start HTTP server (for remote access)
377
+ pnpm start
180
378
 
181
- - **Component Discovery**: Browse all available KoliBri components
182
- - **Copy-Paste Examples**: Get ready-to-use component code
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
- ## 🌐 Online Demo
382
+ # Format
383
+ pnpm format
187
384
 
188
- Try the live API at: [https://public-ui-kolibri-mcp.vercel.app/mcp/](https://public-ui-kolibri-mcp.vercel.app/mcp/)
385
+ # Test
386
+ pnpm test
387
+ ```
189
388
 
190
- - Landing page with API documentation
191
- - Interactive sample browser
192
- - Real-time health status
193
- - Direct API access
389
+ ## Deployment
194
390
 
195
- ## 🔧 Configuration
391
+ ### Vercel
196
392
 
197
- ### Environment Variables
393
+ This package can be deployed to Vercel as a serverless API:
198
394
 
199
395
  ```bash
200
- PORT=3030 # Server port (default: 3030)
201
- NODE_ENV=production # Environment mode
396
+ # Quick start
397
+ pnpm run generate-index
398
+ pnpm run build
399
+ vercel --prod
202
400
  ```
203
401
 
204
- ### Programmatic Usage
402
+ After deployment, the following endpoints are available:
205
403
 
206
- ```javascript
207
- import { handleApiRequest } from '@public-ui/mcp';
404
+ - `GET /` - Landing page with API documentation
405
+ - `POST /mcp` - MCP server endpoint (StreamableHTTP transport)
208
406
 
209
- // Create custom server
210
- const server = require('http').createServer((req, res) => {
211
- handleApiRequest(req, res);
212
- });
407
+ For detailed deployment instructions:
213
408
 
214
- server.listen(3030, () => {
215
- console.log('KoliBri MCP Server running on port 3030');
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
- ## 📖 About KoliBri
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
- [KoliBri](https://public-ui.github.io) is a comprehensive design system and component library focused on:
421
+ ## Sample Data
222
422
 
223
- - **Accessibility-first** design (WCAG 2.1 AA compliant)
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
- ## 📄 License
425
+ - **Samples**: button/basic, input/text, table/basic
426
+ - **Docs**: getting-started, accessibility
229
427
 
230
- This project is licensed under the [EUPL-1.2](https://opensource.org/licenses/EUPL-1.2) license.
428
+ In production, this would be replaced with actual KoliBri component data.
231
429
 
232
- ## 🤝 Contributing
430
+ ## Dependencies
233
431
 
234
- See [AGENTS.md](./AGENTS.md) for development instructions and contribution guidelines.
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
- **Made with ❤️ by [ITZBund](https://www.itzbund.de) for the German government and open source community.**
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('./index.cjs');
5
- const http = require('http');
6
- const apiHandler = require('./api-handler.cjs');
7
- require('node:http');
8
- require('./sample-index.cjs');
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
- const PORT = process.env.PORT || 3030;
14
- const server = http.createServer((req, res) => {
15
- res.setHeader("Access-Control-Allow-Origin", "*");
16
- res.setHeader("Access-Control-Allow-Methods", "GET, POST, OPTIONS");
17
- res.setHeader("Access-Control-Allow-Headers", "Content-Type");
18
- if (req.method === "OPTIONS") {
19
- res.writeHead(200);
20
- res.end();
21
- return;
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
- apiHandler.handleApiRequest(req);
24
- });
25
- server.listen(PORT, () => {
26
- console.log(`\u{1F680} KoliBri MCP Server running on http://localhost:${PORT}`);
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
+