mame-mcp
Enables MAME reverse engineering tasks including memory access tracing, input injection, ROM auditing, and IO-port discovery for arcade-to-SNES porting.
README
mame_mcp
mame_mcp is a Model Context Protocol bridge for MAME-focused reverse
engineering. It is aimed at arcade-to-SNES porting work: memory access traces,
input injection, ROM audit checks, IO-port discovery, and reproducible
headless harnesses.
This first cut is stock-MAME compatible. It drives MAME with generated
-autoboot_script Lua sidecars instead of requiring a custom MAME binary. That
keeps the useful tools available immediately; a deeper MAME source fork can be
added later for live sockets, richer trace buffers, or debugger APIs that Lua
cannot expose cleanly.
Quick Start
python -m pip install -e .
$env:MAME_EXE = "/path/to/mame" # or leave unset if mame is on PATH
mame-mcp-tools --names
mame-mcp-tools --category trace
Wire it into Codex or another MCP client:
{
"mcpServers": {
"mame": {
"command": "mame-mcp-bridge",
"env": {
"MAME_EXE": "/path/to/mame"
}
}
}
}
Restart the MCP client after editing its config.
This repo includes a generic .mcp.json that only starts the bridge. Pass
system and rompath in each tool call, or set MAME_SYSTEM and
MAME_ROMPATH in your local MCP config for the project you are inspecting.
Tools
Current implemented tools:
| Tool | Purpose |
|---|---|
ping |
Verify the MCP bridge is alive. |
config_check |
Show resolved MAME executable, working directory, system, and ROM path. |
audit_romset |
Run mame -verifyroms <system>. |
get_ioports |
Boot a machine briefly and list MAME Lua IO-port fields. |
trace_memory_access |
Generate a Lua read/write tap trace for one or more CPU address ranges. |
trace_cchip_superman |
Optional Superman helper built on trace_memory_access; no ROM path is baked in. |
run_lua_script |
Run a caller-supplied MAME Lua script headlessly. |
The MCP responses return JSON text with command lines, log paths, return codes, stderr/stdout tails, and parsed trace summaries where applicable.
Environment
| Env var | Default | Purpose |
|---|---|---|
MAME_EXE |
mame |
MAME executable or command on PATH. |
MAME_SYSTEM |
none | Default machine short name, e.g. driver_short_name. |
MAME_ROMPATH |
none | ROM search path. |
MAME_CWD |
current directory | Working directory for generated scripts/logs and MAME state. |
MAME_WORKDIR |
<MAME_CWD>/.mame_mcp |
Generated Lua, logs, nvram, cfg, etc. |
Generic Trace Example
{
"system": "driver_short_name",
"rompath": "/path/to/roms",
"frames": 1800,
"ranges": [
{ "name": "device_window", "start": 9437184, "end": 9441279 }
],
"trackReads": [
{ "name": "status", "address": 9439234 }
],
"injectPreset": "none",
"dryRun": true
}
trace_memory_access installs read/write taps over each range, dedupes by
(R/W, PC, address, range), optionally counts values read from selected
addresses, and writes a human-readable log plus a parsed JSON summary.
Use "dryRun": true to generate the Lua harness without launching MAME.
Superman C-Chip Helper
trace_cchip_superman is a convenience wrapper for the known Superman C-Chip
window. It still requires the caller or environment to provide the ROM path.
{
"rompath": "/path/to/roms",
"frames": 1800,
"injectPreset": "none"
}
It expands to a trace_memory_access call over $900000-$900FFF, tracking
reads from $900802/$900803 and reporting whether status $01 and $05 were
seen.
Fork Roadmap
The stock-MAME Lua layer can cover a lot:
- address read/write taps,
- frame callbacks,
- input-field injection,
- ROM audit and machine metadata,
- screenshots via MAME command-line/video options,
- reproducible generated scripts and logs.
A true MAME source fork becomes worthwhile when we need:
- a long-lived JSON-RPC socket inside MAME,
- debugger-grade live memory reads/writes without generated scripts,
- instruction trace ring buffers with low overhead,
- tile/sprite/sound device introspection not exposed through Lua,
- stable save/load state and screenshot APIs as one-shot MCP calls.
The MCP tool names and response shapes here are intentionally similar to the Mesen MCP bridge so agents can learn one mental model and apply it to both console and arcade sources.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。