dolphin-decomp-mcp

dolphin-decomp-mcp

Provides a set of low-level tools for reverse engineering GameCube and Wii games via Dolphin's DAP debug server, including memory/register operations, disassembly, breakpoints, and code injection.

Category
访问服务器

README

dolphin-decomp-mcp

A small, general-purpose tool surface over Dolphin's DAP debug server for decompilation / reverse-engineering work on GameCube & Wii titles.

It exposes 12 primitives — read/write memory and registers, disassemble, run control, code & data breakpoints, a PPC assembler, code injection, detours, and non-halting realtime watches/freezes — as an MCP server (for an agent like Claude Code) and an equivalent CLI (for manual poking). Both front-ends share the exact same handlers, so behaviour can't drift.

The tools are deliberately low-level. The agent composes them into whatever it needs; the three headline workflows fall out of composition (see Recipes).

Requirements

  • A Dolphin built from the feature/dap-server branch with the DAP server enabled (see below). This project talks to that server; it does not embed one.
  • Python ≥ 3.10.
  • For the assembler tools: the powerpc-eabi-* binutils. This project reuses the ones the melee decomp tree ships under build/binutils. Point it elsewhere with DOLPHIN_DECOMP_BINUTILS=/path/to/dir.
  • For the MCP server front-end only: pip install mcp. The CLI and the Python API need no third-party packages.

Install

cd dolphin-decomp-mcp
python3 -m venv .venv && . .venv/bin/activate
pip install -e '.[mcp,dev]'      # drop [mcp] if you only want the CLI
pytest -q                         # 21 tests, no emulator needed

Connecting to Dolphin

Start Dolphin's DAP server. Prefer a Unix socket — it is gated by filesystem permissions. The TCP transport in this fork binds an unauthenticated debug server that grants full guest-memory read/write and code injection; if you use TCP, keep it on loopback (127.0.0.1) and off any untrusted network. (A local patch pinning the fork's TCP bind to loopback lives in the sibling dolphin-dap checkout.)

dolphin-emu-nogui \
  -C Dolphin.General.DAPSocket=/tmp/dolphin-decomp.sock \
  -C Dolphin.General.DAPStopOnEntry=true \
  -v Null --platform headless \
  --exec /path/to/GALE01.iso
# optional: --debug-elf /path/to/main.elf   (adds DWARF 1.1 line info / symbols)

Then point either front-end at it via --socket / --port or the env vars DOLPHIN_DAP_SOCKET, DOLPHIN_DAP_HOST, DOLPHIN_DAP_PORT.

MCP server (agent-facing)

Run it over stdio:

dolphin-decomp-mcp --socket /tmp/dolphin-decomp.sock

Register it with Claude Code (.mcp.json in your project, or claude mcp add):

{
  "mcpServers": {
    "dolphin": {
      "command": "/abs/path/dolphin-decomp-mcp/.venv/bin/dolphin-decomp-mcp",
      "args": ["--socket", "/tmp/dolphin-decomp.sock"],
      "env": { "DOLPHIN_DECOMP_BINUTILS": "/abs/path/melee/build/binutils" }
    }
  }
}

The connection to Dolphin is lazy and reconnects if the socket drops, so the MCP server can start before the emulator is up.

CLI (manual)

Every tool is a subcommand (the dolphin_ prefix is dropped). Scalars are positional/flag args; object/array args are JSON strings. Output is JSON.

dolphin-decomp --socket /tmp/dolphin-decomp.sock session status
dolphin-decomp --socket /tmp/dolphin-decomp.sock read 0x80000000 16
dolphin-decomp --socket /tmp/dolphin-decomp.sock read 0x80003100 4 --format disasm
dolphin-decomp --socket /tmp/dolphin-decomp.sock control pause
dolphin-decomp --socket /tmp/dolphin-decomp.sock inject $'li r3, 1\nblr'
dolphin-decomp --socket /tmp/dolphin-decomp.sock breakpoints --data '[{"address":2147483648,"access":"write"}]'
dolphin-decomp assemble $'li r3, 0x1234\nblr'      # no emulator needed

The tools

Tool What it does
dolphin_session status / attach / launch / restart / terminate / disconnect
dolphin_read read memory as hex, or as disassembly
dolphin_write write raw bytes (hex) to memory
dolphin_registers read all registers of the top frame; optionally write some first
dolphin_eval evaluate a PPC debugger expression (r3 + r4, memory derefs)
dolphin_stack backtrace the stopped core (who called / who wrote)
dolphin_control continue / pause / step_over / step_in / step_out / goto — returns the resulting stop
dolphin_breakpoints set code breakpoints and/or data watchpoints (authoritative)
dolphin_assemble PPC (Gekko) asm text → machine-code bytes, no emulator needed
dolphin_inject assemble (or take hex) and write code into a cave or a fixed address
dolphin_detour install a transparent detour at an instruction (observe or replace)
dolphin_watch non-halting realtime memory watch/poll, and freeze/unfreeze

Recipes

Find the writer (reverse breakpoint). What corrupts 0x8045C000?

  1. dolphin_breakpoints data=[{address: 0x8045C000, access: "write"}]
  2. dolphin_control continue → stops with reason: "data breakpoint", PC = the writing instruction.
  3. dolphin_stack + dolphin_registers → the culprit and its inputs.

Call a function / test a hypothesis. Does fn(0x10) return what you think?

  1. dolphin_control goto <fn_entry>; dolphin_registers writes={r3: 0x10}.
  2. dolphin_breakpoints code=[{address: <caller_return_or_blr>}].
  3. dolphin_control continue; read the result from r3 via dolphin_registers.

Test a code change live. Try a fix without rebuilding the game.

  • Patch in place: dolphin_inject code="<asm>" address=<site> (read it first if you want to restore), or
  • Observe/replace non-destructively: dolphin_detour target=<fn> body="<asm>" (end with b-to-trampoline to observe, or blr after setting r3 to replace), then dolphin_control continue and verify.

Layout

dolphin_decomp/
  dap.py       # framed DAP client core + event pump (no deps)
  session.py   # high-level Dolphin operations (no deps)
  ppc.py       # powerpc-eabi assembler wrapper (no deps)
  tools.py     # the 12-tool registry + Backend (shared by both front-ends)
  server.py    # MCP server (needs `mcp`)
  cli.py       # CLI (no deps)
tests/         # framing, session-over-mock, assembler; mcp_smoke.py is live-only

License

MIT.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选