
TrueIcon
io.github.manikumarkv由 GitHub 帳號 manikumarkv 發布v0.6.0更新於 Oct 24, 2026
Lets AI coding assistants search the icon packages actually installed in your project.
概覽
一個本機 MCP 伺服器,讓 AI 程式設計助理搜尋專案實際安裝的圖示套件,並取得真實存在的圖示名稱與匯入語句。
- 可以做什麼
- 依查詢搜尋圖示套件,可依樣式、圖示集、提供者與結果數量篩選,回傳排序後的符合項目以及可直接貼上的匯入語句與用法片段,涵蓋 React、Vue 與 Svelte 套件。依名稱或匯入名稱查詢單一圖示,取得完整記錄,包括標籤、關鍵字與內部 SVG 標記。列出目前使用的專案目錄及其判定方式、專案使用的圖示套件與解析出的版本,以及所有支援的提供者。執行健康檢查。
- 適用情境
- 適合助理撰寫介面程式碼時容易憑空編造圖示名稱,或從錯誤的函式庫、過舊版本中挑選名稱的情況。適用於已依賴支援圖示套件(如 Lucide、Heroicons、react-icons、MUI、Font Awesome 及其 Vue、Svelte 版本)且需要精確、版本正確匯入語句的專案。
- 執行需求
- 以 stdio 在本機執行;需要 Node.js 20 或更新版本,通常以 npx 啟動。需要包含 package.json、.iconmcp.json 或 node_modules 的專案目錄,可透過 MCP roots、工作目錄或 TRUEICON_PROJECT_DIR 定位。需要連線 npm 登錄檔以下載套件壓縮檔。選用的 TRUEICON_CACHE 可設定快取目錄;選用的語意搜尋需要 @huggingface/transformers 套件並下載本機模型。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 TrueIcon,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
TrueIcon
[npm] [Install in VS Code] [Install in VS Code Insiders] [Install in Cursor]
TrueIcon is an MCP server that gives AI coding assistants exact, version-correct icon references. Your assistant searches the icon packages your project actually uses (lucide-react, react-icons, @heroicons/react, @phosphor-icons/react, @tabler/icons-react, iconoir-react, @fluentui/react-icons, @carbon/icons-react, @ant-design/icons, @mui/icons-material, @radix-ui/react-icons, @remixicon/react, the Font Awesome Free packages, and the Vue and Svelte packages of Lucide, Heroicons, Tabler and Phosphor) and gets back real icon names, import paths and a ready-to-paste import line.
Why
AI assistants often guess icon names. The guess can be an icon that never existed, one renamed a few releases ago, or one from a different library, and you only find out when the build fails. TrueIcon closes that gap:
- It reads which icon packages and versions your project uses.
- It downloads those exact versions from npm and indexes every icon once.
- The assistant calls
search_iconsand gets results that are guaranteed to exist in that version, for exampleimport { Trash2 } from 'lucide-react';.
Supported providers
Vue and Svelte
These index the same artwork as the React packages above, with each package's own component names and import paths.
Heroicons has no official Svelte package. Angular packages aren't supported yet.
Tools accept either the provider id or the npm package name ("lucide" or "lucide-react"). Usage snippets are import lines, which work the same way in React, Vue and Svelte. Phosphor weights all share one component, so pass the record's style as the weight prop (e.g. <TrashIcon weight="bold" />); the usage snippet only shows the import. Font Awesome imports are icon definitions, not components: render them with @fortawesome/react-fontawesome, e.g. <FontAwesomeIcon icon={faTrashCan} />.
Install
TrueIcon needs Node.js 20 or newer.
trueicon is a stdio MCP server. Your MCP client starts it; running it by hand only prints trueicon: v<version> running on stdio to stderr and waits for JSON-RPC on stdin.
Quick start
- Register TrueIcon with your MCP client (Claude Code, Claude Desktop, or VS Code and Cursor).
- Ask your assistant for an icon.
That's it for most projects. TrueIcon finds the icon packages your package.json lists and the versions installed in node_modules. The first search for each package downloads and indexes it, which takes a few seconds. Later searches use the local cache.
Configuration
Which icon packages are searched
- By default, every supported package listed in
dependenciesordevDependenciesof yourpackage.json. - With
.iconmcp.jsonin the project, exactly the packages it lists. Use it to search only some of your icon packages, to add one yourpackage.jsondoesn't list (for example one that comes in through a UI kit), or to pin a version.
- Unsupported packages in
.iconmcp.jsonare skipped, andsearch_iconsreports them as a warning. - Invalid JSON or a malformed entry makes the tools return an error that names the file and the bad field.
- If neither file names a supported package,
search_iconsreturns an error that says which directory it looked in. You can still passproviderto a tool call.
Semantic search (opt-in)
Set "semantic": true in .iconmcp.json to add meaning-based ranking to search_icons. Each query is embedded with a small local model (all-MiniLM-L6-v2, ~90MB downloaded once to the transformers.js cache) and matched against per-icon vectors built at index time; those semantic candidates are merged with the keyword results using reciprocal rank fusion, so exact-name matches still win while conceptual queries like "remove background" can surface eraser.
Semantic search runs on @huggingface/transformers, which is an optional peer dependency and is not installed by default, so installs that never enable the flag stay lean. To enable semantic search, install it once (about 400MB) alongside trueicon:
If the flag is on but the package is missing, search_icons and get_icon fall back to keyword-only indexes and return a one-line warning with the install command.
Toggling the flag rebuilds the indexes once (vectors are stored in index.json alongside each record, and meta.json records the embedding model). It stays fully local: no data leaves your machine. TRUEICON_SEMANTIC=1 (or 0) overrides the flag for one-off runs.
Which directory is the project
TrueIcon reads package.json, .iconmcp.json and node_modules from the project directory. It picks the first of:
$TRUEICON_PROJECT_DIR, when set.- A folder your MCP client shares with the server (MCP roots) that contains a
package.jsonor.iconmcp.json. Clients that support roots, like VS Code, tell TrueIcon which folders you're working in, so it follows your open project without any setup. - The server's working directory, when it contains one of those files. Claude Code starts servers in your project, so this is how it finds it.
- The first shared folder, else the working directory.
list_providers shows the directory in use and which rule picked it, so you can check what your client does.
Environment variables
Versions
Auto-detection
A provider's version is resolved in this order:
- The
versionargument passed to the tool call, if any. - The provider's
versionin.iconmcp.json. - The version installed in
node_modules, looking in the project directory and then each parent directory, so packages hoisted to a monorepo root are found. - The version range declared for the package in the project's
package.json, checkingdependenciesfirst and thendevDependencies.
If none of these is available, the tool asks you to pin the version or add the package to package.json. TrueIcon doesn't read your lockfile, and it downloads its own copy of the package from npm rather than using the files in node_modules. For a range, it indexes the range's base version: ^0.460.0 indexes [email protected]. For a || b ranges, only the first part counts. Before you run npm install, that base version can be older than what you'll get, so pin it in .iconmcp.json if the exact version matters.
Version policy
Indexes are keyed by major.minor:
- Patch versions are ignored. One index serves all of
0.460.x. The index built from0.460.0answers requests for0.460.3. - A minor change gets its own index. Bumping
lucide-reactfrom0.460to0.461builds a fresh index on the next search, with no manual step. - Majors are strict. A different major is always a separate index and is never served from another major's index.
- Cached indexes rebuild automatically when the bundled
synonyms.jsonchanges (detected by hash) or the index format changes.
Using it with Claude
Claude Code
Add TrueIcon from your project directory:
Or commit a .mcp.json at the project root to share it with your team:
Claude Code starts the server in your project directory, so it finds your package.json there with no setup. If it runs from somewhere else, add "env": { "TRUEICON_PROJECT_DIR": "/absolute/path/to/project" }.
Claude Desktop
Claude Desktop doesn't start servers in your project directory, so set TRUEICON_PROJECT_DIR. If your version of Claude Desktop shares folders with servers, TrueIcon uses those instead; list_providers shows which directory it picked. Edit claude_desktop_config.json: ~/Library/Application Support/Claude/claude_desktop_config.json on macOS, %APPDATA%\Claude\claude_desktop_config.json on Windows.
Restart Claude Desktop after editing the file.
Using it in VS Code and Cursor
Use the install badges at the top of this README. They add TrueIcon with TRUEICON_PROJECT_DIR set to ${workspaceFolder}, so it searches the project you have open.
To add it by hand in VS Code, create .vscode/mcp.json in your project:
In Cursor, use the same entry under "mcpServers" in .cursor/mcp.json.
Tools
Every tool returns a single JSON text block. On failure, the block is {"error": "..."} and the MCP result is flagged with isError: true.
search_icons
Searches the index and returns ranked matches with import statements.
Example call:
Response:
How search works:
-
provider,styleandsetare exact, case-insensitive filters. They are applied before ranking. -
Candidates come from Fuse.js fuzzy matching over the icon name, import name, keywords and tags. Small typos are tolerated:
"detele"findsDelete. -
Icons whose name answers the query rank first, compared on the name without its style suffix (
delete-bin-line→delete-bin):- the name is the query:
deletefindsdelete,delete-outlined,DeleteRegular - the name starts with the query:
delete-bin-line - the query is a phrase inside the name:
"arrow right"findscircle-arrow-right - every query word is in the name, a synonym or a tag:
trashfindsrestore-from-trash, anddeletethrough the trash → delete synonym
Within a level, shorter names come first, so the plain icon beats composites (
deletebeforerestore-from-trash), and each icon's styles stay together with the default style first. Variant numbers are ignored unless the query has one, sotrashrankstrashthentrash-2. Everything else, such as typos, follows the fuzzy score. - the name is the query:
-
scoreruns from0(perfect) to1, so lower is better. It encodes the ranking above, so results from several providers are merged and sorted by score without losing it. -
Multi-word queries are tokenized: each word is matched on its own, only icons that match every word are kept, and they are ranked by their average score. So
"trash can"findstrash-canicons. Short keyword queries ("trash","settings","beer") still cast the widest net. -
If one provider fails, for example because its version can't be resolved or the download fails, its results are skipped and a
warningsarray explains why. The other providers still return results.
list_providers
Takes no arguments. Returns the project directory TrueIcon reads and how it was found, the providers the project uses with their resolved versions, and every provider TrueIcon supports.
project.sourceis"TRUEICON_PROJECT_DIR","roots"(a folder your MCP client shared) or"cwd"(the server's working directory). See Which directory is the project.providersFromis"iconmcp.json","package.json", ornullwhen neither names a supported package.- Each provider's
sourcesays where its version came from:"iconmcp.json","node_modules"or"package.json".versionandsourcearenullwhen none provides a version.idisnullfor a package in.iconmcp.jsonthat TrueIcon doesn't support.
get_icon
Gets the full record and import statement for an icon whose name the assistant already knows.
Example call:
Response:
svg is the icon's inner SVG markup, meaning the children of the root <svg> element. Heroicons uses the same import name in every size and style (TrashIcon). Pass the full variant name, such as "trash-24-outline", to get a specific one.
ping
A health check that returns {"status":"ok","server":"trueicon"}.
Indexing and caching
The first time a tool needs [email protected], TrueIcon does the following:
- It downloads the package tarball from
https://registry.npmjs.org, verifies its sha512 integrity, and extracts it into the cache. - It parses the package's shipped files with the provider's adapter. Nothing is executed. Icons are read from the compiled source.
- It writes
index.json(one record per icon) andmeta.json(exact version, synonyms hash, index format, build time).
Later calls only read index.json. Package files are never touched at query time. From your node_modules, TrueIcon only reads each icon package's package.json to get the installed version, and it never modifies anything there. If several tool calls need the same index at once, they share one download.
The cache root is ~/.trueicon/cache, or $TRUEICON_CACHE if set:
- Downloads go to
<package>@<major.minor>, where scoped names are flattened:@heroicons/reactbecomesheroicons-react. A.download-completemarker is written last, and a directory without it is treated as partial and replaced. - Indexes go to
<package>@<major.minor>/index.jsonandmeta.json. For unscoped packages this is the same directory as the download. - The cache is safe to delete. It is rebuilt on demand, which needs network access.
Each record's keywords combine the name parts, the tags, and synonym expansions from the bundled synonyms.json. The expansions are added at index time, so "bin" finds Trash2 without any extra work at query time.
Contributing
CI runs lint, typecheck and tests on Node 20 and 22 for every push and pull request.
In Claude Code on the web, a SessionStart hook (.claude/hooks/session-start.sh) installs the dependencies when a session starts, so these commands work straight away. It installs with --ignore-scripts because the sandbox blocks the native download in the optional semantic-search dependency; the semantic tests that need it are skipped there.
Tests
The fixtures only change when someone edits them, so they can't catch a provider that changes its package format upstream. npm run smoke does. Run npm run smoke -- lucide tabler to check only some providers. CI runs it on pull requests that change src/providers/, src/indexer/ or src/cache/, and every Monday against the latest releases.
Testing and debugging locally
These scripts build the server and run it against playground/, a sample project that lists all 24 providers at their latest versions. They use a separate cache in .cache/dev/, so your real ~/.trueicon cache is untouched.
- Arguments are
key=valuepairs. Numbers and booleans are parsed, solimit=5is sent as a number. - Another project: set
TRUEICON_PROJECT_DIRto test against itspackage.jsonand.iconmcp.json, e.g.TRUEICON_PROJECT_DIR=~/code/my-app npm run dev:inspect. - Rebuild indexes: add
--freshto delete the dev cache first, e.g.npm run dev:call -- --fresh search_icons query=trash. Use it after changing an adapter. - Breakpoints: run
npm run dev:debug, then in VS Code use Debug: Attach to Node Process, or openchrome://inspectin Chrome. Source maps are on, so breakpoints work in the.tsfiles undersrc/. Set them, then call a tool from the Inspector. - Logging: stdout carries the MCP protocol, so log with
console.error. It shows in the terminal fordev:calland in the Inspector's server log fordev:inspect. - Manual test prompts:
playground/TEST-PROMPTS.mdis a checklist of prompts to run in an MCP client against the playground, with the expected tool calls and results. It covers every tool, all 15 providers, ranking, configuration errors and semantic search. Run it before a release.
Extending synonyms.json
src/synonyms/synonyms.json maps a term to extra search terms:
- Keys are matched against an icon's name parts (the name split on
-) and its tags.trash-2matches the keytrash. - Values are added to that icon's
keywords. - Expansion is one-way. If
binshould also find icons nameddelete, add both"trash": ["bin"]and"delete": ["bin"], or add a reverse entry. - Write keys and values in lowercase, and give every key a non-empty array of strings.
tests/synonyms.test.tschecks this. - Changing the file changes its hash, so cached indexes rebuild automatically on the next search.
Adding a provider
- Register it in
src/providers/registry.tswith a stableid, the npmpackageand a shortdescription. - Write an adapter in
src/providers/adapters/<provider>.tsthat exportsparseIcons(packageDir: string): RawIcon[](seesrc/providers/adapter.ts). It gets the extracted package directory and returns oneRawIconper icon:name: kebab-case and unique within the package, because it becomes part of the record id. UsetoKebabCasefromadapter.ts. If the package has variants with clashing component names, add the variant to the name, as the heroicons, react-icons, phosphor and iconoir adapters do.importNameandimportPath: the exact export and module specifier a user would import.svg: the inner SVG markup.LiteralCursor(src/providers/jsLiteral.ts) parses JS object and array literals without executing code.toSvgAttrsandrenderSvg(src/providers/svg.ts) turn React props into SVG markup, andparseCreateElementreads compiledcreateElement(...)trees.- Optional
style,set,categoriesandtags. - Put a comment at the top of the adapter describing the package's file layout, as the existing adapters do.
- Wire it up in
src/providers/adapters/index.tsby adding it toADAPTERSunder the provider id. - Test it. Add a small pinned fixture under
tests/fixtures/<provider>/that mirrors the package layout, with a few real icon files plus any files the adapter must skip. Then addtests/adapters/<provider>.test.ts, covering name mapping, import paths, SVG output andbuildIndexrecord ids like the existing adapter tests.tests/adapters/common.test.tsfails if a registered provider has no adapter. - Add it to the tool tests by adding a case to
CASESintests/providers-tools.test.ts: the fixture, a search query, one icon with its exact import line, and a deprecated alias if the package has them. The test fails if a registered provider has no case. - Add smoke targets to
TARGETSinscripts/smoke.mjs: a few well-known import names and a minimum icon count well below the real one. Then runnpm run smoke -- <provider>to check it against the real published package.
License
MIT © 2026 manikumarkv
來源:README.md,提交 d06a82f
工具
0版本歷史
5- v0.6.0最新Oct 1, 2026
- v0.5.0Sep 29, 2026
- v0.4.0Sep 26, 2026
- v0.3.1Sep 24, 2026
- v0.1.1Sep 23, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分