Skip to main content

A Model Context Protocol server for .NET assembly reverse engineering (ILSpy/ICSharpCode.Decompiler)

Project description

dnre-mcp

A standalone MCP (Model Context Protocol) server for .NET assembly reverse engineering. Provides decompilation and analysis tools to AI assistants like Claude, powered by ICSharpCode.Decompiler (the same engine behind ILSpy).

Why

The previous workflow required launching dnSpyEx with an MCP extension, manually loading assemblies, and connecting Claude to the dnSpy MCP server. This was fragile and heavyweight. dnre-mcp replaces all of that with a single CLI tool that speaks MCP over stdio -- no GUI needed.

Installation

From PyPI (recommended)

dnre-mcp is published as a Windows wheel that bundles a framework-dependent DnreMcp binary behind a small Python launcher, so it installs through uv/pip like any other MCP server:

# run on demand (fetched + cached on first launch)
uvx dnre-mcp

# or install the CLI persistently
uv tool install dnre-mcp

The wheel is tagged py3-none-win_amd64 — it works on any Python 3, but the bundled binary is Windows x64 and requires the .NET 10 runtime on the host:

winget install --id Microsoft.DotNet.Runtime.10 --exact

Pre-built release (no .NET SDK required)

Download the latest release for your platform from the Releases page:

  • Windows x64: dnre-mcp-<version>-win-x64.zip
  • Linux x64: dnre-mcp-<version>-linux-x64.tar.gz

Extract the archive and point your MCP config to the executable:

Windows:

Expand-Archive dnre-mcp-v0.1.0-win-x64.zip -DestinationPath C:\tools\dnre-mcp

Linux:

mkdir -p ~/tools/dnre-mcp
tar xzf dnre-mcp-v0.1.0-linux-x64.tar.gz -C ~/tools/dnre-mcp
chmod +x ~/tools/dnre-mcp/DnreMcp

Build from source

Requires .NET 10 SDK or later.

dotnet build src/DnreMcp/DnreMcp.csproj

To create a self-contained publish:

dotnet publish src/DnreMcp/DnreMcp.csproj -c Release -r win-x64 --self-contained -o ./publish
# or
dotnet publish src/DnreMcp/DnreMcp.csproj -c Release -r linux-x64 --self-contained -o ./publish

Configuration

Claude Code

Add to your MCP settings (.claude/settings.json or project-level):

Using the PyPI wheel via uvx (recommended):

{
  "mcpServers": {
    "dnre": {
      "command": "uvx",
      "args": ["dnre-mcp"]
    }
  }
}

Using a pre-built release:

{
  "mcpServers": {
    "dnre": {
      "command": "C:/tools/dnre-mcp/DnreMcp.exe"
    }
  }
}

Using dotnet run (requires .NET SDK):

{
  "mcpServers": {
    "dnre": {
      "command": "dotnet",
      "args": ["run", "--project", "/path/to/dnre-mcp/src/DnreMcp/DnreMcp.csproj"]
    }
  }
}

Claude Desktop

Add to claude_desktop_config.json:

Using a pre-built release:

{
  "mcpServers": {
    "dnre": {
      "command": "C:/tools/dnre-mcp/DnreMcp.exe"
    }
  }
}

Using dotnet run (requires .NET SDK):

{
  "mcpServers": {
    "dnre": {
      "command": "dotnet",
      "args": ["run", "--project", "/path/to/dnre-mcp/src/DnreMcp/DnreMcp.csproj"]
    }
  }
}

MCP Tools

Assembly Management

Tool Description
load_assembly Load a .NET assembly (dll/exe) from disk for analysis
list_assemblies List all currently loaded assemblies

Type Analysis

Tool Description
list_types List all types in an assembly, optionally filtered by namespace prefix
search_types Search for types by name (case-insensitive substring match)
get_type_info Get full metadata for a type: base class, interfaces, fields, properties, methods, events, nested types
decompile_type Decompile an entire type to C# source code

Method Analysis

Tool Description
search_methods Search for methods by name across all types in an assembly
get_method_info Get method signature details: parameters, return type, accessibility, virtual/abstract/override
decompile_method Decompile a specific method to C# source (handles overloads)

Namespace Browsing

Tool Description
list_namespaces List all namespaces in an assembly

Tool Parameters

All tools that operate on a loaded assembly take an assembly parameter -- this is the assembly name (e.g. Assembly-CSharp), not the file path. You must call load_assembly first to make an assembly available by name.

Type-specific tools take a type_full_name parameter using the dotted namespace format (e.g. MyNamespace.MyClass). Method tools additionally take a method_name parameter.

Parameter Reference

load_assembly(path)
list_assemblies()
list_types(assembly, namespace_filter?)
search_types(assembly, pattern)
get_type_info(assembly, type_full_name)
decompile_type(assembly, type_full_name)
search_methods(assembly, pattern)
get_method_info(assembly, type_full_name, method_name)
decompile_method(assembly, type_full_name, method_name)
list_namespaces(assembly)

Example Workflow

A typical reverse engineering session with Claude:

  1. Load the assembly

    "Load the assembly at C:/Games/MyGame/Managed/Assembly-CSharp.dll"

  2. Explore namespaces

    "What namespaces are in Assembly-CSharp?"

  3. Find types of interest

    "Search for types containing 'Player'"

  4. Inspect a type

    "Show me the type info for GameLogic.PlayerController"

  5. Decompile

    "Decompile the Update method from GameLogic.PlayerController"

Project Structure

dnre-mcp/
  dnre-mcp.sln
  src/DnreMcp/
    DnreMcp.csproj
    Program.cs                  -- Host setup, MCP server registration
    Services/
      AssemblyManager.cs        -- Manages loaded assemblies and decompiler instances
    Tools/
      AssemblyTools.cs          -- load_assembly, list_assemblies
      TypeTools.cs              -- list_types, search_types, get_type_info, decompile_type
      MethodTools.cs            -- search_methods, get_method_info, decompile_method
      NamespaceTools.cs         -- list_namespaces

Dependencies

Package Version Purpose
ModelContextProtocol 1.0.0 Official C# MCP SDK
Microsoft.Extensions.Hosting 10.0.3 Application host and DI
ICSharpCode.Decompiler 9.1.0.7988 .NET decompilation engine (ILSpy)

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dnre_mcp-0.1.1rc1-py3-none-win_amd64.whl (2.6 MB view details)

Uploaded Python 3Windows x86-64

File details

Details for the file dnre_mcp-0.1.1rc1-py3-none-win_amd64.whl.

File metadata

  • Download URL: dnre_mcp-0.1.1rc1-py3-none-win_amd64.whl
  • Upload date:
  • Size: 2.6 MB
  • Tags: Python 3, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for dnre_mcp-0.1.1rc1-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 98e268ac6803bca2d448d0c90b6e0ba79e1249e34fefbaf479945617390c8996
MD5 f9a5768f6a7a6a9a2d5ec470d253450f
BLAKE2b-256 3dd496f4da77eb9d77dbdb58b6c8e3965d72b32ced7e20c68414b793015f2cac

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page