@mdui/mcp 2.1.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/index.d.ts ADDED
@@ -0,0 +1 @@
1
+ export { createServer } from './server.js';
package/index.js ADDED
@@ -0,0 +1 @@
1
+ export { createServer } from './server.js';
package/package.json ADDED
@@ -0,0 +1,36 @@
1
+ {
2
+ "name": "@mdui/mcp",
3
+ "version": "2.1.0",
4
+ "description": "mdui MCP Server",
5
+ "type": "module",
6
+ "main": "index.js",
7
+ "types": "index.d.ts",
8
+ "bin": {
9
+ "mdui-mcp": "stdio.js"
10
+ },
11
+ "files": [
12
+ "data",
13
+ "tools",
14
+ "index.{js,d.ts}",
15
+ "server.{js,d.ts}",
16
+ "stdio.{js,d.ts}",
17
+ "LICENSE",
18
+ "package.json",
19
+ "README.md"
20
+ ],
21
+ "repository": {
22
+ "type": "git",
23
+ "url": "git+https://github.com/zdhxiong/mdui.git"
24
+ },
25
+ "author": "zdhxiong <zdhxiong@gmail.com>",
26
+ "license": "MIT",
27
+ "bugs": {
28
+ "url": "https://github.com/zdhxiong/mdui/issues"
29
+ },
30
+ "homepage": "https://www.mdui.org",
31
+ "dependencies": {
32
+ "@modelcontextprotocol/sdk": "^1.17.5",
33
+ "zod": "^3.25.76",
34
+ "tslib": "^2.8.1"
35
+ }
36
+ }
package/server.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ export declare function createServer(): McpServer;
package/server.js ADDED
@@ -0,0 +1,34 @@
1
+ import fs from 'node:fs';
2
+ import path from 'node:path';
3
+ import { fileURLToPath } from 'node:url';
4
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
5
+ import { registerGetComponentMetadata } from './tools/getComponentMetadata.js';
6
+ import { registerGetDocument } from './tools/getDocument.js';
7
+ import { registerListComponents } from './tools/listComponents.js';
8
+ import { registerListCssClasses } from './tools/listCssClasses.js';
9
+ import { registerListCssVariables } from './tools/listCssVariables.js';
10
+ import { registerListDocuments } from './tools/listDocuments.js';
11
+ import { registerListIconCodes } from './tools/listIconCodes.js';
12
+ import { registerListIconComponents } from './tools/listIconComponents.js';
13
+ export function createServer() {
14
+ const __filename = fileURLToPath(import.meta.url);
15
+ const __dirname = path.dirname(__filename);
16
+ const VERSION = JSON.parse(fs.readFileSync(path.join(__dirname, 'package.json'), 'utf8')).version;
17
+ const server = new McpServer({
18
+ name: 'mdui-mcp',
19
+ version: VERSION,
20
+ capabilities: {
21
+ tools: {},
22
+ },
23
+ });
24
+ // Register tool modules
25
+ registerListComponents(server);
26
+ registerGetComponentMetadata(server);
27
+ registerListCssClasses(server);
28
+ registerListCssVariables(server);
29
+ registerListDocuments(server);
30
+ registerGetDocument(server);
31
+ registerListIconCodes(server);
32
+ registerListIconComponents(server);
33
+ return server;
34
+ }
package/stdio.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
package/stdio.js ADDED
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env node
2
+ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
3
+ import { createServer } from './server.js';
4
+ async function main() {
5
+ const server = createServer();
6
+ const transport = new StdioServerTransport();
7
+ await server.connect(transport);
8
+ }
9
+ main().catch((err) => {
10
+ console.error('[mdui-mcp] fatal:', err);
11
+ process.exit(1);
12
+ });
@@ -0,0 +1,6 @@
1
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ /**
3
+ * 获取指定组件的详细元数据
4
+ * @param server
5
+ */
6
+ export declare function registerGetComponentMetadata(server: McpServer): void;
@@ -0,0 +1,124 @@
1
+ import { z } from 'zod';
2
+ import { components } from '../data/components.js';
3
+ /**
4
+ * 获取指定组件的详细元数据
5
+ * @param server
6
+ */
7
+ export function registerGetComponentMetadata(server) {
8
+ const propertySchema = z
9
+ .object({
10
+ name: z.string().describe('The property name'),
11
+ attribute: z
12
+ .string()
13
+ .nullable()
14
+ .describe('The associated HTML attribute name, or null if none'),
15
+ reflects: z
16
+ .boolean()
17
+ .optional()
18
+ .describe('Whether the property reflects to an attribute'),
19
+ description: z.string().describe('A brief description of the property'),
20
+ type: z.string().describe('The property type as text'),
21
+ default: z
22
+ .string()
23
+ .optional()
24
+ .describe('The default value as text, if any'),
25
+ })
26
+ .strict();
27
+ const methodSchema = z
28
+ .object({
29
+ name: z.string().describe('The method name'),
30
+ signature: z
31
+ .string()
32
+ .describe('The full method signature as text, including parameters and return type'),
33
+ description: z.string().describe('A brief description of the method'),
34
+ })
35
+ .strict();
36
+ const eventSchema = z
37
+ .object({
38
+ name: z.string().describe("The event name (without the 'on' prefix)"),
39
+ description: z.string().describe('A brief description of the event'),
40
+ })
41
+ .strict();
42
+ const slotSchema = z
43
+ .object({
44
+ name: z.string().describe("The slot name ('' for the default slot)"),
45
+ description: z.string().describe('A brief description of the slot'),
46
+ })
47
+ .strict();
48
+ const cssPartSchema = z
49
+ .object({
50
+ name: z.string().describe('The CSS part name (for ::part)'),
51
+ description: z.string().describe('A brief description of the CSS part'),
52
+ })
53
+ .strict();
54
+ const cssPropertySchema = z
55
+ .object({
56
+ name: z
57
+ .string()
58
+ .describe('The CSS custom property name, including the leading --'),
59
+ description: z
60
+ .string()
61
+ .describe('A brief description of the CSS custom property'),
62
+ })
63
+ .strict();
64
+ // Reusable component schema and in-memory index for O(1) lookups
65
+ const componentSchema = z
66
+ .object({
67
+ tagName: z
68
+ .string()
69
+ .describe('The tag name of the component, e.g., mdui-button'),
70
+ description: z.string().describe('A brief description of the component'),
71
+ docUrl: z
72
+ .string()
73
+ .url()
74
+ .describe('The URL to the component documentation'),
75
+ usage: z.string().describe('Example HTML usage snippet of the component'),
76
+ properties: z.array(propertySchema).describe('Public properties'),
77
+ methods: z.array(methodSchema).describe('Public methods'),
78
+ events: z.array(eventSchema).describe('Dispatched events'),
79
+ slots: z.array(slotSchema).describe('Slots'),
80
+ cssParts: z.array(cssPartSchema).describe('Exposed CSS parts'),
81
+ cssProperties: z
82
+ .array(cssPropertySchema)
83
+ .describe('Supported CSS custom properties'),
84
+ })
85
+ .strict();
86
+ const componentsIndex = new Map(components.map((c) => [
87
+ c.tagName.toLowerCase(),
88
+ c,
89
+ ]));
90
+ server.registerTool('get_component_metadata', {
91
+ title: 'Get Component Metadata',
92
+ description: 'Get detailed API metadata for one mdui Web Component by tagName (case-insensitive). Read-only, offline, deterministic. Use list_components to discover available tag names. Returns: tagName, description, documentation URL, usage snippet, and arrays of properties, methods, events, slots, cssParts, and cssProperties. Note: attribute names may differ from property names; when both exist, the property may reflect to the attribute if "reflects" is true.',
93
+ inputSchema: {
94
+ tagName: z
95
+ .string()
96
+ .min(1)
97
+ .transform((s) => s.trim().toLowerCase())
98
+ .describe('The tag name of the component, e.g., mdui-button (case-insensitive).'),
99
+ },
100
+ outputSchema: componentSchema.shape,
101
+ }, async ({ tagName }) => {
102
+ const component = componentsIndex.get(tagName);
103
+ if (!component) {
104
+ return {
105
+ isError: true,
106
+ content: [
107
+ {
108
+ type: 'text',
109
+ text: `Component not found: ${tagName}. Use list_components to see all available tag names.`,
110
+ },
111
+ ],
112
+ };
113
+ }
114
+ return {
115
+ structuredContent: component,
116
+ content: [
117
+ {
118
+ type: 'text',
119
+ text: JSON.stringify(component, null, 2),
120
+ },
121
+ ],
122
+ };
123
+ });
124
+ }
@@ -0,0 +1,7 @@
1
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ /**
3
+ * 根据 key 或 tagName 获取单个文档内容
4
+ * - key: 来自 list_documents 工具的 key,如 components--button
5
+ * - tagName: 来自 list_components 工具的 tagName,如 mdui-button
6
+ */
7
+ export declare function registerGetDocument(server: McpServer): void;
@@ -0,0 +1,97 @@
1
+ import { z } from 'zod';
2
+ import { documents } from '../data/documents.js';
3
+ /**
4
+ * 根据 key 或 tagName 获取单个文档内容
5
+ * - key: 来自 list_documents 工具的 key,如 components--button
6
+ * - tagName: 来自 list_components 工具的 tagName,如 mdui-button
7
+ */
8
+ export function registerGetDocument(server) {
9
+ // 输入:允许传入 key 或 tagName(至少其一,且两者互斥)
10
+ const normalizeOptionalNonEmptyLower = (label) => z
11
+ .preprocess((v) => {
12
+ if (typeof v === 'string') {
13
+ const s = v.trim();
14
+ return s.length === 0 ? undefined : s.toLowerCase();
15
+ }
16
+ return v;
17
+ }, z.string().min(1).optional())
18
+ .describe(label);
19
+ const inputSchema = {
20
+ key: normalizeOptionalNonEmptyLower('Document key from list_documents, e.g., components--button (case-insensitive).'),
21
+ tagName: normalizeOptionalNonEmptyLower('Component tag name from list_components, e.g., mdui-button (case-insensitive).'),
22
+ };
23
+ // 输出:文档对象
24
+ const outputSchema = {
25
+ key: z.string().describe('Unique document key, e.g., components--button'),
26
+ title: z.string().describe('Document title'),
27
+ description: z.string().describe('Short description of the document'),
28
+ content: z.string().describe('Full markdown content of the document'),
29
+ };
30
+ server.registerTool('get_document', {
31
+ title: 'Get Document',
32
+ description: 'Get a single mdui documentation page by key or by component tagName (inputs are mutually exclusive). Read-only, offline, deterministic. If both inputs are provided, the tool returns an error. If only tagName is provided, the tool selects the first document that references this tagName. Returns: key, title, description, and full markdown content.',
33
+ inputSchema,
34
+ outputSchema,
35
+ }, async ({ key, tagName }) => {
36
+ // 互斥与必填校验
37
+ if (!key && !tagName) {
38
+ return {
39
+ isError: true,
40
+ content: [
41
+ {
42
+ type: 'text',
43
+ text: 'Either key or tagName is required.',
44
+ },
45
+ ],
46
+ };
47
+ }
48
+ if (key && tagName) {
49
+ return {
50
+ isError: true,
51
+ content: [
52
+ {
53
+ type: 'text',
54
+ text: 'Provide either key or tagName, not both (they are mutually exclusive).',
55
+ },
56
+ ],
57
+ };
58
+ }
59
+ // 若未提供 key,则根据 tagName 在 documents 中查找包含该 tag 的页面,确定 key
60
+ let resolvedKey = key?.trim().toLowerCase();
61
+ if (!resolvedKey && tagName) {
62
+ const normalizedTag = tagName.trim().toLowerCase();
63
+ for (const [docKey, docItem] of Object.entries(documents)) {
64
+ const tags = docItem.tagNames;
65
+ if (Array.isArray(tags) &&
66
+ tags.map((t) => t.toLowerCase()).includes(normalizedTag)) {
67
+ resolvedKey = docKey;
68
+ break;
69
+ }
70
+ }
71
+ }
72
+ const doc = resolvedKey ? documents[resolvedKey] : undefined;
73
+ if (!doc) {
74
+ return {
75
+ isError: true,
76
+ content: [
77
+ {
78
+ type: 'text',
79
+ text: `Document not found by ${key ? `key: ${key}` : `tagName: ${tagName}`}. Use list_documents to enumerate keys or verify that the component has an associated document.`,
80
+ },
81
+ ],
82
+ };
83
+ }
84
+ const result = {
85
+ key: doc.key,
86
+ title: doc.title,
87
+ description: doc.description,
88
+ content: doc.content,
89
+ };
90
+ return {
91
+ structuredContent: result,
92
+ content: [
93
+ { type: 'text', text: JSON.stringify(result, null, 2) },
94
+ ],
95
+ };
96
+ });
97
+ }
@@ -0,0 +1,6 @@
1
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ /**
3
+ * 列出所有 mdui 组件
4
+ * @param server
5
+ */
6
+ export declare function registerListComponents(server: McpServer): void;
@@ -0,0 +1,50 @@
1
+ import { z } from 'zod';
2
+ import { components } from '../data/components.js';
3
+ /**
4
+ * 列出所有 mdui 组件
5
+ * @param server
6
+ */
7
+ export function registerListComponents(server) {
8
+ server.registerTool('list_components', {
9
+ title: 'List Components',
10
+ description: 'List all mdui Web Components (custom elements) available in the local mdui index. Read-only, offline, and deterministic. No input required. For each item returns: tagName, description, documentation URL, and a minimal HTML usage snippet. Results are sorted by tagName (ascending). Note: this excludes stand‑alone icon components—use list_icon_components for icons, or list_icon_codes for attribute values.',
11
+ inputSchema: {},
12
+ outputSchema: {
13
+ components: z
14
+ .array(z.object({
15
+ tagName: z
16
+ .string()
17
+ .describe('The tag name of the component, e.g., mdui-button'),
18
+ description: z
19
+ .string()
20
+ .describe('A brief description of the component'),
21
+ docUrl: z
22
+ .string()
23
+ .url()
24
+ .describe('The URL to the component documentation'),
25
+ usage: z
26
+ .string()
27
+ .describe('Example HTML usage snippet of the component'),
28
+ }))
29
+ .describe('A list of components with their tag names, descriptions, documentation URLs, and usage snippets (sorted by tagName).'),
30
+ },
31
+ }, async () => {
32
+ const list = components
33
+ .map((component) => ({
34
+ tagName: component.tagName,
35
+ description: component.description,
36
+ docUrl: component.docUrl,
37
+ usage: component.usage,
38
+ }))
39
+ .sort((a, b) => a.tagName.localeCompare(b.tagName));
40
+ return {
41
+ structuredContent: { components: list },
42
+ content: [
43
+ {
44
+ type: 'text',
45
+ text: JSON.stringify({ components: list }, null, 2),
46
+ },
47
+ ],
48
+ };
49
+ });
50
+ }
@@ -0,0 +1,6 @@
1
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ /**
3
+ * 列出所有 mdui 全局 CSS class
4
+ * @param server
5
+ */
6
+ export declare function registerListCssClasses(server: McpServer): void;
@@ -0,0 +1,43 @@
1
+ import { z } from 'zod';
2
+ import { cssClasses } from '../data/cssClasses.js';
3
+ /**
4
+ * 列出所有 mdui 全局 CSS class
5
+ * @param server
6
+ */
7
+ export function registerListCssClasses(server) {
8
+ server.registerTool('list_css_classes', {
9
+ title: 'List Global CSS Classes',
10
+ description: 'List all mdui global CSS classes from the local index (read-only, offline). For each class returns: name, description, documentation URL, and an example usage snippet. Results are sorted by name (ascending). Use this to discover utility/semantics classes, not component APIs.',
11
+ inputSchema: {},
12
+ outputSchema: {
13
+ classes: z
14
+ .array(z.object({
15
+ name: z
16
+ .string()
17
+ .describe('The CSS class name, e.g., mdui-theme-dark'),
18
+ description: z
19
+ .string()
20
+ .describe('A brief description of the CSS class'),
21
+ docUrl: z
22
+ .string()
23
+ .url()
24
+ .describe('The URL to the CSS class documentation'),
25
+ example: z
26
+ .string()
27
+ .describe('Example usage snippet of the CSS class'),
28
+ }))
29
+ .describe('A list of global CSS classes with their names, descriptions, documentation URLs, and example usage snippets (sorted by name).'),
30
+ },
31
+ }, async () => {
32
+ const list = cssClasses.sort((a, b) => a.name.localeCompare(b.name));
33
+ return {
34
+ structuredContent: { classes: list },
35
+ content: [
36
+ {
37
+ type: 'text',
38
+ text: JSON.stringify({ classes: list }, null, 2),
39
+ },
40
+ ],
41
+ };
42
+ });
43
+ }
@@ -0,0 +1,6 @@
1
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ /**
3
+ * 列出所有 mdui 全局 CSS 变量(Design Tokens)
4
+ * @param server
5
+ */
6
+ export declare function registerListCssVariables(server: McpServer): void;
@@ -0,0 +1,40 @@
1
+ import { z } from 'zod';
2
+ import { cssVariables } from '../data/cssVariables.js';
3
+ /**
4
+ * 列出所有 mdui 全局 CSS 变量(Design Tokens)
5
+ * @param server
6
+ */
7
+ export function registerListCssVariables(server) {
8
+ server.registerTool('list_css_variables', {
9
+ title: 'List Global CSS Variables',
10
+ description: 'List all mdui global CSS custom properties (design tokens) from the local index. Read-only, offline, and deterministic. For each variable returns: name, description, and documentation URL. No input required. Results are sorted by name (ascending). Use this to theme/override styles at app level; for per-component tokens, see get_component_metadata.cssProperties.',
11
+ inputSchema: {},
12
+ outputSchema: {
13
+ variables: z
14
+ .array(z.object({
15
+ name: z
16
+ .string()
17
+ .describe('The CSS custom property name, e.g., --mdui-color-primary'),
18
+ description: z
19
+ .string()
20
+ .describe('A brief description of the CSS variable'),
21
+ docUrl: z
22
+ .string()
23
+ .url()
24
+ .describe('The URL to the CSS variable documentation'),
25
+ }))
26
+ .describe('A list of CSS variables with their names, descriptions, and documentation URLs (sorted by name).'),
27
+ },
28
+ }, async () => {
29
+ const list = cssVariables.sort((a, b) => a.name.localeCompare(b.name));
30
+ return {
31
+ structuredContent: { variables: list },
32
+ content: [
33
+ {
34
+ type: 'text',
35
+ text: JSON.stringify({ variables: list }, null, 2),
36
+ },
37
+ ],
38
+ };
39
+ });
40
+ }
@@ -0,0 +1,6 @@
1
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ /**
3
+ * 列出所有文档(key、title、description)
4
+ * @param server
5
+ */
6
+ export declare function registerListDocuments(server: McpServer): void;
@@ -0,0 +1,43 @@
1
+ import { z } from 'zod';
2
+ import { documents } from '../data/documents.js';
3
+ /**
4
+ * 列出所有文档(key、title、description)
5
+ * @param server
6
+ */
7
+ export function registerListDocuments(server) {
8
+ server.registerTool('list_documents', {
9
+ title: 'List Documents',
10
+ description: 'List all mdui documentation pages from the local index (read-only, offline). For each document returns: key, title, and description. Results are sorted by key (ascending). Use get_document with a key from this list to fetch the full markdown content.',
11
+ inputSchema: {},
12
+ outputSchema: {
13
+ documents: z
14
+ .array(z.object({
15
+ key: z
16
+ .string()
17
+ .describe('Unique document key, e.g., components--button'),
18
+ title: z.string().describe('Document title'),
19
+ description: z
20
+ .string()
21
+ .describe('Short description of the document'),
22
+ }))
23
+ .describe('A list of documents with key, title, and description (sorted by key).'),
24
+ },
25
+ }, async () => {
26
+ const list = Object.values(documents)
27
+ .map((doc) => ({
28
+ key: doc.key,
29
+ title: doc.title,
30
+ description: doc.description,
31
+ }))
32
+ .sort((a, b) => a.key.localeCompare(b.key));
33
+ return {
34
+ structuredContent: { documents: list },
35
+ content: [
36
+ {
37
+ type: 'text',
38
+ text: JSON.stringify({ documents: list }, null, 2),
39
+ },
40
+ ],
41
+ };
42
+ });
43
+ }
@@ -0,0 +1,6 @@
1
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ /**
3
+ * 列出指定变体的所有图标名称
4
+ * @param server
5
+ */
6
+ export declare function registerListIconCodes(server: McpServer): void;
@@ -0,0 +1,72 @@
1
+ import { z } from 'zod';
2
+ import { icons } from '../data/icons.js';
3
+ /**
4
+ * 列出指定变体的所有图标名称
5
+ * @param server
6
+ */
7
+ export function registerListIconCodes(server) {
8
+ const variantSchema = z.enum([
9
+ 'filled',
10
+ 'outlined',
11
+ 'rounded',
12
+ 'sharp',
13
+ 'two-tone',
14
+ ]);
15
+ const inputSchema = {
16
+ variant: variantSchema
17
+ .optional()
18
+ .describe("Icon variant to list. One of: 'filled' (default), 'outlined', 'rounded', 'sharp', 'two-tone'."),
19
+ query: z
20
+ .preprocess((v) => (typeof v === 'string' ? v.trim() : v), z.string().min(1).optional())
21
+ .describe('Case-insensitive substring to filter by human-readable name or code.'),
22
+ limit: z
23
+ .number()
24
+ .int()
25
+ .min(1)
26
+ .max(5000)
27
+ .optional()
28
+ .describe('Maximum number of results to return (default: all).'),
29
+ };
30
+ const outputSchema = {
31
+ icons: z
32
+ .array(z.object({
33
+ name: z.string().describe('Human-readable icon label'),
34
+ code: z
35
+ .string()
36
+ .describe("Icon name to use in component attributes/APIs (e.g., 'search' or 'search--outlined')."),
37
+ }))
38
+ .describe("List of icon codes for the requested variant. Use these codes in attributes such as mdui-button's 'icon' or 'end-icon'."),
39
+ };
40
+ const toTitleCase = (s) => s
41
+ .split(' ')
42
+ .map((part) => (part ? part[0].toUpperCase() + part.slice(1) : part))
43
+ .join(' ');
44
+ server.registerTool('list_icon_codes', {
45
+ title: 'List Icon Codes',
46
+ description: "List icon codes (attribute values) for a single variant from the local index. Read-only, offline, deterministic. Use these codes wherever an icon name is required by a component or API, for example: <mdui-button icon=\"search\" end-icon=\"arrow_forward\">.\n\nOutput: array of { name, code }.\n- name: human-readable label.\n- code: value to use in attributes/APIs (e.g., 'search' or 'search--outlined').\n\nDiffers from list_icon_components: this returns attribute codes, not custom element tags/imports.\n\nInput: optional 'variant' — one of 'filled' (default), 'outlined', 'rounded', 'sharp', 'two-tone'; also supports optional 'query' — case-insensitive substring filter applied to the human-readable name or the code; and 'limit' — maximum number of results to return (1–5000, default: all).",
47
+ inputSchema,
48
+ outputSchema,
49
+ }, async ({ variant, query, limit, }) => {
50
+ const v = variant ?? 'filled';
51
+ const q = query?.toLowerCase();
52
+ let list = icons.map((n) => {
53
+ const display = toTitleCase(n.replace(/_/g, ' '));
54
+ const code = v === 'filled' ? n : `${n}--${v}`;
55
+ return { name: display, code };
56
+ });
57
+ if (q) {
58
+ list = list.filter((it) => it.name.toLowerCase().includes(q) ||
59
+ it.code.toLowerCase().includes(q));
60
+ }
61
+ if (typeof limit === 'number') {
62
+ list = list.slice(0, limit);
63
+ }
64
+ const result = { icons: list };
65
+ return {
66
+ structuredContent: result,
67
+ content: [
68
+ { type: 'text', text: JSON.stringify(result, null, 2) },
69
+ ],
70
+ };
71
+ });
72
+ }
@@ -0,0 +1,7 @@
1
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ /**
3
+ * 列出指定变体的所有图标组件信息
4
+ * 返回 { name, tagName, import } 数组
5
+ * @param server
6
+ */
7
+ export declare function registerListIconComponents(server: McpServer): void;