TD

tuna1999/dnspy-mcp

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

85 stars 16 forks 质量 70 趋势 9

tuna1999/dnspy-mcp 是从 https://github.com/tuna1999/dnspy-mcp. 导入的 MCP 服务器候选服务器

概览

tuna1999/dnspy-mcp 是从 https://github.com/tuna1999/dnspy-mcp. 导入的 MCP 服务器候选服务器

概述(AI 翻译)

一个用于 dnSpy 的模型上下文协议(MCP)服务器——.NET 调试器和汇编编辑器——使 AI 代理能够通过 dnSpy 引擎直接反编译、分析、搜索和修补 .NET 汇编。

精彩片段

  • 55个MCP工具 — 静态分析、IL补丁和集成调试器控制(36个无头工具)
  • 字节相同的反编译器输出 — 由dnSpy.exe使用的相同ICSharpCode.Decompiler流水线驱动
  • 两主机,一核心 — 可作为dnSpy扩展(HTTP)或独立无头exe(stdio)运行;工具和输出完全相同
  • 零拖传输 — 该扩展采用最小的 TcpListener HTTP 传输,避免与 dnSpy 运行时的版本冲突
  • 默认加固 — 回环绑定、恒定时间令牌认证、并发限制、请求大小限制、每个工具超时、串行变异
  • 批处理准备 — JSON-RPC 批处理请求(发送数组,获得有序结果);请求按连接顺序运行,因此需要多个连接以实现吞吐量

工作原理

两个主机共享一个工具核心([dnSpy.MCP.Core):

  • 扩展 — 运行于 dnSpy 内部,并集成完整的 UI 功能(树状视图、制表表、输出面板)。

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

dnSpy MCP Server

A Model Context Protocol (MCP) server for dnSpy — the .NET debugger and assembly editor — enabling AI agents to decompile, analyze, search, and patch .NET assemblies directly through dnSpy’s engine.

Highlights

  • 55 MCP tools — static analysis, IL patching, and integrated debugger control (36 tools in headless)
  • Byte-identical decompiler output — powered by the same ICSharpCode.Decompiler pipeline dnSpy.exe uses
  • Two hosts, one core — run as a dnSpy extension (HTTP) or a standalone headless exe (stdio); identical tools and output
  • Zero-drag transport — the extension uses a minimal TcpListener-based HTTP transport, avoiding version conflicts with dnSpy’s runtime
  • Hardened by default — loopback bind, constant-time token auth, concurrency caps, request-size limits, per-tool timeouts, serialized mutations
  • Batch-ready — JSON-RPC batch requests (send an array, get ordered results); requests run sequentially per connection, so use several connections for throughput

How It Works

Two hosts share one tool core (dnSpy.MCP.Core):

┌─ Extension (in dnSpy) ─────────────────┐   ┌─ Headless (standalone exe) ─────────┐
│ dnSpy loads extension → MCP Server     │   │ dotnet dnspy-mcp-headless.dll       │
│ menu → Start → TcpListener on :5150    │   │ --load foo.dll (repeatable, globs)  │
│              ↕                         │   │              ↕                      │
│   AI agent — HTTP POST (JSON-RPC 2.0)  │   │   AI agent — stdio (MCP SDK)        │
└────────────┬───────────────────────────┘   └──────────────┬──────────────────────┘
             └──────────► dnSpy.MCP.Core ◄──────────────────┘
                         (36 tools + decompiler bridge,
                          output identical to dnSpy.exe)
  • Extension — runs inside dnSpy with full UI integration (tree view, tabs, Output pane). Started manually from the MCP Server menu so WPF is fully initialized before any tool call touches the UI thread.
  • Headless — standalone stdio MCP server for batch analysis: same tools, same decompiled output, no UI, no dnSpy install required at analysis time (only the vendored decompiler DLLs in deps/).

Tools (55 total · 36 in headless)

Decompiler

Tool Description
decompile_method Decompile a method to C#. Accepts full name (Namespace.Class::Method), metadata token (0x06000001), or partial name
decompile_type Decompile an entire type (all members) to C#
decompile_assembly Decompile all types in the assembly (limited to 10 for brevity)
Tool Description
在 GitHub 查看完整 README

安装

This server does not publish a one-line install command.

Open the repository installation guide 新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "dnspy-headless": { "command": "dotnet", "args": [ "D:\\path\\to\\publish\\headless\\dnspy-mcp-headless.dll", "--load", "D:\\path\\to\\target.dll" ] } } }