ILens

io.github.tadis174由 GitHub 帳號 tadis174 發布v11更新於 Nov 1, 2026

Inspect compiled .NET assemblies (Windows): find types, decompile to C#, trace usage, compare builds

已驗證STDIO僅桌面檔案與儲存開發者工具

概覽

AI 產生的概覽

本機 Windows MCP 伺服器,讓助理檢查已編譯的 .NET 組件:列出型別與成員、反編譯方法、追蹤交互參照。

可以做什麼
  • 列出命名空間中的型別,以及某個型別的成員(不含方法主體)
  • 依名稱尋找方法,並找出哪些型別公開了指定方法
  • 將單一方法主體反編譯為 C#,並搜尋程式碼
  • 執行交互參照分析:呼叫端、覆寫、實作、擴充方法、屬性使用
  • 顯示已設定的允許根目錄,讓助理知道可存取的範圍
適用情境
當助理需要在 Windows 機器上理解已編譯的 .NET DLL 或 EXE(API 介面、呼叫端或某個方法的邏輯),又不想把整個檔案塞進上下文時適用。它旨在取代為了定點查詢而呼叫 ildasm 或 ilspycmd。
執行需求
Windows 10/11 x64;二進位檔自包含,不需另外安裝 .NET 執行階段。透過 winget 安裝,並在 .mcp.json 中以指令名稱註冊。必須至少傳入一個 --allow-root 目錄,否則無法載入任何組件;可選 --max-total-size 設定記憶體預算(預設 200 MB)。首次安裝後可能需要完整重新啟動用戶端。
安裝前請注意
README 稱其為唯讀且不連網,並具備路徑包含檢查與記憶體預算,但安全模型僅部分獲得保證。只應把願意暴露給助理的目錄設為 --allow-root。反編譯輸出一律為 C#,因此由 F#、VB.NET 或 C++/CLI 編譯的組件可能呈現不準確。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 ILens,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

ILens

An MCP server that lets AI agents inspect compiled .NET assemblies — list types, decompile methods, run cross-reference analysis — without burning tokens on full-file dumps.

Why

The default fallback for an AI agent inspecting a compiled .NET assembly is to shell out to ildasm (IL dump) or ilspycmd (full-C# decompile). Both dump an entire file as text, and that output stays in the agent's context as input tokens on every subsequent turn — quickly thousands of tokens spent inspecting a single class.

Taskilspycmd costILens toolILens cost
List the public types in a namespace1,041,476 tokensfind_types1,109 tokens
See the API surface of one mid-sized class1,041,476 tokenslist_members562 tokens
Find which types expose a given method1,041,476 tokensfind_methods526 tokens

Measured against ICSharpCode.Decompiler.dll 9.1.0.7988 on 2026-10-31; token figures are character counts divided by 4, not a real tokenizer.

ILens turns assembly inspection into bounded, targeted lookups: list types in a namespace, list one type's members without bodies, find methods by name, decompile a single method body, run cross-reference analysis (callers, overrides, implementations, extension methods, attribute usage). Each call returns a focused response — making it cheap enough to leave registered as an always-available tool.

Scope

ILens is built for inspecting C# assemblies, and its output is C#. The metadata-driven tools (find_types, find_methods, list_members, analyze) read language-agnostic metadata and work on an assembly from any .NET language. decompile, search_code and analyze's call_sites kind always emit C# — for an assembly compiled from F#, VB.NET, or C++/CLI they still run, but constructs without a C# equivalent may render unfaithfully.

Built on ILSpy

ILens would be nothing without ILSpy. The decompiler, the analyzer, the type system that lets ILens speak about a .NET assembly in C# terms at all — none of that is ILens's. It belongs to the ILSpy team. The two libraries ILens links — ICSharpCode.Decompiler for the decompiler proper, ICSharpCode.ILSpyX for the analyzer infrastructure — represent more than a decade of careful work; this project is, candidly, a thin MCP shim on top.

That work is MIT-licensed, which is the only reason ILens can exist. If ILens is useful to you, please consider giving ILSpy a star. They earned it.

To be clear: bug reports and feature requests about ILens belong on the ILens issue tracker, not ILSpy's. Please don't take downstream problems to the upstream maintainers — they have enough work of their own.

Installation

System requirements: Windows 10/11, x64. The binary is self-contained — no separate .NET runtime install required.

powershell
winget install Tadis.ILens

Standard winget portable install. The binary lands under %LOCALAPPDATA%\Microsoft\WinGet\Packages\ and ilens becomes available on your user PATH automatically. No admin elevation needed.

See the user guide for alternative installers, updating, and installation troubleshooting.

Setup

Step 1: Register the server

Add an entry to .mcp.json in your project root. The installer adds ilens to your PATH, so the command field references the binary by name — no full path needed:

json
{  "mcpServers": {    "ilens": {      "command": "ilens",      "args": [        "--allow-root", "C:\\path\\to\\dlls"      ]    }  }}

Each --allow-root flag adds a directory tree from which assemblies may be loaded. Without any --allow-root flags, the server cannot load any assemblies. Tool calls supply the assembly path per request; the server validates that the path is inside one of the configured roots, rejects path traversal (..), resolves symbolic links and junctions before re-checking containment, and keeps its memory within a budget (default 200 MB, --max-total-size <MB>) by closing the assemblies used longest ago.

Tool calls then specify which assembly to inspect:

find_types(assembly="C:\\path\\to\\dlls\\MyApp.dll", namespace="MyApp.Models")

The list_allowed_roots tool surfaces the configured roots so the agent can discover what's reachable.

Heads up — a first install needs a full restart, not just a new session. Windows captures PATH per-process at launch, so an already-running Claude app holds a stale environment whenever ilens is a brand-new entry on user PATH (true for a first-ever winget portable install, or any install.ps1 run). Claude Code reads .mcp.json only at session start, so the new server isn't registered in any running session either. Recipe: close Claude app entirely → install ILens → relaunch Claude app → start a new Claude Code session in the relaunched app. Resumed sessions survive a Claude app restart and still hold the old environment, so they won't find ilens. Subsequent winget upgrade Tadis.ILens runs don't change PATH; they only need a fresh Claude Code session.

Step 2: Clients that do not read server instructions

When a client connects, ILens sends it MCP server instructions: what ILens is for, which directories it can read, and which tool answers which question. Claude Code reads them at the start of every session, in the terminal and in the Claude desktop app's Code tab, so with Claude Code, Step 1 is the whole setup.

Claude Desktop's chat does not read server instructions. For it, and for any other client that does not, add this paragraph to the client's instructions and replace <allow-root> with the directory configured above. It names no tool, so it stays correct when a release renames or merges tools:

markdown
## Inspecting .NET assemblies
Assemblies under `<allow-root>` are reachable through the `ilens` MCP server.Prefer its tools over running `ildasm` or `ilspycmd` in a shell, readingassembly files directly, or searching the web for source.

If your project's CLAUDE.md or a client's instructions hold the block an earlier ILens README asked you to paste, delete it: it names tools that no longer exist. A client that does not read server instructions takes the paragraph above in its place.

Full reference

A self-contained HTML user guide covers what this README does not:

  • Per-tool reference — every tool, every parameter (with required / optional flags and types), return shape, and full list of error conditions
  • Alternative integration paths — claude mcp add CLI command, Claude Desktop config
  • Security model — what's enforced (--allow-root mandatory, no traversal, no network, 200 MB memory budget, read-only), and what's not
  • Troubleshooting — error string → likely cause mapping

Read it online at https://tadis174.github.io/ILens/guide.html, or open the bundled guide.html from the release ZIP.

Building from source

If you'd rather build the binary yourself:

bash
dotnet build -c Releasedotnet publish -c Release

The publish target produces Build/dist/ILens.exe along with LICENSE, README.md, guide.html, and third-party-licenses/. The working tree must be clean before publishing, and Build/doc/guide.html must exist (run the project's /doc skill to regenerate it).

License

ILens is released under the MIT License. Third-party dependencies are documented in third-party-licenses/INDEX.md, included in each release alongside the per-source license texts.

來源:README.md,提交 3267535

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v11最新Nov 1, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分