@deay/mcp 0.0.2 → 0.0.3
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 +91 -0
- package/index.js +134 -0
- package/package.json +6 -11
package/README.md
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# @deay/mcp - MCP Server for @deay/ui
|
|
2
|
+
|
|
3
|
+
Model Context Protocol (MCP) server that provides AI assistants with comprehensive documentation about @deay/ui components.
|
|
4
|
+
|
|
5
|
+
## What This Does
|
|
6
|
+
|
|
7
|
+
This MCP server allows AI coding tools (Claude Desktop, Cursor, Windsurf) to:
|
|
8
|
+
- List all available @deay/ui components
|
|
9
|
+
- Get detailed component documentation (props, examples, best practices)
|
|
10
|
+
- Access Figma design specifications
|
|
11
|
+
- Generate accurate code examples
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
### For Development (Local Path)
|
|
16
|
+
|
|
17
|
+
```json
|
|
18
|
+
{
|
|
19
|
+
"mcpServers": {
|
|
20
|
+
"@deay/mcp": {
|
|
21
|
+
"command": "node",
|
|
22
|
+
"args": ["dist/index.js"],
|
|
23
|
+
"cwd": "/path/to/deay-monorepo/packages/mcp-server"
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### For Production (After npm publish)
|
|
30
|
+
|
|
31
|
+
```json
|
|
32
|
+
{
|
|
33
|
+
"mcpServers": {
|
|
34
|
+
"@deay/mcp": {
|
|
35
|
+
"command": "npx",
|
|
36
|
+
"args": ["-y", "@deay/mcp"]
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Usage
|
|
43
|
+
|
|
44
|
+
Once configured, ask your AI assistant:
|
|
45
|
+
- "How do I use the button component?"
|
|
46
|
+
- "Create a form with @deay/ui components"
|
|
47
|
+
- "What are the available sizes for the input component?"
|
|
48
|
+
|
|
49
|
+
## How It Works
|
|
50
|
+
|
|
51
|
+
1. **Local Execution**: Runs locally on your machine (no server deployment needed)
|
|
52
|
+
2. **Stdin/Stdout**: Communicates via stdin/stdout, not HTTP
|
|
53
|
+
3. **Offline Ready**: All documentation bundled, works offline after download
|
|
54
|
+
4. **Privacy First**: Source code never leaves your machine
|
|
55
|
+
|
|
56
|
+
## Available Tools
|
|
57
|
+
|
|
58
|
+
### `list_components`
|
|
59
|
+
Lists all components in @deay/ui library.
|
|
60
|
+
|
|
61
|
+
### `get_component_info`
|
|
62
|
+
Get detailed info about a specific component including:
|
|
63
|
+
- Props with types and defaults
|
|
64
|
+
- Usage examples
|
|
65
|
+
- Best practices
|
|
66
|
+
- Figma design specifications
|
|
67
|
+
|
|
68
|
+
## Development
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
# Build
|
|
72
|
+
npm run build
|
|
73
|
+
|
|
74
|
+
# Watch mode
|
|
75
|
+
npm run dev
|
|
76
|
+
|
|
77
|
+
# Start server
|
|
78
|
+
npm run start
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Contributing
|
|
82
|
+
|
|
83
|
+
When adding new components to @deay/ui:
|
|
84
|
+
1. Update `src/registry.ts` with component documentation
|
|
85
|
+
2. Rebuild: `npm run build`
|
|
86
|
+
3. Test: `node test-mcp.js` (if available)
|
|
87
|
+
4. Republish (if needed): `npm publish`
|
|
88
|
+
|
|
89
|
+
## License
|
|
90
|
+
|
|
91
|
+
MIT
|
package/index.js
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* @deay/mcp - MCP Server for @deay/ui Component Library
|
|
4
|
+
*
|
|
5
|
+
* This server provides AI assistants with comprehensive documentation
|
|
6
|
+
* about @deay/ui components following Figma design specifications.
|
|
7
|
+
*
|
|
8
|
+
* Run locally: bun run dev:mcp
|
|
9
|
+
* Or after npm publish: npx @deay/mcp
|
|
10
|
+
*/
|
|
11
|
+
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
12
|
+
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
13
|
+
import { CallToolRequestSchema, ListToolsRequestSchema, } from '@modelcontextprotocol/sdk/types.js';
|
|
14
|
+
import { getComponentInfo, listComponents, COMPONENT_REGISTRY } from './registry.js';
|
|
15
|
+
// Create server instance
|
|
16
|
+
const server = new Server({
|
|
17
|
+
name: '@deay/mcp',
|
|
18
|
+
version: '0.0.1',
|
|
19
|
+
}, {
|
|
20
|
+
capabilities: {
|
|
21
|
+
tools: {},
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
// List available tools
|
|
25
|
+
server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
26
|
+
return {
|
|
27
|
+
tools: [
|
|
28
|
+
{
|
|
29
|
+
name: 'get_component_info',
|
|
30
|
+
description: 'Get information about @deay/ui components including props, usage examples, and best practices',
|
|
31
|
+
inputSchema: {
|
|
32
|
+
type: 'object',
|
|
33
|
+
properties: {
|
|
34
|
+
component: {
|
|
35
|
+
type: 'string',
|
|
36
|
+
description: 'Component name (e.g., "button", "input")',
|
|
37
|
+
enum: ['button', 'input'],
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
required: ['component'],
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
name: 'list_components',
|
|
45
|
+
description: 'List all available components in @deay/ui',
|
|
46
|
+
inputSchema: {
|
|
47
|
+
type: 'object',
|
|
48
|
+
properties: {},
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
],
|
|
52
|
+
};
|
|
53
|
+
});
|
|
54
|
+
// Handle tool calls
|
|
55
|
+
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
56
|
+
const { name, arguments: args } = request.params;
|
|
57
|
+
switch (name) {
|
|
58
|
+
case 'get_component_info': {
|
|
59
|
+
const componentName = args?.['component'];
|
|
60
|
+
const info = getComponentInfo(componentName);
|
|
61
|
+
if (!info) {
|
|
62
|
+
return {
|
|
63
|
+
content: [
|
|
64
|
+
{
|
|
65
|
+
type: 'text',
|
|
66
|
+
text: `Component "${componentName}" not found. Available components: ${listComponents().join(', ')}`,
|
|
67
|
+
},
|
|
68
|
+
],
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
// Format the component info as a detailed markdown response
|
|
72
|
+
let response = `# ${info.name} Component\n\n`;
|
|
73
|
+
response += `**Selector:** \`${info.selector}\`\n\n`;
|
|
74
|
+
response += `**Description:** ${info.description}\n\n`;
|
|
75
|
+
response += `## Props\n\n`;
|
|
76
|
+
info.props.forEach((prop) => {
|
|
77
|
+
response += `### ${prop.name}\n`;
|
|
78
|
+
response += `- **Type:** \`${prop.type}\`\n`;
|
|
79
|
+
response += `- **Required:** ${prop.required ? 'Yes' : 'No'}\n`;
|
|
80
|
+
response += `- **Default:** \`${prop.default}\`\n`;
|
|
81
|
+
response += `- **Description:** ${prop.description}\n\n`;
|
|
82
|
+
});
|
|
83
|
+
response += `## Usage Examples\n\n`;
|
|
84
|
+
info.examples.forEach((example) => {
|
|
85
|
+
response += `### ${example.title}\n`;
|
|
86
|
+
response += `${example.description}\n\n`;
|
|
87
|
+
response += `\`\`\`html\n${example.code}\n\`\`\`\n\n`;
|
|
88
|
+
});
|
|
89
|
+
response += `## Best Practices\n\n`;
|
|
90
|
+
info.bestPractices.forEach((practice, index) => {
|
|
91
|
+
response += `${index + 1}. ${practice}\n`;
|
|
92
|
+
});
|
|
93
|
+
return {
|
|
94
|
+
content: [
|
|
95
|
+
{
|
|
96
|
+
type: 'text',
|
|
97
|
+
text: response,
|
|
98
|
+
},
|
|
99
|
+
],
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
case 'list_components': {
|
|
103
|
+
const components = listComponents();
|
|
104
|
+
let response = '# Available Components in @deay/ui\n\n';
|
|
105
|
+
components.forEach((name) => {
|
|
106
|
+
const info = COMPONENT_REGISTRY[name];
|
|
107
|
+
response += `## ${info.name}\n`;
|
|
108
|
+
response += `- **Selector:** \`${info.selector}\`\n`;
|
|
109
|
+
response += `- **Description:** ${info.description}\n\n`;
|
|
110
|
+
});
|
|
111
|
+
return {
|
|
112
|
+
content: [
|
|
113
|
+
{
|
|
114
|
+
type: 'text',
|
|
115
|
+
text: response,
|
|
116
|
+
},
|
|
117
|
+
],
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
default:
|
|
121
|
+
throw new Error(`Unknown tool: ${name}`);
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
// Start server
|
|
125
|
+
async function main() {
|
|
126
|
+
const transport = new StdioServerTransport();
|
|
127
|
+
await server.connect(transport);
|
|
128
|
+
console.error('@deay/mcp server running on stdio');
|
|
129
|
+
}
|
|
130
|
+
main().catch((error) => {
|
|
131
|
+
console.error('Server error:', error);
|
|
132
|
+
process.exit(1);
|
|
133
|
+
});
|
|
134
|
+
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -1,24 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deay/mcp",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "MCP server for @deay/ui component library with Figma design specifications",
|
|
6
6
|
"author": "Your Name",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"bin": {
|
|
9
|
-
"deay-mcp": "./
|
|
9
|
+
"deay-mcp": "./index.js"
|
|
10
10
|
},
|
|
11
11
|
"files": [
|
|
12
|
-
"
|
|
12
|
+
".",
|
|
13
13
|
"README.md"
|
|
14
14
|
],
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@modelcontextprotocol/sdk": "
|
|
17
|
-
"zod": "
|
|
18
|
-
},
|
|
19
|
-
"scripts": {
|
|
20
|
-
"build": "tsc",
|
|
21
|
-
"start": "node dist/index.js",
|
|
22
|
-
"dev": "tsc --watch"
|
|
16
|
+
"@modelcontextprotocol/sdk": "0.6.1",
|
|
17
|
+
"zod": "3.25.76"
|
|
23
18
|
}
|
|
24
|
-
}
|
|
19
|
+
}
|