ILSpy MCP Serverのロゴ

ILSpy MCP Server

コミュニティ
bivex

🔓 UNLEASH ILSpy'S POWER. Reverse-engineer DOTNET code at GOD SPEED. AI-assisted debugging that THINKS with you. Decompile ANYTHING. 🚀

公開者bivex
リポジトリILSpy-Mcp
言語C#
フォーク
7
スター
67
利用可能なツール
0
通信方式stdio
カテゴリ
ライセンスMIT
リンク
  • ツールをAIワークフローに接続

    ILSpy MCP Serverは、対応するAIクライアントやAIエージェントから利用できるMCP機能を提供します。

  • 0個の利用可能なツール

    呼び出し可能なアクションを以下で確認できます。サーバーから提供されている場合は、名前や説明も表示されます。

  • コピーして使える設定

    セットアップ用の設定例を使って、お好みのMCPクライアントにこのサーバーを設定できます。

  • オープンソースの注目度

    リンク先のリポジトリには67件のスターと7件のフォークがあります。

ILSpy MCP Server

NuGet Version NuGet Downloads Framework MCP Protocol License: MIT

A Model Context Protocol (MCP) server built on .NET 9 that provides in-memory .NET assembly decompilation and structural analysis capabilities for AI assistants using ILSpy (ICSharpCode.Decompiler).


💡 How It Works

ILSpy MCP Server acts as a bridge between AI assistants (like Claude Code, Cursor, Antigravity) and compiled .NET binaries (.dll, .exe). It enables LLMs to inspect, decompile, and analyze compiled .NET code directly via natural language.

┌─────────────────────────────────────────────────────────────────────────────┐
│                             AI Client / Host                                │
│                     (Claude Code, Cursor, Antigravity)                      │
└───────────────────────────────────┬─────────────────────────────────────────┘
                                    │ stdio (JSON-RPC 2.0)
                                    ▼
┌─────────────────────────────────────────────────────────────────────────────┐
│                             ILSpy MCP Server                                │
│                                                                             │
│  ┌───────────────────────────────────────────────────────────────────────┐  │
│  │ Transport Layer (MCP Tools)                                           │  │
│  │ Mappings: Tool Request ➔ Parameters Validation ➔ Response Formatting  │  │
│  └──────────────────────────────────┬────────────────────────────────────┘  │
│                                     │                                       │
│  ┌──────────────────────────────────▼────────────────────────────────────┐  │
│  │ Application Use Cases                                                 │  │
│  │ Single-responsibility orchestrators (Timeouts, Cancellation, Limits)   │  │
│  └──────────────────────────────────┬────────────────────────────────────┘  │
│                                     │                                       │
│  ┌──────────────────────────────────▼────────────────────────────────────┐  │
│  │ Infrastructure (ILSpy Engine Adapter)                                 │  │
│  │ Wraps ICSharpCode.Decompiler CSharpDecompiler & PEFile Metadata       │  │
│  └──────────────────────────────────┬────────────────────────────────────┘  │
└─────────────────────────────────────┼───────────────────────────────────────┘
                                      │ In-Memory Inspection
                                      ▼
                      ┌───────────────────────────────┐
                      │  Target .NET Assemblies       │
                      │   (.dll / .exe binaries)      │
                      └───────────────────────────────┘

Request Lifecycle & Processing Pipeline

  1. JSON-RPC Communication: The MCP server runs as a background process communicating over standard input/output (stdio) using JSON-RPC 2.0. Logging is redirected to stderr to preserve standard output for protocol payloads.
  2. Tool Selection & Parameter Mapping: When an AI client invokes a tool (e.g., decompile_type or analyze_assembly), the Transport Layer receives the call, validates inputs using strongly-typed domain models (AssemblyPath, TypeName), and prevents path traversal or missing file errors early.
  3. Use Case Execution: The Application Layer invokes a dedicated, single-responsibility use case. It sets up CancellationToken linked to configurable operation timeouts and size safety limits.
  4. ILSpy Engine Processing: The Infrastructure Layer passes the file path to ICSharpCode.Decompiler.CSharp.CSharpDecompiler and PEFile:
    • Parses the PE metadata tables and TypeDefs/MethodDefs.
    • Reconstructs C# Abstract Syntax Trees (AST).
    • Generates formatted, human-readable C# source code or structural metadata in-memory.
  5. Response Formatting & Truncation: Output size is checked against MaxDecompilationSize to protect the LLM context window. The formatted output is sent back to the LLM.

🎯 Recommended LLM Workflow

For best results when analyzing unfamiliar .NET libraries or assemblies, AI assistants follow a 3-step workflow:

  Step 1: DISCOVERY                Step 2: STRUCTURAL INSPECTION         Step 3: DECOMPILATION
┌─────────────────────────┐      ┌───────────────────────────────┐     ┌───────────────────────┐
│ `analyze_assembly`      │ ───► │ `get_type_members`            │ ──► │ `decompile_type`      │
│ `list_assembly_types`   │      │ `find_type_hierarchy`         │     │ `decompile_method`    │
└─────────────────────────┘      │ `search_members_by_name`      │     └───────────────────────┘
                                 │ `find_extension_methods`      │
                                 └───────────────────────────────┘
  1. Discovery: Understand overall structure and namespaces using analyze_assembly or filter types using list_assembly_types.
  2. Structural Inspection: Understand type signatures, public members, and inheritance graphs using get_type_members, find_type_hierarchy, or find_extension_methods without loading full implementation bodies.
  3. Targeted Decompilation: Decompile exact class logic or specific method algorithms using decompile_type or decompile_method.

🛠️ Available MCP Tools

ToolPurposeDescriptionKey Parameters
analyze_assemblyHigh-level ArchitectureHigh-level summary of namespaces, public/internal type counts, and key entry points.assemblyPath, query
list_assembly_typesType DiscoveryLists all types grouped by namespace. Supports namespace filtering.assemblyPath, namespaceFilter
get_type_membersAPI Surface InspectionLists methods, properties, fields, and events for a type without decompiling code bodies.assemblyPath, typeName
find_type_hierarchyInheritance MappingDisplays base classes, implemented interfaces, and derived types.assemblyPath, typeName
decompile_typeFull Type DecompilationDecompiles complete C# source code of a specified class, interface, struct, or enum.assemblyPath, typeName
decompile_methodMethod DecompilationDecompiles only the body and signature of a specific method.assemblyPath, typeName, methodName
search_members_by_nameMember SearchSearches for members matching a substring or pattern across the assembly.assemblyPath, searchTerm
find_extension_methodsExtension DiscoveryFinds all C# extension methods defined in the assembly that target a specific type.assemblyPath, targetTypeName

🚀 Quick Start

Prerequisites

  • .NET 9.0 SDK or higher
  • An MCP-compatible client (Claude Code, Cursor, Antigravity, Claude Desktop, VS Code, etc.)

Option A: Install from NuGet (Recommended)

Install ILSpyMcp.Server globally via NuGet:

bash
dotnet tool install -g ILSpyMcp.Server

To update to the latest release from NuGet:

bash
dotnet tool update -g ILSpyMcp.Server

Option B: Build & Run from Source

Clone the repository and build the project:

bash
git clone https://github.com/gentledepp/ILSpy-Mcp.git
cd ILSpy-Mcp
dotnet build -c Release

You can then run the built DLL directly in your MCP client settings:

json
{
  "mcpServers": {
    "ilspy-mcp": {
      "command": "dotnet",
      "args": ["/path/to/ILSpy-Mcp/bin/Release/net9.0/ILSpy.Mcp.dll"]
    }
  }
}

📦 Packaging & Publishing to NuGet

The project is preconfigured as a .NET Global Tool package (ILSpyMcp.Server).

Build & Pack

Create a .nupkg package in Release mode:

bash
dotnet pack -c Release -o ./nupkg

Publish to NuGet.org

Push the generated package to NuGet.org:

bash
dotnet nuget push ./nupkg/ILSpyMcp.Server.*.nupkg \
  --api-key YOUR_NUGET_API_KEY \
  --source https://api.nuget.org/v3/index.json

Install Local Build (Testing)

Test the locally built package before publishing:

bash
dotnet tool install -g --add-source ./nupkg ILSpyMcp.Server

⚙️ MCP Client Configuration

Claude Code

Register directly with the CLI:

bash
claude mcp add ilspy-mcp --command "ilspy-mcp" --scope user

Or add to .mcp.json in your workspace:

json
{
  "mcpServers": {
    "ilspy-mcp": {
      "type": "stdio",
      "command": "ilspy-mcp",
      "args": []
    }
  }
}

Cursor & Antigravity

Add to your MCP server configuration:

json
{
  "mcpServers": {
    "ilspy-mcp": {
      "command": "ilspy-mcp",
      "args": []
    }
  }
}

Claude Desktop

Add to claude_desktop_config.json:

json
{
  "mcpServers": {
    "ilspy-mcp": {
      "command": "ilspy-mcp",
      "args": []
    }
  }
}

💬 Natural Language Prompt Examples

  • Analyze Assembly Structure:

    "Analyze the architecture of /path/to/MyService.dll and list key entry points."

  • Explore Types:

    "List all public types in the namespace MyService.Core inside /path/to/MyService.dll."

  • Inspect API Surface:

    "Show me all public methods and properties of UserManager in /path/to/MyService.dll."

  • Decompile Class Implementation:

    "Decompile the OrderProcessor class in /path/to/ECommerce.dll and explain how payments are processed."

  • Decompile Specific Method:

    "Decompile the ValidateToken method of JwtHandler from /path/to/Auth.dll."


🔧 Environment Configuration

Customize execution behavior via environment variables:

VariableDescriptionDefault
ILSpy__MaxDecompilationSizeMaximum allowed output size in bytes (protects context windows)1048576 (1 MB)
ILSpy__DefaultTimeoutSecondsOperation timeout limit in seconds30
ILSpy__MaxConcurrentOperationsMaximum concurrent decompilation threads10

Example setting in .mcp.json:

json
{
  "mcpServers": {
    "ilspy-mcp": {
      "command": "ilspy-mcp",
      "env": {
        "ILSpy__MaxDecompilationSize": "2097152",
        "ILSpy__DefaultTimeoutSeconds": "60"
      }
    }
  }
}

🏗️ Architecture & Security

  • Clean Hexagonal Architecture: Strictly decoupled into Domain, Application, Infrastructure, and Transport.
  • Read-Only Operation: The server performs pure read-only disassembly and reflection; it never writes or modifies files on disk.
  • Path Validation: Input assembly paths are checked against illegal characters, path traversal attempts, and file existence.
  • Context Protection: Decompilation output is limited by configurable byte size boundaries to avoid blowing LLM context budgets.
  • Stderr Logging: All diagnostic logging goes to stderr, leaving stdout dedicated strictly for MCP protocol communication.

📜 License

Distributed under the MIT License.

インストール

TypingMind
前提条件:

Node.js 18+

{
  "mcpServers": {
    "bivex-ilspy-mcp": {
      "command": "",
      "args": []
    }
  }
}

ILSpy MCP ServerのMCPを複数のAIモデルで活用

TypingMindはワークスペース単位でMCPツールに接続します。そのため、一度ILSpy MCP Serverに接続すれば、モデルごとに個別に設定することなく、TypingMind内のさまざまなAIモデルで利用できます。 このMCPは、デバイス上のTypingMind MCPコネクタを通じてローカルで動作します。

ローカルコネクタのセットアップガイド

MCPサーバーが、お使いのコンピューター上のローカルファイル、アプリ、非公開リソースにアクセスする必要がある場合は、この方法を使います。

1

MCP設定を開く

TypingMindで「設定」、「詳細設定」、「MCP」の順に進み、「コネクタを設定」を選択してください。

  1. ブラウザでTypingMindを開いてください。
  2. 設定アイコンをクリックしてください。
  3. 「詳細設定」に移動してください。
  4. 「MCP」セクションを開いてください。
  5. 「コネクタを設定」をクリックし、「このデバイス」を選択してください。
「このデバイス」が選択されたTypingMindのMCPコネクタ設定画面
2

コネクタのコマンドを実行

「このデバイス」を選択し、TypingMindからコマンドをコピーしてターミナルで実行してください。MCPの使用中は、プロセスを実行したままにしてください。

  1. TypingMindに表示されるセットアップコマンドをコピーしてください。
  2. macOSではターミナルを、WindowsではWindows Terminalを開いてください。
  3. コマンドを貼り付けて実行してください。
  4. ターミナルで続行の確認を求められた場合は、パッケージのインストールを承認してください。
  5. MCPツールの使用中は、ターミナルウィンドウを開いたまま、プロセスの実行を継続してください。
3

ILSpy MCP Serverをサーバーとして追加

コネクタのステータスが「準備完了」になったら、「サーバーを編集」をクリックし、MCPサーバーの設定を貼り付けてください。

  1. コネクタのステータスが「準備完了」になるまでお待ちください。
  2. 「サーバーを編集」をクリックしてください。
  3. ILSpy MCP ServerのMCPサーバー設定を貼り付けてください。
  4. サーバー一覧を保存してください。
  5. コネクタが引き続き使用可能か確認するには、更新してください。
稼働中のサーバーと「サーバーを編集」ボタンが表示されたTypingMindのMCP設定画面
{
  "mcpServers": {
    "bivex-ilspy-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "ILSpy-Mcp"
      ]
    }
  }
}
4

複数のモデルで同じ接続を使用

サーバー一覧を保存し、「プラグイン」を開いてILSpy MCP ServerのMCPツールを有効にしてください。その後、TypingMindで対応するAIモデルを選択し、チャットでツールを使うか、AIエージェントに割り当ててください。

  1. TypingMindの「プラグイン」ページを開いてください。
  2. ILSpy MCP ServerのMCPツールを有効にしてください。
  3. チャットを開始し、使用するAIモデルを選択してください。
  4. MCPツールをチャットで使うか、AIエージェントに割り当ててください。
  5. MCPに再接続することなく、必要に応じて別のAIモデルに切り替えられます。
選択したAIモデルと有効なMCPツールを使用したTypingMindのチャット
ILSpy MCP Serverを使ってこのタスクを手伝ってもらえますか?
ILSpy MCP Server
はい、読みました。
ILSpy MCP Serverで調べた結果をお伝えします。

よくある質問

ILSpy MCP Server MCPサーバーは何に使いますか?

ILSpy MCP Serverは、対応するAIクライアントを外部ツールやコンテキストに接続するためのMCPサーバーです。TypingMindでは、このMCPサーバーを一度追加するだけで、AIワークスペース内でそのツールを利用できるようになります。

TypingMindでILSpy MCP Server MCPを複数のAIモデルと併用できますか?

はい。TypingMindはワークスペース単位でMCPツールに接続するため、モデルごとにMCPサーバーを設定する必要はありません。Claude、ChatGPT、Geminiや、TypingMindで設定したその他のAIモデルでILSpy MCP Serverを利用できます。

TypingMindでILSpy MCP Server MCPを使うメリットは何ですか?

TypingMindは、複数のAIモデル、プロンプト、プラグイン、AIエージェント、APIキー、MCPツールを1つのワークスペースにまとめられる、LLMチャット向けの優れたフロントエンドです。ILSpy MCP Serverを接続すると、TypingMindでチャットのワークフローを整理しながら、お好みのモデルでそのMCPツールを利用できます。

ILSpy MCP Server MCPをTypingMindに接続するにはどうすればよいですか?

ILSpy MCP ServerはTypingMindのローカルMCPコネクタ経由で動作します。MCPサーバーがコンピューター上のローカルファイル、デスクトップアプリ、コマンドラインツール、プライベートリソースにアクセスする必要がある場合に最適です。

TypingMindでILSpy MCP Server MCPのどのようなツールを利用できますか?

ILSpy MCP ServerはMCP機能を提供しています。TypingMindのプラグインページで有効にすると、チャットで使用したり、AIエージェントに割り当てたりできます。

ILSpy MCP Server MCPを使うには、APIキーをTypingMindと共有する必要がありますか?

いいえ。TypingMindはローカルファーストの設計で、モデルプロバイダー、APIキー、プロンプト、MCP設定をご自身で管理できます。ILSpy MCP Serverで認証が必要な場合は、接続の作成時に、そのMCPサーバーに必要なヘッダー、OAuth設定、またはローカル設定を追加してください。

関連するMCPサーバー

すべて見る

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇