Skip to main content
Glama
dotnet-decompiler-mcp

dotnet-decompiler-mcp

by Kommisaar

dotnet-decompiler-mcp

An MCP server that decompiles and inspects .NET assemblies to C# source, wrapping the ICSharpCode.Decompiler engine (ILSpy, v9.0.0.7889) behind a set of callable tools.

Point an MCP client at any .NET DLL and ask an LLM to "decompile Foo.Bar, then list its public methods" — it returns structured results (C# source, type summaries, symbol matches) the model can reason over.

What it does

  • Decompile a whole type or a single member to readable C# source (with comments — the ILSpy "gold standard" output).

  • Inspect an assembly: list types, list namespaces with counts, get a detailed member summary of one type (methods, fields, properties, events, attributes, base type).

  • Search for symbols by name across one or more assemblies (case-insensitive substring, filterable by kind).

  • A check_env diagnostic tool reports the active Python, .NET runtime, and engine version.

All .NET access is via reflection through pythonnet on CoreCLR; no .NET SDK install is required on the host beyond the runtime.

Related MCP server: GhidraMCP

Requirements

  • Python ≥ 3.14

  • .NET 8 runtime on the host (the decompiler targets net8.0; the bundled CoreCLR runtime pack is 8.0.6, the minimum host runtime is 8.0.17).

  • uv to run the project.

Install

git clone <repo-url> dotnet-decompiler-mcp
cd dotnet-decompiler-mcp
uv sync

The ILSpy engine DLL ships in lib/ICSharpCode.Decompiler.dll — nothing else to download.

Environment variables

These are set automatically at runtime by the bootstrap (runtime/clr.py); you normally do not need to configure them. They are listed for completeness / troubleshooting.

Variable

Value

Purpose

PYTHONNET_RUNTIME

coreclr

Selects CoreCLR over Mono.

PYTHONNET_CORECLR_RUNTIME_CONFIG

path to a temp *.runtimeconfig.json

Tells CoreCLR which framework (Microsoft.NETCore.App 8.0.6) to load. The file is generated into the system temp dir on first boot.

If the runtime fails to start, run check_env (below) — it reports the resolved versions.

MCP client registration

The server speaks MCP over stdio. Register it with any MCP client.

ZCode / OpenCode (.zcode/config.json)

{
  "mcp": {
    "servers": {
      "dotnet-decompiler": {
        "type": "stdio",
        "command": "uv",
        "args": [
          "run",
          "--project",
          "/absolute/path/to/dotnet-decompiler-mcp",
          "python",
          "-m",
          "dotnet_decompiler_mcp"
        ],
        "env": {}
      }
    }
  }
}

Write this to the workspace .zcode/config.json or the user-level ~/.zcode/v2/config.json, then restart the client.

Generic mcpServers (Claude Desktop and others)

{
  "mcpServers": {
    "dotnet-decompiler": {
      "command": "uv",
      "args": [
        "run",
        "--project",
        "/absolute/path/to/dotnet-decompiler-mcp",
        "python",
        "-m",
        "dotnet_decompiler_mcp"
      ]
    }
  }
}

You can also run it directly to smoke-test the stdio server:

uv run python -m dotnet_decompiler_mcp

It should start without errors and wait on stdin. Ctrl+C to exit.

Tools

Seven tools are registered. asm_paths (where present) is an optional list of extra assembly search directories used to resolve cross-DLL references; pass it when the target assembly depends on types in other DLLs.

Tool

Arguments

Returns

Purpose

check_env

(none)

EnvInfo

Startup diagnostics: Python, .NET runtime, engine version, lib dir.

decompile_type

dll, type_name, asm_paths?

DecompileResult

Decompile a whole type to C# source.

decompile_member

dll, type_name, member_name, asm_paths?

MemberDecompileResult

Decompile a single method/field/property/event.

list_types

dll, namespace?, asm_paths?

TypeListResult

List types, optionally filtered by namespace prefix.

list_namespaces

dll, asm_paths?

NamespaceListResult

Distinct namespaces with type counts.

get_type_summary

dll, type_name, asm_paths?

TypeSummary

Detailed public-member breakdown of one type.

search_symbol

dlls, query, kind?, asm_paths?

SearchResult

Case-insensitive symbol search across one or more DLLs.

Notes:

  • type_name is a fully-qualified, case-sensitive name (e.g. ICSharpCode.Decompiler.DecompilerSettings).

  • namespace is a prefix filter — ICSharpCode matches ICSharpCode.Decompiler but not ICSharpCodeX; empty string = all types.

  • search_symbol kind is one of type / method / field / property / event / any (default any).

Usage examples

These target the engine DLL bundled in lib/ — the same cases the test suite pins, so they are known to work. Replace the path with any .NET assembly you want to explore.

check_env
  → EnvInfo(decompiler_version="9.0.0.7889", net_tfm_target="net8.0", ...)

decompile_type("lib/ICSharpCode.Decompiler.dll",
               "ICSharpCode.Decompiler.DecompilerSettings")
  → DecompileResult(source="public class DecompilerSettings : ...", ...)

decompile_member("lib/ICSharpCode.Decompiler.dll",
                 "ICSharpCode.Decompiler.DecompilerSettings",
                 "GetMinimumRequiredVersion")
  → MemberDecompileResult(source="public static Version ...", ...)

get_type_summary("lib/ICSharpCode.Decompiler.dll",
                 "ICSharpCode.Decompiler.DecompilerSettings")
  → TypeSummary(base_type="System.Object",
                events=[EventInfo(name="PropertyChanged", ...)], ...)

search_symbol(["lib/ICSharpCode.Decompiler.dll"], "GetMinimum", kind="method")
  → SearchResult(matches=[SymbolMatch(kind="method",
          name="GetMinimumRequiredVersion", type="...DecompilerSettings")])

Errors

The engine raises typed exceptions; the tool layer does not catch them, so they surface to the MCP client as is_error responses with the exception message. All engine errors inherit from DecompilerError.

Error

Meaning

DllNotFoundError

The dll path does not exist or is not readable.

TypeNotFoundError

type_name was not found in the assembly.

MemberNotFoundError

member_name was not found in the type.

DecompilationFailedError

A reflected .NET call raised; the original exception text is appended as (inner: ...).

InvalidArgumentError

An argument was rejected (e.g. an unknown kind).

Development

uv run pytest          # 65 tests (incl. real-.NET integration tests)
uv run ruff check      # lint (D/E/F/W, Google docstring convention)

Architecture

Four one-way layers, no cycles:

config.py     constants (single source of truth)
runtime/      CoreCLR bootstrap via pythonnet (init_runtime, ensure_initialised)
engine/       CSharpDecompiler reflection wrappers (cache, decompile, metadata, version, errors)
tools/        thin async wrappers (list[str]|None -> tuple|None), errors bubble up
server.py     FastMCP assembly + tool registration
models/       Pydantic response DTOs (anemic, serialization only)

Dependency direction: server → tools → engine → runtime/models/config.

Status

Milestones M0–M4 complete: runtime bootstrap, decompile (type/member), inspect (list/summary) + search, error handling, and documentation.

Available Tools

7 tools
check_envA

Startup diagnostics: verify runtime / DLL / versions are ready.

Checks that the .NET runtime (CoreCLR) is loaded, the bundled ICSharpCode.Decompiler.dll is present in lib/, and returns version info for all components.

The asm_search_dirs field shows which directories the decompiler searches automatically for dependency resolution — typically the lib/ folder. The target DLL's own directory is also always searched.

Example::

check_env()
# Returns: {"python_version": "3.14.3", "decompiler_version": "9.0.0.7889", ...}

Returns: EnvInfo: Python version, .NET runtime version, decompiler version, and library directory status.

Inputs: no named parameters. Returns: Environment diagnostics returned by the check_env tool. Captures Python/.NET ru…

decompile_memberA

Decompile a single member (method/field/property/event/ctor) to C#.

Lighter than decompile_type — use this when you only need one method or property from a large type.

Tip: run get_type_summary first to see available member names.

Examples::

# Decompile a method
decompile_member(
    dll="Backend/GameData.dll",
    type_name="GameData.Domains.Character.Character",
    member_name="ChangeHealth",
)

# Decompile a constructor
decompile_member(
    dll="Managed/Assembly-CSharp.dll",
    type_name="Game.Views.Combat.ViewCombat",
    member_name=".ctor",
)

# Decompile a property getter
decompile_member(
    dll="Backend/GameData.dll",
    type_name="GameData.Domains.Combat.CombatCharacter",
    member_name="get_Name",
)

Args: dll (str): Absolute path to the assembly. type_name (str): Fully-qualified owning type name (case-sensitive). member_name (str): Simple member name, e.g. ToString, ChangeHealth, .ctor (constructor), get_Name. asm_paths (list[str] | None): Extra directories for dependency resolution. Almost always None — see decompile_type.

Returns: MemberDecompileResult: The member's C# source plus metadata.

Raises: DllNotFoundError: dll does not exist. TypeNotFoundError: type_name not found. MemberNotFoundError: member_name not found on the type. DecompilationFailedError: Internal decompiler error.

Inputs: dll (required), type_name (required), member_name (required), asm_paths. Returns: Result of decompiling a single member (method/field/property). Attributes: sour…

decompile_typeA

Decompile a whole .NET type to C# source (with comments).

The decompiler automatically resolves dependencies from the target DLL's own directory and the bundled lib/ folder, so asm_paths is almost never needed for typical Unity/Godot games.

Tip: use list_types first to discover available types, then pass the exact namespace.TypeName here.

Examples::

# Decompile an entire class
decompile_type(
    dll="Backend/GameData.dll",
    type_name="GameData.Domains.Character.Character",
)

# Decompile an enum
decompile_type(
    dll="Backend/GameData.dll",
    type_name="GameData.Domains.Combat.CombatCharacterStateType",
)

Args: dll (str): Absolute path to the assembly (.dll or .exe). type_name (str): Fully-qualified type name, case-sensitive, e.g. GameData.Domains.Taiwu.TaiwuDomain. asm_paths (list[str] | None): Extra directories for dependency resolution. The DLL's own folder and the bundled lib/ are searched automatically, so this can almost always be None. Only needed when a referenced assembly lives outside those paths.

Returns: DecompileResult: The decompiled C# source plus type/dll metadata.

Raises: DllNotFoundError: dll does not exist or is not readable. TypeNotFoundError: type_name was not found (check spelling/case). DecompilationFailedError: Decompiler encountered an internal error.

Inputs: dll (required), type_name (required), asm_paths. Returns: Result of decompiling a whole .NET type to C# source. Attributes: source (str):…

get_type_summaryA

Get a detailed member summary of a single type (public members only).

Shows all public methods, fields, properties, and events with their signatures. Use this to find the exact member name before calling decompile_member.

Example::

get_type_summary(
    dll="Backend/GameData.dll",
    type_name="GameData.Domains.Character.Character",
)
# Returns all ~800 public methods with their signatures

Args: dll (str): Absolute path to the assembly to inspect. type_name (str): Fully-qualified type name (case-sensitive), e.g. GameData.Domains.Character.Character. asm_paths (list[str] | None): Extra dependency dirs (almost never needed — see decompile_type).

Returns: TypeSummary: Base type, attributes, and public member lists (methods/fields/properties/events).

Raises: DllNotFoundError: dll does not exist. TypeNotFoundError: type_name not found (check spelling/case).

Inputs: dll (required), type_name (required), asm_paths. Returns: Detailed summary of a single .NET type's members. Attributes: type (str): Full…

list_namespacesA

List distinct namespaces in an assembly with their type counts.

Use this as the first step when exploring an unknown game/mod DLL: it shows you what high-level modules exist (e.g. GameData.Domains.Combat, Game.Views.Building) and how many types each contains.

Example::

list_namespaces(dll="Backend/GameData.dll")
# Returns: [{"name": "GameData.Domains.Combat", "count": 177}, ...]

Args: dll (str): Absolute path to the assembly to inspect. asm_paths (list[str] | None): Extra dependency dirs (almost never needed — see decompile_type).

Returns: NamespaceListResult: Namespaces (sorted by name) and total type count.

Raises: DllNotFoundError: dll does not exist or is not readable.

Inputs: dll (required), asm_paths. Returns: Result of listing namespaces in an assembly. Attributes: namespaces (list[Names…

list_typesA

List types in an assembly, optionally filtered by namespace prefix.

The namespace filter is a prefix match: "GameData.Domains" matches GameData.Domains.Character, GameData.Domains.Combat, etc. Pass "" (default) to list all types — but beware that large games (e.g. Unity Assembly-CSharp.dll) may have 5000+ types.

Recommended exploration flow::

1. list_namespaces(dll)         → see available namespaces
2. list_types(dll, namespace="Foo")  → see types in that namespace
3. get_type_summary(dll, "Foo.Bar")  → inspect a type's members
4. decompile_type(dll, "Foo.Bar")    → get full C# source

Examples::

# All types in a DLL (may be large)
list_types(dll="Backend/GameData.dll")

# Only types under a specific namespace
list_types(
    dll="Backend/GameData.dll",
    namespace="GameData.Domains.Combat.Ai",
)

Args: dll (str): Absolute path to the assembly (.dll or .exe). namespace (str): Namespace prefix filter. "" lists all types. asm_paths (list[str] | None): Extra dependency dirs (almost never needed — see decompile_type).

Returns: TypeListResult: Matching types (name, namespace, base type, member counts) with total/filtered counts.

Raises: DllNotFoundError: dll does not exist or is not readable.

Inputs: dll (required), namespace, asm_paths. Returns: Result of listing types in an assembly. Attributes: dll (str): Path of the insp…

search_symbolA

Search for symbols by name across one or more assemblies.

Matching is case-insensitive substring on the symbol name. You can search a single DLL or multiple at once — useful when you're not sure which assembly contains a type (e.g. ["GameData.dll", "Assembly-CSharp.dll"]).

Examples::

# Search all symbol kinds for "MakeLove" in one DLL
search_symbol(
    dlls=["Backend/GameData.dll"],
    query="MakeLove",
)

# Search only types named "Combat*" across multiple DLLs
search_symbol(
    dlls=[
        "Backend/GameData.dll",
        "Managed/Assembly-CSharp.dll",
    ],
    query="Combat",
    kind="type",
)

# Search only methods containing "ChangeHealth"
search_symbol(
    dlls=["Backend/GameData.dll"],
    query="ChangeHealth",
    kind="method",
)

Args: dlls (list[str]): One or more assembly paths to search. query (str): Case-insensitive substring to match against symbol names. kind (str): Category filter. One of: - "any" (default) — all categories - "type" — only type names - "method" — only method names - "field" — only field names - "property" — only property names - "event" — only event names asm_paths (list[str] | None): Extra dependency dirs (almost never needed — see decompile_type).

Returns: SearchResult: All matches across all DLLs (with owning type info for member matches).

Raises: InvalidArgumentError: If kind is not a valid category. DllNotFoundError: If any DLL in dlls does not exist.

Inputs: dlls (required), query (required), kind, asm_paths. Returns: Result of a symbol search across an assembly. Attributes: query (str): The sear…

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4.6/5.0

    Scored across 7 tools

    Disambiguation5/5

    Each tool has a clearly distinct purpose: environment checking, decompiling types, decompiling members, getting type summaries, listing namespaces, listing types, and searching symbols. No overlap or ambiguity.

    Naming Consistency5/5

    All tool names follow a consistent verb_noun snake_case pattern: check_env, decompile_member, decompile_type, get_type_summary, list_namespaces, list_types, search_symbol. The pattern is uniform and predictable.

    Tool Count5/5

    Seven tools is an ideal size for a decompiler MCP server, covering diagnostics, exploration, and decompilation without being overwhelming or insufficient.

    Completeness4/5

    The tools cover the core exploration and decompilation workflow (list namespaces, types, summary, decompile type/member, search). However, missing are options for decompilation settings (e.g., with/without comments, debug info), which would make it fully complete.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      B
      maintenance
      ILSpy for LLM coding agents. Reflection-based MCP server with 31+ tools to explore .NET assemblies, NuGet packages, types, members, attributes, and XML docs.
      10
      MIT
    • A
      license
      Not graded
      quality
      F
      maintenance
      MCP server that allows LLMs to autonomously reverse engineer applications using Ghidra, exposing tools like decompilation, renaming, and listing methods.
      27
      Apache 2.0
    • A
      license
      A
      quality
      C
      maintenance
      MCP server for .NET assembly analysis. Vendor-neutral wrapper around AsmResolver and ILSpy for parsing and decompiling .NET assemblies.
      11
      1
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      MCP server that exposes an AI decompiler via an OpenAI-compatible API, enabling decompilation, explanation, and variable renaming of disassembly for binary analysis.
      MIT