@iconaut/mcp 1.7.5 → 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/README.md +2 -2
- package/SKILL.md +4 -2
- package/icons.json.br +0 -0
- package/package.json +1 -1
- package/server.js +36 -12
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @iconaut/mcp
|
|
2
2
|
|
|
3
|
-
An [MCP](https://modelcontextprotocol.io) server for the 1,
|
|
3
|
+
An [MCP](https://modelcontextprotocol.io) server for the 1,680 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
|
|
|
@@ -37,7 +37,7 @@ copy it to `.claude/skills/iconaut-icons/SKILL.md` in your project or `~/.claude
|
|
|
37
37
|
| Tool | What it does |
|
|
38
38
|
|---|---|
|
|
39
39
|
| `search_icons` | Search by name, keyword or meaning (`"settings"`, `"arrow left"`, `"delete"`). Filter by `category` or `style`. |
|
|
40
|
-
| `get_icon` | One icon by name: the SVG at 16, 20 or 24px in line, solid or
|
|
40
|
+
| `get_icon` | One icon by name: the SVG at 16, 20 or 24px in line, solid, duo or duotone, the React import, the shadcn command and the CDN URL. |
|
|
41
41
|
| `list_categories` | The 27 categories and how many icons each holds. |
|
|
42
42
|
|
|
43
43
|
## Tuned for each size
|
package/SKILL.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: iconaut-icons
|
|
3
|
-
description: "Add UI icons to a web or React Native project with the free, MIT-licensed Iconaut set (1,
|
|
3
|
+
description: "Add UI icons to a web or React Native project with the free, MIT-licensed Iconaut set (1,680 icons in line, two-tone, duotone and fill, 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
4
|
---
|
|
5
5
|
|
|
6
6
|
# Iconaut icons
|
|
7
7
|
|
|
8
|
-
Iconaut is a free icon
|
|
8
|
+
Iconaut is a free icon library (MIT) for product UI. The `@iconaut/mcp` server searches it and
|
|
9
9
|
returns exact SVG, imports and install commands, so you never have to guess an icon name.
|
|
10
10
|
|
|
11
11
|
## Set up the MCP server (once)
|
|
@@ -57,6 +57,8 @@ Other values return the nearest native drawing; set the rendered width and heigh
|
|
|
57
57
|
- **duo**: a 25% tint under the line, for feature cards, empty states and illustrations.
|
|
58
58
|
Not every icon has duo (marks like arrows and checks don't); `search_icons` shows which
|
|
59
59
|
styles each icon has.
|
|
60
|
+
- **duotone**: fills only, a 25% layer under a full-strength one, with no stroke. For
|
|
61
|
+
larger, more illustrative spots: feature cards, onboarding, empty states.
|
|
60
62
|
|
|
61
63
|
Keep one style per context. Pairing `line` for inactive with `solid` for active is the
|
|
62
64
|
intended use; mixing styles at random in one toolbar is not.
|
package/icons.json.br
CHANGED
|
Binary file
|
package/package.json
CHANGED
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]));
|
|
@@ -47,7 +49,7 @@ function data() {
|
|
|
47
49
|
}
|
|
48
50
|
|
|
49
51
|
const pascal = (n) => n.split('-').map((p) => p[0].toUpperCase() + p.slice(1)).join('');
|
|
50
|
-
const SUFFIX = { line: '', solid: 'Solid', duo: 'Duo' };
|
|
52
|
+
const SUFFIX = { line: '', solid: 'Solid', duo: 'Duo', duotone: 'Duotone' };
|
|
51
53
|
const component = (name, style) => pascal(name) + SUFFIX[style];
|
|
52
54
|
const slug = (name, style) => name + (style === 'line' ? '' : '-' + style);
|
|
53
55
|
// The sizes come in two detail tiers (design/GRID.md): 16 draws a simplified version, 20 and 24
|
|
@@ -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
|
-
|
|
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
|
|
103
|
-
|
|
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 };
|
|
@@ -128,15 +151,15 @@ function suggest(name) {
|
|
|
128
151
|
}
|
|
129
152
|
|
|
130
153
|
// ── Tools ──────────────────────────────────────────────────────────────────────────────────
|
|
131
|
-
const STYLE_ENUM = ['line', 'solid', 'duo'];
|
|
154
|
+
const STYLE_ENUM = ['line', 'solid', 'duo', 'duotone'];
|
|
132
155
|
const TOOLS = [
|
|
133
156
|
{
|
|
134
157
|
name: 'search_icons',
|
|
135
158
|
title: 'Search Iconaut icons',
|
|
136
159
|
description:
|
|
137
|
-
'Search the free Iconaut icon
|
|
160
|
+
'Search the free Iconaut icon library (MIT) by name, keyword or meaning, e.g. "settings", ' +
|
|
138
161
|
'"arrow left", "delete", "notification". Returns icon names ranked by relevance, with ' +
|
|
139
|
-
'their category, the styles each comes in (line, solid, duo) and the React component ' +
|
|
162
|
+
'their category, the styles each comes in (line, solid, duo, duotone) and the React component ' +
|
|
140
163
|
'names. Call this before using an icon name you have not looked up: guessed names often ' +
|
|
141
164
|
'do not exist. Leave query empty and pass a category to list that category.',
|
|
142
165
|
inputSchema: {
|
|
@@ -163,7 +186,7 @@ const TOOLS = [
|
|
|
163
186
|
type: 'object',
|
|
164
187
|
properties: {
|
|
165
188
|
name: { type: 'string', description: 'Exact icon name, e.g. "settings" or "arrow-left". Find it with search_icons.' },
|
|
166
|
-
style: { type: 'string', enum: STYLE_ENUM, default: 'line', description: 'line (stroked), solid (filled)
|
|
189
|
+
style: { type: 'string', enum: STYLE_ENUM, default: 'line', description: 'line (stroked), solid (filled), duo (two-tone: 25% tint under the line) or duotone (fills only: a 25% layer under a full one).' },
|
|
167
190
|
size: { type: 'integer', default: 24, description: 'Pixel size. 16, 20 and 24 are native sizes; any other value returns the nearest one.' },
|
|
168
191
|
},
|
|
169
192
|
required: ['name'],
|
|
@@ -173,7 +196,7 @@ const TOOLS = [
|
|
|
173
196
|
{
|
|
174
197
|
name: 'list_categories',
|
|
175
198
|
title: 'List Iconaut categories',
|
|
176
|
-
description: 'List the categories of the free Iconaut icon
|
|
199
|
+
description: 'List the categories of the free Iconaut icon library, with how many icons each holds.',
|
|
177
200
|
inputSchema: { type: 'object', properties: {} },
|
|
178
201
|
annotations: { readOnlyHint: true, openWorldHint: false },
|
|
179
202
|
},
|
|
@@ -240,6 +263,7 @@ const handlers = {
|
|
|
240
263
|
`CDN: ${CDN}/${icon.category}/${name}/${size}/${style}.svg`,
|
|
241
264
|
`Page: ${SITE}/icon/${name}`,
|
|
242
265
|
style === 'duo' ? '\nDuo: the tint is the .secondary path (fill-opacity 0.25), the line is g.primary; style either with CSS.' : null,
|
|
266
|
+
style === 'duotone' ? '\nDuotone: two fills, .secondary at fill-opacity 0.25 under .primary; no stroke. Style either with CSS.' : null,
|
|
243
267
|
].filter((x) => x !== null).join('\n');
|
|
244
268
|
},
|
|
245
269
|
|
|
@@ -274,7 +298,7 @@ function handle(msg) {
|
|
|
274
298
|
capabilities: { tools: { listChanged: false } },
|
|
275
299
|
serverInfo: { name: 'iconaut', title: 'Iconaut icons', version: PKG.version },
|
|
276
300
|
instructions:
|
|
277
|
-
'Iconaut is an icon
|
|
301
|
+
'Iconaut is an icon library in line, solid, two-tone and duotone on a 24px grid, with three native sizes (16, 20 and 24px), ' +
|
|
278
302
|
'each with its own stroke weight, and a simplified drawing at 16px. ' +
|
|
279
303
|
'This server covers the free MIT set. Look icons up with search_icons before naming one, then use get_icon ' +
|
|
280
304
|
'for the SVG or the iconaut-react import. Do not invent icon names.',
|