@ringpublishing/mui-components-mcp 1.15.2-alpha.4 → 1.15.2-alpha.7
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 +1 -1
- package/package.json +5 -8
- package/data/knowledge.json +0 -3585
- package/dist/index.d.ts +0 -2
- package/dist/index.js +0 -156
- package/dist/index.js.map +0 -1
- package/dist/types.d.ts +0 -44
- package/dist/types.js +0 -2
- package/dist/types.js.map +0 -1
package/dist/index.d.ts
DELETED
package/dist/index.js
DELETED
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
var _a;
|
|
3
|
-
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
4
|
-
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
5
|
-
import { readFileSync } from 'node:fs';
|
|
6
|
-
import { dirname, join } from 'node:path';
|
|
7
|
-
import { fileURLToPath } from 'node:url';
|
|
8
|
-
import { z } from 'zod';
|
|
9
|
-
const currentDir = dirname(fileURLToPath(import.meta.url));
|
|
10
|
-
const KNOWLEDGE_PATH = join(currentDir, '../data/knowledge.json');
|
|
11
|
-
const PACKAGE_JSON_PATH = join(currentDir, '../package.json');
|
|
12
|
-
const packageJson = JSON.parse(readFileSync(PACKAGE_JSON_PATH, 'utf8'));
|
|
13
|
-
const SERVER_VERSION = (_a = packageJson.version) !== null && _a !== void 0 ? _a : 'dev';
|
|
14
|
-
const knowledge = loadKnowledge();
|
|
15
|
-
const components = Object.values(knowledge.components);
|
|
16
|
-
function loadKnowledge() {
|
|
17
|
-
var _a, _b, _c;
|
|
18
|
-
const fileContent = readFileSync(KNOWLEDGE_PATH, 'utf8');
|
|
19
|
-
const parsed = JSON.parse(fileContent);
|
|
20
|
-
const normalizedComponents = (_a = parsed.components) !== null && _a !== void 0 ? _a : {};
|
|
21
|
-
return {
|
|
22
|
-
generated: parsed.generated || new Date().toISOString(),
|
|
23
|
-
version: (_b = parsed.version) !== null && _b !== void 0 ? _b : SERVER_VERSION,
|
|
24
|
-
importPath: parsed.importPath || '@ringpublishing/mui-components',
|
|
25
|
-
componentCount: (_c = parsed.componentCount) !== null && _c !== void 0 ? _c : Object.keys(normalizedComponents).length,
|
|
26
|
-
components: normalizedComponents,
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
function summarizeComponent(component) {
|
|
30
|
-
return {
|
|
31
|
-
id: component.id,
|
|
32
|
-
name: component.name,
|
|
33
|
-
description: component.description,
|
|
34
|
-
storyNames: component.storyNames,
|
|
35
|
-
argTypesCount: Object.keys(component.argTypes).length,
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
function getComponentDetails(component) {
|
|
39
|
-
return {
|
|
40
|
-
id: component.id,
|
|
41
|
-
name: component.name,
|
|
42
|
-
description: component.description,
|
|
43
|
-
storyNames: component.storyNames,
|
|
44
|
-
argTypes: component.argTypes,
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
function getComponentDocs(component) {
|
|
48
|
-
return {
|
|
49
|
-
id: component.id,
|
|
50
|
-
name: component.name,
|
|
51
|
-
docs: component.docs,
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
function findComponent(query) {
|
|
55
|
-
const normalizedQuery = query.trim();
|
|
56
|
-
if (!normalizedQuery) {
|
|
57
|
-
return null;
|
|
58
|
-
}
|
|
59
|
-
const byId = knowledge.components[normalizedQuery];
|
|
60
|
-
if (byId) {
|
|
61
|
-
return byId;
|
|
62
|
-
}
|
|
63
|
-
const byName = components.find((component) => component.name === normalizedQuery);
|
|
64
|
-
if (byName) {
|
|
65
|
-
return byName;
|
|
66
|
-
}
|
|
67
|
-
const lowerQuery = normalizedQuery.toLowerCase();
|
|
68
|
-
const byCaseInsensitiveName = components.find((component) => component.name.toLowerCase() === lowerQuery);
|
|
69
|
-
if (byCaseInsensitiveName) {
|
|
70
|
-
return byCaseInsensitiveName;
|
|
71
|
-
}
|
|
72
|
-
return null;
|
|
73
|
-
}
|
|
74
|
-
const mcpServer = new McpServer({
|
|
75
|
-
name: 'mui-components-mcp',
|
|
76
|
-
version: SERVER_VERSION,
|
|
77
|
-
});
|
|
78
|
-
mcpServer.registerTool('list_components', {
|
|
79
|
-
description: 'List all available Ring Publishing MUI components with names and short descriptions.',
|
|
80
|
-
}, () => {
|
|
81
|
-
const allComponents = components.map((component) => summarizeComponent(component));
|
|
82
|
-
return {
|
|
83
|
-
content: [
|
|
84
|
-
{
|
|
85
|
-
type: 'text',
|
|
86
|
-
text: JSON.stringify({
|
|
87
|
-
total: allComponents.length,
|
|
88
|
-
version: knowledge.version,
|
|
89
|
-
importPath: knowledge.importPath,
|
|
90
|
-
components: allComponents,
|
|
91
|
-
}, null, 2),
|
|
92
|
-
},
|
|
93
|
-
],
|
|
94
|
-
};
|
|
95
|
-
});
|
|
96
|
-
mcpServer.registerTool('get_component_details', {
|
|
97
|
-
description: 'Get structured details for a specific component: description, prop definitions (argTypes) with types,' +
|
|
98
|
-
' defaults, and options, and available story names.' +
|
|
99
|
-
' Story names correspond to usage examples documented in the component docs — use get_component_docs to see them in full context.' +
|
|
100
|
-
' If an argType references a complex type, look it up directly in the source code or TypeScript exports' +
|
|
101
|
-
' of the @ringpublishing/mui-components library.' +
|
|
102
|
-
' Use this tool when you need to know how to use the component (what props to pass).',
|
|
103
|
-
inputSchema: {
|
|
104
|
-
name: z
|
|
105
|
-
.string()
|
|
106
|
-
.describe('Component name (e.g. "Accordion") or component id (e.g. "molecules-accordion").'),
|
|
107
|
-
},
|
|
108
|
-
}, ({ name }) => {
|
|
109
|
-
const component = findComponent(name);
|
|
110
|
-
if (!component) {
|
|
111
|
-
return {
|
|
112
|
-
content: [
|
|
113
|
-
{
|
|
114
|
-
type: 'text',
|
|
115
|
-
text: `Component "${name}" not found. Use list_components to see available components.`,
|
|
116
|
-
},
|
|
117
|
-
],
|
|
118
|
-
};
|
|
119
|
-
}
|
|
120
|
-
return {
|
|
121
|
-
content: [{ type: 'text', text: JSON.stringify(getComponentDetails(component), null, 2) }],
|
|
122
|
-
};
|
|
123
|
-
});
|
|
124
|
-
mcpServer.registerTool('get_component_docs', {
|
|
125
|
-
description: 'Get full prose documentation for a specific component: usage guidelines, behavior descriptions, and code examples.' +
|
|
126
|
-
' Use this when you need to understand how and when to use the component.',
|
|
127
|
-
inputSchema: {
|
|
128
|
-
name: z
|
|
129
|
-
.string()
|
|
130
|
-
.describe('Component name (e.g. "Accordion") or component id (e.g. "molecules-accordion").'),
|
|
131
|
-
},
|
|
132
|
-
}, ({ name }) => {
|
|
133
|
-
const component = findComponent(name);
|
|
134
|
-
if (!component) {
|
|
135
|
-
return {
|
|
136
|
-
content: [
|
|
137
|
-
{
|
|
138
|
-
type: 'text',
|
|
139
|
-
text: `Component "${name}" not found. Use list_components to see available components.`,
|
|
140
|
-
},
|
|
141
|
-
],
|
|
142
|
-
};
|
|
143
|
-
}
|
|
144
|
-
return {
|
|
145
|
-
content: [{ type: 'text', text: JSON.stringify(getComponentDocs(component), null, 2) }],
|
|
146
|
-
};
|
|
147
|
-
});
|
|
148
|
-
async function main() {
|
|
149
|
-
const transport = new StdioServerTransport();
|
|
150
|
-
await mcpServer.connect(transport);
|
|
151
|
-
}
|
|
152
|
-
main().catch((error) => {
|
|
153
|
-
console.error(error);
|
|
154
|
-
process.exit(1);
|
|
155
|
-
});
|
|
156
|
-
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAA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package/dist/types.d.ts
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
export interface ArgType {
|
|
2
|
-
description: string;
|
|
3
|
-
control?: string | false;
|
|
4
|
-
category?: string;
|
|
5
|
-
type?: string;
|
|
6
|
-
defaultValue?: string;
|
|
7
|
-
options?: Array<string | number | boolean>;
|
|
8
|
-
}
|
|
9
|
-
export interface Component {
|
|
10
|
-
id: string;
|
|
11
|
-
name: string;
|
|
12
|
-
category: string;
|
|
13
|
-
title: string;
|
|
14
|
-
description: string;
|
|
15
|
-
argTypes: Record<string, ArgType>;
|
|
16
|
-
storyNames: string[];
|
|
17
|
-
docs: string;
|
|
18
|
-
}
|
|
19
|
-
export interface Knowledge {
|
|
20
|
-
generated: string;
|
|
21
|
-
version?: string;
|
|
22
|
-
importPath?: string;
|
|
23
|
-
componentCount?: number;
|
|
24
|
-
components: Record<string, Component>;
|
|
25
|
-
}
|
|
26
|
-
export interface ListComponentResult {
|
|
27
|
-
id: string;
|
|
28
|
-
name: string;
|
|
29
|
-
description: string;
|
|
30
|
-
storyNames: string[];
|
|
31
|
-
argTypesCount: number;
|
|
32
|
-
}
|
|
33
|
-
export interface ComponentDetailsResult {
|
|
34
|
-
id: string;
|
|
35
|
-
name: string;
|
|
36
|
-
description: string;
|
|
37
|
-
storyNames: string[];
|
|
38
|
-
argTypes: Record<string, ArgType>;
|
|
39
|
-
}
|
|
40
|
-
export interface ComponentDocsResult {
|
|
41
|
-
id: string;
|
|
42
|
-
name: string;
|
|
43
|
-
docs: string;
|
|
44
|
-
}
|
package/dist/types.js
DELETED
package/dist/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|