dnSpy MCP Server (C#) logo

dnSpy MCP Server (C#)

Community
soufianetahiri

MCP server for .NET reverse engineering workflows (dnSpy/ILSpy ecosystem), built in C#.

Publishersoufianetahiri
Repositorydnspy-mcp
LanguageC#
Forks
7
Stars
44
Available tools
0
Transport typestdio
Categories
Links
  • Connect tools to AI workflows

    dnSpy MCP Server (C#) exposes MCP capabilities that can be used by compatible AI clients and agents.

  • 0 available tools

    Browse the callable actions below, including names and descriptions when provided by the server.

  • Ready-to-copy setup

    Use the installation snippets to configure this server in your preferred MCP client.

  • Open source signals

    44 stars and 7 forks from the linked repository.

dnSpy MCP Server (C#)

MCP server for .NET reverse engineering workflows (dnSpy/ILSpy ecosystem), built in C#.

What’s implemented

  • Modular architecture (Core, Transport, Tools, Services)
  • Reflection-based tool registration via attributes
  • Auto-generated tool JSON schemas from C# method signatures
  • MCP stdio transport (Claude Code / Codex / OpenCode compatible)
  • MCP resources/list + resources/read
  • Structured tool outputs (structuredContent) + plain text content
  • Single-file publish profiles (win-x64 / linux-x64)

For full implementation details, see AGENT.md.

Project layout

  • dnspy-mcp.slnx
  • Directory.Build.props
  • publish.ps1
  • src/DnSpyMcpServer/Program.cs
  • src/DnSpyMcpServer/Core/*
  • src/DnSpyMcpServer/Transport/*
  • src/DnSpyMcpServer/Tools/*
  • src/DnSpyMcpServer/Services/*
  • src/DnSpyMcpServer/Properties/PublishProfiles/*

Tools

  • list_types
  • decompile_type
  • decompile_method (supports overload targeting)
  • get_method_il (supports overload targeting)
  • search_members
  • list_methods (helper for overload signatures)
  • find_string_references (find string-literal references in IL)
  • format_dnspy_jump (turn tokens/IL offsets into direct dnSpy navigation steps)
  • patch_replace_string_literal (patch one IL string literal)
  • patch_nop_instructions (NOP one/many IL instructions)

Navigation-friendly output: search/method/reference results include metadata tokens (TypeDef, MethodDef, etc.) so you can jump directly in dnSpy by token.

Patch safety: patch tools always create a backup before writing changes.

All tools return:

  • content (text)
  • structuredContent (JSON object for programmatic clients)

Resources

  • resources/list returns:

    • dnspy://assemblies
    • cached assembly resources, e.g. dnspy://assembly?path=...&view=summary
    • cached assembly resources, e.g. dnspy://assembly?path=...&view=types
  • resources/read supports:

    • dnspy://assemblies
    • dnspy://assembly?path=<absolute-or-relative>&view=summary
    • dnspy://assembly?path=<absolute-or-relative>&view=types

Note: assembly resources are cache-driven. Cache is populated when tools are called with assemblyPath.

Build

bash
dotnet build src/DnSpyMcpServer/DnSpyMcpServer.csproj -c Release

Run

bash
dotnet run --project src/DnSpyMcpServer/DnSpyMcpServer.csproj -c Release

Publish (single-file)

PowerShell helper:

powershell
./publish.ps1 -Runtime win-x64
./publish.ps1 -Runtime linux-x64

Or directly:

bash
dotnet publish src/DnSpyMcpServer/DnSpyMcpServer.csproj -c Release -p:PublishProfile=win-x64
dotnet publish src/DnSpyMcpServer/DnSpyMcpServer.csproj -c Release -p:PublishProfile=linux-x64

Quick start (copy/paste)

  1. Build:
bash
dotnet build src/DnSpyMcpServer/DnSpyMcpServer.csproj -c Release
  1. Use this server command in your MCP client:
json
{
  "mcpServers": {
    "dnspy": {
      "command": "dotnet",
      "args": [
        "C:/Tools/Cooking/Reverse/dnSpy/dnspy-mcp/src/DnSpyMcpServer/bin/Release/net8.0/win-x64/DnSpyMcpServer.dll"
      ]
    }
  }
}
  1. Restart your MCP client.

Prebuilt config files

Ready-to-copy templates are in:

  • configs/claude-code.mcp.json
  • configs/codex.mcp.json
  • configs/opencode.mcp.json

If your local path differs, edit the executable path in the selected file (args[0] for stdio clients, command[0] for OpenCode local MCP).

Client-specific config snippets

Claude Code

Add/update your MCP config with:

json
{
  "mcpServers": {
    "dnspy": {
      "command": "dotnet",
      "args": [
        "C:/Tools/Cooking/Reverse/dnSpy/dnspy-mcp/src/DnSpyMcpServer/bin/Release/net8.0/win-x64/DnSpyMcpServer.dll"
      ]
    }
  }
}

Codex

Use the same MCP server entry:

json
{
  "mcpServers": {
    "dnspy": {
      "command": "dotnet",
      "args": [
        "C:/Tools/Cooking/Reverse/dnSpy/dnspy-mcp/src/DnSpyMcpServer/bin/Release/net8.0/win-x64/DnSpyMcpServer.dll"
      ]
    }
  }
}

OpenCode (Windows)

OpenCode uses this config file:

%USERPROFILE%\.config\opencode\opencode.json

Add this block under mcp:

json
{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "dnspy": {
      "type": "local",
      "enabled": true,
      "command": [
        "dotnet",
        "C:/Tools/Cooking/Reverse/dnSpy/dnspy-mcp/src/DnSpyMcpServer/bin/Release/net8.0/win-x64/DnSpyMcpServer.dll"
      ]
    }
  }
}

(Template file: configs/opencode.mcp.json)

Optional: run from project instead of DLL

json
{
  "mcpServers": {
    "dnspy": {
      "command": "dotnet",
      "args": [
        "run",
        "--project",
        "C:/Tools/Cooking/Reverse/dnSpy/dnspy-mcp/src/DnSpyMcpServer/DnSpyMcpServer.csproj",
        "-c",
        "Release"
      ]
    }
  }
}

First actions to test in your client

After restart, ask your client to call:

  1. list_types
json
{ "assemblyPath": "C:/path/to/target.dll" }
  1. list_methods
json
{ "assemblyPath": "C:/path/to/target.dll", "typeFullName": "MyApp.Services.AuthService" }
  1. decompile_method
json
{
  "assemblyPath": "C:/path/to/target.dll",
  "typeFullName": "MyApp.Services.AuthService",
  "methodName": "Login",
  "parameterTypeNames": ["System.String", "System.String"]
}
  1. resources/list then resources/read with dnspy://assemblies

  2. find_string_references

json
{
  "assemblyPath": "C:/Program Files (x86)/Cato Networks/Cato Client/CatoClient.exe",
  "text": "Screenshot 2026-03-11 082704.png",
  "caseSensitive": false,
  "maxResults": 200
}

Tip: also search fragments like Pictures\\Screenshots or just Screenshot.

  1. format_dnspy_jump
json
{
  "assemblyPath": "C:/Program Files (x86)/Cato Networks/Cato Client/CatoClient.exe",
  "typeDefToken": "0x02000058",
  "methodDefToken": "0x060005C1",
  "ilOffset": "IL_01D2"
}
  1. patch_replace_string_literal (always creates backup)
json
{
  "assemblyPath": "C:/Program Files (x86)/Cato Networks/Cato Client/CatoClient.exe",
  "methodDefToken": "0x060005C1",
  "ilOffset": "IL_01D2",
  "newText": "[patched text]",
  "inPlace": false
}
  1. patch_nop_instructions (always creates backup)
json
{
  "assemblyPath": "C:/Program Files (x86)/Cato Networks/Cato Client/CatoClient.exe",
  "methodDefToken": "0x060005C1",
  "ilOffset": "IL_01DD",
  "count": 1,
  "inPlace": false
}

Overload targeting example

json
{
  "assemblyPath": "C:/path/target.dll",
  "typeFullName": "MyApp.Services.AuthService",
  "methodName": "Login",
  "parameterTypeNames": ["System.String", "System.String"]
}

If parameterTypeNames is omitted and overloads exist, the server returns an ambiguity error with available signatures.

Installation

TypingMind
{
  "mcpServers": {
    "soufianetahiri-dnspy-mcp": {
      "command": "dotnet",
      "args": [
        "path/to/your/DnSpyMcpServer.dll"
      ]
    }
  }
}

Use dnSpy MCP Server (C#) MCP with multiple AI models

TypingMind connects MCP tools at the workspace level, so once dnSpy MCP Server (C#) is connected, you can use it with different AI models in TypingMind instead of setting it up separately for each model. This MCP runs locally through the TypingMind MCP connector on your device.

Setup guide to use the local connector

Use this when the MCP server needs access to local files, apps, or private resources on your computer.

1

Open the MCP settings

In TypingMind, go to Settings, Advanced Settings, then Model Context Protocol and choose Setup Connector.

  1. Open TypingMind in your browser.
  2. Click the Settings icon.
  3. Go to Advanced Settings.
  4. Open the Model Context Protocol section.
  5. Click Setup Connector and choose This Device.
TypingMind MCP connector setup screen with This Device selected
2

Run the connector command

Choose This Device, copy the command from TypingMind, and run it in Terminal. Keep the process running while you use MCP.

  1. Copy the setup command shown by TypingMind.
  2. Open Terminal on macOS or Windows Terminal on Windows.
  3. Paste and run the command.
  4. Approve the package install if Terminal asks you to proceed.
  5. Keep the Terminal window running while using MCP tools.
3

Add dnSpy MCP Server (C#) as a server

When the connector status is Ready, click Edit Servers and paste the MCP server configuration.

  1. Wait until the connector status shows Ready.
  2. Click Edit Servers.
  3. Paste the dnSpy MCP Server (C#) MCP server configuration.
  4. Save the server list.
  5. Refresh if you want to confirm the connector is still ready.
TypingMind MCP settings showing active server and Edit Servers button
{
  "mcpServers": {
    "soufianetahiri-dnspy-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "<mcp-server-package>"
      ]
    }
  }
}
4

Use it across models

Save the server list, open Plugins, enable the dnSpy MCP Server (C#) MCP tools, then select any supported AI model in TypingMind and use the tools in chat or assign them to an AI agent.

  1. Open the Plugins page in TypingMind.
  2. Enable the dnSpy MCP Server (C#) MCP tools.
  3. Start a chat and choose the AI model you want to use.
  4. Use the MCP tools in chat or assign them to an AI agent.
  5. Switch to another AI model whenever needed without reconnecting MCP.
TypingMind chat using enabled MCP tools with a selected AI model
Can you use dnSpy MCP Server (C#) to help me with this task?
dnSpy MCP Server (C#)
Sure. I read it.
Here is what I found using dnSpy MCP Server (C#).

Frequently asked questions

What is the dnSpy MCP Server (C#) MCP server used for?

dnSpy MCP Server (C#) is an MCP server that lets compatible AI clients connect to external tools and context. In TypingMind, you can add this MCP server once and make its tools available in your AI workspace.

Can I use dnSpy MCP Server (C#) MCP with multiple AI models in TypingMind?

Yes. TypingMind connects MCP tools at the workspace level, so you can use dnSpy MCP Server (C#) with different AI models such as Claude, ChatGPT, Gemini, or other models you have configured in TypingMind without setting up the MCP server separately for each model.

Why use dnSpy MCP Server (C#) MCP with TypingMind?

TypingMind is one of the best frontends for LLM chat because it brings multiple AI models, prompts, plugins, AI agents, API keys, and MCP tools into one workspace. With dnSpy MCP Server (C#) connected, you can use its MCP tools across your preferred models while keeping your chat workflow organized in TypingMind.

How do I connect dnSpy MCP Server (C#) MCP to TypingMind?

dnSpy MCP Server (C#) runs through the TypingMind local MCP connector. This is best when the MCP server needs access to local files, desktop apps, command-line tools, or private resources on your computer.

What tools does dnSpy MCP Server (C#) MCP provide in TypingMind?

dnSpy MCP Server (C#) exposes MCP capabilities that can be enabled from the TypingMind Plugins page and used in chat or assigned to AI agents.

Do I need to share my API keys with TypingMind to use dnSpy MCP Server (C#) MCP?

No. TypingMind is local-first and lets you keep your model providers, API keys, prompts, and MCP configuration under your control. If dnSpy MCP Server (C#) requires authentication, add the required headers, OAuth settings, or local configuration for that MCP server when you create the connection.

Related MCP Servers

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇