反编译器
STDIO.NET程序集反编译分析MCP服务器
.NET程序集反编译分析MCP服务器
A powerful MCP (Model Context Protocol) server for decompiling and analyzing .NET assemblies. DecompilerServer provides comprehensive decompilation, search, and code analysis capabilities for any .NET DLL, with specialized convenience features for Unity's Assembly-CSharp.dll files.
Clone the repository:
git clone https://github.com/pardeike/DecompilerServer.git cd DecompilerServer
Build the project:
dotnet build DecompilerServer.sln
Run tests (optional):
dotnet test
💡 Tip: See 🤖 AI Tool Integration to configure with AI assistants.
Configure with AI assistants via MCP (Model Context Protocol):
Codex (.codex/config.toml):
[mcp_servers.decompiler] command = "path_to_DecompilerServer.exe" args = []
GitHub Copilot (.copilot/config.yaml):
servers: decompiler: command: "path_to_DecompilerServer.exe" args: []
Claude Desktop (claude_desktop_config.json):
{ "mcpServers": { "decompiler": { "command": "path_to_DecompilerServer.exe", "args": [] } } }
VS Code MCP Extension (.vscode/settings.json):
{ "mcp.servers": [{ "name": "decompiler", "command": "path_to_DecompilerServer.exe", "args": [] }] }
Start the server:
dotnet run --project DecompilerServer
Load any .NET assembly (via MCP client):
{ "tool": "LoadAssembly", "arguments": { "assemblyPath": "/path/to/YourAssembly.dll" } }
OR for Unity projects:
{ "tool": "LoadAssembly", "arguments": { "gameDir": "/path/to/unity/game" } }
Explore the assembly:
{ "tool": "ListNamespaces", "arguments": {} }
Search for types:
{ "tool": "SearchTypes", "arguments": { "query": "Player", "limit": 10 } }
Decompile source code:
{ "tool": "GetDecompiledSource", "arguments": { "memberId": "<member-id-from-search>" } }
DecompilerServer is built on a robust, modular architecture:
All members use a stable ID format: <mvid-32hex>:<token-8hex>:<kind-code>
# 1. Load any .NET assembly directly { "tool": "LoadAssembly", "arguments": { "assemblyPath": "/path/to/MyLibrary.dll" } } # 2. Find all public classes { "tool": "SearchTypes", "arguments": { "query": "", "accessibility": "public" } } # 3. Get detailed information about a specific type { "tool": "GetMemberDetails", "arguments": { "memberId": "abc123...def:12345678:T" } }
# 1. Load Unity's main assembly { "tool": "LoadAssembly", "arguments": { "assemblyPath": "Game_Data/Managed/Assembly-CSharp.dll" } } # 2. Find all Player-related classes { "tool": "SearchTypes", "arguments": { "query": "Player", "accessibility": "public" } } # 3. Get detailed information about a specific type { "tool": "GetMemberDetails", "arguments": { "memberId": "abc123...def:12345678:T" } } # 4. Generate a Harmony patch skeleton { "tool": "GenerateHarmonyPatchSkeleton", "arguments": { "memberId": "abc123...def:87654321:M", "patchType": "Prefix" } }
# 1. Search for methods containing specific string literals { "tool": "SearchStringLiterals", "arguments": { "query": "PlayerDied", "caseSensitive": false } } # 2. Batch decompile multiple members { "tool": "BatchGetDecompiledSource", "arguments": { "memberIds": ["id1", "id2", "id3"] } } # 3. Analyze usage patterns { "tool": "FindUsages", "arguments": { "memberId": "target-member-id", "includeReferences": true } }
# Build entire solution dotnet build DecompilerServer.sln # Build specific project dotnet build DecompilerServer.csproj
# Run all tests dotnet test # Run with verbose output dotnet test --verbosity normal # Run specific test class dotnet test --filter "ClassName=CoreToolTests"
# Format code before committing dotnet format DecompilerServer.sln
DecompilerServer/
├── Services/           # Core service implementations (7 services)
├── Tools/             # MCP tool implementations (39 tools)  
├── Tests/             # Comprehensive xUnit test suite
├── TestLibrary/       # Test assembly for validation
├── Program.cs         # Application entry point
├── ServiceLocator.cs  # Service locator for MCP tools
└── *.md              # Documentation files
We welcome contributions! Please see our development documentation for detailed guidelines:
dotnet format before committingdotnet test to ensure all tests passdotnet format to maintain code styleDecompilerServer is designed for high performance and thread safety:
ReaderWriterLockSlim for concurrent operationsDecompilerServer implements the Model Context Protocol for seamless integration with AI development tools:
[McpServerTool] attributesSee 🤖 AI Tool Integration for configuration examples.
This project is open source. Please check the repository for license details.
Built with:
For detailed technical documentation and advanced usage scenarios, please refer to the comprehensive guides in the repository documentation.