@nodo-icons/mcp 0.1.0 → 0.1.1

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 CHANGED
@@ -39,7 +39,7 @@ With a Pro license, unzip the Pro download and point the server at it to get SVG
39
39
  { "command": "npx", "args": ["-y", "@nodo-icons/mcp"], "env": { "NODO_PRO_DIR": "/path/to/nodo-icons-pro" } }
40
40
  ```
41
41
 
42
- React and Vue packages for the Pro styles are not released yet: for a Pro style, `get_icon` returns its SVG (from your Pro download), ready to paste or wrap in a component.
42
+ For React and Vue, `get_icon` returns code for `@nodo-icons/react-pro` / `@nodo-icons/vue-pro`, which install from the Nodo Icons registry with your license key: see [the docs](https://nodoicons.com/docs/#nodo-icons-pro-in-react-and-vue).
43
43
 
44
44
  ## CLI
45
45
 
package/package.json CHANGED
@@ -9,9 +9,9 @@
9
9
  "type": "git",
10
10
  "url": "git+https://github.com/NodoIcons/nodoicons.git"
11
11
  },
12
- "version": "0.1.0",
12
+ "version": "0.1.1",
13
13
  "description": "MCP server and CLI for Nodo Icons: let AI agents search 5,000 icons and insert SVG, React or Vue code.",
14
- "mcpName": "io.github.NodoIcons/nodo-icons",
14
+ "mcpName": "com.nodoicons/nodo-icons",
15
15
  "homepage": "https://nodoicons.com/docs/",
16
16
  "type": "module",
17
17
  "license": "MIT",
package/src/core.js CHANGED
@@ -6,7 +6,8 @@ import { STYLE_INFO, STYLES, toSVG, componentName } from './render.js';
6
6
  const DATA = JSON.parse(readFileSync(new URL('../data/icons.json', import.meta.url), 'utf8'));
7
7
  export const FREE_STYLE = DATA.free;
8
8
  export const VERSION = DATA.version;
9
- export const PRO_URL = 'https://nodoicons.com/#pricing';
9
+ export const DOCS_URL = 'https://nodoicons.com/docs/#nodo-icons-pro-in-react-and-vue';
10
+ const PRO_URL = 'https://nodoicons.com/#pricing';
10
11
  const PRO_DIR = process.env.NODO_PRO_DIR || ''; // folder of the unzipped Pro download (contains svg/<style>/)
11
12
 
12
13
  export const icons = DATA.icons.map(([name, category, tags]) => ({ name, category, tags }));
@@ -86,24 +87,18 @@ export function getIcon(name, { style = FREE_STYLE, format = 'svg', size = 24, c
86
87
  if (!STYLE_INFO[style]) return { ok: false, text: `Unknown style "${style}". Styles: ${STYLES.join(', ')}.` };
87
88
  const comp = componentName(name);
88
89
  const pro = !isFree(style);
89
- const pkg = (fw) => `@nodo-icons/${fw}`;
90
+ const pkg = (fw) => (pro ? `@nodo-icons/${fw}-pro/${style}` : `@nodo-icons/${fw}`);
90
91
  const sw = strokeWidth && STYLE_INFO[style].paint === 'stroke' ? strokeWidth : undefined;
91
-
92
- // Pro styles have no React/Vue package yet: hand back their SVG from the Pro download instead.
93
- if (pro && (format === 'react' || format === 'vue')) {
94
- const soon = `React/Vue packages for Nodo Icons Pro styles are not released yet; the free Linear style is "@nodo-icons/${format}".`;
95
- const svg = svgFor(name, style, { size, color, strokeWidth: sw });
96
- if (svg) return { ok: true, text: `${svg}\n\n<!-- ${STYLE_INFO[style].label} SVG from your Pro download. ${soon} -->` };
97
- return { ok: false, text: `"${name}" in ${STYLE_INFO[style].label} is a Nodo Icons Pro style. With a Pro license, set NODO_PRO_DIR to the unzipped Pro download to get its SVG (${PRO_URL}). ${soon}` };
98
- }
92
+ // Pro React/Vue packages install from the Nodo Icons registry with the license key (see the docs).
93
+ const proNote = pro ? `\n\n// ${STYLE_INFO[style].label} is a Nodo Icons Pro style: install @nodo-icons/${format}-pro from https://nodoicons.com/npm/ with your license key (${DOCS_URL}).` : '';
99
94
 
100
95
  if (format === 'react') {
101
96
  const props = [`size={${size}}`, color !== 'currentColor' ? `color="${color}"` : '', sw ? `strokeWidth={${sw}}` : ''].filter(Boolean).join(' ');
102
- return { ok: true, text: `import { ${comp} } from '${pkg('react')}';\n\n<${comp} ${props} />` };
97
+ return { ok: true, text: `import { ${comp} } from '${pkg('react')}';\n\n<${comp} ${props} />${proNote}` };
103
98
  }
104
99
  if (format === 'vue') {
105
100
  const props = [`:size="${size}"`, color !== 'currentColor' ? `color="${color}"` : '', sw ? `:stroke-width="${sw}"` : ''].filter(Boolean).join(' ');
106
- return { ok: true, text: `<script setup>\nimport { ${comp} } from '${pkg('vue')}';\n</script>\n\n<template><${comp} ${props} /></template>` };
101
+ return { ok: true, text: `<script setup>\nimport { ${comp} } from '${pkg('vue')}';\n</script>\n\n<template><${comp} ${props} /></template>${proNote.replace('// ', '<!-- ').replace(/\)\.$/, '). -->')}` };
107
102
  }
108
103
  if (format === 'sprite') {
109
104
  const htmlNote = pro ? `\n<!-- ${STYLE_INFO[style].label} is a Nodo Icons Pro style: it needs a Pro license (${PRO_URL}). -->` : '';
package/src/server.js CHANGED
@@ -1,6 +1,10 @@
1
1
  // Minimal MCP server over stdio (JSON-RPC 2.0, one message per line). No dependencies.
2
2
  import { createInterface } from 'node:readline';
3
- import { search, getIcon, styles, categories, VERSION, FREE_STYLE, proAvailable } from './core.js';
3
+ import { readFileSync } from 'node:fs';
4
+ import { search, getIcon, styles, categories, FREE_STYLE, proAvailable } from './core.js';
5
+
6
+ // the npm package's own version (the icon data carries the kit's version separately)
7
+ const PKG_VERSION = JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8')).version;
4
8
 
5
9
  const SUPPORTED = ['2025-06-18', '2025-03-26', '2024-11-05'];
6
10
  const send = (msg) => process.stdout.write(JSON.stringify(msg) + '\n');
@@ -77,7 +81,7 @@ export function startServer() {
77
81
  return ok(id, {
78
82
  protocolVersion: SUPPORTED.includes(asked) ? asked : SUPPORTED[0],
79
83
  capabilities: { tools: {} },
80
- serverInfo: { name: 'nodo-icons', version: VERSION },
84
+ serverInfo: { name: 'nodo-icons', version: PKG_VERSION },
81
85
  instructions: 'Use search_icons to find an icon name, then get_icon to get SVG or React/Vue code. Prefer the free "linear" style unless the user has Nodo Icons Pro.',
82
86
  });
83
87
  }