better-icons 1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Better Auth Inc.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,191 @@
1
+ # Better Icons
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).
4
+
5
+ ## Why?
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
+ ## Quick Setup
15
+
16
+ ### 1. Install the MCP Server
17
+
18
+ ```bash
19
+ npx better-icons setup
20
+ ```
21
+
22
+ This will interactively configure the MCP server for:
23
+ - **Cursor**
24
+ - **Claude Desktop**
25
+ - **VS Code (Copilot)**
26
+ - **Windsurf**
27
+
28
+ ### 2. Add AI Rules to Your Project
29
+
30
+ Teach your AI assistant how to properly use better-icons:
31
+
32
+ ```bash
33
+ npx skills add better-auth/better-icons
34
+ ```
35
+
36
+ Or install rules directly (supports multiple editors):
37
+
38
+ ```bash
39
+ npx better-icons rules
40
+ ```
41
+
42
+ This opens an interactive selector for:
43
+ - **Cursor**
44
+ - **Claude Code**
45
+ - **Windsurf**
46
+ - **OpenCode**
47
+ - **GitHub Copilot**
48
+ - **Cline / Roo**
49
+ - **Aider**
50
+
51
+ The rules ensure AI assistants will:
52
+ - ✅ Use the `better-icons` MCP instead of installing icon packages
53
+ - ✅ Create a single `icons.tsx` file with all icons
54
+ - ✅ Reuse existing icons before adding new ones
55
+ - ✅ Follow consistent naming conventions
56
+ - ❌ Never install `lucide-react`, `react-icons`, `@heroicons/react`, etc.
57
+
58
+ ## Manual Installation
59
+
60
+ ### Cursor
61
+
62
+ Add to `~/.cursor/mcp.json`:
63
+
64
+ ```json
65
+ {
66
+ "mcpServers": {
67
+ "better-icons": {
68
+ "command": "npx",
69
+ "args": ["-y", "better-icons"]
70
+ }
71
+ }
72
+ }
73
+ ```
74
+
75
+ ### Claude Desktop
76
+
77
+ Add to `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS) or `%APPDATA%\Claude\claude_desktop_config.json` (Windows):
78
+
79
+ ```json
80
+ {
81
+ "mcpServers": {
82
+ "better-icons": {
83
+ "command": "npx",
84
+ "args": ["-y", "better-icons"]
85
+ }
86
+ }
87
+ }
88
+ ```
89
+
90
+ ## Tools
91
+
92
+ ### `search_icons`
93
+
94
+ Search for icons across 200+ icon libraries.
95
+
96
+ ```
97
+ Search for "arrow" icons
98
+ Search for "home" icons in the lucide collection
99
+ ```
100
+
101
+ **Parameters:**
102
+ - `query` (required): Search query (e.g., 'arrow', 'home', 'user')
103
+ - `limit` (optional): Maximum results (1-999, default: 32)
104
+ - `prefix` (optional): Filter by collection (e.g., 'mdi', 'lucide')
105
+ - `category` (optional): Filter by category
106
+
107
+ ### `get_icon`
108
+
109
+ Get the SVG code for a specific icon with multiple usage formats.
110
+
111
+ ```
112
+ Get the SVG for mdi:home
113
+ Get lucide:arrow-right with size 24
114
+ ```
115
+
116
+ **Parameters:**
117
+ - `icon_id` (required): Icon ID in format 'prefix:name' (e.g., 'mdi:home')
118
+ - `color` (optional): Icon color (e.g., '#ff0000', 'currentColor')
119
+ - `size` (optional): Icon size in pixels
120
+
121
+ **Returns:**
122
+ - Raw SVG code
123
+ - React/JSX component code
124
+ - Iconify component usage
125
+
126
+ ### `list_collections`
127
+
128
+ List available icon collections/libraries.
129
+
130
+ ```
131
+ List all icon collections
132
+ Search for "material" collections
133
+ ```
134
+
135
+ **Parameters:**
136
+ - `category` (optional): Filter by category
137
+ - `search` (optional): Search collections by name
138
+
139
+ ### `recommend_icons`
140
+
141
+ Get icon recommendations for a specific use case.
142
+
143
+ ```
144
+ What icon should I use for a settings button?
145
+ Recommend icons for user authentication
146
+ ```
147
+
148
+ **Parameters:**
149
+ - `use_case` (required): Describe what you need
150
+ - `style` (optional): 'solid', 'outline', or 'any'
151
+ - `limit` (optional): Number of recommendations (1-20)
152
+
153
+ ## Popular Icon Collections
154
+
155
+ | Prefix | Name | Style | Icons |
156
+ |--------|------|-------|-------|
157
+ | `mdi` | Material Design Icons | Solid | 7,000+ |
158
+ | `lucide` | Lucide Icons | Outline | 1,500+ |
159
+ | `heroicons` | Heroicons | Both | 300+ |
160
+ | `tabler` | Tabler Icons | Outline | 5,000+ |
161
+ | `ph` | Phosphor Icons | Multiple | 9,000+ |
162
+ | `ri` | Remix Icons | Both | 2,800+ |
163
+ | `fa6-solid` | Font Awesome 6 | Solid | 2,000+ |
164
+ | `simple-icons` | Simple Icons | Logos | 3,000+ |
165
+
166
+ ## CLI Commands
167
+
168
+ ```bash
169
+ npx better-icons # Run the MCP server
170
+ npx better-icons setup # Interactive setup wizard
171
+ npx better-icons rules # Install AI rules to your project
172
+ npx better-icons config # Show manual config instructions
173
+ npx better-icons help # Show help
174
+ ```
175
+
176
+ ## Development
177
+
178
+ ```bash
179
+ # Install dependencies
180
+ bun install
181
+
182
+ # Run locally
183
+ bun run index.ts
184
+
185
+ # Build for publishing
186
+ bun run build
187
+ ```
188
+
189
+ ## License
190
+
191
+ MIT
@@ -0,0 +1,149 @@
1
+ ---
2
+ name: better-icons-best-practices
3
+ description: Skill for integrating Better Icons
4
+ ---
5
+ ## Overview
6
+
7
+ Use the `better-icons` MCP server for all icon needs. Do NOT use `lucide-react`, `@heroicons/react`, `react-icons`, or any other icon library.
8
+
9
+ ## How to Get Icons
10
+
11
+ 1. **Search for icons** using the `search_icons` tool
12
+ 2. **Get the SVG** using the `get_icon` tool
13
+ 3. **Add to the project's `icons.tsx` file** (create if it doesn't exist)
14
+
15
+ ## React Projects - Icon Pattern
16
+
17
+ ### File Structure
18
+
19
+ All icons should be in a single `icons.tsx` file (typically at `src/components/icons.tsx` or `components/icons.tsx`).
20
+
21
+ ### Icons File Format
22
+
23
+ ```tsx
24
+ import { SVGProps } from "react";
25
+
26
+ type IconProps = SVGProps<SVGSVGElement>;
27
+
28
+ export const Icons = {
29
+ // Example icons - add more as needed
30
+ home: (props: IconProps) => (
31
+ <svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24" {...props}>
32
+ <path fill="currentColor" d="M10 20v-6h4v6h5v-8h3L12 3L2 12h3v8z"/>
33
+ </svg>
34
+ ),
35
+
36
+ arrowRight: (props: IconProps) => (
37
+ <svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24" {...props}>
38
+ <path fill="currentColor" d="M12 4l-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8z"/>
39
+ </svg>
40
+ ),
41
+
42
+ // Add more icons here...
43
+ } as const;
44
+
45
+ export type IconName = keyof typeof Icons;
46
+ ```
47
+
48
+ ### Usage in Components
49
+
50
+ ```tsx
51
+ import { Icons } from "@/components/icons";
52
+
53
+ // Basic usage
54
+ <Icons.home />
55
+
56
+ // With props
57
+ <Icons.arrowRight className="w-5 h-5 text-blue-500" />
58
+
59
+ // With click handler
60
+ <button onClick={handleClick}>
61
+ <Icons.settings className="w-4 h-4" />
62
+ Settings
63
+ </button>
64
+ ```
65
+
66
+ ## Workflow for Adding Icons
67
+
68
+ ### Step 1: Check if icon exists
69
+
70
+ Before adding a new icon, check the existing `icons.tsx` file. If an icon with the same purpose exists, use it.
71
+
72
+ ### Step 2: Search for the icon
73
+
74
+ Use the `search_icons` tool:
75
+ ```
76
+ search_icons({ query: "settings", prefix: "lucide", limit: 5 })
77
+ ```
78
+
79
+ Prefer these collections (in order):
80
+ 1. `lucide` - Clean, consistent outline icons
81
+ 2. `tabler` - Similar style to lucide
82
+ 3. `mdi` - Comprehensive, good for filled icons
83
+ 4. `heroicons` - Tailwind-style icons
84
+
85
+ ### Step 3: Get the SVG
86
+
87
+ Use the `get_icon` tool:
88
+ ```
89
+ get_icon({ icon_id: "lucide:settings" })
90
+ ```
91
+
92
+ ### Step 4: Add to icons.tsx
93
+
94
+ Convert the SVG to the Icons pattern:
95
+
96
+ ```tsx
97
+ // From get_icon response:
98
+ // <svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24">...</svg>
99
+
100
+ // Add to Icons object:
101
+ settings: (props: IconProps) => (
102
+ <svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24" {...props}>
103
+ {/* SVG content */}
104
+ </svg>
105
+ ),
106
+ ```
107
+
108
+ ### Step 5: Use in component
109
+
110
+ ```tsx
111
+ <Icons.settings className="w-5 h-5" />
112
+ ```
113
+
114
+ ## Icon Naming Conventions
115
+
116
+ - Use camelCase: `arrowRight`, `chevronDown`, `userPlus`
117
+ - Be descriptive: `checkCircle` not `check2`
118
+ - Match purpose: `close` for X icons, `menu` for hamburger
119
+ - Avoid prefixes: `settings` not `iconSettings`
120
+
121
+ ## Common Icons Reference
122
+
123
+ | Purpose | Icon Name | Search Term |
124
+ |---------|-----------|-------------|
125
+ | Navigation | `menu`, `close`, `arrowLeft`, `arrowRight` | menu, x, arrow |
126
+ | Actions | `plus`, `minus`, `edit`, `trash`, `save` | plus, edit, trash |
127
+ | Status | `check`, `x`, `alertCircle`, `info` | check, alert, info |
128
+ | User | `user`, `users`, `userPlus` | user |
129
+ | Media | `play`, `pause`, `volume`, `image` | play, volume |
130
+ | Files | `file`, `folder`, `download`, `upload` | file, download |
131
+ | Communication | `mail`, `message`, `phone`, `bell` | mail, message |
132
+ | UI | `search`, `filter`, `settings`, `more` | search, settings |
133
+
134
+ ## DO NOT
135
+
136
+ - ❌ Install `lucide-react`, `react-icons`, `@heroicons/react`, etc.
137
+ - ❌ Import icons from external packages
138
+ - ❌ Create separate files for each icon
139
+ - ❌ Use icon fonts (Font Awesome CDN, etc.)
140
+ - ❌ Inline SVGs directly in components (put them in icons.tsx)
141
+
142
+ ## DO
143
+
144
+ - ✅ Use the `better-icons` MCP tools to find icons
145
+ - ✅ Maintain a single `icons.tsx` file
146
+ - ✅ Reuse existing icons when possible
147
+ - ✅ Use consistent naming conventions
148
+ - ✅ Pass className for sizing/coloring
149
+ - ✅ Use `currentColor` for fill/stroke (inherits text color)