ILSpy MCP Server
Provides tools for decompiling .NET assemblies, extracting metadata, types, methods, IL code, and project exports, enabling AI agents to analyze and work with .NET binaries.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@ILSpy MCP Serverdecompile MyAssembly.dll to C# files"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
ILSpy MCP Server
A production-grade MCP server that exposes all major ILSpy CLI features as separate tools for decompiling .NET assemblies.
Features
10 MCP Tools: Decompile, export projects, extract IL, list types/methods, resolve references, and more
Workflow Orchestration: Automated end-to-end processing of .NET assemblies
Structured Output: JSON reports with metadata, types, methods, and logs
Forward Compatible: Raw ilspycmd tool for unsupported features
Cross-Platform: Works on Windows, Linux, and macOS
Related MCP server: sharplens-mcp
Prerequisites
Python 3.10+
ILSpy CLI (ilspycmd) installed and available in PATH
Download from: https://github.com/icsharpcode/ILSpy/releases
Or install via:
dotnet tool install -g ilspycmd
Installation
pip install -r requirements.txtUsage
Option 1: MCP Server Mode
Start the MCP server and use it with any MCP-compatible client:
python server.pyThe server communicates via stdio using JSON-RPC. Configure it in your MCP client using config.json.
Option 2: Direct Orchestrator Usage
Process assemblies directly using the orchestrator:
# Single assembly
python orchestrator.py assembly.dll
# Multiple assemblies
python orchestrator.py assembly1.dll assembly2.dll assembly3.exe
# With options
python orchestrator.py assembly.dll --langver:11 --nullable --no-recordsOption 3: Python API
Use the orchestrator programmatically:
from orchestrator import process_assemblies, save_report
from pathlib import Path
report = process_assemblies(
["assembly.dll"],
language_version="11",
nullable_enabled=True,
handle_records=True,
)
save_report(report, Path("work/report.json"))Tools
decompile_file - Decompile assembly to C# files
Supports:
--langver,--nullable,--with-records, etc.
export_project - Export compilable C# project
Includes: References, metadata, project files
get_il - Extract IL code
View intermediate language instead of decompiled C#
list_types - List all types in assembly
Returns: Namespace-qualified type names
list_methods - List methods for a type
Input: Full type name (e.g.,
Namespace.ClassName)
resolve_references - Analyze external references
Extracts: Package references, assembly references
set_language_version - Control C# language version
Versions: 9, 10, 11, 12, etc.
enable_nullable_context - Enable/disable nullable reference types
Options:
trueorfalse
handle_records_init_only - Handle record types properly
Ensures: Records and init-only setters decompile correctly
raw_ilspycmd - Run arbitrary ilspycmd commands
Forward-compatible with all future ILSpy features
Output Structure
work/
input/ # Input assemblies (optional)
output/
decompile/ # Decompiled C# files
<assembly>/
*.cs files
project/ # Exported projects
<assembly>/
*.csproj
*.cs files
il/ # IL code output
<assembly>/
*.il files
report.json # Final structured JSON reportJSON Report Format
The orchestrator generates a structured JSON report:
{
"assemblies": [
{
"assembly": "example.dll",
"status": "success",
"paths": {
"decompiled": "work/output/decompile/example/",
"project": "work/output/project/example/",
"il": "work/output/il/example/"
},
"types": [
{
"name": "Namespace.MyClass",
"methods": ["Main", "DoSomething"],
"il_size": {"Main": 123, "DoSomething": 42}
}
],
"references": ["System", "System.Linq"],
"flags_used": ["--langver:11", "--nullable"],
"logs": {
"stdout": "...",
"stderr": "..."
}
}
]
}Workflow
The orchestrator follows this workflow for each assembly:
Decompile → Generate C# source files
Export Project → Create compilable project with references
Extract IL → Get intermediate language code
List Types → Discover all types in assembly
List Methods → For each type, extract methods
Resolve References → Analyze dependencies
Apply Settings → Language version, nullable context, records
Generate Report → Collect all metadata into JSON
Error Handling
All tools return structured JSON with
returncode,stdout, andstderrFailed operations are marked with
status: "error"in the reportFull error logs are included in the report for debugging
Tools are idempotent - safe to run multiple times
Examples
See example_usage.py for complete examples of:
Processing single assemblies
Processing multiple assemblies
Using different language versions
Enabling/disabling nullable context
Custom flags and options
License
This project wraps ILSpy CLI. Please refer to ILSpy's license for usage terms.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- Alicense-qualityDmaintenanceEnables LLMs to autonomously reverse engineer applications by exposing Ghidra's core functionality through MCP tools. Supports decompiling binaries, analyzing code structure, and automatically renaming methods and data.2Apache 2.0
- AlicenseAqualityAmaintenanceA Model Context Protocol (MCP) server providing 62 AI-optimized tools for .NET/C# semantic code analysis, navigation, refactoring, and code generation using Microsoft Roslyn. Built for AI coding agents - provides compiler-accurate code understanding that AI cannot infer from reading source files alone.6231MIT
- Alicense-qualityAmaintenanceILSpy for LLM coding agents. Reflection-based MCP server with 31+ tools to explore .NET assemblies, NuGet packages, types, members, attributes, and XML docs.6MIT
- AlicenseAqualityCmaintenanceMCP server for .NET assembly analysis. Vendor-neutral wrapper around AsmResolver and ILSpy for parsing and decompiling .NET assemblies.111MIT
Related MCP Connectors
JSON tools MCP.
NuGet MCP — .NET package registry
Free MCP tools: the only MCP linter, health checks, cost estimation, and trust evaluation.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/BROKENISTXD/ilspy-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server