mcp-server-icon
A Model Context Protocol server for searching and fetching icons from iconfont.cn.
README
MCP Icon Server
A Model Context Protocol (MCP) server for searching and fetching icons from iconfont.cn.
Features
- 🔍 Icon Search: Search icons from iconfont.cn
- 📄 Icon Details: Get detailed information about icons
- 🎨 SVG Content: Get SVG format content of icons
- ⚡ Caching: Built-in cache for improved performance
- 📊 Cache Management: View and manage cache statistics
- 🔧 Zero Dependencies: Uses only Node.js built-in features
Installation
npm install @liangshanli/mcp-server-icon
Installation
Global Installation (Recommended)
npm install -g @liangshanli/mcp-server-icon
Local Installation
npm install @liangshanli/mcp-server-icon
From Source
git clone https://github.com/liliangshan/mcp-server-icon.git
cd mcp-server-icon
npm install
Usage
1. Direct Run (Global Installation)
mcp-server-icon
2. Using npx (Recommended)
npx @liangshanli/mcp-server-icon
3. Direct Start (Source Installation)
npm start
4. Development Mode
npm run dev
5. Daemon Mode
npm run daemon
Editor Integration
Cursor Editor Configuration
- Create
.cursor/mcp.jsonfile in your project root:
{
"mcpServers": {
"icon": {
"command": "npx",
"args": ["@liangshanli/mcp-server-icon"],
"env": {
"LANGUAGE": "en",
"WEB_SERVER_AUTO_OPEN": "true"
}
}
}
}
VS Code Configuration
- Install the MCP extension for VS Code
- Create
.vscode/settings.jsonfile:
{
"mcp.servers": {
"icon": {
"command": "npx",
"args": ["@liangshanli/mcp-server-icon"],
"env": {
"LANGUAGE": "en",
"WEB_SERVER_AUTO_OPEN": "true"
}
}
}
}
As MCP Server
The server communicates with MCP clients via stdin/stdout after startup:
{"jsonrpc": "2.0", "id": 1, "method": "initialize", "params": {"protocolVersion": "2024-11-05"}}
Environment Variables
LANGUAGE: Interface language setting (enorzh-CN, default:en)WEB_SERVER_AUTO_OPEN: Whether to auto-open browser (trueorfalse, default:true)MCP_LOG_DIR: Log directory (default:./logs)MCP_LOG_FILE: Log filename (default:mcp-icon.log)
API Tools
1. search_icons
Search icons from iconfont.cn
Parameters:
q(string): Search keywordsortType(string): Sort type, defaultupdated_atpage(number): Page number, default 1pageSize(number): Items per page, default 100, max 100sType(string): Search type filterfromCollection(number): Collection filter, default -1 (all)fills(string): Fill type filter
Example:
{
"name": "search_icons",
"arguments": {
"q": "user",
"page": 1,
"pageSize": 20
}
}
2. get_cache_stats
Get cache statistics
Parameters: None
3. clear_cache
Clear icon cache
Parameters:
expiredOnly(boolean): Only clear expired entries, default false
Response Format
Search Icons Response
{
"code": 200,
"data": {
"icons": [
{
"id": 145442,
"name": "用户",
"status": 1,
"is_private": 0,
"category_id": "1",
"slug": "用户",
"unicode": "58931",
"width": 1024,
"height": 1024,
"defs": null,
"path_attributes": "fill=\"#FF9000\"",
"fills": 1,
"font_class": "yonghu",
"user_id": 4689,
"repositorie_id": 1029,
"created_at": "2015-04-08T03:37:56.000Z",
"updated_at": "2022-11-30T14:45:12.000Z",
"preview_image": null,
"svg_hash": "1c5e2a9ebaeb74599a727720e6439cb9",
"svg_fill_hash": "3768e9af3b85014e5cabfe723186fcfe",
"fork_from": null,
"deleted_at": null,
"show_svg": "<svg class=\"icon\" style=\"width: 1em;height: 1em;vertical-align: middle;fill: currentColor;overflow: hidden;\" viewBox=\"0 0 1024 1024\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M703.400215 995.074204c-3.51915 0-7.078209-0.991584-10.240225-3.066849-30.28884-19.875676-80.136132-25.263383-97.079012-25.678846l-22.119787 0-35.287691 0.271176c-0.048095 0-0.095167 0-0.143263 0L92.740194 966.599685c-10.326183 0-18.696828-8.370645-18.696828-18.696828l0-22.467711c-0.318248-6.266727-0.910743-40.603767 21.004383-78.307484 13.716396-23.598464 33.431414-43.86095 58.598606-60.225663 30.493501-19.828604 69.116147-33.909297 114.796536-41.84913 0.233314-0.039909 0.466628-0.075725 0.700965-0.107447 0.346901-0.047072 35.499515-4.858658 71.208808-14.273075 61.894675-16.317641 67.307965-30.743188 67.345828-30.884404 0.364297-1.430582 0.89437-2.803859 1.572822-4.095271 0.50756-2.699482 1.76418-12.858866-0.63752-40.079834-6.100952-69.136613-42.120306-109.995183-71.061452-142.825916-9.127891-10.354835-17.749246-20.133549-24.387433-29.722952-28.640294-41.37227-31.296797-88.416725-31.396057-90.39887-0.01535-0.311085-0.022513-0.62217-0.022513-0.933255 0-18.779715 9.363252-27.418466 17.624403-35.041074l0.433882-0.401136c0.271176-0.25071 0.442068-0.436952 0.542352-0.556679 0.093121-1.340531-0.566912-4.743024-1.013073-7.04137-0.169869-0.873903-0.339738-1.750877-0.50142-2.632967-7.179516-38.981826-7.670703-99.19214-1.175779-137.837298 2.409886-50.813293 46.224788-89.711208 48.105624-91.356684 0.071631-0.062422 0.143263-0.12382 0.214894-0.185218 6.290263-5.338588 12.671601-11.169387 16.727986-17.636682 0.487094-0.775666 0.827855-1.37737 1.066285-1.836835-0.304945-0.786922-0.741897-1.793856-1.094938-2.608407-2.436492-5.618974-6.118348-14.109346-4.02364-25.02393 1.263783-6.589069 6.078439-18.362206 24.118304-23.173792 7.261381-1.937119 15.022135-2.333138 20.689205-2.62171l1.122567-0.058328c22.38994-1.178849 46.272883-2.176572 70.435189-0.324388 174.730557 13.396101 234.920404 78.686107 237.396805 81.459267 0.140193 0.155543 0.276293 0.314155 0.409322 0.474814 13.986549 16.756639 24.347524 37.635155 30.7964 62.055334 2.01489 7.619538 3.309372 14.016225 4.062526 20.072151 6.102998 35.464723 5.084808 71.904657 3.78214 96.269577-0.732687 13.675464-2.257413 28.030403-4.800329 45.175899-0.691755 4.656043 0.068562 5.564739 0.355087 5.906523 0.75827 0.906649 1.686409 1.892093 2.667759 2.934842 3.862981 4.099365 9.152451 9.713222 11.964496 18.721387 1.410116 4.502547 2.069125 9.360182 2.069125 15.267728 0 0.311085-0.008186 0.62217-0.022513 0.933255-0.099261 1.982144-2.755764 49.0266-31.395034 90.397846-6.639211 9.590426-15.259542 19.36914-24.387433 29.722952-28.942169 32.829709-64.960501 73.689303-71.061452 142.827963-2.4017 27.220968-1.14508 37.379329-0.63752 40.079834 0.678452 1.291412 1.208525 2.664689 1.572822 4.094248 0.036839 0.141216 5.471618 14.613836 67.648726 30.964222 35.7052 9.388834 70.557986 14.146185 70.90591 14.193257 0.303922 0.040932 0.606821 0.090051 0.908696 0.145309 46.095851 8.549723 84.956927 22.991644 115.505687 42.923602 25.252127 16.476253 44.930305 36.7019 58.489112 60.114123 21.50171 37.128619 20.626783 70.714552 20.195971 77.443813l0 22.332634c0 10.326183-8.370645 18.696828-18.696828 18.696828L775.884063 966.602755c-10.326183 0-18.696828-8.370645-18.696828-18.696828s8.370645-18.696828 18.696828-18.696828l158.188812 0L934.072875 924.897911c0-0.686638 0.00921-1.106194 0.081864-1.769296 0.104377-1.508353 1.627057-28.332279-16.349363-58.130955-10.82044-17.937534-26.589588-33.609469-46.870494-46.580898-26.100448-16.693194-59.762105-28.967752-100.05274-36.482913-4.63967-0.642636-39.012526-5.564739-75.080999-15.059997-70.761624-18.629289-87.964424-39.353286-93.189426-54.395888-4.004197-7.765871-6.245238-23.195282-2.984984-60.153008 7.18054-81.369216 49.41955-129.282458 80.260975-164.268274 8.747221-9.921977 16.301268-18.491143 21.693068-26.279526 21.120017-30.510898 24.437575-66.300009 24.765033-70.606081-0.032746-2.252297-0.260943-3.223415-0.36225-3.549849-0.248663-0.798179-1.89721-2.547009-3.490497-4.238534-1.25048-1.327228-2.667759-2.832512-4.136204-4.587482-7.950066-9.504468-10.782577-21.079084-8.66024-35.384905 2.367931-15.960507 3.781116-29.206182 4.449335-41.684378 1.951445-36.502355 0.913812-63.747883-3.363607-88.341001-0.057305-0.326435-0.105401-0.654916-0.145309-0.983397-0.531096-4.438079-1.530866-9.354042-3.14769-15.46932-4.986571-18.884093-12.726859-34.770921-23.006993-47.232744-1.714038-1.747807-15.385409-15.125489-45.883003-29.67588-54.882981-26.183336-120.791064-35.849486-166.417217-39.34817-21.934568-1.681292-44.442188-0.732687-65.614393 0.382717l-1.178849 0.060375c-1.766226 0.090051-4.735861 0.2415-7.55814 0.525979 2.447748 5.841032 5.453199 14.632255 2.296299 25.136493-1.184989 3.939729-3.003404 7.792477-5.723352 12.129248-6.732331 10.733459-15.923668 19.23611-24.054859 26.145473-1.597381 1.441838-34.223452 31.356149-35.351136 65.738213-0.028653 0.86981-0.11768 1.736551-0.267083 2.594081-5.972015 34.304294-5.568832 90.780563 0.898463 125.894292 0.140193 0.765433 0.288572 1.52575 0.435928 2.282996 1.980097 10.205433 5.294586 27.284413-10.879792 42.202171l-0.434905 0.402159c-2.086521 1.924839-4.943592 4.560876-5.41636 5.468548l0 0c0.00307 0-0.13303 0.426719-0.164752 1.584078 0.328481 4.295839 3.654226 40.060391 24.76401 70.554916 5.3918 7.788383 12.945847 16.356526 21.693068 26.279526 30.841426 34.984792 73.079412 82.899058 80.259952 164.266227 3.260254 36.95875 1.019213 52.388161-2.984984 60.154032-5.226025 15.042601-22.427802 35.766598-93.189426 54.395888-36.365232 9.574053-71.006194 14.497179-75.18947 15.074324-39.83424 6.958482-73.196069 18.883069-99.160417 35.44528-20.185738 12.876262-35.971259 28.599362-46.919613 46.732347-18.282389 30.281677-17.133216 57.860802-17.055444 59.33641 0.050142 0.543376 0.054235 0.867764 0.054235 1.433652l0 4.309142 427.01135 0 35.287691-0.271176c0.047072 0 0.095167 0 0.143263 0l22.423709 0c0.141216 0 0.280386 0.001023 0.421602 0.005117 2.895957 0.064468 71.446215 1.943258 116.949572 31.803333 8.633634 5.665023 11.039427 17.254989 5.374404 25.888624C715.458855 992.104569 709.488887 995.074204 703.400215 995.074204zM631.466905 689.8762c0.454348 0.36839 0.890276 0.757247 1.305739 1.164522C632.378671 690.653913 631.943766 690.26301 631.466905 689.8762zM414.041968 689.8762c-0.471744 0.382717-0.901533 0.768503-1.292436 1.152243C413.160901 690.626283 413.592736 690.24152 414.041968 689.8762z\" fill=\"#FF9000\" /></svg>"
}
]
},
"pagination": {
"page": 1,
"pageSize": 100,
"total": 1
},
"searchParams": {
"q": "user",
"sortType": "updated_at",
"sType": "",
"fromCollection": -1,
"fills": ""
}
}
Caching
The server includes built-in caching for improved performance:
- Cache expiry time: 30 minutes
- Supports search result caching
- Provides cache statistics and cleanup functionality
Quick Start
1. Install Package
npm install -g @liangshanli/mcp-server-icon
2. Configure Cursor Editor
Create .cursor/mcp.json file in your project root:
{
"mcpServers": {
"icon": {
"command": "npx",
"args": ["@liangshanli/mcp-server-icon"],
"env": {
"LANGUAGE": "en",
"WEB_SERVER_AUTO_OPEN": "true"
}
}
}
}
3. Restart Cursor
Restart Cursor editor to load the new MCP server configuration.
4. Start Using
The icon search tools will be available in Cursor's MCP interface.
Requirements
- Node.js 18.0.0 or higher
- No external dependencies (uses built-in fetch)
Development
Project Structure
mcp-server-icon/
├── src/
│ ├── server-final.js # Main server file
│ ├── server-final-http.js # HTTP server file
│ ├── utils/ # Utility classes directory
│ │ ├── http-server.js # HTTP server utility class
│ │ ├── web-interface.js # Web interface handler
│ │ ├── window-utils.js # Window utility class
│ │ ├── search-icons.js # Icon search utility
│ │ ├── cache-manager.js # Cache management utility
│ │ ├── web-server-manager.js # Web server management utility
│ │ ├── icon-saver.js # Icon saving utility
│ │ └── selection-checker.js # Selection status checker utility
│ └── lang/ # Multi-language support
│ ├── index.js
│ ├── en.js
│ └── zh-CN.js
├── bin/
│ └── cli.js # CLI entry point
├── start.js # Startup script
├── start-server.js # Server startup script
├── package.json
└── README.md
Development Environment Setup
- Clone the repository
git clone https://github.com/liliangshan/mcp-server-icon.git
cd mcp-server-icon
npm install
- Set up environment variables
# Language settings
export LANGUAGE=en
export WEB_SERVER_AUTO_OPEN=true
# Logging settings
export MCP_LOG_DIR=./logs
export MCP_LOG_FILE=mcp-icon.log
- Run in development mode
npm run dev
Testing
npm test
License
MIT License
Author
liliangshan
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。