dnSpy-MCP logo

dnSpy-MCP

Community
notgate

Headless CLI reflection debugger for .NET assemblies with MCP server support

Publishernotgate
RepositorydnSpy-MCP
LanguageC#
Forks
2
Stars
19
Available tools
0
Transport typestdio
Categories
Links
  • Connect tools to AI workflows

    dnSpy-MCP exposes MCP capabilities that can be used by compatible AI clients and agents.

  • 0 available tools

    Browse the callable actions below, including names and descriptions when provided by the server.

  • Ready-to-copy setup

    Use the installation snippets to configure this server in your preferred MCP client.

  • Open source signals

    19 stars and 2 forks from the linked repository.

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:

json
{
  "mcpServers": {
    "dnspy-mcp": {
      "command": "dotnet",
      "args": ["/path/to/src/DnSpyMcp/bin/Release/net8.0/DnSpyMcp.dll"]
    }
  }
}

Tools

ToolDescriptionKey Parameters
get_pe_infoGet PE/COFF header information, assembly metadata, and target frameworkassemblyPath
get_resourcesList all manifest resources embedded in the assemblyassemblyPath
resolve_tokenResolve a metadata token (hex, e.g. 0x02000001) to its definitionassemblyPath, tokenHex
list_pinvokesList all P/Invoke (DllImport) declarations in the assemblyassemblyPath
find_attributesFind all types and methods decorated with a specific attributeassemblyPath, attributeName
get_methods_for_typeGet all methods defined on a specific typeassemblyPath, typeName
decompile_assemblyDecompile the entire assembly to C# source codeassemblyPath
decompile_typeDecompile a specific type to C# source codeassemblyPath, typeName
decompile_methodDecompile a specific method to C# source codeassemblyPath, typeName, methodName
dump_ilDump IL (CIL) disassembly for the whole assembly, a type, or a specific methodassemblyPath, typeName?, methodName?
inspect_typeInspect a type's structure: fields, methods, properties, interfaces, optionally with sourceassemblyPath, typeName, includeSource?
inspect_methodInspect a specific method: signature, parameters, decompiled source, optionally ILassemblyPath, typeName, methodName, includeSource?, includeIL?
list_typesList all type definitions in the assemblyassemblyPath
find_methodsFind methods in the assembly, optionally filtered by name patternassemblyPath, pattern?
search_stringsSearch for string literals in the assembly's decompiled sourceassemblyPath, pattern, useRegex?
search_membersSearch for types, methods, fields, and properties by name patternassemblyPath, pattern
set_breakpointSet a virtual breakpoint on a method at a specific IL offsetassemblyPath, typeName, methodName, ilOffset
list_breakpointsList all active virtual breakpoints
inspect_breakpointShow IL at a breakpoint offset, infer stack types, and find all callers of the methodid
clear_breakpointsRemove all virtual breakpoints or a specific one by idid?
detect_anti_debugStatic analysis to detect anti-debug techniques across 7 categoriesassemblyPath
detect_anti_tamperStatic analysis to detect obfuscation and anti-tamper protectionsassemblyPath
get_protection_reportAggregate anti-debug and anti-tamper analysis into a report with risk score (0-10) and bypass recommendationsassemblyPath

Protection Analysis

detect_anti_debug, detect_anti_tamper, and get_protection_report perform static analysis only. The target assembly is never loaded as a .NET type, never JIT-compiled, and never executed. Analysis uses ICSharpCode.Decompiler's type system and PE reader exclusively.

Anti-Debug Detection Categories

  • P/Invoke declarations targeting known anti-debug APIs (IsDebuggerPresent, NtQueryInformationProcess, etc.)
  • Managed API usage (System.Diagnostics.Debugger.IsAttached, etc.)
  • Timing-based checks (Stopwatch, GetTickCount, QueryPerformanceCounter patterns)
  • Thread hiding (NtSetInformationThread with ThreadHideFromDebugger)
  • TLS callback presence (executes before Main entry point)
  • Hardware breakpoint detection (CONTEXT Dr0-Dr3 reads)
  • Exception-based anti-debug patterns

Anti-Tamper Detection Categories

  • Obfuscator fingerprinting (ConfuserEx, Dotfuscator, Eazfuscator, .NET Reactor, SmartAssembly, KoiVM, and 10+ more)
  • Name obfuscation heuristics (control characters, zero-width characters, saturation)
  • String encryption stubs (cctor array init patterns, int-to-string decrypt method signatures)
  • Control flow obfuscation (switch proxies, high goto density)
  • Integrity checks (self-hash, File.ReadAllBytes on own assembly, termination after hash comparison)
  • VM/virtualisation (large switch dispatchers, encrypted IL stubs)
  • Packing (PE section names: UPX, MPRESS, .vmp0, Themida, etc.)

Risk Score

get_protection_report computes a risk score (0-10):

  • High severity/confidence finding: +1.5 points
  • Medium: +0.75 points
  • Low: +0.25 points
  • Capped at 10

Project Structure

src/DnSpyMcp/
├── Program.cs
├── Core/
│   ├── AssemblyCache.cs        Thread-safe decompiler cache (keyed by path + mtime)
│   └── BreakpointRegistry.cs  In-memory virtual breakpoint store
├── Models/
│   └── Results.cs              All result record types
└── Tools/
    ├── Analysis/
    │   ├── AnalysisTools.cs    PE info, resources, token resolution, P/Invokes, attributes
    │   ├── BreakpointTools.cs  Virtual breakpoints: set, list, inspect, clear
    │   ├── DecompileTools.cs   C# decompilation, IL disassembly
    │   ├── InspectTools.cs     Type and method inspection
    │   └── SearchTools.cs      Type/method/member/string search
    └── Security/
        ├── AntiDebugTools.cs         Anti-debug pattern detection
        ├── AntiTamperTools.cs        Obfuscation and anti-tamper detection
        └── ProtectionReportTools.cs  Aggregated protection report

Known Issues

The name obfuscation detector flags members with single-letter names or compiler-generated names (containing < >). Standard .NET compiler-generated types (lambda closures, async state machines) will contribute to the obfuscated-name ratio. The threshold is set at 30% to reduce noise, but assemblies making heavy use of generics or LINQ may still trigger it.

The string decryption method detector only fires when the method name itself is obfuscated (contains control characters or is a single letter). If a protector uses readable method names for its string decrypt routines, this check will not detect them. The cctor array initialisation pattern is unaffected.

ICSharpCode.Decompiler attempts to resolve referenced assemblies from the same directory as the target. If dependencies are missing, decompilation of affected methods will fall back to partial output or skip. PE-level operations (get_pe_info, get_resources, resolve_token, list_pinvokes) are not affected. ThrowOnAssemblyResolveErrors is set to false by default to suppress resolver errors.

The list_pinvokes and anti-debug P/Invoke scanner only detect methods decorated with [DllImport]. Dynamic P/Invoke patterns using NativeLibrary.Load + GetExport, GetProcAddress via Marshal, or manually built delegate function pointers will not be detected.

Credits

Detect It Easy (DIE)

The protection detection logic in Tools/Security/ draws directly from the detection approach used by Detect It Easy by horsicq.

DIE's core insight — that protector fingerprinting should operate on raw binary byte patterns, PE section metadata, and metadata string heap searches rather than decompiled source — is the foundation of the sub-millisecond detection performance in this project. Several obfuscator signatures (ConfuserEx, Eazfuscator, KoiVM, .NET Reactor, VMProtect, Dotfuscator, MPRESS, Themida, and others) are adapted from DIE's PE signature scripts under db/PE/. DIE is maintained by horsicq and contributors and is available under the MIT license.

Anti-Debug Research

The anti-debug detection categories and API coverage are informed by:

  • bengabay1994, Anti-Debugging with .NET in Windows Environment — PEB field checks (BeingDebugged, NtGlobalFlag, heap Flags/ForceFlags), StartupInfo.lpDesktop, NtCreateThreadEx thread hiding
  • hsheric0210, AntiDebug.NET — comprehensive .NET anti-debug and anti-VM technique reference covering dynamic IAT resolution, manual module mapping, and hook bypass patterns
  • Check Point Research, Anti-Debug Tricks — referenced via AntiDebug.NET

Installation

TypingMind
Prerequisites:

Node.js 18+

{
  "mcpServers": {
    "zerats-dnspy-mcp": {
      "command": "",
      "args": []
    }
  }
}

Use dnSpy-MCP MCP with multiple AI models

TypingMind connects MCP tools at the workspace level, so once dnSpy-MCP is connected, you can use it with different AI models in TypingMind instead of setting it up separately for each model. This MCP runs locally through the TypingMind MCP connector on your device.

Setup guide to use the local connector

Use this when the MCP server needs access to local files, apps, or private resources on your computer.

1

Open the MCP settings

In TypingMind, go to Settings, Advanced Settings, then Model Context Protocol and choose Setup Connector.

  1. Open TypingMind in your browser.
  2. Click the Settings icon.
  3. Go to Advanced Settings.
  4. Open the Model Context Protocol section.
  5. Click Setup Connector and choose This Device.
TypingMind MCP connector setup screen with This Device selected
2

Run the connector command

Choose This Device, copy the command from TypingMind, and run it in Terminal. Keep the process running while you use MCP.

  1. Copy the setup command shown by TypingMind.
  2. Open Terminal on macOS or Windows Terminal on Windows.
  3. Paste and run the command.
  4. Approve the package install if Terminal asks you to proceed.
  5. Keep the Terminal window running while using MCP tools.
3

Add dnSpy-MCP as a server

When the connector status is Ready, click Edit Servers and paste the MCP server configuration.

  1. Wait until the connector status shows Ready.
  2. Click Edit Servers.
  3. Paste the dnSpy-MCP MCP server configuration.
  4. Save the server list.
  5. Refresh if you want to confirm the connector is still ready.
TypingMind MCP settings showing active server and Edit Servers button
{
  "mcpServers": {
    "zerats-dnspy-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "dnSpy-MCP"
      ]
    }
  }
}
4

Use it across models

Save the server list, open Plugins, enable the dnSpy-MCP MCP tools, then select any supported AI model in TypingMind and use the tools in chat or assign them to an AI agent.

  1. Open the Plugins page in TypingMind.
  2. Enable the dnSpy-MCP MCP tools.
  3. Start a chat and choose the AI model you want to use.
  4. Use the MCP tools in chat or assign them to an AI agent.
  5. Switch to another AI model whenever needed without reconnecting MCP.
TypingMind chat using enabled MCP tools with a selected AI model
Can you use dnSpy-MCP to help me with this task?
dnSpy-MCP
Sure. I read it.
Here is what I found using dnSpy-MCP.

Frequently asked questions

What is the dnSpy-MCP MCP server used for?

dnSpy-MCP is an MCP server that lets compatible AI clients connect to external tools and context. In TypingMind, you can add this MCP server once and make its tools available in your AI workspace.

Can I use dnSpy-MCP MCP with multiple AI models in TypingMind?

Yes. TypingMind connects MCP tools at the workspace level, so you can use dnSpy-MCP with different AI models such as Claude, ChatGPT, Gemini, or other models you have configured in TypingMind without setting up the MCP server separately for each model.

Why use dnSpy-MCP MCP with TypingMind?

TypingMind is one of the best frontends for LLM chat because it brings multiple AI models, prompts, plugins, AI agents, API keys, and MCP tools into one workspace. With dnSpy-MCP connected, you can use its MCP tools across your preferred models while keeping your chat workflow organized in TypingMind.

How do I connect dnSpy-MCP MCP to TypingMind?

dnSpy-MCP runs through the TypingMind local MCP connector. This is best when the MCP server needs access to local files, desktop apps, command-line tools, or private resources on your computer.

What tools does dnSpy-MCP MCP provide in TypingMind?

dnSpy-MCP exposes MCP capabilities that can be enabled from the TypingMind Plugins page and used in chat or assigned to AI agents.

Do I need to share my API keys with TypingMind to use dnSpy-MCP MCP?

No. TypingMind is local-first and lets you keep your model providers, API keys, prompts, and MCP configuration under your control. If dnSpy-MCP requires authentication, add the required headers, OAuth settings, or local configuration for that MCP server when you create the connection.

Related MCP Servers

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇