mGBA MCP Server
Enables programmatic control of the mGBA emulator for Game Boy, Game Boy Color, and Game Boy Advance games, including screenshot capture, memory reading, sprite data dumping, and custom Lua script execution for automated testing and game analysis.
README
mgba-mcp
MCP (Model Context Protocol) server for mGBA emulator - enables programmatic control of Game Boy, Game Boy Color, and Game Boy Advance emulation.
Features
- Headless execution - Runs via xvfb for automated testing
- Screenshot capture - Get PNG screenshots at any frame
- Memory reading - Read individual addresses or memory ranges
- OAM dumping - Dump all 40 sprite entries with position, tile, flags, and palette
- Entity dumping - Read game entity/actor data from WRAM
- Custom Lua scripts - Execute arbitrary Lua code in the emulator
- Savestate support - Load savestates for reproducible testing
Installation
# Install with uv
uv pip install -e .
# Or with pip
pip install -e .
Requirements
- Python 3.11+
- mGBA (mgba-qt) installed and in PATH
- xvfb-run (for headless operation on Linux)
MCP Tools
mgba_run
Run a ROM for a specified number of frames and capture a screenshot.
{
"rom_path": "/path/to/game.gb",
"frames": 120,
"savestate_path": "/path/to/save.ss0"
}
mgba_read_memory
Read memory at specified addresses.
{
"rom_path": "/path/to/game.gb",
"addresses": [49664, 65471],
"frames": 60
}
mgba_read_range
Read a contiguous range of memory.
{
"rom_path": "/path/to/game.gb",
"start_address": 49664,
"length": 256,
"frames": 60
}
mgba_dump_oam
Dump OAM (Object Attribute Memory) sprite data.
{
"rom_path": "/path/to/game.gb",
"savestate_path": "/path/to/save.ss0",
"frames": 60
}
mgba_dump_entities
Dump entity/actor data from WRAM.
{
"rom_path": "/path/to/game.gb",
"entity_base": 49664,
"entity_size": 24,
"entity_count": 10,
"frames": 60
}
mgba_run_lua
Execute a custom Lua script in the emulator.
{
"rom_path": "/path/to/game.gb",
"script": "callbacks:add('frame', function() if emu:currentFrame() > 60 then emu:screenshot('screenshot.png'); emu:quit() end end)",
"timeout": 30
}
Claude Code Integration
Add to your Claude Code MCP settings:
{
"mcpServers": {
"mgba": {
"command": "uv",
"args": ["run", "--directory", "/path/to/mgba-mcp", "mgba-mcp"]
}
}
}
Usage Example
Once configured, Claude Code can use commands like:
Use mgba_dump_oam to check sprite palettes in rom/working/penta_dragon_dx_FIXED.gb
Use mgba_read_range to dump entity data at 0xC200 for 256 bytes
Memory Addresses (Game Boy)
Common memory regions:
0x8000-0x9FFF- VRAM (tile data)0xC000-0xDFFF- WRAM (work RAM)0xFE00-0xFE9F- OAM (sprite attributes)0xFF00-0xFF7F- I/O registers0xFF80-0xFFFE- HRAM (high RAM)
License
MIT
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.