@iconaut/mcp 1.7.4 → 2.0.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/README.md CHANGED
@@ -1,10 +1,11 @@
1
1
  # @iconaut/mcp
2
2
 
3
- An [MCP](https://modelcontextprotocol.io) server for the 1,263 free Iconaut icons. It
3
+ An [MCP](https://modelcontextprotocol.io) server for the 1,297 free Iconaut icons. It
4
4
  lets a coding agent look an icon up instead of guessing its name, and hands back the exact SVG,
5
5
  the `iconaut-react` import and the shadcn/ui command.
6
6
 
7
7
  Everything runs locally from data bundled in the package: no network, no account, no API key.
8
+ **Zero dependencies**, too: the server is one file on Node's standard library.
8
9
 
9
10
  ## Set up
10
11
 
@@ -24,6 +25,13 @@ Cursor, Windsurf, Claude Desktop and other clients take the same command in thei
24
25
  }
25
26
  ```
26
27
 
28
+ ## Agent skill
29
+
30
+ [`SKILL.md`](https://github.com/iconaut-design/icons/blob/main/skills/iconaut-icons/SKILL.md)
31
+ (also in this package) tells the agent when to reach for these tools, which size and style to ask
32
+ for, and how to wire the result into React, shadcn/ui, React Native or plain SVG. In Claude Code,
33
+ copy it to `.claude/skills/iconaut-icons/SKILL.md` in your project or `~/.claude/skills/`.
34
+
27
35
  ## Tools
28
36
 
29
37
  | Tool | What it does |
package/SKILL.md ADDED
@@ -0,0 +1,116 @@
1
+ ---
2
+ name: iconaut-icons
3
+ description: "Add UI icons to a web or React Native project with the free, MIT-licensed Iconaut set (1,263 icons in line, solid and duotone, drawn natively at 16, 20 and 24px). Use whenever the task needs an icon in code: a button, nav item, menu, empty state, status badge, form field, toolbar or shadcn/ui component, or the user asks for an SVG icon, an icon import, or to replace lucide/heroicons with Iconaut. Uses the Iconaut MCP server to look icons up instead of guessing names."
4
+ ---
5
+
6
+ # Iconaut icons
7
+
8
+ Iconaut is a free icon set (MIT) for product UI. The `@iconaut/mcp` server searches it and
9
+ returns exact SVG, imports and install commands, so you never have to guess an icon name.
10
+
11
+ ## Set up the MCP server (once)
12
+
13
+ If the `search_icons` and `get_icon` tools aren't available, ask the user to add the server:
14
+
15
+ ```bash
16
+ claude mcp add iconaut -- npx -y @iconaut/mcp
17
+ ```
18
+
19
+ Cursor, Windsurf, Claude Desktop and other clients:
20
+
21
+ ```json
22
+ { "mcpServers": { "iconaut": { "command": "npx", "args": ["-y", "@iconaut/mcp"] } } }
23
+ ```
24
+
25
+ It runs locally from bundled data: no network, account or API key.
26
+
27
+ ## Workflow
28
+
29
+ 1. **Search, don't guess.** Call `search_icons` with what the icon means ("delete",
30
+ "notification", "arrow left"), not the name you expect. Guessed names often don't exist,
31
+ and the same meaning may be named differently than in lucide or heroicons.
32
+ 2. **Pick by meaning and category.** Results list each icon's category, the styles it comes
33
+ in and its React component names. If nothing fits, try a synonym, or call
34
+ `list_categories` and then `search_icons` with an empty query and a `category`.
35
+ 3. **Get it at the size it's shown at.** Call `get_icon` with `name`, `style` and `size`.
36
+ The response holds the SVG, the React import, the shadcn/ui command and a CDN URL. Use
37
+ what it returns verbatim.
38
+
39
+ ## Size: ask for the real one
40
+
41
+ 16, 20 and 24 are native sizes, each with its own stroke weight. 16 also gets a simplified
42
+ drawing with less detail. Don't fetch 24 and scale it down to 16: request `size: 16`.
43
+
44
+ | Rendered at | Request | Typical use |
45
+ |---|---|---|
46
+ | 14 to 17px | 16 | inline with body text, shadcn/ui buttons, inputs, menus, badges |
47
+ | 18 to 21px | 20 | sidebar and nav items, list rows, toolbars |
48
+ | 22px and up | 24 | headers, empty states, standalone icon buttons |
49
+
50
+ Other values return the nearest native drawing; set the rendered width and height yourself.
51
+
52
+ ## Style
53
+
54
+ - **line** (default): most UI.
55
+ - **solid**: selected or active states (the active tab, a toggled favorite), and small
56
+ sizes where a filled shape reads better.
57
+ - **duo**: a 25% tint under the line, for feature cards, empty states and illustrations.
58
+ Not every icon has duo (marks like arrows and checks don't); `search_icons` shows which
59
+ styles each icon has.
60
+
61
+ Keep one style per context. Pairing `line` for inactive with `solid` for active is the
62
+ intended use; mixing styles at random in one toolbar is not.
63
+
64
+ ## Use it in the project
65
+
66
+ Check `package.json` and match what's already there.
67
+
68
+ **React** (`iconaut-react`): components are PascalCase with a style suffix
69
+ (`Rocket`, `RocketSolid`, `RocketDuo`).
70
+
71
+ ```jsx
72
+ import { Rocket } from "iconaut-react";
73
+ <Rocket size={20} className="text-muted-foreground" />
74
+ ```
75
+
76
+ `size` picks the native drawing, `strokeWidth` overrides the stroke, `className` styles it.
77
+
78
+ **shadcn/ui**: either swap the lucide import in a component for the drop-in names,
79
+ which use the 16px drawing shadcn sizes icons to:
80
+
81
+ ```jsx
82
+ import { ChevronDownIcon } from "iconaut-react/shadcn";
83
+ ```
84
+
85
+ or copy a single icon into the project with the command `get_icon` returns
86
+ (`npx shadcn@latest add @iconaut/<name>`).
87
+
88
+ **React Native** (`@iconaut/react-native`, needs `react-native-svg`): import each icon
89
+ from its own path, because Metro bundles the whole set for a named import from the root.
90
+
91
+ ```jsx
92
+ import Rocket from "@iconaut/react-native/rocket";
93
+ <Rocket size={20} color={colors.text} />
94
+ ```
95
+
96
+ **Plain HTML, Vue, Svelte or anything else**: paste the SVG from `get_icon` inline, or
97
+ reference the CDN URL in an `<img>`.
98
+
99
+ ## Color and accessibility
100
+
101
+ - Everything uses `currentColor`, so icons inherit the surrounding text color. Set color
102
+ through text color (`text-red-600`, `color:`), not by editing the SVG.
103
+ - Duo exposes `.secondary` (the tint) and `.primary` (the line), so each can be styled
104
+ with CSS: `className="[&_.secondary]:fill-blue-500/20 [&_.primary]:stroke-blue-600"`.
105
+ - A decorative icon next to a text label gets `aria-hidden="true"`. An icon-only button
106
+ needs an accessible name on the button (`aria-label="Delete"`).
107
+
108
+ ## Don't
109
+
110
+ - Don't invent icon names or component names. Look them up.
111
+ - Don't mix Iconaut with another icon library in the same UI unless the user asks; the
112
+ stroke weights and corner styles won't match.
113
+ - Don't hand-edit icon paths. If an icon is missing or wrong, tell the user, and point them
114
+ to https://github.com/iconaut-design/icons/issues.
115
+
116
+ Browse the set: https://iconaut.design/icons
package/icons.json.br CHANGED
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iconaut/mcp",
3
- "version": "1.7.4",
3
+ "version": "2.0.0",
4
4
  "description": "MCP server for the free Iconaut icons: search the set, get the SVG at its native size, get the React import and shadcn command.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -8,9 +8,11 @@
8
8
  "iconaut-mcp": "server.js"
9
9
  },
10
10
  "main": "server.js",
11
+ "mcpName": "io.github.iconaut-design/iconaut",
11
12
  "files": [
12
13
  "server.js",
13
14
  "icons.json.br",
15
+ "SKILL.md",
14
16
  "README.md",
15
17
  "LICENSE"
16
18
  ],
package/server.js CHANGED
@@ -40,6 +40,8 @@ function data() {
40
40
  i.nameTokens = i.name.split('-');
41
41
  i.kw = i.keywords.map((k) => k.toLowerCase());
42
42
  i.kwTokens = [...new Set(i.kw.flatMap((k) => k.split(/[\s-]+/)))];
43
+ i.squashName = squash(i.name);
44
+ i.kwSquash = i.kw.map(squash);
43
45
  byName.set(i.name, i);
44
46
  }
45
47
  const labels = Object.fromEntries(raw.categories.map((c) => [c.id, c.label]));
@@ -67,11 +69,17 @@ const nearestSize = (n, sizes) => sizes.reduce((a, b) => (Math.abs(b - n) < Math
67
69
  // query word has to match something, so "arrow left" does not return every arrow; when nothing
68
70
  // matches all of them, the best partial matches come back instead of nothing.
69
71
  const tokenize = (q) => String(q || '').toLowerCase().trim().split(/[\s,_/-]+/).filter(Boolean);
72
+ const squash = (s) => s.replace(/[\s_-]+/g, '');
70
73
 
71
- function scoreIcon(icon, q, words) {
74
+ // Words people add to an icon search that name the format, not the drawing: "settings icon",
75
+ // "arrow svg". They are only dropped when the query as typed finds nothing, so "svg" on its own
76
+ // still finds file-type-svg.
77
+ const FILLER = new Set(['icon', 'icons', 'svg', 'svgs']);
78
+
79
+ function scoreIcon(icon, q, words, loose = false) {
72
80
  let score = 0, matched = 0;
73
81
  const joined = words.join('-');
74
- if (icon.name === joined) score += 100;
82
+ if (icon.name === joined || (loose && icon.squashName === squash(joined))) score += 100;
75
83
  else if (icon.name.startsWith(joined)) score += 40;
76
84
  // Keywords are written closest-synonym first, so an exact hit early in the list is worth more:
77
85
  // "house" is home's first keyword and door's seventh.
@@ -83,6 +91,12 @@ function scoreIcon(icon, q, words) {
83
91
  else if (icon.nameTokens.some((t) => t.startsWith(w))) best = 7;
84
92
  if (icon.kwTokens.includes(w)) best = Math.max(best, 8);
85
93
  else if (w.length >= 3 && icon.kwTokens.some((t) => t.startsWith(w))) best = Math.max(best, 4);
94
+ // Loose pass only: a word typed without its hyphen or space, "arrowleft" for arrow-left,
95
+ // "thumbsup" for the keyword "thumbs up".
96
+ if (!best && loose && w.length >= 4) {
97
+ if (icon.squashName === w || icon.kwSquash.includes(w)) best = 10;
98
+ else if (icon.squashName.startsWith(w) || icon.kwSquash.some((k) => k.startsWith(w))) best = 5;
99
+ }
86
100
  if (!best && icon.category === w) best = 2;
87
101
  if (best) matched++;
88
102
  score += best;
@@ -90,17 +104,26 @@ function scoreIcon(icon, q, words) {
90
104
  return { score, matched };
91
105
  }
92
106
 
107
+ function rank(pool, words, loose) {
108
+ const q = words.join(' ');
109
+ return pool.map((i) => ({ i, ...scoreIcon(i, q, words, loose) })).filter((r) => r.score > 0);
110
+ }
111
+
93
112
  function search({ query = '', category, style, limit = 20 }) {
94
113
  const d = data();
95
114
  const words = tokenize(query);
96
- const q = words.join(' ');
97
115
  const max = Math.max(1, Math.min(100, Number(limit) || 20));
98
116
  let pool = d.icons;
99
117
  if (category) pool = pool.filter((i) => i.category === category);
100
118
  if (style) pool = pool.filter((i) => i.styles.includes(style));
101
119
  if (!words.length) return { results: pool.slice(0, max), total: pool.length, partial: false };
102
- const scored = pool.map((i) => ({ i, ...scoreIcon(i, q, words) })).filter((r) => r.score > 0);
103
- const full = scored.filter((r) => r.matched === words.length);
120
+ const scored = rank(pool, words, false);
121
+ let full = scored.filter((r) => r.matched === words.length);
122
+ // Nothing matched every word as typed: retry without filler words and with joined words
123
+ // allowed, before falling back to partial matches.
124
+ // A query of nothing but filler ("icon") has nothing left to retry with.
125
+ const kept = words.filter((w) => !FILLER.has(w));
126
+ if (!full.length && kept.length) full = rank(pool, kept, true).filter((r) => r.matched === kept.length);
104
127
  const use = full.length ? full : scored;
105
128
  use.sort((a, b) => b.score - a.score || b.matched - a.matched || a.i.name.length - b.i.name.length || a.i.name.localeCompare(b.i.name));
106
129
  return { results: use.slice(0, max).map((r) => r.i), total: use.length, partial: !full.length };