@mcp-html-bridge/cli 0.5.1 → 0.6.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/package.json CHANGED
@@ -1,12 +1,15 @@
1
1
  {
2
2
  "name": "@mcp-html-bridge/cli",
3
- "version": "0.5.1",
3
+ "version": "0.6.0",
4
4
  "description": "CLI adapter for MCP-HTML-Bridge",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
7
7
  "bin": {
8
8
  "mcp-bridge": "./dist/index.js"
9
9
  },
10
+ "files": [
11
+ "dist/"
12
+ ],
10
13
  "scripts": {
11
14
  "build": "tsc -p tsconfig.json",
12
15
  "clean": "rm -rf dist"
package/src/compile.ts DELETED
@@ -1,46 +0,0 @@
1
- // ── compile subcommand: connect to MCP server → extract schemas → generate SKILL.md ──
2
- import { writeFileSync } from 'node:fs';
3
- import { MCPClient } from '@mcp-html-bridge/mcp-client';
4
- import { renderFromSchema } from '@mcp-html-bridge/ui-engine';
5
- import type { JSONSchema } from '@mcp-html-bridge/ui-engine';
6
-
7
- export async function compile(serverCommand: string, outputPath: string): Promise<void> {
8
- const client = new MCPClient();
9
-
10
- console.log(` Connecting to: ${serverCommand}`);
11
- await client.connect({ command: serverCommand });
12
-
13
- console.log(' Listing tools...');
14
- const tools = await client.listTools();
15
- console.log(` Found ${tools.length} tools`);
16
-
17
- const sections: string[] = [];
18
-
19
- sections.push('# MCP Tool UI Reference\n');
20
- sections.push(`> Auto-generated by mcp-html-bridge from \`${serverCommand}\``);
21
- sections.push(`> ${tools.length} tools discovered\n`);
22
-
23
- for (const tool of tools) {
24
- console.log(` Processing: ${tool.name}`);
25
-
26
- const schema = tool.inputSchema as JSONSchema;
27
- const html = renderFromSchema(schema, {
28
- toolName: tool.name,
29
- toolDescription: tool.description,
30
- });
31
-
32
- sections.push(`## ${tool.name}\n`);
33
- if (tool.description) {
34
- sections.push(`${tool.description}\n`);
35
- }
36
- sections.push('```mcp-html');
37
- sections.push(html);
38
- sections.push('```\n');
39
- }
40
-
41
- const content = sections.join('\n');
42
- writeFileSync(outputPath, content);
43
- console.log(`\n ✓ Written to ${outputPath}`);
44
-
45
- await client.disconnect();
46
- }
package/src/index.ts DELETED
@@ -1,38 +0,0 @@
1
- #!/usr/bin/env node
2
- // ── CLI Entry: mcp-bridge command ──
3
- import { Command } from 'commander';
4
- import { testMock } from './test-mock.js';
5
- import { compile } from './compile.js';
6
-
7
- const program = new Command();
8
-
9
- program
10
- .name('mcp-bridge')
11
- .description('MCP-HTML-Bridge — render MCP schemas/data as self-contained HTML')
12
- .version('0.1.0');
13
-
14
- program
15
- .command('compile <server-command>')
16
- .description('Connect to an MCP server, extract tool schemas, and generate a SKILL.md file')
17
- .option('-o, --output <path>', 'Output file path', 'SKILL.md')
18
- .action(async (serverCommand: string, opts: { output: string }) => {
19
- try {
20
- console.log('\n mcp-bridge compile\n');
21
- await compile(serverCommand, opts.output);
22
- } catch (err) {
23
- console.error('Error:', (err as Error).message);
24
- process.exit(1);
25
- }
26
- });
27
-
28
- program
29
- .command('test-mock')
30
- .description('Generate HTML from built-in mock datasets for browser testing')
31
- .option('-o, --output <dir>', 'Output directory', './mcp-html-output')
32
- .option('-d, --debug', 'Enable debug playground panel', false)
33
- .action((opts: { output: string; debug: boolean }) => {
34
- console.log('\n mcp-bridge test-mock\n');
35
- testMock(opts.output, opts.debug);
36
- });
37
-
38
- program.parse();
package/src/mock-data.ts DELETED
@@ -1,170 +0,0 @@
1
- // ── Mock datasets for testing ──
2
-
3
- /** E-commerce SKU matrix dataset */
4
- export const ecommerceData = {
5
- store: 'TechMart Global',
6
- lastUpdated: '2026-03-20T08:00:00Z',
7
- summary: {
8
- totalSKUs: 8,
9
- totalRevenue: 284750.0,
10
- avgPrice: 449.99,
11
- lowStockCount: 2,
12
- },
13
- products: [
14
- {
15
- sku: 'TM-LAP-001',
16
- name: 'UltraBook Pro 16"',
17
- category: 'Laptops',
18
- price: 1299.99,
19
- stock: 142,
20
- status: 'Active',
21
- rating: 4.7,
22
- revenue: 92399.29,
23
- },
24
- {
25
- sku: 'TM-LAP-002',
26
- name: 'DevStation X1 Carbon',
27
- category: 'Laptops',
28
- price: 1849.0,
29
- stock: 67,
30
- status: 'Active',
31
- rating: 4.9,
32
- revenue: 55470.0,
33
- },
34
- {
35
- sku: 'TM-PHN-001',
36
- name: 'Pixel Ultra 8',
37
- category: 'Phones',
38
- price: 899.0,
39
- stock: 234,
40
- status: 'Active',
41
- rating: 4.5,
42
- revenue: 44950.0,
43
- },
44
- {
45
- sku: 'TM-PHN-002',
46
- name: 'GalaxyFold Z7',
47
- category: 'Phones',
48
- price: 1799.0,
49
- stock: 12,
50
- status: 'Low Stock',
51
- rating: 4.3,
52
- revenue: 35980.0,
53
- },
54
- {
55
- sku: 'TM-TAB-001',
56
- name: 'iPad Air M3',
57
- category: 'Tablets',
58
- price: 649.0,
59
- stock: 0,
60
- status: 'Out of Stock',
61
- rating: 4.8,
62
- revenue: 25960.0,
63
- },
64
- {
65
- sku: 'TM-AUD-001',
66
- name: 'AirPods Max 2',
67
- category: 'Audio',
68
- price: 549.0,
69
- stock: 89,
70
- status: 'Active',
71
- rating: 4.6,
72
- revenue: 16470.0,
73
- },
74
- {
75
- sku: 'TM-ACC-001',
76
- name: 'MagSafe Charger Bundle',
77
- category: 'Accessories',
78
- price: 79.99,
79
- stock: 456,
80
- status: 'Active',
81
- rating: 4.2,
82
- revenue: 7999.0,
83
- },
84
- {
85
- sku: 'TM-ACC-002',
86
- name: 'USB-C Hub 12-in-1',
87
- category: 'Accessories',
88
- price: 129.99,
89
- stock: 8,
90
- status: 'Backorder',
91
- rating: 4.4,
92
- revenue: 5521.71,
93
- },
94
- ],
95
- };
96
-
97
- /** Particle physics collision dataset */
98
- export const physicsData = {
99
- experiment: 'LHC Run 4 — Higgs Boson Decay Analysis',
100
- runId: 'CERN-2026-0342',
101
- timestamp: '2026-03-19T14:32:07.291Z',
102
- beamEnergy: 13.6, // TeV
103
- luminosity: 4.2e34, // cm⁻²s⁻¹
104
- description:
105
- 'Analysis of diphoton invariant mass spectrum from proton-proton collisions at √s = 13.6 TeV. This run focused on measuring the Higgs boson signal strength in the H→γγ decay channel with improved electromagnetic calorimeter calibration. The observed excess at 125.09 GeV is consistent with the Standard Model Higgs boson prediction within 1.2σ.',
106
- results: {
107
- observedEvents: 14283,
108
- backgroundEstimate: 13950,
109
- signalExcess: 333,
110
- significance: 5.2, // sigma
111
- higgsMass: 125.09, // GeV/c²
112
- massUncertainty: 0.24,
113
- signalStrength: 1.12,
114
- signalStrengthError: 0.09,
115
- },
116
- eventSample: [
117
- { eventId: 'EVT-90341', energy: 125.3, eta: -1.42, phi: 2.81, pt: 64.2, channel: 'diphoton', selected: true },
118
- { eventId: 'EVT-90342', energy: 124.8, eta: 0.67, phi: -1.23, pt: 58.7, channel: 'diphoton', selected: true },
119
- { eventId: 'EVT-90343', energy: 91.2, eta: 2.11, phi: 0.45, pt: 42.1, channel: 'Z-boson', selected: false },
120
- { eventId: 'EVT-90344', energy: 125.1, eta: -0.23, phi: -2.67, pt: 71.3, channel: 'diphoton', selected: true },
121
- { eventId: 'EVT-90345', energy: 80.4, eta: 1.89, phi: 1.12, pt: 38.5, channel: 'W-boson', selected: false },
122
- { eventId: 'EVT-90346', energy: 125.0, eta: 0.02, phi: -0.89, pt: 66.8, channel: 'diphoton', selected: true },
123
- ],
124
- };
125
-
126
- /** Sample JSON Schema for a tool */
127
- export const sampleToolSchema = {
128
- name: 'search_products',
129
- description: 'Search the product catalog with filters and sorting options.',
130
- inputSchema: {
131
- type: 'object' as const,
132
- properties: {
133
- query: {
134
- type: 'string',
135
- description: 'Search query string',
136
- },
137
- category: {
138
- type: 'string',
139
- enum: ['Laptops', 'Phones', 'Tablets', 'Audio', 'Accessories'],
140
- description: 'Filter by product category',
141
- },
142
- priceRange: {
143
- type: 'object',
144
- properties: {
145
- min: { type: 'number', minimum: 0, description: 'Minimum price' },
146
- max: { type: 'number', minimum: 0, description: 'Maximum price' },
147
- },
148
- description: 'Price range filter',
149
- },
150
- inStockOnly: {
151
- type: 'boolean',
152
- default: true,
153
- description: 'Only show in-stock items',
154
- },
155
- sortBy: {
156
- type: 'string',
157
- enum: ['price', 'rating', 'name', 'stock'],
158
- description: 'Sort results by field',
159
- },
160
- limit: {
161
- type: 'integer',
162
- minimum: 1,
163
- maximum: 100,
164
- default: 20,
165
- description: 'Maximum number of results',
166
- },
167
- },
168
- required: ['query'],
169
- },
170
- };
package/src/test-mock.ts DELETED
@@ -1,74 +0,0 @@
1
- // ── test-mock subcommand: render mock data to HTML files ──
2
- import { writeFileSync, mkdirSync } from 'node:fs';
3
- import { join } from 'node:path';
4
- import { renderFromDataSync, renderFromSchema } from '@mcp-html-bridge/ui-engine';
5
- import { ecommerceData, physicsData, sampleToolSchema } from './mock-data.js';
6
-
7
- export function testMock(outputDir: string, debug: boolean): void {
8
- mkdirSync(outputDir, { recursive: true });
9
-
10
- const opts = { debug };
11
-
12
- // 1. E-commerce data (composite: metrics + grid)
13
- const ecommerceHtml = renderFromDataSync(ecommerceData, {
14
- ...opts,
15
- title: 'E-Commerce Dashboard — TechMart',
16
- toolName: 'get_inventory',
17
- });
18
- const ecomPath = join(outputDir, 'ecommerce.html');
19
- writeFileSync(ecomPath, ecommerceHtml);
20
- console.log(` ✓ ${ecomPath}`);
21
-
22
- // 2. E-commerce products only (data grid)
23
- const gridHtml = renderFromDataSync(ecommerceData.products, {
24
- ...opts,
25
- title: 'Product Grid',
26
- toolName: 'list_products',
27
- });
28
- const gridPath = join(outputDir, 'data-grid.html');
29
- writeFileSync(gridPath, gridHtml);
30
- console.log(` ✓ ${gridPath}`);
31
-
32
- // 3. Physics data (composite: reading block + metrics + grid)
33
- const physicsHtml = renderFromDataSync(physicsData, {
34
- ...opts,
35
- title: 'LHC Collision Analysis',
36
- toolName: 'analyze_collisions',
37
- });
38
- const physicsPath = join(outputDir, 'physics.html');
39
- writeFileSync(physicsPath, physicsHtml);
40
- console.log(` ✓ ${physicsPath}`);
41
-
42
- // 4. Physics results only (metrics cards)
43
- const metricsHtml = renderFromDataSync(physicsData.results, {
44
- ...opts,
45
- title: 'Collision Metrics',
46
- toolName: 'get_results',
47
- });
48
- const metricsPath = join(outputDir, 'metrics.html');
49
- writeFileSync(metricsPath, metricsHtml);
50
- console.log(` ✓ ${metricsPath}`);
51
-
52
- // 5. Tool schema (form)
53
- const formHtml = renderFromSchema(sampleToolSchema.inputSchema, {
54
- ...opts,
55
- title: 'Search Products',
56
- toolName: sampleToolSchema.name,
57
- toolDescription: sampleToolSchema.description,
58
- });
59
- const formPath = join(outputDir, 'form.html');
60
- writeFileSync(formPath, formHtml);
61
- console.log(` ✓ ${formPath}`);
62
-
63
- // 6. Deep JSON (json-tree)
64
- const treeHtml = renderFromDataSync(physicsData, {
65
- ...opts,
66
- title: 'Raw JSON Tree',
67
- });
68
- const treePath = join(outputDir, 'json-tree.html');
69
- writeFileSync(treePath, treeHtml);
70
- console.log(` ✓ ${treePath}`);
71
-
72
- console.log(`\n ${6} HTML files written to ${outputDir}`);
73
- console.log(' Open them in a browser to verify rendering.');
74
- }
package/tsconfig.json DELETED
@@ -1,12 +0,0 @@
1
- {
2
- "extends": "../../tsconfig.base.json",
3
- "compilerOptions": {
4
- "outDir": "./dist",
5
- "rootDir": "./src"
6
- },
7
- "include": ["src/**/*"],
8
- "references": [
9
- { "path": "../core-ui-engine" },
10
- { "path": "../core-mcp-client" }
11
- ]
12
- }