Skip to content

JordanRO2/mcp-x64dbg

Repository files navigation

MCP-x64dbg

x64dbg MCP Server with Domain-Driven Design (DDD) architecture for LLM-assisted debugging and reverse engineering.

Based on wasdubya/x64dbgmcp, restructured with DDD architecture for better maintainability, testability, and extensibility.

Architecture

This project follows Domain-Driven Design principles with a layered architecture:

src/x64dbg_mcp/
  domain/           # Business logic: entities, value objects
  application/      # Services, DTOs
  infrastructure/   # HTTP client, debugger adapter
  interface/        # MCP tools (6 modules)
  zeromcp/          # Custom MCP protocol implementation

27 MCP tools across 6 interface modules:

  • Debug Control: IsDebugging, Run, Pause, Stop, StepIn, StepOver, StepOut
  • Breakpoints: SetBreakpoint, DeleteBreakpoint
  • Registers: RegisterGet, RegisterSet, FlagGet, FlagSet
  • Memory: MemoryRead, MemoryWrite, MemoryCheck, PatternFind
  • Disassembly: Disassemble, GetCurrentInstruction, Assemble, AssembleToMemory
  • Stack: StackPop, StackPush, StackPeek
  • Modules: GetModuleList, ParseExpression, ExecCommand

Prerequisites

Installation

1. Install the Plugin

Copy the plugin files to your x64dbg installation:

build/MCPx64dbg.dp32 -> x64dbg/release/x32/plugins/
build/MCPx64dbg.dp64 -> x64dbg/release/x64/plugins/

Or build from source:

mkdir build && cd build
cmake .. -G "Visual Studio 17 2022"
cmake --build . --config Release --target all_plugins

2. Install the Python Package

pip install https://github.com/JordanRO2/MCP-x64dbg/archive/refs/heads/main.zip

Or for development:

git clone https://github.com/JordanRO2/MCP-x64dbg.git
cd MCP-x64dbg
pip install -e .

3. Configure MCP Client

For Claude Code (~/.claude.json):

{
  "mcpServers": {
    "x64dbg-mcp": {
      "type": "http",
      "url": "http://127.0.0.1:13339/mcp"
    }
  }
}

For Claude Desktop (claude_desktop_config.json):

{
  "mcpServers": {
    "x64dbg-mcp": {
      "command": "python",
      "args": ["-m", "x64dbg_mcp", "--stdio"]
    }
  }
}

Usage

Auto-Start (Recommended)

  1. Create start_mcp.bat in the project root:
@echo off
cd /d "C:\path\to\MCP-x64dbg\src"
set PYTHONPATH=C:\path\to\MCP-x64dbg\src
python -m x64dbg_mcp --host 0.0.0.0
  1. Start x64dbg - the plugin automatically starts:
    • HTTP server on port 8888 (x64dbg API)
    • MCP server on port 13339 (AI interface)

Manual Start

# Start x64dbg first, then:
cd src
python -m x64dbg_mcp --host 0.0.0.0 --port 13339

Plugin Commands

In x64dbg command bar:

  • httpserver - Toggle HTTP server on/off
  • httpport <port> - Change HTTP server port
  • mcpserver - Toggle MCP server on/off

Usage Examples

Set a breakpoint and analyze:

"Set a breakpoint at the main function and step through the first few instructions"

Memory analysis:

"Read 100 bytes from address 0x401000 and show me what's there"

Register inspection:

"What's the current value of RAX and RIP registers?"

Pattern searching:

"Find the pattern '48 8B 05' in the current module"

WSL2 Configuration

For WSL2 access to Windows-hosted x64dbg:

  1. Find Windows host IP:
cat /etc/resolv.conf | grep nameserver | awk '{print $2}'
  1. Add firewall rule (PowerShell as Admin):
New-NetFirewallRule -DisplayName "MCP x64dbg" -Direction Inbound -LocalPort 13339 -Protocol TCP -Action Allow
  1. Configure Claude (~/.claude.json):
{
  "mcpServers": {
    "x64dbg-mcp": {
      "type": "http",
      "url": "http://<WINDOWS_HOST_IP>:13339/mcp"
    }
  }
}

Project Structure

MCP-x64dbg/
  src/
    x64dbg_mcp/           # Python MCP server
      domain/             # Entities: Register, Memory, Breakpoint, Module, Instruction
      application/        # DebuggerService
      infrastructure/     # HTTP client, DebuggerAdapter
      interface/tools/    # MCP tool implementations
      zeromcp/            # MCP protocol
    MCPx64dbg.cpp         # C++ plugin source
  deps/
    x64dbg_sdk/           # x64dbg plugin SDK
  build/                  # Compiled plugins (.dp32, .dp64)
  start_mcp.bat           # Auto-start batch file

Credits

License

MIT License - see LICENSE for details.

About

x64dbg MCP Server with Domain-Driven Design (DDD) architecture for LLM-assisted debugging and reverse engineering.

Resources

License

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors