better-icons 1.0.2 → 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.
- package/README.md +77 -69
- package/dist/index.js +146 -143
- package/package.json +6 -4
package/README.md
CHANGED
|
@@ -1,82 +1,65 @@
|
|
|
1
1
|
# Better Icons
|
|
2
2
|
|
|
3
|
-
|
|
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
|
-
##
|
|
6
|
-
|
|
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
|
-
|
|
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!).
|
|
13
|
-
|
|
14
|
-
## Auto-Learning Preferences
|
|
15
|
-
|
|
16
|
-
Better Icons automatically learns which icon collections you prefer based on your usage. When you retrieve icons using `get_icon`, the server tracks which collections you use most frequently and prioritizes them in future searches and recommendations.
|
|
17
|
-
|
|
18
|
-
- **Consistent style**: Icons from your preferred collections appear first in search results
|
|
19
|
-
- **Zero configuration**: Just use the server normally and it learns your preferences
|
|
20
|
-
- **Global memory**: Preferences are stored in `~/.better-icons/preferences.json` and apply across all projects
|
|
21
|
-
- **Full control**: View preferences with `get_icon_preferences` or reset with `clear_icon_preferences`
|
|
5
|
+
## Quick Start
|
|
22
6
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
Automatically sync icons to your project's icon file - no configuration needed.
|
|
26
|
-
|
|
27
|
-
```
|
|
28
|
-
You: "I need a settings icon"
|
|
29
|
-
|
|
30
|
-
AI: Uses sync_icon → automatically:
|
|
31
|
-
✓ Fetches the icon from Iconify
|
|
32
|
-
✓ Adds SettingsIcon to your icons.tsx
|
|
33
|
-
✓ Returns: import { SettingsIcon } from './icons'
|
|
34
|
-
```
|
|
7
|
+
### Add SKills
|
|
35
8
|
|
|
36
|
-
|
|
9
|
+
You can enable the underlying icons cli usage using skills
|
|
37
10
|
|
|
11
|
+
```bash
|
|
12
|
+
npx add-skill better-auth/better-icons
|
|
38
13
|
```
|
|
39
|
-
sync_icon(
|
|
40
|
-
icons_file: "/Users/me/myapp/src/components/icons.tsx",
|
|
41
|
-
framework: "react",
|
|
42
|
-
icon_id: "lucide:settings"
|
|
43
|
-
)
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
### Supported frameworks
|
|
47
14
|
|
|
48
|
-
|
|
49
|
-
- **Vue** - Template-based components
|
|
50
|
-
- **Svelte** - Svelte components with className prop
|
|
51
|
-
- **Solid** - SolidJS components
|
|
52
|
-
- **SVG** - Raw SVG string exports
|
|
15
|
+
### MCP Server (AI Agents)
|
|
53
16
|
|
|
54
|
-
|
|
17
|
+
Configure the MCP server to enable icon tools in your AI coding agents.
|
|
55
18
|
|
|
56
19
|
```bash
|
|
57
20
|
npx better-icons setup
|
|
58
21
|
```
|
|
59
22
|
|
|
60
|
-
This
|
|
23
|
+
This interactively configures the MCP server for:
|
|
61
24
|
- **Cursor**
|
|
62
25
|
- **Claude Code**
|
|
63
26
|
- **OpenCode**
|
|
64
27
|
- **Windsurf**
|
|
65
28
|
- **VS Code (Copilot)**
|
|
66
29
|
|
|
67
|
-
|
|
30
|
+
Or [configure manually](#manual-installation).
|
|
68
31
|
|
|
69
|
-
|
|
32
|
+
### CLI (Direct Usage)
|
|
33
|
+
|
|
34
|
+
Use the CLI to search and retrieve icons directly from your terminal.
|
|
70
35
|
|
|
71
36
|
```bash
|
|
72
|
-
|
|
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
|
|
73
48
|
```
|
|
74
49
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
-
|
|
78
|
-
|
|
79
|
-
|
|
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
|
|
80
63
|
|
|
81
64
|
## Manual Installation
|
|
82
65
|
|
|
@@ -110,11 +93,13 @@ Add to `~/.claude/settings.json`:
|
|
|
110
93
|
}
|
|
111
94
|
```
|
|
112
95
|
|
|
113
|
-
## Tools
|
|
96
|
+
## MCP Tools
|
|
97
|
+
|
|
98
|
+
The following tools are available when using the MCP server with AI agents.
|
|
114
99
|
|
|
115
100
|
### `search_icons`
|
|
116
101
|
|
|
117
|
-
Search for icons across
|
|
102
|
+
Search for icons across 150+ icon collections.
|
|
118
103
|
|
|
119
104
|
```
|
|
120
105
|
Search for "arrow" icons
|
|
@@ -279,18 +264,46 @@ Scan my icons file
|
|
|
279
264
|
| `fa6-solid` | Font Awesome 6 | Solid | 2,000+ |
|
|
280
265
|
| `simple-icons` | Simple Icons | Logos | 3,000+ |
|
|
281
266
|
|
|
282
|
-
## CLI
|
|
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.
|
|
283
286
|
|
|
284
287
|
```bash
|
|
285
|
-
|
|
286
|
-
npx better-icons setup # Interactive setup wizard
|
|
287
|
-
npx better-icons setup -y # Setup with auto-confirm (global)
|
|
288
|
-
npx better-icons setup -s project # Setup for current project only
|
|
289
|
-
npx better-icons config # Show manual config instructions
|
|
290
|
-
npx better-icons --help # Show help
|
|
288
|
+
better-icons get <icon-id> [options]
|
|
291
289
|
```
|
|
292
290
|
|
|
293
|
-
|
|
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
|
+
```
|
|
294
307
|
|
|
295
308
|
| Option | Description |
|
|
296
309
|
|--------|-------------|
|
|
@@ -298,11 +311,6 @@ npx better-icons --help # Show help
|
|
|
298
311
|
| `-a, --agent <agents...>` | Specify agents (cursor, claude-code, opencode, windsurf, vscode) |
|
|
299
312
|
| `-s, --scope <scope>` | Config scope: `global` (default) or `project` |
|
|
300
313
|
|
|
301
|
-
### Scope
|
|
302
|
-
|
|
303
|
-
- **Global**: Configures MCP server for all projects (stored in home directory)
|
|
304
|
-
- **Project**: Configures MCP server for current project only (stored in project root)
|
|
305
|
-
|
|
306
314
|
## Development
|
|
307
315
|
|
|
308
316
|
```bash
|