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 分