mcp-mgba
This server provides a Model Context Protocol (MCP) interface to control the mGBA Game Boy Advance emulator programmatically, enabling AI clients to inspect, manipulate, and automate running games.
Connectivity & Info
mgba_ping— Verify the bridge connection is alivemgba_get_info— Retrieve ROM title, game code, platform, frame count, and a capability map of supported mGBA features
Memory Reading
mgba_read8/mgba_read16/mgba_read32— Read 8-, 16-, or 32-bit values from any mapped memory addressmgba_read_range— Read up to 4096 bytes at once as a hex dump
Memory Writing
mgba_write8/mgba_write16/mgba_write32— Write 8-, 16-, or 32-bit values directly to memory (bypasses cartridge bus/MBC mapper)mgba_write_range— Write up to 4096 bytes in a single call
Input Control
mgba_press_buttons— Queue button presses (A, B, Start, Select, Up, Down, Left, Right, L, R) with configurable hold and release durations; uses a FIFO queue so consecutive presses register as distinct events
Emulation Control
mgba_pause/mgba_unpause— Freeze and resume real-time emulationmgba_advance_frames— Step emulation by exactly N frames synchronouslymgba_reset— Hard-reset the loaded ROM back to boot state
Screenshots
mgba_screenshot— Capture the current display as a PNG file
Save States
mgba_save_state— Save full emulator state (RAM, registers, timing) to a numbered slot (0–9) or an arbitrary file pathmgba_load_state— Restore emulator state from a slot or file path, enabling snapshot/experiment/restore workflows
mcp-mgba
An MCP server that exposes the mGBA Game Boy Advance emulator to any MCP-compatible client (Claude Desktop, Claude Code, etc.).
Lets your model read and write GBA memory, inject button presses, take screenshots, and step the emulator — all through a clean tool interface.

Claude driving an in-development homebrew side-scroller through mgba_press_buttons — Start to begin, A to confirm New Game, then Right to walk and A to jump. Each frame is captured via mgba_screenshot.
How it works
+------------------+ stdio +------------------+ TCP :8765 +------------------+
| MCP client | JSON-RPC | mcp-mgba | newline JSON | mGBA emulator |
| (Claude / etc.) | ===========> | (Node.js) | ============> | bridge.lua |
+------------------+ +------------------+ +------------------+Two pieces:
lua/bridge.lua— runs inside mGBA's scripting engine, opens a loopback TCP server on port 8765dist/index.js— Node.js MCP server, talks to the Lua bridge over TCP, exposes tools over stdio
Related MCP server: PokeMCP
Requirements
mGBA 0.10 or newer (with Lua scripting)
Node.js 22+ (for the MCP server)
Install
Option A — install from npm (recommended)
npm install -g mcp-mgbaPuts mcp-mgba on your PATH. Verify with mcp-mgba --help (it'll print a startup line and wait for stdio — Ctrl+C to exit).
Option B — npx (no install)
npx -y mcp-mgbaRun on demand. Good for trying it out without committing to a global install.
Option C — clone and develop
git clone https://github.com/dmang-dev/mcp-mgba
cd mcp-mgba
npm install # also runs the build via the `prepare` hookThen reference the absolute path to dist/index.js when registering, or npm install -g . to symlink the bin globally.
Set up the mGBA bridge
Launch mGBA and load any GBA ROM.
Open Tools > Scripting…
Click File > Load script and select
lua/bridge.luafrom this repo.
You should see in the scripting console:
[mcp-mgba] bridge listening on 127.0.0.1:8765
[mcp-mgba] frame callback registered — bridge is activeIf you see a bind failed error, the previous instance's socket is still held — quit and relaunch mGBA.
Register with your MCP client
Claude Code (CLI)
claude mcp add mgba --scope user mcp-mgba(if you used Option B without global install, replace mcp-mgba with node /absolute/path/to/dist/index.js)
Verify:
claude mcp list
# mgba: mcp-mgba - ✓ ConnectedClaude Desktop
Edit claude_desktop_config.json:
Platform | Path |
macOS |
|
Windows |
|
Linux |
|
Add (assuming Option A — globally installed):
{
"mcpServers": {
"mgba": {
"command": "mcp-mgba"
}
}
}Or with explicit Node + path (Option B):
{
"mcpServers": {
"mgba": {
"command": "node",
"args": ["/absolute/path/to/mcp-mgba/dist/index.js"]
}
}
}Restart Claude Desktop after editing.
Other MCP clients
The server speaks standard MCP over stdio. Run mcp-mgba (or node dist/index.js) and connect any MCP client to its stdio.
Configuration
Env var | Default | Purpose |
|
| Bridge host to dial |
|
| Bridge port to dial |
Tools
Tool | Description |
| Verify bridge connectivity (returns |
| Game title, code, frame count |
| Read memory at an address |
| Write to RAM |
| Read up to 4096 bytes as a byte array |
| Write up to 4096 bytes from a byte array |
| Queue a button press (FIFO; consecutive calls produce distinct events) |
| Step the emulator N frames |
| Pause / resume emulation |
| Reset the loaded ROM |
| Save a PNG of the current display |
| Save/load emulator state to a slot or path |
See docs/RECIPES.md for end-to-end examples (RAM hunting, snapshot-experiment-restore, side-scroller automation, etc.).
GBA button names
A, B, Select, Start, Right, Left, Up, Down, R, L
GBA address space (cheat sheet)
Range | Region |
| EWRAM (256 KiB, general) |
| IWRAM (32 KiB, fast) |
| I/O registers |
| Palette RAM |
| VRAM |
| OAM |
| ROM (read-only) |
Troubleshooting
Symptom | Cause / Fix |
| mGBA isn't running, or |
| A previous mGBA instance still holds the socket; quit and relaunch mGBA |
Tool calls hang | The bridge script may have errored out silently after a hot-reload — check the mGBA scripting console |
Tools missing in Claude after install | Restart your MCP client; Claude only enumerates servers on startup |
Tool calls return data shaped like an old version after editing | mGBA doesn't fully tear down a previous script when you reload. The new script's |
| mGBA's |
| This particular build of mGBA doesn't expose that method. The bridge feature-detects on the first frame; check |
| Known mGBA Lua quirk — the typed read methods are flaky via pcall from the frame callback. The bridge already routes |
Multiple | Older |
Development
npm install
npm run dev # tsc --watch — autobuilds on src/ changesThe Lua side (lua/bridge.lua and lua/json.lua) needs no build step. Edit and reload via mGBA's File > Load script.
Debugging with the MCP Inspector
Browse and call this server's tools interactively with the MCP Inspector:
npm run inspectorBuild first if you've edited src/ since your last npm install (npm run build, or keep npm run dev running). Override the bridge address with MGBA_HOST / MGBA_PORT (default 127.0.0.1:8765). tools/list works even without mGBA connected; calling a tool needs mGBA open with lua/bridge.lua loaded.
License
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- FlicenseAqualityCmaintenanceEnables 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.Last updated63
- FlicenseAqualityFmaintenanceEnables AI assistants to play Pokemon Fire Red through the mGBA emulator by providing tools for button inputs and screenshots. It allows for direct reading of real-time game state from RAM, including party information, player location, and battle status.Last updated103
- AlicenseAqualityAmaintenanceMCP server for PCSX2 and other emulators that speak the PINE protocol. Read and write 8/16/32/64-bit emulator memory and control save states for PlayStation-family emulation.Last updated14151MIT
- AlicenseAqualityAmaintenanceMCP server for RetroArch via its Network Control Interface. Drive any libretro core — read/write memory, save/load state, screenshot, pause/frame-advance/reset — across NES, SNES, Genesis, N64, GBA, PS1 and more.Last updated17182MIT
Related MCP Connectors
Official remote MCP server bridge for Muumuu Domain.
MCP server for understanding Javascript internals from ECMAScript specification.
Person-owned, portable AI memory as a remote MCP server, readable and writable by any MCP client.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/dmang-dev/mcp-mgba'
If you have feedback or need assistance with the MCP directory API, please join our Discord server