ARISTODE/ILSpy-MCP-Server
If you are the rightful owner of ILSpy-MCP-Server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
The ILSpy MCP Server is a Model Context Protocol bridge that provides automated .NET reverse engineering capabilities by exposing ILSpy functionalities through MCP.
ILSpy MCP Server
Model Context Protocol (MCP) bridge that surfaces ILSpy functionality for automated .NET reverse engineering. The server wraps the official ILSpy PowerShell cmdlets and exposes a small set of tools (list types, enumerate methods, decompile C#) over MCP so coordinating agents can reason about managed assemblies when native decompilers are unavailable.
Prerequisites
Follow these steps to prepare the environment (verified against the upstream ILSpy documentation and official installation guides):
-
Install the .NET 10.0 SDK
- macOS/Linux: download the installer from dotnet.microsoft.com/download/dotnet/10.0 or use Homebrew (
brew install --cask dotnet-sdk
). - Windows: use the .NET SDK installer from the same link.
- Verify with
dotnet --list-sdks
(should show a10.0.*
entry).
- macOS/Linux: download the installer from dotnet.microsoft.com/download/dotnet/10.0 or use Homebrew (
-
Install PowerShell 7+
- macOS:
brew install --cask powershell
- Windows/Linux: follow the instructions at https://learn.microsoft.com/powershell/scripting/install/installing-powershell.
- Confirm availability with
pwsh --version
.
- macOS:
-
Clone and build ILSpy (per the official README)
git clone https://github.com/icsharpcode/ILSpy ../ilspy cd ../ilspy git submodule update --init --recursive dotnet build ILSpy.XPlat.slnf
The PowerShell module is emitted at
../ilspy/ICSharpCode.Decompiler.PowerShell/bin/Debug/netstandard2.0/ICSharpCode.Decompiler.PowerShell.dll
. -
Install MCP server dependencies
python -m pip install mcp[server] typer pydantic
(Use a virtual environment if preferred.)
Installation
Clone this repository and install the package in editable mode (optional):
cd ILSpy-MCP-Server
python -m pip install -e .
Alternatively, run directly with PYTHONPATH=src
.
Configuration
By default the server assumes the sibling ILSpy checkout and PowerShell module described above. To override locations, pass --module-path
or --powershell-path
arguments (see below).
Environment Variable | CLI Option | Description |
---|---|---|
ILSPY_MCP_HOST | --host | Interface to bind (default 127.0.0.1 ). |
ILSPY_MCP_PORT | --port | Port for SSE transport (default 8891 ). |
ILSPY_MCP_TRANSPORT | --transport | sse , streamable-http , or stdio . |
ILSPY_MCP_MODULE | --module-path | Path to ICSharpCode.Decompiler.PowerShell.dll . |
ILSPY_MCP_PWSH | --powershell-path | Path to the pwsh executable. |
(Transport environment variables are optional; the CLI options take precedence.)
Running the Server
cd ILSpy-MCP-Server
PYTHONPATH=src python -m ilspy_mcp.server \
--port 8891 \
--host 127.0.0.1 \
--transport sse
On startup the server imports the ILSpy PowerShell module to verify prerequisites, then listens for MCP tool calls.
Available Tools
Tool ID | Description |
---|---|
set_binary_path | Load a managed assembly (.dll/.exe) for subsequent calls. |
list_types | Enumerate types; optional comma-separated kinds . |
list_modules | Report module/assembly metadata. |
list_methods | List methods for a fully qualified type. |
decompile_type | Return full C# source for a type. |
decompile_method | Return the C# body for a single method. |
search_strings | Regex search across decompiled source; returns type hits. |
Clients should call set_binary_path
once per session before invoking other tools.
Testing
A minimal suite validates the client-side session helpers:
PYTHONPATH=src pytest tests -q
The tests assume the sample managed DLL used during development is available; replace the path in tests/test_session.py
if needed.
Repository Layout
src/ilspy_mcp/ # FastMCP server implementation and helpers
tests/ # Basic integration tests using the MCP client wrapper
configs/ # Example MCP client configuration files
Client Configuration Examples
- Cursor – copy
configs/cursor.json
into your Cursor MCP configuration directory and adjust environment variables (e.g.,ILSPY_MCP_MODULE
) as needed. - Claude Desktop – merge the
configs/claude.json
snippet with your existingclaude_desktop_config.json
to register the server under theilspy-mcp
key.
Both examples invoke python -m ilspy_mcp.server
with SSE transport and rely on PYTHONPATH=src
so the package is importable without installation. Update paths if you are running from a different
working directory.
References
- ILSpy project: https://github.com/icsharpcode/ILSpy
- PowerShell: https://github.com/PowerShell/PowerShell
- Model Context Protocol spec: https://modelcontextprotocol.io/