@vezham/icons-mcp 1.0.7 → 27.0.2

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/dist/package.json CHANGED
@@ -19,29 +19,22 @@
19
19
  "cli",
20
20
  "server",
21
21
  "core",
22
- "data",
23
- "README.md",
24
- "LICENSE"
22
+ "data"
25
23
  ],
26
- "scripts": {
27
- "build": "node scripts/build.cjs"
28
- },
29
24
  "keywords": [
30
25
  "icons",
31
26
  "mcp",
32
27
  "model-context-protocol",
33
28
  "svg"
34
29
  ],
35
- "author": "Dev Chauhan",
36
- "license": "MIT",
37
30
  "repository": {
38
31
  "type": "git",
39
- "url": "https://github.com/vezham/reicon",
32
+ "url": "https://github.com/vezham/vx-fe-assets-pkgs",
40
33
  "directory": "packages/icons-mcp"
41
34
  },
42
35
  "homepage": "https://vezham.com",
43
36
  "bugs": {
44
- "url": "https://github.com/vezham/reicon/issues"
37
+ "url": "https://github.com/vezham/vx-fe-assets-pkgs/issues"
45
38
  },
46
39
  "dependencies": {
47
40
  "@modelcontextprotocol/sdk": "^1.12.0",
@@ -5,10 +5,15 @@ import { handleApplyIcon } from './tools/apply-icon.js';
5
5
  import { handleListCategories } from './tools/list-categories.js';
6
6
  import { handleSearchIcons } from './tools/search-icons.js';
7
7
  import { handleViewIcon } from './tools/view-icon.js';
8
- const ICON_WEIGHT_VALUES = ['outline', 'filled', 'duotone-outline', 'duotone-filled'];
8
+ const ICON_WEIGHT_VALUES = [
9
+ 'outline',
10
+ 'filled',
11
+ 'duotone-outline',
12
+ 'duotone-filled'
13
+ ];
9
14
  const server = new McpServer({
10
15
  name: 'vezham-icons-mcp',
11
- version: '1.1.0',
16
+ version: '1.1.0'
12
17
  });
13
18
  server.tool('search_icons', [
14
19
  'Search 2,700+ Vezham icons by any keyword, phrase, or description.',
@@ -16,9 +21,11 @@ server.tool('search_icons', [
16
21
  'multi-word queries ("user circle", "credit card", "volume up"), and name parts ("up" → arrow-up).',
17
22
  'Returns ranked matches. Short specific terms work best but full phrases also work.',
18
23
  'After getting results, pick the highest-scoring match and call apply_icon directly.',
19
- 'Only call view_icon first if you need to inspect the raw SVG before generating code.',
24
+ 'Only call view_icon first if you need to inspect the raw SVG before generating code.'
20
25
  ].join(' '), {
21
- query: z.string().describe('Keyword(s) or phrase — e.g. "cart", "user circle", "volume up", "credit card", "go back", "delete". Handles synonyms, misspellings, and multi-word queries.'),
26
+ query: z
27
+ .string()
28
+ .describe('Keyword(s) or phrase — e.g. "cart", "user circle", "volume up", "credit card", "go back", "delete". Handles synonyms, misspellings, and multi-word queries.'),
22
29
  weight: z
23
30
  .enum(ICON_WEIGHT_VALUES)
24
31
  .optional()
@@ -29,24 +36,26 @@ server.tool('search_icons', [
29
36
  .min(1)
30
37
  .max(20)
31
38
  .optional()
32
- .describe('Max results to return. Defaults to 8.'),
39
+ .describe('Max results to return. Defaults to 8.')
33
40
  }, async (args) => {
34
41
  const result = handleSearchIcons(args);
35
42
  return {
36
- content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
43
+ content: [{ type: 'text', text: JSON.stringify(result, null, 2) }]
37
44
  };
38
45
  });
39
46
  server.tool('view_icon', [
40
47
  'Fetch raw SVG markup and metadata for a specific Vezham icon.',
41
48
  'Use this to inspect the SVG before applying, or when you only need the raw markup.',
42
- 'For generating import/docs code, prefer apply_icon instead.',
49
+ 'For generating import/docs code, prefer apply_icon instead.'
43
50
  ].join(' '), {
44
- name: z.string().describe('Icon kebab-case name, e.g. "heart", "arrow-right", "user-circle"'),
45
- weight: z.enum(ICON_WEIGHT_VALUES).describe('Which weight variant to fetch'),
51
+ name: z
52
+ .string()
53
+ .describe('Icon kebab-case name, e.g. "heart", "arrow-right", "user-circle"'),
54
+ weight: z.enum(ICON_WEIGHT_VALUES).describe('Which weight variant to fetch')
46
55
  }, async (args) => {
47
56
  const result = handleViewIcon(args);
48
57
  return {
49
- content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
58
+ content: [{ type: 'text', text: JSON.stringify(result, null, 2) }]
50
59
  };
51
60
  });
52
61
  server.tool('apply_icon', [
@@ -54,7 +63,7 @@ server.tool('apply_icon', [
54
63
  'Returns importStatement and docsSnippet for the chosen framework.',
55
64
  'Supported frameworks: react, react-native, vue, svelte, html (CDN custom element), svg (raw markup).',
56
65
  'Insert importStatement at the top of the file and docsSnippet where the icon should appear.',
57
- 'Always call search_icons first to confirm the icon name and weight exist.',
66
+ 'Always call search_icons first to confirm the icon name and weight exist.'
58
67
  ].join(' '), {
59
68
  name: z.string().describe('Icon kebab-case name, e.g. "heart"'),
60
69
  weight: z.enum(ICON_WEIGHT_VALUES).describe('Icon weight variant'),
@@ -75,28 +84,28 @@ server.tool('apply_icon', [
75
84
  componentName: z
76
85
  .string()
77
86
  .optional()
78
- .describe('Override the component name. Defaults to the PascalCase icon name.'),
87
+ .describe('Override the component name. Defaults to the PascalCase icon name.')
79
88
  }, async (args) => {
80
89
  const result = handleApplyIcon(args);
81
90
  return {
82
- content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
91
+ content: [{ type: 'text', text: JSON.stringify(result, null, 2) }]
83
92
  };
84
93
  });
85
94
  server.tool('list_categories', [
86
95
  'List all icon categories available in the Vezham dataset.',
87
96
  'Use this to explore what types of icons exist before searching.',
88
- 'Each category can be used as a search keyword with search_icons.',
97
+ 'Each category can be used as a search keyword with search_icons.'
89
98
  ].join(' '), {}, async () => {
90
99
  const result = handleListCategories();
91
100
  return {
92
- content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
101
+ content: [{ type: 'text', text: JSON.stringify(result, null, 2) }]
93
102
  };
94
103
  });
95
104
  async function main() {
96
105
  const transport = new StdioServerTransport();
97
106
  await server.connect(transport);
98
107
  }
99
- main().catch((err) => {
108
+ main().catch(err => {
100
109
  console.error(err);
101
110
  process.exit(1);
102
111
  });
@@ -1,9 +1,6 @@
1
1
  import type { ApplyIconInput } from '../../core/types.js';
2
2
  export declare function handleApplyIcon(args: ApplyIconInput): {
3
3
  error: string;
4
- } | {
5
- error: string;
6
- suggestion: string;
7
4
  } | {
8
5
  meta: {
9
6
  name: string;
@@ -13,6 +10,4 @@ export declare function handleApplyIcon(args: ApplyIconInput): {
13
10
  };
14
11
  importStatement: string;
15
12
  docsSnippet: string;
16
- error?: undefined;
17
- suggestion?: undefined;
18
13
  };
@@ -1,24 +1,11 @@
1
1
  import { generateCode } from '../../core/codegen.js';
2
2
  import { loadIndex } from '../../core/load-index.js';
3
- import { findIcon } from '../../core/search.js';
3
+ import { resolveIcon } from '../../core/search.js';
4
4
  export function handleApplyIcon(args) {
5
- const index = loadIndex();
6
- const icon = findIcon(index, args.name);
7
- if (!icon) {
8
- // Soft-match: try normalized kebab-case
9
- const lower = args.name.toLowerCase().replace(/\s+/g, '-');
10
- const match = index.icons.find((i) => i.name.toLowerCase() === lower ||
11
- i.pascal.toLowerCase() === lower.replace(/-/g, ''));
12
- if (match) {
13
- return {
14
- error: `Icon "${args.name}" not found. Did you mean "${match.name}"? Call apply_icon again with name="${match.name}".`,
15
- suggestion: match.name,
16
- };
17
- }
18
- return {
19
- error: `Icon "${args.name}" not found. Use search_icons to find the correct name.`,
20
- };
21
- }
5
+ const resolved = resolveIcon(loadIndex(), args.name, suggestion => ` Call apply_icon again with name="${suggestion}".`);
6
+ if ('error' in resolved)
7
+ return resolved;
8
+ const { icon } = resolved;
22
9
  const result = generateCode(icon, args);
23
10
  if ('error' in result)
24
11
  return result;
@@ -29,7 +16,7 @@ export function handleApplyIcon(args) {
29
16
  name: icon.name,
30
17
  weight: args.weight,
31
18
  framework: args.framework,
32
- size: args.size ?? 24,
33
- },
19
+ size: args.size ?? 24
20
+ }
34
21
  };
35
22
  }
@@ -4,6 +4,6 @@ export function handleSearchIcons(args) {
4
4
  const index = loadIndex();
5
5
  return searchIcons(index, args.query, {
6
6
  weight: args.weight,
7
- limit: args.limit,
7
+ limit: args.limit
8
8
  });
9
9
  }
@@ -4,26 +4,13 @@ export declare function handleViewIcon(args: {
4
4
  weight: IconWeight;
5
5
  }): {
6
6
  error: string;
7
- } | {
8
- error: string;
9
- suggestion: string;
10
- name?: undefined;
11
- weight?: undefined;
12
- availableWeights?: undefined;
13
- category?: undefined;
14
- tags?: undefined;
15
- viewBox?: undefined;
16
- svg?: undefined;
17
- hint?: undefined;
18
7
  } | {
19
8
  name: string;
20
9
  weight: IconWeight;
21
10
  availableWeights: IconWeight[];
22
11
  category: string;
23
12
  tags: string[];
24
- viewBox: string;
13
+ viewBox: string | undefined;
25
14
  svg: string;
26
15
  hint: string;
27
- error?: undefined;
28
- suggestion?: undefined;
29
16
  };
@@ -1,26 +1,15 @@
1
1
  import { buildSvgMarkup } from '../../core/codegen.js';
2
2
  import { loadIndex } from '../../core/load-index.js';
3
- import { findIcon } from '../../core/search.js';
3
+ import { resolveIcon } from '../../core/search.js';
4
4
  export function handleViewIcon(args) {
5
- const index = loadIndex();
6
- const icon = findIcon(index, args.name);
7
- if (!icon) {
8
- // Try a soft match in case casing or dashes differ
9
- const lower = args.name.toLowerCase().replace(/\s+/g, '-');
10
- const match = index.icons.find((i) => i.name.toLowerCase() === lower || i.pascal.toLowerCase() === lower.replace(/-/g, ''));
11
- if (match) {
12
- return {
13
- error: `Icon "${args.name}" not found. Did you mean "${match.name}"?`,
14
- suggestion: match.name,
15
- };
16
- }
17
- return { error: `Icon "${args.name}" not found. Use search_icons to find the correct name.` };
18
- }
5
+ const resolved = resolveIcon(loadIndex(), args.name);
6
+ if ('error' in resolved)
7
+ return resolved;
8
+ const { icon } = resolved;
19
9
  const svg = buildSvgMarkup(icon, args.weight);
20
10
  if (typeof svg !== 'string') {
21
11
  return svg;
22
12
  }
23
- const weightData = icon.weights[args.weight];
24
13
  const availableWeights = Object.keys(icon.weights);
25
14
  return {
26
15
  name: icon.name,
@@ -28,8 +17,8 @@ export function handleViewIcon(args) {
28
17
  availableWeights,
29
18
  category: icon.category,
30
19
  tags: icon.tags,
31
- viewBox: weightData.viewBox,
20
+ viewBox: icon.weights[args.weight]?.viewBox,
32
21
  svg,
33
- hint: 'Call apply_icon with this name and weight to generate framework-specific code.',
22
+ hint: 'Call apply_icon with this name and weight to generate framework-specific code.'
34
23
  };
35
24
  }
package/package.json CHANGED
@@ -1,20 +1,37 @@
1
1
  {
2
2
  "name": "@vezham/icons-mcp",
3
- "version": "1.0.7",
4
- "type": "module",
3
+ "version": "27.0.2",
5
4
  "description": "MCP server and CLI for browsing and applying Vezham icons.",
5
+ "keywords": [
6
+ "icons",
7
+ "mcp",
8
+ "model-context-protocol",
9
+ "svg"
10
+ ],
11
+ "homepage": "https://vezham.com",
12
+ "bugs": {
13
+ "url": "https://github.com/vezham/vx-fe-assets-pkgs/issues"
14
+ },
6
15
  "repository": {
7
16
  "type": "git",
8
- "url": "https://github.com/vezham/reicon",
17
+ "url": "https://github.com/vezham/vx-fe-assets-pkgs",
9
18
  "directory": "packages/icons-mcp"
10
19
  },
11
- "bugs": {
12
- "url": "https://github.com/vezham/reicon/issues"
20
+ "type": "module",
21
+ "exports": {
22
+ ".": {
23
+ "types": "./dist/server/index.d.ts",
24
+ "import": "./dist/server/index.js"
25
+ }
13
26
  },
14
- "homepage": "https://vezham.com",
27
+ "main": "./dist/server/index.js",
28
+ "types": "./dist/server/index.d.ts",
15
29
  "bin": {
16
30
  "vezham-icons-mcp": "./dist/bin/run.cjs"
17
31
  },
32
+ "files": [
33
+ "dist"
34
+ ],
18
35
  "dependencies": {
19
36
  "@modelcontextprotocol/sdk": "^1.12.0",
20
37
  "zod": "^3.24.0"
@@ -22,25 +39,6 @@
22
39
  "engines": {
23
40
  "node": ">=18"
24
41
  },
25
- "license": "MIT",
26
- "main": "./dist/server/index.js",
27
- "types": "./dist/server/index.d.ts",
28
- "exports": {
29
- ".": {
30
- "import": "./dist/server/index.js",
31
- "types": "./dist/server/index.d.ts"
32
- }
33
- },
34
- "files": [
35
- "dist"
36
- ],
37
- "keywords": [
38
- "icons",
39
- "mcp",
40
- "model-context-protocol",
41
- "svg"
42
- ],
43
- "author": "Dev Chauhan",
44
42
  "scripts": {
45
43
  "build": "node scripts/build.cjs"
46
44
  }
package/README.md DELETED
@@ -1,69 +0,0 @@
1
- # vezham-icons-mcp
2
-
3
- MCP server and CLI for searching, previewing, and applying Vezham icons. Works fully offline with a prebuilt search index.
4
-
5
- ## MCP Server
6
-
7
- Add to your MCP client config:
8
-
9
- ```json
10
- {
11
- "mcpServers": {
12
- "vezham": {
13
- "command": "npx",
14
- "args": ["@vezham/icons-mcp"]
15
- }
16
- }
17
- }
18
- ```
19
-
20
- Or point directly at the local binary after building:
21
-
22
- ```json
23
- {
24
- "mcpServers": {
25
- "vezham": {
26
- "command": "node",
27
- "args": ["/path/to/vezham/packages/icons-mcp/bin/run.cjs"]
28
- }
29
- }
30
- }
31
- ```
32
-
33
- ### Tools
34
-
35
- | Tool | Description |
36
- | :--- | :--- |
37
- | `search_icons` | Rank icons by keyword |
38
- | `view_icon` | Return raw SVG markup and metadata |
39
- | `apply_icon` | Generate framework-specific import and docs snippets |
40
- | `list_categories` | List all icon categories |
41
-
42
- ## CLI
43
-
44
- ```bash
45
- npx @vezham/icons-mcp search "shopping cart"
46
- npx @vezham/icons-mcp view heart --weight filled
47
- npx @vezham/icons-mcp apply heart --framework react --size 32 --color "#ef4444"
48
- npx @vezham/icons-mcp categories
49
- ```
50
-
51
- ### File write mode
52
-
53
- For scripted insertion, replace a marker string in a target file:
54
-
55
- ```bash
56
- npx @vezham/icons-mcp apply heart --framework react --file src/App.tsx --marker "{/* ICON */}"
57
- ```
58
-
59
- The marker must exist exactly once. The command exits non-zero if the marker is not found.
60
-
61
- ## Build
62
-
63
- From the monorepo root:
64
-
65
- ```bash
66
- npm run build:mcp
67
- ```
68
-
69
- MIT © [Dev Chauhan](https://devchauhan.in)
package/dist/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 Dev Chauhan
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
package/dist/README.md DELETED
@@ -1,69 +0,0 @@
1
- # vezham-icons-mcp
2
-
3
- MCP server and CLI for searching, previewing, and applying Vezham icons. Works fully offline with a prebuilt search index.
4
-
5
- ## MCP Server
6
-
7
- Add to your MCP client config:
8
-
9
- ```json
10
- {
11
- "mcpServers": {
12
- "vezham": {
13
- "command": "npx",
14
- "args": ["@vezham/icons-mcp"]
15
- }
16
- }
17
- }
18
- ```
19
-
20
- Or point directly at the local binary after building:
21
-
22
- ```json
23
- {
24
- "mcpServers": {
25
- "vezham": {
26
- "command": "node",
27
- "args": ["/path/to/vezham/packages/icons-mcp/bin/run.cjs"]
28
- }
29
- }
30
- }
31
- ```
32
-
33
- ### Tools
34
-
35
- | Tool | Description |
36
- | :--- | :--- |
37
- | `search_icons` | Rank icons by keyword |
38
- | `view_icon` | Return raw SVG markup and metadata |
39
- | `apply_icon` | Generate framework-specific import and docs snippets |
40
- | `list_categories` | List all icon categories |
41
-
42
- ## CLI
43
-
44
- ```bash
45
- npx @vezham/icons-mcp search "shopping cart"
46
- npx @vezham/icons-mcp view heart --weight filled
47
- npx @vezham/icons-mcp apply heart --framework react --size 32 --color "#ef4444"
48
- npx @vezham/icons-mcp categories
49
- ```
50
-
51
- ### File write mode
52
-
53
- For scripted insertion, replace a marker string in a target file:
54
-
55
- ```bash
56
- npx @vezham/icons-mcp apply heart --framework react --file src/App.tsx --marker "{/* ICON */}"
57
- ```
58
-
59
- The marker must exist exactly once. The command exits non-zero if the marker is not found.
60
-
61
- ## Build
62
-
63
- From the monorepo root:
64
-
65
- ```bash
66
- npm run build:mcp
67
- ```
68
-
69
- MIT © [Dev Chauhan](https://devchauhan.in)
@@ -1,11 +0,0 @@
1
- import type { IconIndex } from './types.js';
2
- export declare function buildIconIndex(data: {
3
- categories?: Record<string, {
4
- icons?: Record<string, {
5
- description?: string[];
6
- weights?: Record<string, {
7
- code?: string;
8
- }>;
9
- }>;
10
- }>;
11
- }): IconIndex;
@@ -1,68 +0,0 @@
1
- const W_KEYS = ['outline', 'filled', 'duotone-outline', 'duotone-filled'];
2
- function toPascalCase(str) {
3
- return str
4
- .split('-')
5
- .map((s) => s.charAt(0).toUpperCase() + s.slice(1))
6
- .join('');
7
- }
8
- function stripSvgWrapper(code) {
9
- if (!code)
10
- return '';
11
- return code.replace(/^<svg[^>]*>/, '').replace(/<\/svg>\s*$/, '').trim();
12
- }
13
- function rewriteColors(svg) {
14
- return svg
15
- .replace(/#1C274C/gi, 'currentColor')
16
- .replace(/fill="white"/g, 'fill="currentColor"')
17
- .replace(/stroke="white"/g, 'stroke="currentColor"');
18
- }
19
- function generateTags(name, description) {
20
- const tags = new Set();
21
- for (const t of description)
22
- tags.add(t);
23
- const parts = name.split('-');
24
- for (const part of parts) {
25
- if (part.length > 1)
26
- tags.add(part);
27
- }
28
- return [...tags];
29
- }
30
- export function buildIconIndex(data) {
31
- const icons = [];
32
- const categorySet = new Set();
33
- const pascalLowerSet = new Set();
34
- for (const [catKey, catData] of Object.entries(data.categories || {})) {
35
- categorySet.add(catKey);
36
- for (const [iconKey, icon] of Object.entries(catData.icons || {})) {
37
- let pascal = toPascalCase(iconKey);
38
- if (pascalLowerSet.has(pascal.toLowerCase())) {
39
- pascal += toPascalCase(catKey);
40
- }
41
- pascalLowerSet.add(pascal.toLowerCase());
42
- const weights = {};
43
- for (const wName of W_KEYS) {
44
- const wData = icon.weights?.[wName];
45
- if (wData?.code) {
46
- weights[wName] = {
47
- code: rewriteColors(stripSvgWrapper(wData.code)),
48
- viewBox: '0 0 24 24',
49
- };
50
- }
51
- }
52
- if (Object.keys(weights).length > 0) {
53
- icons.push({
54
- name: iconKey,
55
- pascal,
56
- category: catKey,
57
- tags: generateTags(iconKey, icon.description || []),
58
- weights,
59
- });
60
- }
61
- }
62
- }
63
- icons.sort((a, b) => a.name.localeCompare(b.name));
64
- return {
65
- icons,
66
- categories: [...categorySet].sort(),
67
- };
68
- }