better-icons 1.0.1 → 1.0.3-beta.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.
Files changed (3) hide show
  1. package/README.md +173 -32
  2. package/dist/index.js +247 -128
  3. package/package.json +6 -4
package/README.md CHANGED
@@ -1,42 +1,65 @@
1
1
  # Better Icons
2
2
 
3
- An MCP (Model Context Protocol) server for searching and retrieving icons from 200+ icon libraries powered by [Iconify](https://iconify.design/) - the same data source behind [icones.js.org](https://icones.js.org).
3
+ Search and retrieve 200,000+ icons from 150+ icon collections. Works as an MCP server for AI agents or CLI tool.
4
4
 
5
- ## Why?
5
+ ## Quick Start
6
+
7
+ ### Add SKills
8
+
9
+ You can enable the underlying icons cli usage using skills
6
10
 
7
- When doing AI-assisted coding, icons are often a pain point. AI models struggle to:
8
- - Know what icons are available
9
- - Provide correct SVG code
10
- - Suggest appropriate icons for UI elements
11
+ ```bash
12
+ npx add-skill better-auth/better-icons
13
+ ```
11
14
 
12
- This MCP server solves that by giving AI models direct access to search and retrieve icons from the massive Iconify collection (200,000+ icons!).
15
+ ### MCP Server (AI Agents)
13
16
 
14
- ## Quick Setup
17
+ Configure the MCP server to enable icon tools in your AI coding agents.
15
18
 
16
19
  ```bash
17
20
  npx better-icons setup
18
21
  ```
19
22
 
20
- This will interactively configure the MCP server for:
23
+ This interactively configures the MCP server for:
21
24
  - **Cursor**
22
25
  - **Claude Code**
23
26
  - **OpenCode**
24
27
  - **Windsurf**
25
28
  - **VS Code (Copilot)**
26
29
 
27
- ## Add AI Skills (Optional)
30
+ Or [configure manually](#manual-installation).
28
31
 
29
- Teach your AI assistant best practices for using better-icons:
32
+ ### CLI (Direct Usage)
33
+
34
+ Use the CLI to search and retrieve icons directly from your terminal.
30
35
 
31
36
  ```bash
32
- npx skills add better-auth/better-icons
37
+ # Search for icons
38
+ npx better-icons search arrow
39
+ npx better-icons search home --prefix lucide --limit 10
40
+
41
+ # Get icon SVG (outputs to stdout)
42
+ npx better-icons get lucide:home > icon.svg
43
+ npx better-icons get mdi:account --color '#333' --size 24
44
+
45
+ # JSON output for scripting
46
+ npx better-icons search settings --json | jq '.icons[:5]'
47
+ npx better-icons get heroicons:check --json
33
48
  ```
34
49
 
35
- This ensures AI assistants will:
36
- - ✅ Use the `better-icons` MCP instead of installing icon packages
37
- - For React, create a single `icons.tsx` file with all icons
38
- - ✅ Reuse existing icons before adding new ones
39
- - ✅ Follow consistent naming conventions
50
+ ## Why?
51
+
52
+ Icons are a common pain point in AI-assisted coding. Models often struggle to know which icons are available, generate correct SVG code, maintain consistent styles, and organize icons properly. Inline SVGs also consume unnecessary tokens.
53
+
54
+ ## Features
55
+
56
+ - **200,000+ Icons** - Search across 150+ icon collections (Lucide, Heroicons, Material Design, etc.)
57
+ - **Auto-Learning** - Remembers which icon collections you use and prioritizes them in future searches
58
+ - **Project Sync** - Icons are written directly to your icons file (`.tsx`, `.ts`, `.js`) instead of pasting SVG into chat (saves tokens!)
59
+ - **Batch Retrieval** - Get multiple icons at once
60
+ - **Similar Icons** - Find the same icon across different collections and styles
61
+ - **Recent Icons** - Quick access to icons you've used before
62
+ - **Multi-Framework** - React, Vue, Svelte, Solid, and raw SVG exports
40
63
 
41
64
  ## Manual Installation
42
65
 
@@ -70,11 +93,13 @@ Add to `~/.claude/settings.json`:
70
93
  }
71
94
  ```
72
95
 
73
- ## Tools
96
+ ## MCP Tools
97
+
98
+ The following tools are available when using the MCP server with AI agents.
74
99
 
75
100
  ### `search_icons`
76
101
 
77
- Search for icons across 200+ icon libraries.
102
+ Search for icons across 150+ icon collections.
78
103
 
79
104
  ```
80
105
  Search for "arrow" icons
@@ -93,6 +118,7 @@ Get the SVG code for a specific icon with multiple usage formats.
93
118
 
94
119
  ```
95
120
  Get the SVG for mdi:home
121
+ Get a URL for mdi:home
96
122
  Get lucide:arrow-right with size 24
97
123
  ```
98
124
 
@@ -100,11 +126,13 @@ Get lucide:arrow-right with size 24
100
126
  - `icon_id` (required): Icon ID in format 'prefix:name' (e.g., 'mdi:home')
101
127
  - `color` (optional): Icon color (e.g., '#ff0000', 'currentColor')
102
128
  - `size` (optional): Icon size in pixels
129
+ - `format` (optional): 'svg' (default) or 'url'
103
130
 
104
131
  **Returns:**
105
132
  - Raw SVG code
106
133
  - React/JSX component code
107
134
  - Iconify component usage
135
+ - Direct SVG URL (when `format: "url"`)
108
136
 
109
137
  ### `list_collections`
110
138
 
@@ -133,6 +161,96 @@ Recommend icons for user authentication
133
161
  - `style` (optional): 'solid', 'outline', or 'any'
134
162
  - `limit` (optional): Number of recommendations (1-20)
135
163
 
164
+ ### `get_icon_preferences`
165
+
166
+ View your learned icon collection preferences with usage statistics.
167
+
168
+ ```
169
+ Show my icon preferences
170
+ What icon collections do I use most?
171
+ ```
172
+
173
+ ### `clear_icon_preferences`
174
+
175
+ Reset all learned icon preferences to start fresh.
176
+
177
+ ```
178
+ Clear my icon preferences
179
+ Reset icon preferences
180
+ ```
181
+
182
+ ### `find_similar_icons`
183
+
184
+ Find similar icons or variations of a given icon across different collections and styles.
185
+
186
+ ```
187
+ Find icons similar to lucide:home
188
+ What other arrow icons are there like mdi:arrow-right?
189
+ ```
190
+
191
+ **Parameters:**
192
+ - `icon_id` (required): Icon ID to find variations of
193
+ - `limit` (optional): Maximum number of similar icons (1-50, default: 10)
194
+
195
+ ### `get_icons`
196
+
197
+ Get multiple icons at once (batch retrieval). More efficient than multiple `get_icon` calls.
198
+
199
+ ```
200
+ Get these icons: lucide:home, lucide:settings, lucide:user
201
+ ```
202
+
203
+ **Parameters:**
204
+ - `icon_ids` (required): Array of icon IDs (max 20)
205
+ - `color` (optional): Color for all icons
206
+ - `size` (optional): Size in pixels for all icons
207
+
208
+ ### `get_recent_icons`
209
+
210
+ View your recently used icons for quick reuse.
211
+
212
+ ```
213
+ Show my recent icons
214
+ What icons have I used recently?
215
+ ```
216
+
217
+ **Parameters:**
218
+ - `limit` (optional): Number of recent icons to show (1-50, default: 20)
219
+
220
+ ### `sync_icon`
221
+
222
+ Get an icon AND automatically add it to your project's icons file. The recommended way to add icons.
223
+
224
+ ```
225
+ Sync the lucide:home icon to my project
226
+ Add a settings icon to my icons file
227
+ ```
228
+
229
+ **Parameters:**
230
+ - `icons_file` (required): Absolute path to the icons file
231
+ - `framework` (required): 'react', 'vue', 'svelte', 'solid', or 'svg'
232
+ - `icon_id` (required): Icon ID in format 'prefix:name'
233
+ - `component_name` (optional): Custom component name
234
+ - `color` (optional): Icon color
235
+ - `size` (optional): Icon size in pixels
236
+
237
+ **Returns:**
238
+ - Confirmation that icon was added (or already exists)
239
+ - Import statement to use
240
+ - Usage example
241
+
242
+ ### `scan_project_icons`
243
+
244
+ Scan an icons file to see what icons are already available.
245
+
246
+ ```
247
+ What icons are already in my project?
248
+ Scan my icons file
249
+ ```
250
+
251
+ **Parameters:**
252
+ - `icons_file` (required): Absolute path to the icons file
253
+
136
254
  ## Popular Icon Collections
137
255
 
138
256
  | Prefix | Name | Style | Icons |
@@ -146,18 +264,46 @@ Recommend icons for user authentication
146
264
  | `fa6-solid` | Font Awesome 6 | Solid | 2,000+ |
147
265
  | `simple-icons` | Simple Icons | Logos | 3,000+ |
148
266
 
149
- ## CLI Commands
267
+ ## CLI Reference
268
+
269
+ ### Search Icons
270
+
271
+ Search across 150+ icon collections.
272
+
273
+ ```bash
274
+ better-icons search <query> [options]
275
+ ```
276
+
277
+ | Option | Description |
278
+ |--------|-------------|
279
+ | `-p, --prefix <prefix>` | Filter by collection (e.g., `lucide`, `mdi`) |
280
+ | `-l, --limit <number>` | Maximum results (default: 32) |
281
+ | `--json` | Output as JSON for scripting |
282
+
283
+ ### Get Icon
284
+
285
+ Retrieve a single icon's SVG code.
150
286
 
151
287
  ```bash
152
- npx better-icons # Run the MCP server (for tool configs)
153
- npx better-icons setup # Interactive setup wizard
154
- npx better-icons setup -y # Setup with auto-confirm (global)
155
- npx better-icons setup -s project # Setup for current project only
156
- npx better-icons config # Show manual config instructions
157
- npx better-icons --help # Show help
288
+ better-icons get <icon-id> [options]
158
289
  ```
159
290
 
160
- ### Options
291
+ | Option | Description |
292
+ |--------|-------------|
293
+ | `-c, --color <color>` | Icon color (e.g., `#ff0000`, `currentColor`) |
294
+ | `-s, --size <pixels>` | Icon size in pixels |
295
+ | `--json` | Output as JSON with metadata |
296
+
297
+ The icon ID format is `prefix:name` (e.g., `lucide:home`, `mdi:arrow-right`).
298
+
299
+ ### Setup Commands
300
+
301
+ ```bash
302
+ better-icons setup # Interactive setup wizard
303
+ better-icons setup -y # Auto-confirm (global scope)
304
+ better-icons setup -s project # Setup for current project only
305
+ better-icons config # Show manual config instructions
306
+ ```
161
307
 
162
308
  | Option | Description |
163
309
  |--------|-------------|
@@ -165,11 +311,6 @@ npx better-icons --help # Show help
165
311
  | `-a, --agent <agents...>` | Specify agents (cursor, claude-code, opencode, windsurf, vscode) |
166
312
  | `-s, --scope <scope>` | Config scope: `global` (default) or `project` |
167
313
 
168
- ### Scope
169
-
170
- - **Global**: Configures MCP server for all projects (stored in home directory)
171
- - **Project**: Configures MCP server for current project only (stored in project root)
172
-
173
314
  ## Development
174
315
 
175
316
  ```bash