@mohityadav0903/branintelle-mcp 1.0.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/README.md +154 -0
- package/mcp-server.js +275 -0
- package/package.json +35 -0
- package/test-mcp.js +108 -0
package/README.md
ADDED
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
# Branintelle UI Library - MCP Server
|
|
2
|
+
|
|
3
|
+
## ๐ Quick Start
|
|
4
|
+
|
|
5
|
+
Your component library now includes an MCP (Model Context Protocol) server that LLMs can query for documentation!
|
|
6
|
+
|
|
7
|
+
### โ
What's Working:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
# Test it locally
|
|
11
|
+
cd branintelle-ui-lib
|
|
12
|
+
node test-mcp.js
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## ๐ฆ Available Tools
|
|
16
|
+
|
|
17
|
+
### 1. **list_components**
|
|
18
|
+
Lists all 36 components, grouped by category
|
|
19
|
+
|
|
20
|
+
```json
|
|
21
|
+
{
|
|
22
|
+
"name": "list_components",
|
|
23
|
+
"arguments": {
|
|
24
|
+
"category": "Buttons" // optional filter
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
**Response:** All components with names, categories, descriptions
|
|
30
|
+
|
|
31
|
+
### 2. **get_component_docs**
|
|
32
|
+
Get docs for specific components
|
|
33
|
+
|
|
34
|
+
```json
|
|
35
|
+
{
|
|
36
|
+
"name": "get_component_docs",
|
|
37
|
+
"arguments": {
|
|
38
|
+
"components": ["CustomButton", "StatusPill"]
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
**Response:** Import statements, usage examples, descriptions
|
|
44
|
+
|
|
45
|
+
### 3. **get_design_tokens**
|
|
46
|
+
Get design system tokens
|
|
47
|
+
|
|
48
|
+
```json
|
|
49
|
+
{
|
|
50
|
+
"name": "get_design_tokens",
|
|
51
|
+
"arguments": {
|
|
52
|
+
"category": "colors" // "colors", "typography", or "all"
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
**Response:** Color palette, typography scales, usage info
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## ๐ง How to Use with Claude Desktop
|
|
62
|
+
|
|
63
|
+
### Step 1: Publish Package (or use npx)
|
|
64
|
+
```bash
|
|
65
|
+
npm run build:lib
|
|
66
|
+
cd dist/lib
|
|
67
|
+
npm pack
|
|
68
|
+
# Publish to npm
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Step 2: Add to Claude Desktop Config
|
|
72
|
+
|
|
73
|
+
**File:** `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
74
|
+
|
|
75
|
+
```json
|
|
76
|
+
{
|
|
77
|
+
"mcpServers": {
|
|
78
|
+
"branintelle": {
|
|
79
|
+
"command": "npx",
|
|
80
|
+
"args": ["-y", "@mohityadav0903/branintelle-ui-lib", "branintelle-mcp"]
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Or if installed globally:
|
|
87
|
+
```json
|
|
88
|
+
{
|
|
89
|
+
"mcpServers": {
|
|
90
|
+
"branintelle": {
|
|
91
|
+
"command": "branintelle-mcp"
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Step 3: Restart Claude Desktop
|
|
98
|
+
|
|
99
|
+
The MCP server will appear in the ๐ menu!
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## ๐งช Test Results
|
|
104
|
+
|
|
105
|
+
```
|
|
106
|
+
โ
Initialize - Server responds with capabilities
|
|
107
|
+
โ
List Tools - 3 tools available
|
|
108
|
+
โ
List Components - 36 components, 12 categories
|
|
109
|
+
โ
Get Component Docs - Import + usage examples
|
|
110
|
+
โ
Get Design Tokens - Full color & typography tokens
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
## ๐ก Example LLM Queries
|
|
116
|
+
|
|
117
|
+
Once connected, LLMs can ask:
|
|
118
|
+
|
|
119
|
+
- "What button components are available in Branintelle?"
|
|
120
|
+
- "Show me how to use the ScrollableDataTable"
|
|
121
|
+
- "What are the primary brand colors?"
|
|
122
|
+
- "List all table components"
|
|
123
|
+
- "Get design tokens for typography"
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
## ๐ Files Created
|
|
128
|
+
|
|
129
|
+
- `mcp-server.js` - Main MCP server implementation
|
|
130
|
+
- `bin/branintelle-mcp` - Executable entry point
|
|
131
|
+
- `test-mcp.js` - Test script
|
|
132
|
+
- `package.json` - Updated with `bin` and `type: "module"`
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
## ๐ Next Steps
|
|
137
|
+
|
|
138
|
+
1. โ
**Test locally** - Run `node test-mcp.js`
|
|
139
|
+
2. โฌ **Add more component details** - Props, examples, patterns
|
|
140
|
+
3. โฌ **Publish to npm** - Make it available via `npx`
|
|
141
|
+
4. โฌ **Test in Claude Desktop** - Add to config and verify
|
|
142
|
+
5. โฌ **Add resources** - Component examples, migration guides
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
|
|
146
|
+
## ๐ Notes
|
|
147
|
+
|
|
148
|
+
- Server runs on **stdio** (standard input/output)
|
|
149
|
+
- Responses are **JSON-RPC 2.0** format
|
|
150
|
+
- Component data is currently **static** (can be auto-generated later)
|
|
151
|
+
- Design tokens are **simplified** (subset of full tokens.css)
|
|
152
|
+
|
|
153
|
+
**Status:** โ
MVP Working! Ready to test with Claude Desktop after publishing.
|
|
154
|
+
|
package/mcp-server.js
ADDED
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Branintelle UI Library - MCP Server
|
|
5
|
+
* Provides component documentation and design tokens via Model Context Protocol
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
9
|
+
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
10
|
+
import {
|
|
11
|
+
CallToolRequestSchema,
|
|
12
|
+
ListToolsRequestSchema,
|
|
13
|
+
} from '@modelcontextprotocol/sdk/types.js';
|
|
14
|
+
|
|
15
|
+
// Component metadata
|
|
16
|
+
const COMPONENTS = [
|
|
17
|
+
{ name: 'CustomButton', category: 'Buttons', description: 'Primary action button with loading states' },
|
|
18
|
+
{ name: 'ApproveButton', category: 'Buttons', description: 'Approve action button with icon' },
|
|
19
|
+
{ name: 'CancelButton', category: 'Buttons', description: 'Cancel/dismiss button' },
|
|
20
|
+
{ name: 'BackButton', category: 'Buttons', description: 'Navigation back button' },
|
|
21
|
+
{ name: 'ButtonImage', category: 'Buttons', description: 'Button with image icon' },
|
|
22
|
+
|
|
23
|
+
{ name: 'StatusPill', category: 'Status', description: 'Status indicator with color and icon' },
|
|
24
|
+
{ name: 'PillBadge', category: 'Status', description: 'Small badge for counts' },
|
|
25
|
+
{ name: 'PillBox', category: 'Status', description: 'Tag-style pill component' },
|
|
26
|
+
|
|
27
|
+
{ name: 'ProgressBar', category: 'Progress', description: 'Linear progress indicator' },
|
|
28
|
+
{ name: 'SegmentedProgressBar', category: 'Progress', description: 'Multi-segment progress bar' },
|
|
29
|
+
|
|
30
|
+
{ name: 'VerticalStepper', category: 'Navigation', description: 'Vertical step indicator' },
|
|
31
|
+
{ name: 'CustomBreadcrumb', category: 'Navigation', description: 'Breadcrumb navigation' },
|
|
32
|
+
{ name: 'HeaderTabs', category: 'Navigation', description: 'Tab navigation with status counts' },
|
|
33
|
+
|
|
34
|
+
{ name: 'TitleHeaderSubtext', category: 'Text', description: 'Title with subtitle component' },
|
|
35
|
+
{ name: 'HelpText', category: 'Text', description: 'Helper text with icon' },
|
|
36
|
+
|
|
37
|
+
{ name: 'SearchBar', category: 'Forms', description: 'Search input with icon' },
|
|
38
|
+
{ name: 'Checklist', category: 'Forms', description: 'Checklist with items' },
|
|
39
|
+
|
|
40
|
+
{ name: 'HorizontalCard', category: 'Cards', description: 'Horizontal layout card' },
|
|
41
|
+
{ name: 'InfoActionCard', category: 'Cards', description: 'Card with action buttons' },
|
|
42
|
+
{ name: 'ProgressDisplayCard', category: 'Cards', description: 'Card showing progress' },
|
|
43
|
+
{ name: 'ProfileImageList', category: 'Cards', description: 'Avatar stack component' },
|
|
44
|
+
|
|
45
|
+
{ name: 'SingleSelectDropdown', category: 'Dropdowns', description: 'Single selection dropdown' },
|
|
46
|
+
{ name: 'MultiSelectDropdown', category: 'Dropdowns', description: 'Multi-selection dropdown' },
|
|
47
|
+
{ name: 'DropdownWithStatus', category: 'Dropdowns', description: 'Dropdown with status indicators' },
|
|
48
|
+
{ name: 'MultilineOptionDropdown', category: 'Dropdowns', description: 'Dropdown with multiline options' },
|
|
49
|
+
{ name: 'ExpandableMenuDropdown', category: 'Dropdowns', description: 'Nested menu dropdown' },
|
|
50
|
+
|
|
51
|
+
{ name: 'CustomTooltip', category: 'Overlays', description: 'Tooltip component' },
|
|
52
|
+
{ name: 'ConfirmWarning', category: 'Overlays', description: 'Confirmation dialog' },
|
|
53
|
+
|
|
54
|
+
{ name: 'VerticalStages', category: 'Workflows', description: 'Vertical stage indicator' },
|
|
55
|
+
{ name: 'UserSelection', category: 'Workflows', description: 'User selection component' },
|
|
56
|
+
{ name: 'Accordion', category: 'Workflows', description: 'Collapsible accordion' },
|
|
57
|
+
|
|
58
|
+
{ name: 'GeoTagFilter', category: 'Filters', description: 'Geographic tag filter' },
|
|
59
|
+
{ name: 'TableActionMenu', category: 'Filters', description: 'Table action menu' },
|
|
60
|
+
|
|
61
|
+
{ name: 'ScrollableDataTable', category: 'Tables', description: 'Scrollable data table with sorting' },
|
|
62
|
+
{ name: 'CollapsableTable', category: 'Tables', description: 'Budget table with collapsible rows' },
|
|
63
|
+
{ name: 'CollapsableTableSmall', category: 'Tables', description: 'Compact collapsible table' },
|
|
64
|
+
];
|
|
65
|
+
|
|
66
|
+
const DESIGN_TOKENS = {
|
|
67
|
+
colors: {
|
|
68
|
+
primary: {
|
|
69
|
+
'violet-500': '#544d7c',
|
|
70
|
+
'violet-600': '#4c4671',
|
|
71
|
+
'violet-700': '#3c3758',
|
|
72
|
+
},
|
|
73
|
+
text: {
|
|
74
|
+
'text-500': '#262728',
|
|
75
|
+
'text-400': '#515253',
|
|
76
|
+
'text-300': '#6e6e6f',
|
|
77
|
+
'text-200': '#9b9c9c',
|
|
78
|
+
},
|
|
79
|
+
feedback: {
|
|
80
|
+
'positive-high': '#2c9148',
|
|
81
|
+
'negative-high': '#ce2d4f',
|
|
82
|
+
'notification-high': '#ffac4e',
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
typography: {
|
|
86
|
+
fontFamily: 'Lato',
|
|
87
|
+
sizes: {
|
|
88
|
+
'heading-large': '24px',
|
|
89
|
+
'heading-medium': '20px',
|
|
90
|
+
'heading-small': '18px',
|
|
91
|
+
'body-large': '16px',
|
|
92
|
+
'body-medium': '14px',
|
|
93
|
+
'body-small': '12px',
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
// Create server instance
|
|
99
|
+
const server = new Server(
|
|
100
|
+
{
|
|
101
|
+
name: 'branintelle-ui-lib',
|
|
102
|
+
version: '1.0.0',
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
capabilities: {
|
|
106
|
+
tools: {},
|
|
107
|
+
},
|
|
108
|
+
}
|
|
109
|
+
);
|
|
110
|
+
|
|
111
|
+
// List available tools
|
|
112
|
+
server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
113
|
+
return {
|
|
114
|
+
tools: [
|
|
115
|
+
{
|
|
116
|
+
name: 'list_components',
|
|
117
|
+
description: 'List all available UI components in the Branintelle library',
|
|
118
|
+
inputSchema: {
|
|
119
|
+
type: 'object',
|
|
120
|
+
properties: {
|
|
121
|
+
category: {
|
|
122
|
+
type: 'string',
|
|
123
|
+
description: 'Filter by category (Buttons, Tables, Dropdowns, etc.)',
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
},
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
name: 'get_component_docs',
|
|
130
|
+
description: 'Get detailed documentation for specific components',
|
|
131
|
+
inputSchema: {
|
|
132
|
+
type: 'object',
|
|
133
|
+
properties: {
|
|
134
|
+
components: {
|
|
135
|
+
type: 'array',
|
|
136
|
+
items: { type: 'string' },
|
|
137
|
+
description: 'List of component names to fetch docs for',
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
required: ['components'],
|
|
141
|
+
},
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
name: 'get_design_tokens',
|
|
145
|
+
description: 'Get design system tokens (colors, typography, spacing)',
|
|
146
|
+
inputSchema: {
|
|
147
|
+
type: 'object',
|
|
148
|
+
properties: {
|
|
149
|
+
category: {
|
|
150
|
+
type: 'string',
|
|
151
|
+
description: 'Token category (colors, typography, all)',
|
|
152
|
+
enum: ['colors', 'typography', 'all'],
|
|
153
|
+
},
|
|
154
|
+
},
|
|
155
|
+
},
|
|
156
|
+
},
|
|
157
|
+
],
|
|
158
|
+
};
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
// Handle tool execution
|
|
162
|
+
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
163
|
+
const { name, arguments: args } = request.params;
|
|
164
|
+
|
|
165
|
+
try {
|
|
166
|
+
if (name === 'list_components') {
|
|
167
|
+
const category = args?.category;
|
|
168
|
+
let filtered = COMPONENTS;
|
|
169
|
+
|
|
170
|
+
if (category) {
|
|
171
|
+
filtered = COMPONENTS.filter(c =>
|
|
172
|
+
c.category.toLowerCase() === category.toLowerCase()
|
|
173
|
+
);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
const grouped = filtered.reduce((acc, comp) => {
|
|
177
|
+
if (!acc[comp.category]) acc[comp.category] = [];
|
|
178
|
+
acc[comp.category].push(comp);
|
|
179
|
+
return acc;
|
|
180
|
+
}, {});
|
|
181
|
+
|
|
182
|
+
return {
|
|
183
|
+
content: [
|
|
184
|
+
{
|
|
185
|
+
type: 'text',
|
|
186
|
+
text: JSON.stringify({
|
|
187
|
+
total: filtered.length,
|
|
188
|
+
components: grouped,
|
|
189
|
+
categories: Object.keys(grouped),
|
|
190
|
+
}, null, 2),
|
|
191
|
+
},
|
|
192
|
+
],
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
if (name === 'get_component_docs') {
|
|
197
|
+
const componentNames = args?.components || [];
|
|
198
|
+
const docs = componentNames.map(name => {
|
|
199
|
+
const comp = COMPONENTS.find(c => c.name === name);
|
|
200
|
+
if (!comp) return { name, error: 'Component not found' };
|
|
201
|
+
|
|
202
|
+
return {
|
|
203
|
+
name: comp.name,
|
|
204
|
+
category: comp.category,
|
|
205
|
+
description: comp.description,
|
|
206
|
+
import: `import { ${comp.name} } from '@mohityadav0903/branintelle-ui-lib';`,
|
|
207
|
+
usage: `<bi-${comp.name.replace(/([A-Z])/g, '-$1').toLowerCase().slice(1)} />`,
|
|
208
|
+
package: '@mohityadav0903/branintelle-ui-lib',
|
|
209
|
+
};
|
|
210
|
+
});
|
|
211
|
+
|
|
212
|
+
return {
|
|
213
|
+
content: [
|
|
214
|
+
{
|
|
215
|
+
type: 'text',
|
|
216
|
+
text: JSON.stringify({ components: docs }, null, 2),
|
|
217
|
+
},
|
|
218
|
+
],
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
if (name === 'get_design_tokens') {
|
|
223
|
+
const category = args?.category || 'all';
|
|
224
|
+
let tokens = DESIGN_TOKENS;
|
|
225
|
+
|
|
226
|
+
if (category !== 'all') {
|
|
227
|
+
tokens = { [category]: DESIGN_TOKENS[category] };
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
return {
|
|
231
|
+
content: [
|
|
232
|
+
{
|
|
233
|
+
type: 'text',
|
|
234
|
+
text: JSON.stringify({
|
|
235
|
+
tokens,
|
|
236
|
+
usage: 'Use CSS variables: var(--violet-500), var(--body-medium-size), etc.',
|
|
237
|
+
location: 'src/styles/tokens.css in demo app',
|
|
238
|
+
}, null, 2),
|
|
239
|
+
},
|
|
240
|
+
],
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
return {
|
|
245
|
+
content: [
|
|
246
|
+
{
|
|
247
|
+
type: 'text',
|
|
248
|
+
text: JSON.stringify({ error: 'Unknown tool' }),
|
|
249
|
+
},
|
|
250
|
+
],
|
|
251
|
+
};
|
|
252
|
+
} catch (error) {
|
|
253
|
+
return {
|
|
254
|
+
content: [
|
|
255
|
+
{
|
|
256
|
+
type: 'text',
|
|
257
|
+
text: JSON.stringify({ error: error.message }),
|
|
258
|
+
},
|
|
259
|
+
],
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
});
|
|
263
|
+
|
|
264
|
+
// Start server
|
|
265
|
+
async function main() {
|
|
266
|
+
const transport = new StdioServerTransport();
|
|
267
|
+
await server.connect(transport);
|
|
268
|
+
console.error('Branintelle UI Library MCP Server running on stdio');
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
main().catch((error) => {
|
|
272
|
+
console.error('Server error:', error);
|
|
273
|
+
process.exit(1);
|
|
274
|
+
});
|
|
275
|
+
|
package/package.json
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@mohityadav0903/branintelle-mcp",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "MCP server for Branintelle UI Library - provides component documentation via Model Context Protocol",
|
|
6
|
+
"main": "mcp-server.js",
|
|
7
|
+
"bin": {
|
|
8
|
+
"branintelle-mcp": "./mcp-server.js"
|
|
9
|
+
},
|
|
10
|
+
"scripts": {
|
|
11
|
+
"test": "node test-mcp.js"
|
|
12
|
+
},
|
|
13
|
+
"keywords": [
|
|
14
|
+
"mcp",
|
|
15
|
+
"model-context-protocol",
|
|
16
|
+
"branintelle",
|
|
17
|
+
"angular",
|
|
18
|
+
"components",
|
|
19
|
+
"documentation",
|
|
20
|
+
"ai",
|
|
21
|
+
"llm"
|
|
22
|
+
],
|
|
23
|
+
"author": "Branintelle",
|
|
24
|
+
"license": "MIT",
|
|
25
|
+
"repository": {
|
|
26
|
+
"type": "git",
|
|
27
|
+
"url": "git+https://github.com/branintelle/branintelle-mcp.git"
|
|
28
|
+
},
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"@modelcontextprotocol/sdk": "^1.0.4"
|
|
31
|
+
},
|
|
32
|
+
"engines": {
|
|
33
|
+
"node": ">=18.0.0"
|
|
34
|
+
}
|
|
35
|
+
}
|
package/test-mcp.js
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* MCP Server Test Script
|
|
5
|
+
* Tests the Branintelle UI Library MCP server
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { spawn } from 'child_process';
|
|
9
|
+
|
|
10
|
+
// Start MCP server
|
|
11
|
+
const server = spawn('node', ['mcp-server.js'], {
|
|
12
|
+
cwd: process.cwd(),
|
|
13
|
+
stdio: ['pipe', 'pipe', 'inherit'],
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
let messageId = 1;
|
|
17
|
+
|
|
18
|
+
// Helper to send JSON-RPC request
|
|
19
|
+
function sendRequest(method, params = {}) {
|
|
20
|
+
const request = {
|
|
21
|
+
jsonrpc: '2.0',
|
|
22
|
+
id: messageId++,
|
|
23
|
+
method,
|
|
24
|
+
params,
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const message = JSON.stringify(request) + '\n';
|
|
28
|
+
server.stdin.write(message);
|
|
29
|
+
console.log('๐ค Sent:', method, params);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// Collect responses
|
|
33
|
+
let buffer = '';
|
|
34
|
+
server.stdout.on('data', (data) => {
|
|
35
|
+
buffer += data.toString();
|
|
36
|
+
const lines = buffer.split('\n');
|
|
37
|
+
buffer = lines.pop() || '';
|
|
38
|
+
|
|
39
|
+
lines.forEach(line => {
|
|
40
|
+
if (line.trim()) {
|
|
41
|
+
try {
|
|
42
|
+
const response = JSON.parse(line);
|
|
43
|
+
console.log('\n๐ฅ Response:', JSON.stringify(response, null, 2));
|
|
44
|
+
} catch (e) {
|
|
45
|
+
// Ignore non-JSON lines
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
server.on('close', (code) => {
|
|
52
|
+
console.log(`\nโ
Server exited with code ${code}`);
|
|
53
|
+
process.exit(code);
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
// Run tests
|
|
57
|
+
console.log('๐งช Testing Branintelle MCP Server\n');
|
|
58
|
+
|
|
59
|
+
setTimeout(() => {
|
|
60
|
+
console.log('\n๐ Test 1: Initialize');
|
|
61
|
+
sendRequest('initialize', {
|
|
62
|
+
protocolVersion: '2024-11-05',
|
|
63
|
+
capabilities: {},
|
|
64
|
+
clientInfo: {
|
|
65
|
+
name: 'test-client',
|
|
66
|
+
version: '1.0.0',
|
|
67
|
+
},
|
|
68
|
+
});
|
|
69
|
+
}, 100);
|
|
70
|
+
|
|
71
|
+
setTimeout(() => {
|
|
72
|
+
console.log('\n๐ Test 2: List Tools');
|
|
73
|
+
sendRequest('tools/list');
|
|
74
|
+
}, 500);
|
|
75
|
+
|
|
76
|
+
setTimeout(() => {
|
|
77
|
+
console.log('\n๐ Test 3: List Components');
|
|
78
|
+
sendRequest('tools/call', {
|
|
79
|
+
name: 'list_components',
|
|
80
|
+
arguments: {},
|
|
81
|
+
});
|
|
82
|
+
}, 1000);
|
|
83
|
+
|
|
84
|
+
setTimeout(() => {
|
|
85
|
+
console.log('\n๐ Test 4: Get Component Docs');
|
|
86
|
+
sendRequest('tools/call', {
|
|
87
|
+
name: 'get_component_docs',
|
|
88
|
+
arguments: {
|
|
89
|
+
components: ['CustomButton', 'StatusPill', 'ScrollableDataTable'],
|
|
90
|
+
},
|
|
91
|
+
});
|
|
92
|
+
}, 1500);
|
|
93
|
+
|
|
94
|
+
setTimeout(() => {
|
|
95
|
+
console.log('\n๐ Test 5: Get Design Tokens');
|
|
96
|
+
sendRequest('tools/call', {
|
|
97
|
+
name: 'get_design_tokens',
|
|
98
|
+
arguments: {
|
|
99
|
+
category: 'all',
|
|
100
|
+
},
|
|
101
|
+
});
|
|
102
|
+
}, 2000);
|
|
103
|
+
|
|
104
|
+
setTimeout(() => {
|
|
105
|
+
console.log('\nโจ Tests complete! Closing server...');
|
|
106
|
+
server.stdin.end();
|
|
107
|
+
}, 2500);
|
|
108
|
+
|