核cp
MCP(模型上下文协议)服务器,使Claude可以直接访问您的本地 核。 图标库——搜索图标,将其预览为图像,并导出为PDF。
运作原理
Nucleo将其图标库存储在磁盘上的两个位置:
- SQLite数据库 —
~/Library/Application Support/Nucleo/icons/data.sqlite3(约54k个带有名称、标签、设置成员资格的图标) - SVG文件 —
~/Library/Application Support/Nucleo/icons/sets/{set_id}/{icon_id}.svg
此服务器直接读取这些文件。Nucleo应用程序不需要运行。
PDF导出用途 rsvg-convert 以SVG的自然维度生成具有透明背景的正确矢量PDF,与Nucleo本机导出的内容相同。
需求
- 安装了Nucleo的macOS,并且至少有一个图标库已同步
- Node.js 18+
rsvg-convert--通过Homebrew安装:brew install librsvg
安装
git clone git@github.com:julianallchin/nucleo-mcp.git
cd nucleo-mcp
npm install
npm run build然后添加到您的Claude Code配置中(~/.claude.json):
{
"mcpServers": {
"nucleo": {
"type": "stdio",
"command": "node",
"args": ["/absolute/path/to/nucleo-mcp/dist/index.js"]
}
}
}或者对于特定项目,添加 .mcp.json 在repo根目录:
{
"mcpServers": {
"nucleo": {
"type": "stdio",
"command": "node",
"args": ["/absolute/path/to/nucleo-mcp/dist/index.js"]
}
}
}工具
search_icons
按名称和/或标签搜索图标。
query string Search term (matched against name and tags)
limit number Max results, default 20, max 100
set_id number Filter by icon set ID
favorites_only boolean Only return starred icons
variant string Filter by style: "outline" | "solid" | "duotone-outline" | "duotone-solid"结果包括每个图标的检测变量。
preview_icon
返回图标的PNG图像(通过resvg渲染)。
icon_id number Icon ID
scale number Zoom multiplier, default 4 (gives 96px from an 18px icon)get_icon_svg
返回图标的原始SVG源代码。
icon_id number Icon IDexport_icon_to_pdf
将图标导出为SVG自然尺寸的矢量PDF,背景透明。适合直接用作Xcode图像资源。
icon_id number Icon ID
output_path string Destination path, e.g. ~/Desktop/icon.pdfget_icon_variants
按名称返回图标的所有样式变体,并带有PNG预览。有助于找到与现有图标的视觉风格相匹配的正确变体。
name string Exact icon name, e.g. "alarm-clock"
set_id number Limit to a specific set (optional)
preview boolean Include PNG previews, default truelist_icon_sets
列出所有具有ID、标题、大小和图标计数的图标集。
get_icons_in_set
列出特定集合中的图标。
set_id number Set ID
limit number Max results, default 50get_favorite_icons
返回Nucleo中标记为收藏夹的所有图标。
limit number Max results, default 50变体
Nucleo为每个图标提供多种样式变体。该变体是从SVG源中检测到的:
| 变体 | 描述 |
|---|---|
solid | 填充黑色形状,无笔划 |
outline | 走过的路, fill="none" |
duotone-solid | 固体初级+半透明次级填料 |
duotone-outline | 经敲击的初级+半透明次级填料 |
使用 get_icon_variants 在决定导出哪个图标之前,并排查看图标的所有变体。
发展
npm run dev # run with tsx (no build step)
npm run build # compile TypeScript to dist/
npm start # run compiled output