@idealyst/mcp-server 1.0.84
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 +202 -0
- package/dist/data/cli-commands.d.ts +2 -0
- package/dist/data/cli-commands.d.ts.map +1 -0
- package/dist/data/cli-commands.js +100 -0
- package/dist/data/cli-commands.js.map +1 -0
- package/dist/data/components/Accordion.d.ts +15 -0
- package/dist/data/components/Accordion.d.ts.map +1 -0
- package/dist/data/components/Accordion.js +112 -0
- package/dist/data/components/Accordion.js.map +1 -0
- package/dist/data/components/ActivityIndicator.d.ts +15 -0
- package/dist/data/components/ActivityIndicator.d.ts.map +1 -0
- package/dist/data/components/ActivityIndicator.js +82 -0
- package/dist/data/components/ActivityIndicator.js.map +1 -0
- package/dist/data/components/Alert.d.ts +15 -0
- package/dist/data/components/Alert.d.ts.map +1 -0
- package/dist/data/components/Alert.js +132 -0
- package/dist/data/components/Alert.js.map +1 -0
- package/dist/data/components/Avatar.d.ts +15 -0
- package/dist/data/components/Avatar.d.ts.map +1 -0
- package/dist/data/components/Avatar.js +93 -0
- package/dist/data/components/Avatar.js.map +1 -0
- package/dist/data/components/Badge.d.ts +15 -0
- package/dist/data/components/Badge.d.ts.map +1 -0
- package/dist/data/components/Badge.js +64 -0
- package/dist/data/components/Badge.js.map +1 -0
- package/dist/data/components/Breadcrumb.d.ts +15 -0
- package/dist/data/components/Breadcrumb.d.ts.map +1 -0
- package/dist/data/components/Breadcrumb.js +96 -0
- package/dist/data/components/Breadcrumb.js.map +1 -0
- package/dist/data/components/Button.d.ts +15 -0
- package/dist/data/components/Button.d.ts.map +1 -0
- package/dist/data/components/Button.js +87 -0
- package/dist/data/components/Button.js.map +1 -0
- package/dist/data/components/Card.d.ts +15 -0
- package/dist/data/components/Card.d.ts.map +1 -0
- package/dist/data/components/Card.js +67 -0
- package/dist/data/components/Card.js.map +1 -0
- package/dist/data/components/Checkbox.d.ts +15 -0
- package/dist/data/components/Checkbox.d.ts.map +1 -0
- package/dist/data/components/Checkbox.js +118 -0
- package/dist/data/components/Checkbox.js.map +1 -0
- package/dist/data/components/Chip.d.ts +15 -0
- package/dist/data/components/Chip.d.ts.map +1 -0
- package/dist/data/components/Chip.js +76 -0
- package/dist/data/components/Chip.js.map +1 -0
- package/dist/data/components/Dialog.d.ts +15 -0
- package/dist/data/components/Dialog.d.ts.map +1 -0
- package/dist/data/components/Dialog.js +137 -0
- package/dist/data/components/Dialog.js.map +1 -0
- package/dist/data/components/Divider.d.ts +15 -0
- package/dist/data/components/Divider.d.ts.map +1 -0
- package/dist/data/components/Divider.js +71 -0
- package/dist/data/components/Divider.js.map +1 -0
- package/dist/data/components/Icon.d.ts +15 -0
- package/dist/data/components/Icon.d.ts.map +1 -0
- package/dist/data/components/Icon.js +70 -0
- package/dist/data/components/Icon.js.map +1 -0
- package/dist/data/components/Image.d.ts +15 -0
- package/dist/data/components/Image.d.ts.map +1 -0
- package/dist/data/components/Image.js +122 -0
- package/dist/data/components/Image.js.map +1 -0
- package/dist/data/components/Input.d.ts +15 -0
- package/dist/data/components/Input.d.ts.map +1 -0
- package/dist/data/components/Input.js +109 -0
- package/dist/data/components/Input.js.map +1 -0
- package/dist/data/components/List.d.ts +15 -0
- package/dist/data/components/List.d.ts.map +1 -0
- package/dist/data/components/List.js +113 -0
- package/dist/data/components/List.js.map +1 -0
- package/dist/data/components/Menu.d.ts +15 -0
- package/dist/data/components/Menu.d.ts.map +1 -0
- package/dist/data/components/Menu.js +132 -0
- package/dist/data/components/Menu.js.map +1 -0
- package/dist/data/components/Popover.d.ts +15 -0
- package/dist/data/components/Popover.d.ts.map +1 -0
- package/dist/data/components/Popover.js +159 -0
- package/dist/data/components/Popover.js.map +1 -0
- package/dist/data/components/Pressable.d.ts +15 -0
- package/dist/data/components/Pressable.d.ts.map +1 -0
- package/dist/data/components/Pressable.js +125 -0
- package/dist/data/components/Pressable.js.map +1 -0
- package/dist/data/components/Progress.d.ts +15 -0
- package/dist/data/components/Progress.d.ts.map +1 -0
- package/dist/data/components/Progress.js +95 -0
- package/dist/data/components/Progress.js.map +1 -0
- package/dist/data/components/RadioButton.d.ts +15 -0
- package/dist/data/components/RadioButton.d.ts.map +1 -0
- package/dist/data/components/RadioButton.js +140 -0
- package/dist/data/components/RadioButton.js.map +1 -0
- package/dist/data/components/SVGImage.d.ts +15 -0
- package/dist/data/components/SVGImage.d.ts.map +1 -0
- package/dist/data/components/SVGImage.js +112 -0
- package/dist/data/components/SVGImage.js.map +1 -0
- package/dist/data/components/Screen.d.ts +15 -0
- package/dist/data/components/Screen.d.ts.map +1 -0
- package/dist/data/components/Screen.js +99 -0
- package/dist/data/components/Screen.js.map +1 -0
- package/dist/data/components/Select.d.ts +15 -0
- package/dist/data/components/Select.d.ts.map +1 -0
- package/dist/data/components/Select.js +146 -0
- package/dist/data/components/Select.js.map +1 -0
- package/dist/data/components/Skeleton.d.ts +15 -0
- package/dist/data/components/Skeleton.d.ts.map +1 -0
- package/dist/data/components/Skeleton.js +110 -0
- package/dist/data/components/Skeleton.js.map +1 -0
- package/dist/data/components/Slider.d.ts +15 -0
- package/dist/data/components/Slider.d.ts.map +1 -0
- package/dist/data/components/Slider.js +129 -0
- package/dist/data/components/Slider.js.map +1 -0
- package/dist/data/components/Switch.d.ts +15 -0
- package/dist/data/components/Switch.d.ts.map +1 -0
- package/dist/data/components/Switch.js +127 -0
- package/dist/data/components/Switch.js.map +1 -0
- package/dist/data/components/TabBar.d.ts +15 -0
- package/dist/data/components/TabBar.d.ts.map +1 -0
- package/dist/data/components/TabBar.js +145 -0
- package/dist/data/components/TabBar.js.map +1 -0
- package/dist/data/components/Table.d.ts +15 -0
- package/dist/data/components/Table.d.ts.map +1 -0
- package/dist/data/components/Table.js +151 -0
- package/dist/data/components/Table.js.map +1 -0
- package/dist/data/components/Tabs.d.ts +15 -0
- package/dist/data/components/Tabs.d.ts.map +1 -0
- package/dist/data/components/Tabs.js +150 -0
- package/dist/data/components/Tabs.js.map +1 -0
- package/dist/data/components/Text.d.ts +15 -0
- package/dist/data/components/Text.d.ts.map +1 -0
- package/dist/data/components/Text.js +85 -0
- package/dist/data/components/Text.js.map +1 -0
- package/dist/data/components/TextArea.d.ts +15 -0
- package/dist/data/components/TextArea.d.ts.map +1 -0
- package/dist/data/components/TextArea.js +155 -0
- package/dist/data/components/TextArea.js.map +1 -0
- package/dist/data/components/Tooltip.d.ts +15 -0
- package/dist/data/components/Tooltip.d.ts.map +1 -0
- package/dist/data/components/Tooltip.js +105 -0
- package/dist/data/components/Tooltip.js.map +1 -0
- package/dist/data/components/Video.d.ts +15 -0
- package/dist/data/components/Video.d.ts.map +1 -0
- package/dist/data/components/Video.js +168 -0
- package/dist/data/components/Video.js.map +1 -0
- package/dist/data/components/View.d.ts +15 -0
- package/dist/data/components/View.d.ts.map +1 -0
- package/dist/data/components/View.js +126 -0
- package/dist/data/components/View.js.map +1 -0
- package/dist/data/components/index.d.ts +37 -0
- package/dist/data/components/index.d.ts.map +1 -0
- package/dist/data/components/index.js +110 -0
- package/dist/data/components/index.js.map +1 -0
- package/dist/data/framework-guides.d.ts +2 -0
- package/dist/data/framework-guides.d.ts.map +1 -0
- package/dist/data/framework-guides.js +589 -0
- package/dist/data/framework-guides.js.map +1 -0
- package/dist/data/icon-guide.d.ts +2 -0
- package/dist/data/icon-guide.d.ts.map +1 -0
- package/dist/data/icon-guide.js +285 -0
- package/dist/data/icon-guide.js.map +1 -0
- package/dist/data/icons.json +7452 -0
- package/dist/data/navigation-guides.d.ts +2 -0
- package/dist/data/navigation-guides.d.ts.map +1 -0
- package/dist/data/navigation-guides.js +1196 -0
- package/dist/data/navigation-guides.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +422 -0
- package/dist/index.js.map +1 -0
- package/package.json +34 -0
- package/src/data/cli-commands.ts +103 -0
- package/src/data/components/Accordion.ts +106 -0
- package/src/data/components/ActivityIndicator.ts +82 -0
- package/src/data/components/Alert.ts +132 -0
- package/src/data/components/Avatar.ts +93 -0
- package/src/data/components/Badge.ts +63 -0
- package/src/data/components/Breadcrumb.ts +94 -0
- package/src/data/components/Button.ts +86 -0
- package/src/data/components/Card.ts +67 -0
- package/src/data/components/Checkbox.ts +117 -0
- package/src/data/components/Chip.ts +93 -0
- package/src/data/components/Dialog.ts +136 -0
- package/src/data/components/Divider.ts +70 -0
- package/src/data/components/Icon.ts +70 -0
- package/src/data/components/Image.ts +121 -0
- package/src/data/components/Input.ts +150 -0
- package/src/data/components/List.ts +103 -0
- package/src/data/components/Menu.ts +125 -0
- package/src/data/components/Popover.ts +159 -0
- package/src/data/components/Pressable.ts +123 -0
- package/src/data/components/Progress.ts +95 -0
- package/src/data/components/RadioButton.ts +130 -0
- package/src/data/components/SVGImage.ts +114 -0
- package/src/data/components/Screen.ts +103 -0
- package/src/data/components/Select.ts +140 -0
- package/src/data/components/Skeleton.ts +102 -0
- package/src/data/components/Slider.ts +150 -0
- package/src/data/components/Switch.ts +127 -0
- package/src/data/components/TabBar.ts +142 -0
- package/src/data/components/Table.ts +153 -0
- package/src/data/components/Tabs.ts +152 -0
- package/src/data/components/Text.ts +85 -0
- package/src/data/components/TextArea.ts +155 -0
- package/src/data/components/Tooltip.ts +105 -0
- package/src/data/components/Video.ts +168 -0
- package/src/data/components/View.ts +126 -0
- package/src/data/components/index.ts +109 -0
- package/src/data/framework-guides.ts +593 -0
- package/src/data/icon-guide.ts +284 -0
- package/src/data/icons.json +7452 -0
- package/src/data/navigation-guides.ts +1199 -0
- package/src/index.ts +473 -0
- package/test-client.js +86 -0
- package/tsconfig.json +20 -0
package/src/index.ts
ADDED
|
@@ -0,0 +1,473 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
4
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
5
|
+
import {
|
|
6
|
+
ListToolsRequestSchema,
|
|
7
|
+
CallToolRequestSchema,
|
|
8
|
+
ListResourcesRequestSchema,
|
|
9
|
+
ReadResourceRequestSchema,
|
|
10
|
+
} from "@modelcontextprotocol/sdk/types.js";
|
|
11
|
+
import { components } from "./data/components/index.js";
|
|
12
|
+
import { cliCommands } from "./data/cli-commands.js";
|
|
13
|
+
import { frameworkGuides } from "./data/framework-guides.js";
|
|
14
|
+
import { navigationGuides } from "./data/navigation-guides.js";
|
|
15
|
+
import { iconGuide } from "./data/icon-guide.js";
|
|
16
|
+
import iconsData from "./data/icons.json" with { type: "json" };
|
|
17
|
+
|
|
18
|
+
const server = new Server(
|
|
19
|
+
{
|
|
20
|
+
name: "@idealyst/mcp-server",
|
|
21
|
+
version: "1.0.83",
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
capabilities: {
|
|
25
|
+
tools: {},
|
|
26
|
+
resources: {},
|
|
27
|
+
},
|
|
28
|
+
}
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
// List all available tools
|
|
32
|
+
server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
33
|
+
return {
|
|
34
|
+
tools: [
|
|
35
|
+
{
|
|
36
|
+
name: "list_components",
|
|
37
|
+
description: "List all available Idealyst components with brief descriptions",
|
|
38
|
+
inputSchema: {
|
|
39
|
+
type: "object",
|
|
40
|
+
properties: {},
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
name: "get_component_docs",
|
|
45
|
+
description: "Get detailed documentation for a specific Idealyst component including props, usage, and examples",
|
|
46
|
+
inputSchema: {
|
|
47
|
+
type: "object",
|
|
48
|
+
properties: {
|
|
49
|
+
component: {
|
|
50
|
+
type: "string",
|
|
51
|
+
description: "The name of the component (e.g., 'Button', 'Card', 'Input')",
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
required: ["component"],
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
name: "get_component_example",
|
|
59
|
+
description: "Get a code example for a specific Idealyst component",
|
|
60
|
+
inputSchema: {
|
|
61
|
+
type: "object",
|
|
62
|
+
properties: {
|
|
63
|
+
component: {
|
|
64
|
+
type: "string",
|
|
65
|
+
description: "The name of the component",
|
|
66
|
+
},
|
|
67
|
+
example_type: {
|
|
68
|
+
type: "string",
|
|
69
|
+
description: "Type of example: 'basic', 'variants', 'with-icons', 'interactive'",
|
|
70
|
+
enum: ["basic", "variants", "with-icons", "interactive"],
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
required: ["component"],
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
name: "get_cli_usage",
|
|
78
|
+
description: "Get information about Idealyst CLI commands and usage",
|
|
79
|
+
inputSchema: {
|
|
80
|
+
type: "object",
|
|
81
|
+
properties: {
|
|
82
|
+
command: {
|
|
83
|
+
type: "string",
|
|
84
|
+
description: "Specific CLI command to get info about (optional)",
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
name: "search_components",
|
|
91
|
+
description: "Search for components by name, category, or feature",
|
|
92
|
+
inputSchema: {
|
|
93
|
+
type: "object",
|
|
94
|
+
properties: {
|
|
95
|
+
query: {
|
|
96
|
+
type: "string",
|
|
97
|
+
description: "Search query",
|
|
98
|
+
},
|
|
99
|
+
category: {
|
|
100
|
+
type: "string",
|
|
101
|
+
description: "Filter by category: 'layout', 'form', 'display', 'navigation', 'overlay', 'data'",
|
|
102
|
+
enum: ["layout", "form", "display", "navigation", "overlay", "data"],
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
name: "search_icons",
|
|
109
|
+
description: "Search for Material Design Icons by name or keyword. Returns matching icon names from 7,447 available icons.",
|
|
110
|
+
inputSchema: {
|
|
111
|
+
type: "object",
|
|
112
|
+
properties: {
|
|
113
|
+
query: {
|
|
114
|
+
type: "string",
|
|
115
|
+
description: "Search term to find icons (e.g., 'home', 'user', 'arrow')",
|
|
116
|
+
},
|
|
117
|
+
limit: {
|
|
118
|
+
type: "number",
|
|
119
|
+
description: "Maximum number of results to return (default: 20)",
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
required: ["query"],
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
],
|
|
126
|
+
};
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
// Handle tool calls
|
|
130
|
+
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
131
|
+
const { name, arguments: args } = request.params;
|
|
132
|
+
|
|
133
|
+
switch (name) {
|
|
134
|
+
case "list_components": {
|
|
135
|
+
const componentList = Object.entries(components).map(([name, data]) => ({
|
|
136
|
+
name,
|
|
137
|
+
category: data.category,
|
|
138
|
+
description: data.description,
|
|
139
|
+
}));
|
|
140
|
+
|
|
141
|
+
return {
|
|
142
|
+
content: [
|
|
143
|
+
{
|
|
144
|
+
type: "text",
|
|
145
|
+
text: JSON.stringify(componentList, null, 2),
|
|
146
|
+
},
|
|
147
|
+
],
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
case "get_component_docs": {
|
|
152
|
+
const componentName = args?.component as string;
|
|
153
|
+
const component = components[componentName];
|
|
154
|
+
|
|
155
|
+
if (!component) {
|
|
156
|
+
return {
|
|
157
|
+
content: [
|
|
158
|
+
{
|
|
159
|
+
type: "text",
|
|
160
|
+
text: `Component "${componentName}" not found. Available components: ${Object.keys(components).join(", ")}`,
|
|
161
|
+
},
|
|
162
|
+
],
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
const docs = `# ${componentName}
|
|
167
|
+
|
|
168
|
+
${component.description}
|
|
169
|
+
|
|
170
|
+
## Category
|
|
171
|
+
${component.category}
|
|
172
|
+
|
|
173
|
+
## Props
|
|
174
|
+
${component.props}
|
|
175
|
+
|
|
176
|
+
## Usage Examples
|
|
177
|
+
${component.usage}
|
|
178
|
+
|
|
179
|
+
## Features
|
|
180
|
+
${component.features.map((f: string) => `- ${f}`).join("\n")}
|
|
181
|
+
|
|
182
|
+
## Best Practices
|
|
183
|
+
${component.bestPractices.map((bp: string) => `- ${bp}`).join("\n")}
|
|
184
|
+
`;
|
|
185
|
+
|
|
186
|
+
return {
|
|
187
|
+
content: [
|
|
188
|
+
{
|
|
189
|
+
type: "text",
|
|
190
|
+
text: docs,
|
|
191
|
+
},
|
|
192
|
+
],
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
case "get_component_example": {
|
|
197
|
+
const componentName = args?.component as string;
|
|
198
|
+
const exampleType = (args?.example_type as string) || "basic";
|
|
199
|
+
const component = components[componentName];
|
|
200
|
+
|
|
201
|
+
if (!component) {
|
|
202
|
+
return {
|
|
203
|
+
content: [
|
|
204
|
+
{
|
|
205
|
+
type: "text",
|
|
206
|
+
text: `Component "${componentName}" not found.`,
|
|
207
|
+
},
|
|
208
|
+
],
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
const example = component.examples[exampleType] || component.examples.basic;
|
|
213
|
+
|
|
214
|
+
return {
|
|
215
|
+
content: [
|
|
216
|
+
{
|
|
217
|
+
type: "text",
|
|
218
|
+
text: example,
|
|
219
|
+
},
|
|
220
|
+
],
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
case "get_cli_usage": {
|
|
225
|
+
const commandName = args?.command as string;
|
|
226
|
+
|
|
227
|
+
if (commandName) {
|
|
228
|
+
const command = cliCommands[commandName];
|
|
229
|
+
if (!command) {
|
|
230
|
+
return {
|
|
231
|
+
content: [
|
|
232
|
+
{
|
|
233
|
+
type: "text",
|
|
234
|
+
text: `Command "${commandName}" not found. Available commands: ${Object.keys(cliCommands).join(", ")}`,
|
|
235
|
+
},
|
|
236
|
+
],
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
return {
|
|
241
|
+
content: [
|
|
242
|
+
{
|
|
243
|
+
type: "text",
|
|
244
|
+
text: `# ${commandName}
|
|
245
|
+
|
|
246
|
+
${command.description}
|
|
247
|
+
|
|
248
|
+
## Usage
|
|
249
|
+
\`\`\`bash
|
|
250
|
+
${command.usage}
|
|
251
|
+
\`\`\`
|
|
252
|
+
|
|
253
|
+
## Options
|
|
254
|
+
${command.options.map((opt: any) => `- \`${opt.flag}\`: ${opt.description}`).join("\n")}
|
|
255
|
+
|
|
256
|
+
## Examples
|
|
257
|
+
${command.examples.map((ex: string) => `\`\`\`bash\n${ex}\n\`\`\``).join("\n\n")}
|
|
258
|
+
`,
|
|
259
|
+
},
|
|
260
|
+
],
|
|
261
|
+
};
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
// Return all commands
|
|
265
|
+
const allCommands = Object.entries(cliCommands).map(([name, data]) => ({
|
|
266
|
+
name,
|
|
267
|
+
description: data.description,
|
|
268
|
+
usage: data.usage,
|
|
269
|
+
}));
|
|
270
|
+
|
|
271
|
+
return {
|
|
272
|
+
content: [
|
|
273
|
+
{
|
|
274
|
+
type: "text",
|
|
275
|
+
text: JSON.stringify(allCommands, null, 2),
|
|
276
|
+
},
|
|
277
|
+
],
|
|
278
|
+
};
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
case "search_components": {
|
|
282
|
+
const query = (args?.query as string)?.toLowerCase() || "";
|
|
283
|
+
const category = args?.category as string;
|
|
284
|
+
|
|
285
|
+
let results = Object.entries(components);
|
|
286
|
+
|
|
287
|
+
if (category) {
|
|
288
|
+
results = results.filter(([_, data]) => data.category === category);
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
if (query) {
|
|
292
|
+
results = results.filter(([name, data]) =>
|
|
293
|
+
name.toLowerCase().includes(query) ||
|
|
294
|
+
data.description.toLowerCase().includes(query) ||
|
|
295
|
+
data.features.some((f: string) => f.toLowerCase().includes(query))
|
|
296
|
+
);
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
const resultList = results.map(([name, data]) => ({
|
|
300
|
+
name,
|
|
301
|
+
category: data.category,
|
|
302
|
+
description: data.description,
|
|
303
|
+
}));
|
|
304
|
+
|
|
305
|
+
return {
|
|
306
|
+
content: [
|
|
307
|
+
{
|
|
308
|
+
type: "text",
|
|
309
|
+
text: JSON.stringify(resultList, null, 2),
|
|
310
|
+
},
|
|
311
|
+
],
|
|
312
|
+
};
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
case "search_icons": {
|
|
316
|
+
const query = (args?.query as string)?.toLowerCase() || "";
|
|
317
|
+
const limit = (args?.limit as number) || 20;
|
|
318
|
+
|
|
319
|
+
if (!query) {
|
|
320
|
+
return {
|
|
321
|
+
content: [
|
|
322
|
+
{
|
|
323
|
+
type: "text",
|
|
324
|
+
text: "Please provide a search query.",
|
|
325
|
+
},
|
|
326
|
+
],
|
|
327
|
+
};
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
// Filter icons that match the query
|
|
331
|
+
const matchingIcons = iconsData.icons.filter((icon: string) =>
|
|
332
|
+
icon.toLowerCase().includes(query)
|
|
333
|
+
);
|
|
334
|
+
|
|
335
|
+
// Limit results
|
|
336
|
+
const limitedResults = matchingIcons.slice(0, limit);
|
|
337
|
+
|
|
338
|
+
const result = {
|
|
339
|
+
query,
|
|
340
|
+
total: iconsData.total,
|
|
341
|
+
matches: matchingIcons.length,
|
|
342
|
+
returned: limitedResults.length,
|
|
343
|
+
icons: limitedResults,
|
|
344
|
+
};
|
|
345
|
+
|
|
346
|
+
return {
|
|
347
|
+
content: [
|
|
348
|
+
{
|
|
349
|
+
type: "text",
|
|
350
|
+
text: JSON.stringify(result, null, 2),
|
|
351
|
+
},
|
|
352
|
+
],
|
|
353
|
+
};
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
default:
|
|
357
|
+
return {
|
|
358
|
+
content: [
|
|
359
|
+
{
|
|
360
|
+
type: "text",
|
|
361
|
+
text: `Unknown tool: ${name}`,
|
|
362
|
+
},
|
|
363
|
+
],
|
|
364
|
+
};
|
|
365
|
+
}
|
|
366
|
+
});
|
|
367
|
+
|
|
368
|
+
// List available resources
|
|
369
|
+
server.setRequestHandler(ListResourcesRequestSchema, async () => {
|
|
370
|
+
return {
|
|
371
|
+
resources: [
|
|
372
|
+
{
|
|
373
|
+
uri: "idealyst://framework/getting-started",
|
|
374
|
+
name: "Getting Started with Idealyst",
|
|
375
|
+
description: "Complete guide to setting up and using the Idealyst framework",
|
|
376
|
+
mimeType: "text/markdown",
|
|
377
|
+
},
|
|
378
|
+
{
|
|
379
|
+
uri: "idealyst://framework/components-overview",
|
|
380
|
+
name: "Components Overview",
|
|
381
|
+
description: "Overview of all available Idealyst components organized by category",
|
|
382
|
+
mimeType: "text/markdown",
|
|
383
|
+
},
|
|
384
|
+
{
|
|
385
|
+
uri: "idealyst://framework/theming",
|
|
386
|
+
name: "Theming Guide",
|
|
387
|
+
description: "Guide to customizing themes in Idealyst",
|
|
388
|
+
mimeType: "text/markdown",
|
|
389
|
+
},
|
|
390
|
+
{
|
|
391
|
+
uri: "idealyst://framework/cli",
|
|
392
|
+
name: "CLI Reference",
|
|
393
|
+
description: "Complete reference for the Idealyst CLI",
|
|
394
|
+
mimeType: "text/markdown",
|
|
395
|
+
},
|
|
396
|
+
{
|
|
397
|
+
uri: "idealyst://navigation/overview",
|
|
398
|
+
name: "Navigation System Overview",
|
|
399
|
+
description: "Overview of the Idealyst navigation system for cross-platform routing",
|
|
400
|
+
mimeType: "text/markdown",
|
|
401
|
+
},
|
|
402
|
+
{
|
|
403
|
+
uri: "idealyst://navigation/route-configuration",
|
|
404
|
+
name: "Route Configuration",
|
|
405
|
+
description: "Learn how to define and structure routes in Idealyst",
|
|
406
|
+
mimeType: "text/markdown",
|
|
407
|
+
},
|
|
408
|
+
{
|
|
409
|
+
uri: "idealyst://navigation/navigator-types",
|
|
410
|
+
name: "Navigator Types",
|
|
411
|
+
description: "Guide to stack, tab, drawer, and modal navigators",
|
|
412
|
+
mimeType: "text/markdown",
|
|
413
|
+
},
|
|
414
|
+
{
|
|
415
|
+
uri: "idealyst://navigation/custom-layouts",
|
|
416
|
+
name: "Custom Layouts (Web)",
|
|
417
|
+
description: "Creating custom layouts with headers and sidebars for web applications",
|
|
418
|
+
mimeType: "text/markdown",
|
|
419
|
+
},
|
|
420
|
+
{
|
|
421
|
+
uri: "idealyst://navigation/use-navigator",
|
|
422
|
+
name: "useNavigator Hook",
|
|
423
|
+
description: "Complete reference for the useNavigator hook API",
|
|
424
|
+
mimeType: "text/markdown",
|
|
425
|
+
},
|
|
426
|
+
{
|
|
427
|
+
uri: "idealyst://icons/reference",
|
|
428
|
+
name: "Icon Reference Guide",
|
|
429
|
+
description: "Complete guide to Material Design Icons with 7,447 available icons, common icons by category, and usage examples",
|
|
430
|
+
mimeType: "text/markdown",
|
|
431
|
+
},
|
|
432
|
+
],
|
|
433
|
+
};
|
|
434
|
+
});
|
|
435
|
+
|
|
436
|
+
// Handle resource reads
|
|
437
|
+
server.setRequestHandler(ReadResourceRequestSchema, async (request) => {
|
|
438
|
+
const { uri } = request.params;
|
|
439
|
+
|
|
440
|
+
// Check framework guides first, then navigation guides, then icon guide
|
|
441
|
+
let guide = frameworkGuides[uri] || navigationGuides[uri];
|
|
442
|
+
|
|
443
|
+
// Handle icon reference
|
|
444
|
+
if (uri === "idealyst://icons/reference") {
|
|
445
|
+
guide = iconGuide;
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
if (!guide) {
|
|
449
|
+
throw new Error(`Resource not found: ${uri}`);
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
return {
|
|
453
|
+
contents: [
|
|
454
|
+
{
|
|
455
|
+
uri,
|
|
456
|
+
mimeType: "text/markdown",
|
|
457
|
+
text: guide,
|
|
458
|
+
},
|
|
459
|
+
],
|
|
460
|
+
};
|
|
461
|
+
});
|
|
462
|
+
|
|
463
|
+
// Start the server
|
|
464
|
+
async function main() {
|
|
465
|
+
const transport = new StdioServerTransport();
|
|
466
|
+
await server.connect(transport);
|
|
467
|
+
console.error("Idealyst MCP Server running on stdio");
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
main().catch((error) => {
|
|
471
|
+
console.error("Fatal error:", error);
|
|
472
|
+
process.exit(1);
|
|
473
|
+
});
|
package/test-client.js
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Simple test client to verify the MCP server is working
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { spawn } from 'child_process';
|
|
8
|
+
|
|
9
|
+
// Start the MCP server
|
|
10
|
+
const server = spawn('node', ['./dist/index.js'], {
|
|
11
|
+
stdio: ['pipe', 'pipe', 'pipe']
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
let responseData = '';
|
|
15
|
+
|
|
16
|
+
server.stdout.on('data', (data) => {
|
|
17
|
+
responseData += data.toString();
|
|
18
|
+
|
|
19
|
+
// Try to parse JSON responses
|
|
20
|
+
const lines = responseData.split('\n');
|
|
21
|
+
lines.forEach(line => {
|
|
22
|
+
if (line.trim() && line.includes('{')) {
|
|
23
|
+
try {
|
|
24
|
+
const json = JSON.parse(line);
|
|
25
|
+
console.log('Response:', JSON.stringify(json, null, 2));
|
|
26
|
+
} catch (e) {
|
|
27
|
+
// Not JSON, probably stderr message
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
server.stderr.on('data', (data) => {
|
|
34
|
+
console.error('Server:', data.toString().trim());
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
// Wait a moment for server to start
|
|
38
|
+
setTimeout(() => {
|
|
39
|
+
console.log('\nš Testing list_tools...\n');
|
|
40
|
+
|
|
41
|
+
// Send a request to list tools
|
|
42
|
+
const request = {
|
|
43
|
+
jsonrpc: '2.0',
|
|
44
|
+
id: 1,
|
|
45
|
+
method: 'tools/list',
|
|
46
|
+
params: {}
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
server.stdin.write(JSON.stringify(request) + '\n');
|
|
50
|
+
|
|
51
|
+
// Wait for response
|
|
52
|
+
setTimeout(() => {
|
|
53
|
+
console.log('\nš Testing get_component_docs for Button...\n');
|
|
54
|
+
|
|
55
|
+
const toolRequest = {
|
|
56
|
+
jsonrpc: '2.0',
|
|
57
|
+
id: 2,
|
|
58
|
+
method: 'tools/call',
|
|
59
|
+
params: {
|
|
60
|
+
name: 'get_component_docs',
|
|
61
|
+
arguments: {
|
|
62
|
+
component: 'Button'
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
server.stdin.write(JSON.stringify(toolRequest) + '\n');
|
|
68
|
+
|
|
69
|
+
// Close after a moment
|
|
70
|
+
setTimeout(() => {
|
|
71
|
+
console.log('\nā
Test complete!\n');
|
|
72
|
+
server.kill();
|
|
73
|
+
process.exit(0);
|
|
74
|
+
}, 2000);
|
|
75
|
+
}, 2000);
|
|
76
|
+
}, 1000);
|
|
77
|
+
|
|
78
|
+
// Handle errors
|
|
79
|
+
server.on('error', (error) => {
|
|
80
|
+
console.error('Error:', error);
|
|
81
|
+
process.exit(1);
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
server.on('close', (code) => {
|
|
85
|
+
console.log(`Server process exited with code ${code}`);
|
|
86
|
+
});
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"module": "NodeNext",
|
|
5
|
+
"moduleResolution": "NodeNext",
|
|
6
|
+
"lib": ["ES2022"],
|
|
7
|
+
"outDir": "./dist",
|
|
8
|
+
"rootDir": "./src",
|
|
9
|
+
"strict": true,
|
|
10
|
+
"esModuleInterop": true,
|
|
11
|
+
"skipLibCheck": true,
|
|
12
|
+
"forceConsistentCasingInFileNames": true,
|
|
13
|
+
"resolveJsonModule": true,
|
|
14
|
+
"declaration": true,
|
|
15
|
+
"declarationMap": true,
|
|
16
|
+
"sourceMap": true
|
|
17
|
+
},
|
|
18
|
+
"include": ["src/**/*"],
|
|
19
|
+
"exclude": ["node_modules", "dist"]
|
|
20
|
+
}
|