支持MCP服务器的.NET装配的无头CLI反射调试器
概览
一个由 ICSharpCode.Decompiler(dnSpyEx 引擎)驱动的静态 .NET 汇编分析模型上下文协议服务器。作为 stdio 上的 MCP 工具,公开反编译、IL 反汇编、元数据检查和保护分析。从不执行目标汇编。 - .NET 8 SDK 或更高版本 - 兼容 MCP 客户端(Claude Desktop、Cursor 或任何支持 MCP 标准传输的客户端) detect_anti_debug、detect_anti_tamper 和 get_protection_report 仅执行静态分析。目标汇编从不以 .NET 类型加载,也不会 JIT 编译,也不会执行。分析仅使用 ICSharpCode.Decompiler 的类型系统和 PE 读取器。 - 针对已知反调试 API(如 IsDebuggerPresent、NtQueryInformationProcess 等)的 P/Invoke 声明- 托管 API 使用情况(System.Diagnostics.Debugger.IsAttached 等)
概述(AI 翻译)
一个由 ICSharpCode.Decompiler(dnSpyEx 引擎)驱动的静态 .NET 汇编分析模型上下文协议服务器。作为 stdio 上的 MCP 工具,公开反编译、IL 反汇编、元数据检查和保护分析。从不执行目标汇编。
要求
- .NET 8 SDK 或更高版本
- 兼容MCP客户端(Claude桌面、光标或任何支持MCP标准传输的客户端)
安装
Claude Desktop Configuration
加到claude_desktop_config.json:
工具
| 工具 | 说明 | 关键参数 |
|---|---|---|
get_pe_info |
获取PE/COFF头信息、装配元数据和目标框架 | assemblyPath |
get_resources |
列出嵌入装配中的所有显单资源 | assemblyPath |
resolve_token |
将元数据令牌(十六进制,例如 0x02000001)解析为其定义 |
assemblyPath, tokenHex |
list_pinvokes |
列出汇编中所有P/Invoke(DllImport)声明 | assemblyPath |
find_attributes |
查找所有带有特定属性装饰的类型和方法 | assemblyPath, attributeName |
本页由 AI 翻译,技术细节请以原文为准。
README
以下为原文 README 节选,完整内容请查看原文。
dnSpy-MCP
A Model Context Protocol server for static .NET assembly analysis powered by ICSharpCode.Decompiler (dnSpyEx engine). Exposes decompilation, IL disassembly, metadata inspection, and protection analysis as MCP tools over stdio. Never executes target assemblies.
Requirements
- .NET 8 SDK or later
- Compatible MCP client (Claude Desktop, Cursor, or any client supporting MCP stdio transport)
Installation
git clone https://github.com/ZeraTS/dnSpy-MCP.git
cd dnSpy-MCP
dotnet build src/DnSpyMcp/DnSpyMcp.csproj -c Release
Claude Desktop Configuration
Add to claude_desktop_config.json:
{
"mcpServers": {
"dnspy-mcp": {
"command": "dotnet",
"args": ["/path/to/src/DnSpyMcp/bin/Release/net8.0/DnSpyMcp.dll"]
}
}
}
Tools
| Tool | Description | Key Parameters |
|---|---|---|
get_pe_info |
Get PE/COFF header information, assembly metadata, and target framework | assemblyPath |
get_resources |
List all manifest resources embedded in the assembly | assemblyPath |
resolve_token |
Resolve a metadata token (hex, e.g. 0x02000001) to its definition |
assemblyPath, tokenHex |
list_pinvokes |
List all P/Invoke (DllImport) declarations in the assembly | assemblyPath |
find_attributes |
Find all types and methods decorated with a specific attribute | assemblyPath, attributeName |
get_methods_for_type |
Get all methods defined on a specific type | assemblyPath, typeName |
decompile_assembly |
Decompile the entire assembly to C# source code | assemblyPath |
decompile_type |
Decompile a specific type to C# source code | assemblyPath, typeName |
decompile_method |
Decompile a specific method to C# source code | assemblyPath, typeName, methodName |
dump_il |
Dump IL (CIL) disassembly for the whole assembly, a type, or a specific method | assemblyPath, typeName?, methodName? |
inspect_type |
Inspect a type’s structure: fields, methods, properties, interfaces, optionally with source | assemblyPath, typeName, includeSource? |
inspect_method |
Inspect a specific method: signature, parameters, decompiled source, optionally IL | assemblyPath, typeName, methodName, includeSource?, includeIL? |
list_types |
List all type definitions in the assembly | assemblyPath |
find_methods |
Find methods in the assembly, optionally filtered by name pattern | assemblyPath, pattern? |
search_strings |
Search for string literals in the assembly’s decompiled source | assemblyPath, pattern, useRegex? |
search_members |
Search for types, methods, fields, and properties by name pattern | assemblyPath, pattern |
set_breakpoint |
Set a virtual breakpoint on a method at a specific IL offset | assemblyPath, typeName, methodName, ilOffset |
list_breakpoints |
List all active virtual breakpoints |
安装
This server does not publish a one-line install command.
Open the repository installation guide 新手?先看 mcpskill.org 教程 →配置
{
"mcpServers": {
"dnspy-mcp": {
"command": "dotnet",
"args": ["/path/to/src/DnSpyMcp/bin/Release/net8.0/DnSpyMcp.dll"]
}
}
}