@lineandstone/icons-mcp 0.1.0 → 0.2.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 +21 -40
- package/bin/locate.js +120 -0
- package/bin/server.js +34 -28
- package/bin/setup.js +68 -0
- package/package.json +36 -9
package/README.md
CHANGED
|
@@ -7,20 +7,25 @@ Ask *"add a pause button to each agent card"* and your assistant searches LINE &
|
|
|
7
7
|
- **Line icons on one 24 px grid**, round caps and joins, in **1, 1.25 and 1.5 px** strokes.
|
|
8
8
|
- **Search by meaning**: names, natural English titles and keywords for every icon.
|
|
9
9
|
- **100 free icons** work right away, no account, no API key.
|
|
10
|
-
- **The full set** (1,877 icons in 17 categories, including AI & Agents and Oriental Living) unlocks from the download you already bought — locally, offline.
|
|
10
|
+
- **The full set** (1,877 icons in 17 categories, including AI & Agents and Oriental Living) unlocks automatically from the download you already bought — locally, offline.
|
|
11
11
|
- Works with Cursor, Claude Code, Claude Desktop, VS Code (Copilot agent mode), Windsurf and any MCP client.
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
## Install (one click)
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
| App | How |
|
|
16
|
+
|---|---|
|
|
17
|
+
| **Claude Desktop** | Download [lineandstone-icons.mcpb](https://github.com/lineandstone/icons-mcp/releases/latest/download/lineandstone-icons.mcpb) and double-click it. Nothing else to install. |
|
|
18
|
+
| **Cursor** | [Add to Cursor](cursor://anysphere.cursor-deeplink/mcp/install?name=lineandstone-icons&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBsaW5lYW5kc3RvbmUvaWNvbnMtbWNwIl19) |
|
|
19
|
+
| **VS Code** (Copilot agent mode) | [Install in VS Code](https://vscode.dev/redirect?url=vscode%3Amcp%2Finstall%3F%257B%2522name%2522%253A%2522lineandstone-icons%2522%252C%2522command%2522%253A%2522npx%2522%252C%2522args%2522%253A%255B%2522-y%2522%252C%2522%2540lineandstone%252Ficons-mcp%2522%255D%257D) |
|
|
20
|
+
| **Claude Code** | `claude mcp add lineandstone-icons -- npx -y @lineandstone/icons-mcp` |
|
|
21
|
+
| **Every app at once** | In a terminal: `npx -y @lineandstone/icons-mcp setup` — adds the tool to Cursor, Claude Code, Claude Desktop, Windsurf and VS Code, whichever you have. |
|
|
16
22
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
23
|
+
Cursor, VS Code, Claude Code and `setup` need [Node.js](https://nodejs.org) 18 or later. Claude Desktop does not.
|
|
24
|
+
|
|
25
|
+
Or just tell your assistant: *"Install the LINE & STONE icons MCP server: run `npx -y @lineandstone/icons-mcp setup`."*
|
|
26
|
+
|
|
27
|
+
<details><summary>Manual config</summary>
|
|
21
28
|
|
|
22
|
-
### Cursor
|
|
23
|
-
`.cursor/mcp.json` in your project (or `~/.cursor/mcp.json` for all projects):
|
|
24
29
|
```json
|
|
25
30
|
{
|
|
26
31
|
"mcpServers": {
|
|
@@ -28,42 +33,18 @@ claude mcp add lineandstone-icons -- npx -y @lineandstone/icons-mcp
|
|
|
28
33
|
}
|
|
29
34
|
}
|
|
30
35
|
```
|
|
36
|
+
Cursor: `~/.cursor/mcp.json` · Claude Desktop: `claude_desktop_config.json` · Windsurf: `~/.codeium/windsurf/mcp_config.json`. VS Code uses `"servers"` instead of `"mcpServers"` and adds `"type": "stdio"`.
|
|
37
|
+
</details>
|
|
31
38
|
|
|
32
|
-
|
|
33
|
-
`.vscode/mcp.json`:
|
|
34
|
-
```json
|
|
35
|
-
{
|
|
36
|
-
"servers": {
|
|
37
|
-
"lineandstone-icons": { "type": "stdio", "command": "npx", "args": ["-y", "@lineandstone/icons-mcp"] }
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
### Claude Desktop / Windsurf / others
|
|
43
|
-
Add the same `command` and `args` to the client's MCP configuration (`claude_desktop_config.json`, `~/.codeium/windsurf/mcp_config.json`, …).
|
|
44
|
-
|
|
45
|
-
## Unlock the full set (buyers)
|
|
46
|
-
|
|
47
|
-
Unzip your LINE & STONE download (any tier — Basic, Pro or Team / Dev) and point `LS_ICONS_DIR` at the folder:
|
|
39
|
+
## Unlock the full set (buyers): nothing to set up
|
|
48
40
|
|
|
49
|
-
|
|
50
|
-
{
|
|
51
|
-
"mcpServers": {
|
|
52
|
-
"lineandstone-icons": {
|
|
53
|
-
"command": "npx",
|
|
54
|
-
"args": ["-y", "@lineandstone/icons-mcp"],
|
|
55
|
-
"env": { "LS_ICONS_DIR": "/Users/you/Downloads/lineandstone-icons-team-v1.1.0" }
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
```
|
|
60
|
-
Claude Code: `claude mcp add lineandstone-icons -e LS_ICONS_DIR=/path/to/download -- npx -y @lineandstone/icons-mcp`
|
|
41
|
+
Keep your LINE & STONE download in **Downloads** (or on the Desktop) — the `.zip` as it arrived, or the unzipped folder, any tier. The tool finds it the first time your assistant asks for an icon. When you download a newer version, it switches to the newest one.
|
|
61
42
|
|
|
62
|
-
|
|
43
|
+
Keep it somewhere else? Run `npx -y @lineandstone/icons-mcp setup /path/to/download`, choose the folder in Claude Desktop's extension settings, or set `LS_ICONS_DIR` yourself.
|
|
63
44
|
|
|
64
|
-
|
|
45
|
+
Not unlocking? Ask your assistant *"why are LINE & STONE icons locked?"* — the tool tells it where it looked and what to do. Or run `npx -y @lineandstone/icons-mcp --check`.
|
|
65
46
|
|
|
66
|
-
|
|
47
|
+
Icons are read from your own disk. Nothing is uploaded, and the tool never contacts our servers. On macOS your app may ask once for access to Downloads; allow it so the tool can see your download.
|
|
67
48
|
|
|
68
49
|
**Team / Dev:** if `@lineandstone/icons-react` or `@lineandstone/icons-vue` is in your project's `package.json`, the tool returns component code (`<LsAgentPause size={20} strokeWidth={1} />`) instead of inline SVG.
|
|
69
50
|
|
package/bin/locate.js
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
// Finds the buyer's own LINE & STONE download on this computer, unzipped folder or the .zip itself.
|
|
2
|
+
// Everything stays local: we only list folder names and read SVG files; nothing is uploaded.
|
|
3
|
+
import { readdirSync, statSync, openSync, readSync, fstatSync, readFileSync } from 'node:fs';
|
|
4
|
+
import { join, resolve, basename } from 'node:path';
|
|
5
|
+
import { homedir } from 'node:os';
|
|
6
|
+
import { inflateRawSync } from 'node:zlib';
|
|
7
|
+
|
|
8
|
+
const HOME = homedir();
|
|
9
|
+
const KIT = /^line-?(and|&)?-?stone[-_ ]?icons[-_ ]?(basic|pro|team)/i; // lineandstone-icons-pro-v1.1.0[.zip], "… 2", "(1)"
|
|
10
|
+
const BRAND = /line.?(and|&).?stone/i;
|
|
11
|
+
const SVG = /(^|\/)svg\/1px\/([^/]+)\/([^/]+)\.svg$/;
|
|
12
|
+
|
|
13
|
+
// Where browsers put downloads. On macOS each folder may ask the user for permission once,
|
|
14
|
+
// so the background scan stays in Downloads and Desktop; `setup` (run by the user) looks further.
|
|
15
|
+
export function searchDirs(wide = false) {
|
|
16
|
+
const d = [join(HOME, 'Downloads'), join(HOME, 'Desktop')];
|
|
17
|
+
if (wide || process.platform !== 'darwin') d.push(join(HOME, 'Documents'));
|
|
18
|
+
if (process.platform === 'win32') for (const x of ['Downloads', 'Desktop', 'Documents']) d.push(join(HOME, 'OneDrive', x));
|
|
19
|
+
d.push(join(HOME, '.lineandstone'), process.cwd());
|
|
20
|
+
return [...new Set(d)];
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// ---------- tiny zip reader (stored / deflate, no zip64; our kits are < 100 MB) ----------
|
|
24
|
+
function openZip(file) {
|
|
25
|
+
const fd = openSync(file, 'r'), size = fstatSync(fd).size;
|
|
26
|
+
const tl = Math.min(size, 65557), tail = Buffer.alloc(tl);
|
|
27
|
+
readSync(fd, tail, 0, tl, size - tl);
|
|
28
|
+
let e = -1;
|
|
29
|
+
for (let i = tl - 22; i >= 0; i--) if (tail.readUInt32LE(i) === 0x06054b50) { e = i; break; }
|
|
30
|
+
if (e < 0) throw new Error('not a zip');
|
|
31
|
+
const n = tail.readUInt16LE(e + 10), cs = tail.readUInt32LE(e + 12), co = tail.readUInt32LE(e + 16);
|
|
32
|
+
const cd = Buffer.alloc(cs); readSync(fd, cd, 0, cs, co);
|
|
33
|
+
const entries = new Map();
|
|
34
|
+
for (let k = 0, p = 0; k < n && cd.readUInt32LE(p) === 0x02014b50; k++) {
|
|
35
|
+
const nl = cd.readUInt16LE(p + 28), xl = cd.readUInt16LE(p + 30), cl = cd.readUInt16LE(p + 32);
|
|
36
|
+
entries.set(cd.toString('utf8', p + 46, p + 46 + nl), { m: cd.readUInt16LE(p + 10), cs: cd.readUInt32LE(p + 20), off: cd.readUInt32LE(p + 42) });
|
|
37
|
+
p += 46 + nl + xl + cl;
|
|
38
|
+
}
|
|
39
|
+
const read = (name) => {
|
|
40
|
+
const en = entries.get(name); if (!en) return null;
|
|
41
|
+
const h = Buffer.alloc(30); readSync(fd, h, 0, 30, en.off);
|
|
42
|
+
const d = Buffer.alloc(en.cs); readSync(fd, d, 0, en.cs, en.off + 30 + h.readUInt16LE(26) + h.readUInt16LE(28));
|
|
43
|
+
return (en.m === 8 ? inflateRawSync(d) : d).toString('utf8');
|
|
44
|
+
};
|
|
45
|
+
return { entries, read };
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// A source maps icon name -> category and can read one SVG at a given stroke weight.
|
|
49
|
+
function fromZip(file) {
|
|
50
|
+
const z = openZip(file), owned = new Map(); let prefix = null;
|
|
51
|
+
for (const name of z.entries.keys()) {
|
|
52
|
+
const m = name.match(SVG); if (!m) continue;
|
|
53
|
+
const pre = name.slice(0, name.length - m[0].length + m[1].length);
|
|
54
|
+
if (prefix === null) prefix = pre; else if (pre !== prefix) continue;
|
|
55
|
+
owned.set(m[3], m[2]);
|
|
56
|
+
}
|
|
57
|
+
if (!owned.size) return null;
|
|
58
|
+
return { kind: 'zip', path: file, owned, read: (n, w) => z.read(`${prefix}svg/${w}px/${owned.get(n)}/${n}.svg`) };
|
|
59
|
+
}
|
|
60
|
+
function fromDir(dir) {
|
|
61
|
+
const cands = [dir, join(dir, '..')];
|
|
62
|
+
try { for (const x of readdirSync(dir)) cands.push(join(dir, x)); } catch { return null; }
|
|
63
|
+
for (const c of cands) {
|
|
64
|
+
const root = join(c, 'svg');
|
|
65
|
+
try { if (!statSync(join(root, '1px')).isDirectory()) continue; } catch { continue; }
|
|
66
|
+
const owned = new Map();
|
|
67
|
+
for (const cat of readdirSync(join(root, '1px'))) {
|
|
68
|
+
let files = []; try { files = readdirSync(join(root, '1px', cat)); } catch { continue; }
|
|
69
|
+
for (const f of files) if (f.endsWith('.svg')) owned.set(f.slice(0, -4), cat);
|
|
70
|
+
}
|
|
71
|
+
if (owned.size) return { kind: 'folder', path: resolve(c), owned, read: (n, w) => readFileSync(join(root, w + 'px', owned.get(n), n + '.svg'), 'utf8') };
|
|
72
|
+
}
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
export function openSource(p) {
|
|
76
|
+
try {
|
|
77
|
+
const st = statSync(p);
|
|
78
|
+
return st.isDirectory() ? fromDir(p) : /\.zip$/i.test(p) ? fromZip(p) : null;
|
|
79
|
+
} catch { return null; }
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const ver = (s) => (s.match(/v?(\d+)\.(\d+)\.(\d+)/) || [0, 0, 0, 0]).slice(1).map(Number);
|
|
83
|
+
const cmpVer = (a, b) => { for (let i = 0; i < 3; i++) if (a[i] !== b[i]) return b[i] - a[i]; return 0; };
|
|
84
|
+
const TIER = { team: 3, pro: 2, basic: 1 };
|
|
85
|
+
|
|
86
|
+
// Every LINE & STONE kit we can see in the given folders (one level deep, or two inside a "LINE & STONE" folder).
|
|
87
|
+
export function findKits(dirs) {
|
|
88
|
+
const out = [];
|
|
89
|
+
const look = (dir, depth) => {
|
|
90
|
+
let names = []; try { names = readdirSync(dir); } catch { return; }
|
|
91
|
+
for (const name of names) {
|
|
92
|
+
const p = join(dir, name);
|
|
93
|
+
if (KIT.test(name)) { let m = 0; try { m = statSync(p).mtimeMs; } catch {} out.push({ path: p, name, v: ver(name), zip: /\.zip$/i.test(name), tier: TIER[(name.match(/basic|pro|team/i) || [''])[0].toLowerCase()] || 0, m }); }
|
|
94
|
+
else if (depth === 0 && BRAND.test(name)) look(p, 1);
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
for (const d of dirs) look(d, 0);
|
|
98
|
+
// newest version first, then unzipped folder before zip, then Team > Pro > Basic, then most recent
|
|
99
|
+
return out.sort((a, b) => cmpVer(a.v, b.v) || a.zip - b.zip || b.tier - a.tier || b.m - a.m);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// Resolve what this computer has. env = LS_ICONS_DIR (folder or .zip); empty means "look for it".
|
|
103
|
+
export function locate(env, { wide = false } = {}) {
|
|
104
|
+
const tried = []; let envBad = false;
|
|
105
|
+
if (env && env.trim()) {
|
|
106
|
+
const p = resolve(env.trim().replace(/^~(?=$|[\\/])/, HOME));
|
|
107
|
+
const s = openSource(p);
|
|
108
|
+
if (s) return { source: s, via: 'LS_ICONS_DIR', tried };
|
|
109
|
+
tried.push(p); envBad = true;
|
|
110
|
+
// fall through: the path may be stale (e.g. a newer download sits in Downloads)
|
|
111
|
+
}
|
|
112
|
+
const dirs = searchDirs(wide);
|
|
113
|
+
for (const k of findKits(dirs)) {
|
|
114
|
+
const s = openSource(k.path);
|
|
115
|
+
if (s) return { source: s, via: 'auto', tried, envBad };
|
|
116
|
+
tried.push(k.path);
|
|
117
|
+
}
|
|
118
|
+
return { source: null, tried, dirs, envBad };
|
|
119
|
+
}
|
|
120
|
+
export const kitName = (p) => basename(p);
|
package/bin/server.js
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
// LINE & STONE Icons — MCP server (stdio). No dependencies.
|
|
3
3
|
// Free: the 100 free icons in 1 / 1.25 / 1.5 px. Full set: point LS_ICONS_DIR at your unzipped LINE & STONE download.
|
|
4
4
|
// Code: MIT. Icons: free icons under LICENSE-ICONS-FREE.txt; paid icons under your own purchase licence.
|
|
5
|
-
import { readFileSync
|
|
6
|
-
import { join, dirname
|
|
5
|
+
import { readFileSync } from 'node:fs';
|
|
6
|
+
import { join, dirname } from 'node:path';
|
|
7
7
|
import { fileURLToPath } from 'node:url';
|
|
8
|
-
import {
|
|
8
|
+
import { locate } from './locate.js';
|
|
9
9
|
|
|
10
10
|
const HERE = dirname(fileURLToPath(import.meta.url));
|
|
11
11
|
const PKG = JSON.parse(readFileSync(join(HERE, '..', 'package.json'), 'utf8'));
|
|
@@ -19,25 +19,25 @@ const CATS = Object.fromEntries(INDEX.categories.map((c) => [c.id, c.name]));
|
|
|
19
19
|
const ICONS = INDEX.icons.slice();
|
|
20
20
|
const BY = new Map(ICONS.map((i) => [i.n, i]));
|
|
21
21
|
|
|
22
|
-
// ---------- full set from the buyer's own download
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
const cands = [d, join(d, '..')];
|
|
27
|
-
try { for (const x of readdirSync(d)) cands.push(join(d, x)); } catch { return null; }
|
|
28
|
-
for (const c of cands) { try { if (statSync(join(c, 'svg', '1px')).isDirectory()) return join(c, 'svg'); } catch {} }
|
|
29
|
-
return null;
|
|
30
|
-
}
|
|
31
|
-
const SVG_ROOT = findSvgRoot(process.env.LS_ICONS_DIR);
|
|
22
|
+
// ---------- full set from the buyer's own download ----------
|
|
23
|
+
// Looked up on the first tool call (not at start-up), then cached. LS_ICONS_DIR is optional:
|
|
24
|
+
// without it we look for the download (folder or .zip) in Downloads / Desktop.
|
|
25
|
+
let LOC = null;
|
|
32
26
|
const OWNED = new Map(); // name -> category folder
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
27
|
+
function load() {
|
|
28
|
+
if (LOC) return LOC;
|
|
29
|
+
LOC = locate(process.env.LS_ICONS_DIR);
|
|
30
|
+
if (LOC.source) for (const [n, cat] of LOC.source.owned) {
|
|
31
|
+
OWNED.set(n, cat);
|
|
32
|
+
if (!BY.has(n)) { const cap = (w) => w[0].toUpperCase() + w.slice(1); const i = { n, t: n.split('-').map(cap).join(' '), c: cat, k: [], comp: 'Ls' + n.split('-').map(cap).join(''), f: false }; ICONS.push(i); BY.set(n, i); }
|
|
40
33
|
}
|
|
34
|
+
return LOC;
|
|
35
|
+
}
|
|
36
|
+
const HOW = 'Put your LINE & STONE download (the .zip or the unzipped folder) in Downloads, then ask again. Or run `npx -y @lineandstone/icons-mcp setup` once.';
|
|
37
|
+
function unlockInfo() {
|
|
38
|
+
const L = load();
|
|
39
|
+
if (L.source) return { unlocked: true, icons: OWNED.size, from: L.source.path, kind: L.source.kind, ...(L.envBad ? { warning: `LS_ICONS_DIR (${process.env.LS_ICONS_DIR}) has no icons; using the download found in ${L.source.path} instead.` } : {}) };
|
|
40
|
+
return { unlocked: false, lookedIn: L.dirs, ...(L.envBad ? { problem: `LS_ICONS_DIR is set to ${process.env.LS_ICONS_DIR}, but there is no svg/1px folder or LINE & STONE .zip there.` } : {}), howToUnlock: HOW };
|
|
41
41
|
}
|
|
42
42
|
const status = (i) => (i.f ? 'free' : OWNED.has(i.n) ? 'licensed' : 'locked');
|
|
43
43
|
|
|
@@ -75,6 +75,7 @@ function score(i, q, qt) {
|
|
|
75
75
|
return s;
|
|
76
76
|
}
|
|
77
77
|
function search({ query = '', category, limit = 10 }) {
|
|
78
|
+
load();
|
|
78
79
|
const q = String(query).toLowerCase().trim();
|
|
79
80
|
const qt = toks(q).filter((t) => !STOP.has(t));
|
|
80
81
|
const lim = Math.max(1, Math.min(50, Number(limit) || 10));
|
|
@@ -84,7 +85,7 @@ function search({ query = '', category, limit = 10 }) {
|
|
|
84
85
|
.sort((a, b) => b[0] - a[0] || (status(a[1]) === 'locked') - (status(b[1]) === 'locked') || a[1].n.localeCompare(b[1].n))
|
|
85
86
|
.slice(0, lim);
|
|
86
87
|
return { query, count: res.length,
|
|
87
|
-
note:
|
|
88
|
+
note: LOC.source ? `Full set unlocked from ${LOC.source.path}.` : 'Free icons can be inserted now. "locked" icons are part of the paid LINE & STONE set; prefer a free icon, or tell the user how to unlock (see get_icon).',
|
|
88
89
|
results: res.map(([, i]) => ({ name: i.n, title: i.t, category: CATS[i.c] || i.c, keywords: i.k.slice(0, 8), status: status(i), component: i.comp })) };
|
|
89
90
|
}
|
|
90
91
|
|
|
@@ -92,10 +93,11 @@ function search({ query = '', category, limit = 10 }) {
|
|
|
92
93
|
function readSvg(i, w) {
|
|
93
94
|
if (i.f && FREE[i.n]) return FREE[i.n][w];
|
|
94
95
|
if (!OWNED.has(i.n)) return null;
|
|
95
|
-
try { return
|
|
96
|
+
try { return (LOC.source.read(i.n, w) || '').trim() || null; } catch { return null; }
|
|
96
97
|
}
|
|
97
98
|
const sized = (svg, size) => svg.replace(/<svg\b([^>]*)>/, (m, a) => '<svg' + a.replace(/\s(width|height)="[^"]*"/g, '') + ` width="${size}" height="${size}">`);
|
|
98
99
|
function getIcon({ name, strokeWidth = 1, format, size = 24 }) {
|
|
100
|
+
load();
|
|
99
101
|
const n = String(name || '').trim().toLowerCase().replace(/\s+/g, '-');
|
|
100
102
|
const i = BY.get(n);
|
|
101
103
|
if (!i) {
|
|
@@ -106,7 +108,7 @@ function getIcon({ name, strokeWidth = 1, format, size = 24 }) {
|
|
|
106
108
|
if (!WEIGHTS.includes(w)) return { error: 'strokeWidth must be 1, 1.25 or 1.5.' };
|
|
107
109
|
const st = status(i);
|
|
108
110
|
const page = `${SITE}/icons/${i.c}/${i.n}/?${UTM}`;
|
|
109
|
-
if (st === 'locked') return { name: i.n, title: i.t, status: 'locked', message: `"${i.t}" is part of the LINE & STONE paid set, so it can't be inserted yet. Do not draw a substitute; use a free icon or ask the user.`, preview: page, buy: `${SITE}/pricing/?${UTM}`, unlock:
|
|
111
|
+
if (st === 'locked') return { name: i.n, title: i.t, status: 'locked', message: `"${i.t}" is part of the LINE & STONE paid set, so it can't be inserted yet. Do not draw a substitute; use a free icon or ask the user.`, preview: page, buy: `${SITE}/pricing/?${UTM}`, unlock: unlockInfo() };
|
|
110
112
|
const comp = format === 'react' || format === 'vue' ? format : format === 'svg' ? null : componentPkg();
|
|
111
113
|
const out = { name: i.n, title: i.t, category: CATS[i.c] || i.c, status: st, strokeWidth: Number(w) };
|
|
112
114
|
if (comp) {
|
|
@@ -116,7 +118,7 @@ function getIcon({ name, strokeWidth = 1, format, size = 24 }) {
|
|
|
116
118
|
out.note = 'Requires the LINE & STONE Team / Dev package installed in this project. For an icon-only button, add an aria-label.';
|
|
117
119
|
} else {
|
|
118
120
|
const svg = readSvg(i, w);
|
|
119
|
-
if (!svg) return { error: `Could not read "${i.n}" from
|
|
121
|
+
if (!svg) return { error: `Could not read "${i.n}" from ${LOC.source ? LOC.source.path : 'the download'}. The file may have been moved; ask again after putting the download back in Downloads.` };
|
|
120
122
|
out.format = 'svg'; out.svg = sized(svg, size);
|
|
121
123
|
out.note = 'Inline as-is; color follows currentColor. Keep one stroke weight per screen. For an icon-only button, add an aria-label.';
|
|
122
124
|
}
|
|
@@ -130,7 +132,7 @@ const TOOLS = [
|
|
|
130
132
|
inputSchema: { type: 'object', properties: { query: { type: 'string', description: 'What the icon is for, in plain words' }, category: { type: 'string', description: 'Optional category id or name, e.g. ai-and-agents' }, limit: { type: 'number', description: '1–50, default 10' } }, required: ['query'] } },
|
|
131
133
|
{ name: 'get_icon', description: 'Get one LINE & STONE icon ready to paste: inline SVG, or a React / Vue component usage if the Team / Dev package is installed. Locked icons return a preview and buy link instead; do not substitute a hand-drawn icon.',
|
|
132
134
|
inputSchema: { type: 'object', properties: { name: { type: 'string', description: 'Icon name from search_icons, e.g. agent-pause' }, strokeWidth: { type: 'number', enum: [1, 1.25, 1.5], description: 'Default 1. Keep one weight per screen.' }, format: { type: 'string', enum: ['svg', 'react', 'vue'], description: 'Default: component if @lineandstone/icons-react or -vue is in package.json, else svg' }, size: { type: 'number', description: 'Pixel size, default 24' } }, required: ['name'] } },
|
|
133
|
-
{ name: 'list_categories', description: 'List the LINE & STONE icon categories with counts
|
|
135
|
+
{ name: 'list_categories', description: 'List the LINE & STONE icon categories with counts, how many icons are usable right now, and whether (and from where) the full set is unlocked. Use it when the user asks why paid icons are locked.', inputSchema: { type: 'object', properties: {} } },
|
|
134
136
|
];
|
|
135
137
|
const INSTRUCTIONS = 'LINE & STONE line icons (24 px grid; 1, 1.25 and 1.5 px strokes; round caps). When the UI needs an icon: call search_icons with what the icon is for, then get_icon. Use only icons this tool returns; never draw or invent SVG icons. Keep one stroke weight per screen. Add aria-label to icon-only buttons. Free icons need a credit line in the project README.';
|
|
136
138
|
const SUPPORTED = ['2025-06-18', '2025-03-26', '2024-11-05'];
|
|
@@ -138,7 +140,7 @@ const SUPPORTED = ['2025-06-18', '2025-03-26', '2024-11-05'];
|
|
|
138
140
|
function call(name, args = {}) {
|
|
139
141
|
if (name === 'search_icons') return search(args);
|
|
140
142
|
if (name === 'get_icon') return getIcon(args);
|
|
141
|
-
if (name === 'list_categories') return { version: INDEX.version,
|
|
143
|
+
if (name === 'list_categories') return { version: INDEX.version, unlock: unlockInfo(), categories: INDEX.categories.map((c) => ({ id: c.id, name: c.name, count: c.count, usable: ICONS.filter((i) => i.c === c.id && status(i) !== 'locked').length })) };
|
|
142
144
|
throw Object.assign(new Error('Unknown tool: ' + name), { code: -32602 });
|
|
143
145
|
}
|
|
144
146
|
function handle(msg) {
|
|
@@ -160,9 +162,13 @@ function handle(msg) {
|
|
|
160
162
|
}
|
|
161
163
|
|
|
162
164
|
if (process.argv.includes('--version')) { console.log(PKG.version); process.exit(0); }
|
|
165
|
+
if (process.argv[2] === 'setup') { const { setup } = await import('./setup.js'); await setup(process.argv[3]); process.exit(0); }
|
|
163
166
|
if (process.argv.includes('--check')) { // quick self-check for the install guide
|
|
164
|
-
|
|
165
|
-
console.log(
|
|
167
|
+
const u = unlockInfo();
|
|
168
|
+
console.log(`LINE & STONE Icons MCP ${PKG.version} · data ${INDEX.version} · ${INDEX.icons.length} icons · free ${Object.keys(FREE).length}`);
|
|
169
|
+
console.log(u.unlocked ? `Full set unlocked: ${u.icons} icons from ${u.from}` : `Free mode. Looked in: ${u.lookedIn.join(', ')}`);
|
|
170
|
+
if (u.warning || u.problem) console.log(u.warning || u.problem);
|
|
171
|
+
if (!u.unlocked) console.log('Bought the full set? ' + u.howToUnlock);
|
|
166
172
|
process.exit(0);
|
|
167
173
|
}
|
|
168
174
|
let buf = '';
|
package/bin/setup.js
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
// `npx -y @lineandstone/icons-mcp setup [path]`
|
|
2
|
+
// Adds the server to every AI app found on this computer and connects the user's download if there is one.
|
|
3
|
+
// Only touches the MCP config files of apps that are installed; keeps a .bak copy of each file it changes.
|
|
4
|
+
import { readFileSync, writeFileSync, existsSync, mkdirSync, copyFileSync } from 'node:fs';
|
|
5
|
+
import { join, dirname, resolve } from 'node:path';
|
|
6
|
+
import { homedir } from 'node:os';
|
|
7
|
+
import { execFileSync } from 'node:child_process';
|
|
8
|
+
import { locate, openSource, searchDirs } from './locate.js';
|
|
9
|
+
|
|
10
|
+
const HOME = homedir(), WIN = process.platform === 'win32', MAC = process.platform === 'darwin';
|
|
11
|
+
const APPDATA = process.env.APPDATA || join(HOME, 'AppData', 'Roaming');
|
|
12
|
+
const NAME = 'lineandstone-icons', PKG = '@lineandstone/icons-mcp';
|
|
13
|
+
const appSupport = (...p) => (MAC ? join(HOME, 'Library', 'Application Support', ...p) : WIN ? join(APPDATA, ...p) : join(HOME, '.config', ...p));
|
|
14
|
+
|
|
15
|
+
function writeJson(file, mutate) {
|
|
16
|
+
let data = {};
|
|
17
|
+
if (existsSync(file)) {
|
|
18
|
+
const raw = readFileSync(file, 'utf8');
|
|
19
|
+
if (raw.trim()) { try { data = JSON.parse(raw); } catch { return `skipped: ${file} is not plain JSON (comments?). Add the server by hand.`; } }
|
|
20
|
+
copyFileSync(file, file + '.bak');
|
|
21
|
+
} else mkdirSync(dirname(file), { recursive: true });
|
|
22
|
+
mutate(data);
|
|
23
|
+
writeFileSync(file, JSON.stringify(data, null, 2) + '\n');
|
|
24
|
+
return 'added';
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export async function setup(arg) {
|
|
28
|
+
console.log('LINE & STONE Icons · setup\n');
|
|
29
|
+
// 1. the download
|
|
30
|
+
let src = null, via = '';
|
|
31
|
+
if (arg) { src = openSource(resolve(arg.replace(/^~(?=$|[\\/])/, HOME))); via = 'path'; if (!src) console.log(`No LINE & STONE icons found in ${arg}. Point to the .zip or the unzipped folder.\n`); }
|
|
32
|
+
if (!src) { const L = locate('', { wide: true }); src = L.source; via = 'auto'; }
|
|
33
|
+
// Downloads/Desktop are searched automatically, so newer downloads there are picked up without a fixed path.
|
|
34
|
+
const auto = src && searchDirs(false).some((d) => src.path.startsWith(d + (WIN ? '\\' : '/')));
|
|
35
|
+
const env = src && !auto ? { LS_ICONS_DIR: src.path } : undefined;
|
|
36
|
+
console.log(src ? `✓ Full set: ${src.owned.size} icons from ${src.path}` : '· No LINE & STONE download found yet, so the 100 free icons will be used.\n Bought the full set? Put the download (.zip or folder) in Downloads; it unlocks automatically.');
|
|
37
|
+
console.log('');
|
|
38
|
+
|
|
39
|
+
// 2. the apps
|
|
40
|
+
const base = { command: 'npx', args: ['-y', PKG], ...(env ? { env } : {}) };
|
|
41
|
+
const winWrap = { command: 'cmd', args: ['/c', 'npx', '-y', PKG], ...(env ? { env } : {}) };
|
|
42
|
+
const apps = [
|
|
43
|
+
{ name: 'Cursor', dir: join(HOME, '.cursor'), file: join(HOME, '.cursor', 'mcp.json'), set: (d) => { (d.mcpServers ||= {})[NAME] = base; } },
|
|
44
|
+
{ name: 'Claude Desktop', dir: appSupport('Claude'), file: appSupport('Claude', 'claude_desktop_config.json'), set: (d) => { (d.mcpServers ||= {})[NAME] = WIN ? winWrap : base; } },
|
|
45
|
+
{ name: 'Windsurf', dir: join(HOME, '.codeium', 'windsurf'), file: join(HOME, '.codeium', 'windsurf', 'mcp_config.json'), set: (d) => { (d.mcpServers ||= {})[NAME] = base; } },
|
|
46
|
+
{ name: 'VS Code', dir: appSupport('Code', 'User'), file: appSupport('Code', 'User', 'mcp.json'), set: (d) => { (d.servers ||= {})[NAME] = { type: 'stdio', ...base }; } },
|
|
47
|
+
];
|
|
48
|
+
const done = [];
|
|
49
|
+
for (const a of apps) {
|
|
50
|
+
if (!existsSync(a.dir)) continue;
|
|
51
|
+
const r = writeJson(a.file, a.set);
|
|
52
|
+
console.log(r === 'added' ? `✓ ${a.name}` : `· ${a.name}: ${r}`);
|
|
53
|
+
if (r === 'added') done.push(a.name);
|
|
54
|
+
}
|
|
55
|
+
// Claude Code has its own command
|
|
56
|
+
try {
|
|
57
|
+
const sh = { stdio: 'ignore', shell: WIN };
|
|
58
|
+
execFileSync('claude', ['--version'], sh);
|
|
59
|
+
try { execFileSync('claude', ['mcp', 'remove', '-s', 'user', NAME], sh); } catch {}
|
|
60
|
+
execFileSync('claude', ['mcp', 'add', '-s', 'user', NAME, ...(env ? ['-e', `LS_ICONS_DIR=${env.LS_ICONS_DIR}`] : []), '--', 'npx', '-y', PKG], sh);
|
|
61
|
+
console.log('✓ Claude Code'); done.push('Claude Code');
|
|
62
|
+
} catch {}
|
|
63
|
+
|
|
64
|
+
console.log('');
|
|
65
|
+
if (done.length) console.log(`Done. Restart ${done.join(', ')}, then ask your assistant for an icon, e.g. "add a pause button to each agent card".`);
|
|
66
|
+
else console.log('No AI app found on this computer (Cursor, Claude Code, Claude Desktop, Windsurf, VS Code).\nSee https://lineandstoneco.com/tools/mcp/ for other apps.');
|
|
67
|
+
console.log('Icons by LINE & STONE · https://lineandstoneco.com');
|
|
68
|
+
}
|
package/package.json
CHANGED
|
@@ -1,15 +1,42 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lineandstone/icons-mcp",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "MCP server for LINE & STONE line icons: your AI coding assistant searches icons by meaning and inserts real SVG or React/Vue components. 100 free icons; the full set unlocks from your own download.",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "MCP server for LINE & STONE line icons: your AI coding assistant searches icons by meaning and inserts real SVG or React/Vue components. 100 free icons; the full set unlocks automatically from your own download.",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"bin": {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
"
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
"bin": {
|
|
7
|
+
"lineandstone-icons-mcp": "bin/server.js"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"bin/",
|
|
11
|
+
"data/",
|
|
12
|
+
"README.md",
|
|
13
|
+
"LICENSE",
|
|
14
|
+
"LICENSE-ICONS-FREE.txt"
|
|
15
|
+
],
|
|
16
|
+
"engines": {
|
|
17
|
+
"node": ">=18"
|
|
18
|
+
},
|
|
19
|
+
"scripts": {
|
|
20
|
+
"test": "node test/test.js && node test/locate.js"
|
|
21
|
+
},
|
|
22
|
+
"keywords": [
|
|
23
|
+
"mcp",
|
|
24
|
+
"model-context-protocol",
|
|
25
|
+
"icons",
|
|
26
|
+
"line-icons",
|
|
27
|
+
"svg",
|
|
28
|
+
"react",
|
|
29
|
+
"vue",
|
|
30
|
+
"cursor",
|
|
31
|
+
"claude",
|
|
32
|
+
"ai-agents",
|
|
33
|
+
"lineandstone"
|
|
34
|
+
],
|
|
35
|
+
"homepage": "https://lineandstoneco.com/tools/mcp/",
|
|
36
|
+
"repository": {
|
|
37
|
+
"type": "git",
|
|
38
|
+
"url": "git+https://github.com/lineandstone/icons-mcp.git"
|
|
39
|
+
},
|
|
13
40
|
"author": "LINE & STONE (Pin Huang) <lineandstoneco@gmail.com>",
|
|
14
41
|
"license": "SEE LICENSE IN LICENSE",
|
|
15
42
|
"mcpName": "io.github.lineandstone/icons-mcp"
|