Logo vun dnSpy-MCP

dnSpy-MCP

Communautéit
notgate

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

Editeurnotgate
RepositorydnSpy-MCP
SproochC#
Forks
2
Stären
19
Disponibel Tools
0
Transporttypstdio
Kategorien
Linken
  • Tools mat KI-Workflows verbannen

    dnSpy-MCP stellt MCP-Funktioune bereit, déi vu kompatibele KI-Clienten a KI-Agente kënne benotzt ginn.

  • 0 disponibel Tools

    Kuckt Iech déi opruffbar Aktiounen hei drënner un, mat Nimm a Beschreiwungen, wa se vum Server geliwwert ginn.

  • Konfiguratioun fir ze kopéieren

    Benotzt d'Installatiounsbeispiller, fir dëse Server an Ärem bevorzugte MCP-Client ze konfiguréieren.

  • Indicateure fir Open Source

    19 Stären an 2 Forks aus dem verlinkte 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

Installatioun

TypingMind
Viraussetzungen:

Node.js 18+

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

dnSpy-MCP MCP mat verschiddene KI-Modeller benotzen

TypingMind verbënnt MCP-Tools um Niveau vum Aarbechtsberäich. Soubal dnSpy-MCP verbonnen ass, kënnt Dir et mat verschiddene KI-Modeller an TypingMind benotzen, amplaz et fir all Modell separat anzeriichten. Dës MCP-Integratioun leeft lokal iwwer den TypingMind-MCP-Connector op Ärem Apparat.

Ariichtungsuleedung fir de lokale Connector ze benotzen

Benotzt dës Optioun, wann den MCP-Server Zougrëff op lokal Fichieren, Appen oder privat Ressourcen op Ärem Computer brauch.

1

D'MCP-Astellungen opmaachen

Gitt an TypingMind op „Astellungen“, „Erweidert Astellungen“, dann op „Model Context Protocol“ a wielt „Connector ariichten“.

  1. Maacht TypingMind an Ärem Browser op.
  2. Klickt op d'Astellungssymbol.
  3. Gitt op „Erweidert Astellungen“.
  4. Maacht d'Sektioun „Model Context Protocol“ op.
  5. Klickt op „Connector ariichten“ a wielt „Dësen Apparat“.
Ariichtungsbildschierm vum TypingMind-MCP-Connector mat „Dësen Apparat“ ausgewielt
2

De Connector-Befeel ausféieren

Wielt „Dësen Apparat“, kopéiert de Befeel aus TypingMind a féiert en am Terminal aus. Loosst de Prozess lafen, wärend Dir MCP benotzt.

  1. Kopéiert den Ariichtungsbefeel, deen TypingMind uweist.
  2. Maacht Terminal op macOS oder Windows Terminal op Windows op.
  3. Pescht de Befeel an a féiert en aus.
  4. Bestätegt d'Installatioun vum Package, wann den Terminal Iech freet, ob Dir weiderfuere wëllt.
  5. Loosst den Terminal an de Prozess doranner lafen, wärend Dir MCP-Tools benotzt.
3

dnSpy-MCP als Server derbäisetzen

Wann de Connector-Status „Prett“ ass, klickt op „Serveren änneren“ a pescht d'MCP-Serverkonfiguratioun an.

  1. Waart, bis de Connector-Status „Prett“ weist.
  2. Klickt op „Serveren änneren“.
  3. Pescht d'MCP-Serverkonfiguratioun vu dnSpy-MCP an.
  4. Späichert d'Serverlëscht.
  5. Aktualiséiert, wann Dir kontrolléiere wëllt, ob de Connector nach ëmmer prett ass.
MCP-Astellunge vun TypingMind mat aktivem Server an dem Knäppchen „Serveren änneren“
{
  "mcpServers": {
    "zerats-dnspy-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "dnSpy-MCP"
      ]
    }
  }
}
4

D'Verbindung mat verschiddene Modeller benotzen

Späichert d'Serverlëscht, maacht „Plugins“ op an aktivéiert d'MCP-Tools vu dnSpy-MCP. Wielt dann e belibegen ënnerstëtzte KI-Modell an TypingMind a benotzt d'Tools am Chat oder weist se engem KI-Agent zou.

  1. Maacht d'Säit „Plugins“ an TypingMind op.
  2. Aktivéiert d'MCP-Tools vu dnSpy-MCP.
  3. Start e Chat a wielt de KI-Modell, deen Dir benotze wëllt.
  4. Benotzt d'MCP-Tools am Chat oder weist se engem KI-Agent zou.
  5. Wiesselt bei Bedarf op en anere KI-Modell, ouni MCP nei ze verbannen.
TypingMind-Chat mat aktivéierte MCP-Tools an engem ausgewielte KI-Modell
Hëlleft Dir mir bei dëser Aufgab mat dnSpy-MCP?
dnSpy-MCP
Jo. Ech hunn et gelies.
Dat hunn ech mat dnSpy-MCP fonnt.

Heefeg gestallte Froen

Fir wat gëtt de MCP-Server dnSpy-MCP benotzt?

dnSpy-MCP ass e MCP-Server, deen et kompatibele KI-Clienten erlaabt, sech mat externen Tools a Kontext ze verbannen. An TypingMind kënnt Dir dëse MCP-Server eemol derbäisetzen a seng Tools an Ärem KI-Aarbechtsberäich zur Verfügung stellen.

Kann ech dnSpy-MCP MCP mat méi KI-Modeller an TypingMind benotzen?

Jo. TypingMind verbënnt MCP-Tools um Niveau vum Aarbechtsberäich. Sou kënnt Dir dnSpy-MCP mat verschiddene KI-Modeller wéi Claude, ChatGPT, Gemini oder anere Modeller benotzen, déi Dir an TypingMind konfiguréiert hutt, ouni de MCP-Server fir all Modell separat anzeriichten.

Firwat dnSpy-MCP MCP mat TypingMind benotzen?

TypingMind ass eng vun de beschte Benotzeruewerfläche fir LLM-Chat, well et méi KI-Modeller, Prompts, Plugins, KI-Agenten, API-Schlësselen a MCP-Tools an engem Aarbechtsberäich zesummebréngt. Wann dnSpy-MCP verbonnen ass, kënnt Dir seng MCP-Tools mat Äre bevorzugte Modeller benotzen a gläichzäiteg Är Chataarbecht an TypingMind organiséieren.

Wéi verbannen ech dnSpy-MCP MCP mat TypingMind?

dnSpy-MCP leeft iwwer de lokale MCP-Connector vun TypingMind. Dat eegent sech am beschten, wann de MCP-Server Zougrëff op lokal Fichieren, Desktop-Apps, Kommandozeilen-Tools oder privat Ressourcen op Ärem Computer brauch.

Wéi eng Tools stellt dnSpy-MCP MCP an TypingMind zur Verfügung?

dnSpy-MCP stellt MCP-Funktiounen zur Verfügung, déi Dir op der Plugins-Säit vun TypingMind aktivéiere kënnt, fir se am Chat ze benotzen oder KI-Agenten zouzeweisen.

Muss ech meng API-Schlëssele mat TypingMind deelen, fir dnSpy-MCP MCP ze benotzen?

Nee. TypingMind setzt op lokal Veraarbechtung a léisst Iech d'Kontroll iwwer Är Modellubidder, API-Schlësselen, Prompts a MCP-Konfiguratioun. Wann dnSpy-MCP eng Authentifizéierung verlaangt, setzt déi néideg Headeren, OAuth-Astellungen oder lokal Konfiguratioun fir dee MCP-Server derbäi, wann Dir d'Verbindung erstallt.

Änlech MCP-Serveren

All weisen

Elo Ären eegene KI-Workspace ariichten

Abonnéiert Iech op eisen Newsletter, fir iwwer nei Funktiounen an zukünfteg Gewënnspiller informéiert ze ginn 👇