Controls an mGBA session through MCP, including memory access, input, frame stepping, screenshots, and emulator state management.
Copy the AI prompt to install this server into Claude Code, Cursor, or another agent ā or use 1-click editor setup below.
This server is confirmed live ā we successfully called its tools/list endpoint directly (see the verified badge above). We haven't yet sandbox-tested the stdio install command below specifically, which is a separate, ongoing check.
š” Paste the JSON block into your client's configuration file under mcpServers, then restart the application.
Inspect callable tools, capabilities, and parameters exposed to AI agents by MCP Mgba.
mgba_pingPURPOSE: Verify that the mGBA Lua bridge is connected and responding to RPC over the TCP socket. USAGE: Call this once at start-of-session before issuing other tool calls; if it succeeds, every other tool will at least be reachable (individual tools may still fail if the loaded mGBA build doesn't expose a particular emu method ā see mgba_get_info ā capabilities for that). BEHAVIOR: No side effects ā pure liveness probe. Times out after a few seconds with a clear error if mGBA isn't running, isn't pointed at the right host:port, or hasn't loaded the bridge Lua script (Tools ā Scripting in mGBA). RETURNS: The literal string 'pong' on success.
mgba_get_infoPURPOSE: Get the loaded ROM's title, internal game code (e.g. 'AGBE' for GBA Pokemon Emerald US, 'BPRE' for FireRed), platform identifier (GBA vs GB/GBC), current frame count, and a `capabilities` map listing which optional emu methods this mGBA build exposes (pause, unpause, frameAdvance, saveStateSlot, saveStateFile, screenshot, etc.). USAGE: Call after mgba_ping at the start of a session to identify the loaded ROM and feature-detect optional capabilities BEFORE invoking tools that depend on them ā pause/unpause/reset/save_state/load_state/advance_frames are all build-dependent on mGBA. The platform field tells you whether to address memory using the GBA layout (32-bit, EWRAM 0x02000000) or the GB/GBC layout (16-bit, WRAM 0xC000). BEHAVIOR: No side effects ā pure read of emulator metadata. Returns '(unavailable)' for fields the loaded core can't expose (title when no ROM is loaded, code on systems without a header, etc.). Never throws on a partial read. RETURNS: Multi-line text with Title, Code, Platform, Frame, then the lists of present and missing capabilities for this build.
mgba_read8PURPOSE: Read an unsigned 8-bit byte from emulated memory at the given system bus address. USAGE: Use for single-byte status flags, counters, and 8-bit fields. For 16- or 32-bit values use mgba_read16/read32 (one call instead of multi-byte assembly); for spans of more than ~4 bytes use mgba_read_range (one round-trip instead of N frame-latency hops). Reads work the same way whether emulation is paused or running, so pause is optional but recommended when you need a coherent snapshot across multiple reads. BEHAVIOR: No side effects ā pure read. Returns an error if the address is outside the platform's mapped regions or the bridge method is missing on this mGBA build. RETURNS: Single line 'ADDR_HEX: VAL_DEC (0xVAL_HEX)', e.g. '0x2000000: 99 (0x63)'. GBA address space: 0x02000000 EWRAM (256 KiB, general-purpose) 0x03000000 IWRAM (32 KiB, fast stack/variables) 0x04000000 IO registers 0x05000000 Palette RAM (1 KiB) 0x06000000 VRAM (96 KiB) 0x07000000 OAM (1 KiB) 0x08000000 ROM (up to 32 MiB, read-only) Game Boy / GBC address space (when running a GB/GBC ROM): 0x0000 ROM bank 0 (16 KiB, read-only on bus; writes here trigger MBC commands but mgba_write* bypasses the bus) 0x4000 ROM banked (switchable) 0x8000 VRAM (8 KiB) 0xA000 Cartridge SRAM (8 KiB) ā disabled by default on MBC1/3/5 carts 0xC000 WRAM (8 KiB; CGB has banked extension to 0xD000) 0xFE00 OAM (160 B) 0xFF00 I/O registers 0xFF80 HRAM (127 B)
mgba_read16PURPOSE: Read an unsigned 16-bit little-endian value from emulated memory at the given system bus address. USAGE: Use for 16-bit fields (most game-state values: HP, score, coordinates on 16-bit-flavoured layouts). For single bytes use mgba_read8; for 32-bit values use mgba_read32; for non-aligned spans, big-endian fields, or arbitrary structures use mgba_read_range and decode the bytes yourself (this tool always interprets bytes as little-endian, which matches both GBA and GB/GBC native endianness). BEHAVIOR: No side effects ā pure read. Reads two consecutive bytes (low byte at `address`, high byte at `address+1`) and combines them as little-endian. Returns an error if the address is unmapped, the read straddles a region boundary, or the bridge method is missing on this build. RETURNS: Single line 'ADDR_HEX: VAL_DEC (0xVAL_HEX)'.
mgba_read32PURPOSE: Read an unsigned 32-bit little-endian value from emulated memory at the given system bus address. USAGE: Use for 32-bit fields (timestamps, large counters, pointers on GBA, RGBA colours). For 8/16-bit reads use mgba_read8/read16; for big-endian or unaligned multi-word reads use mgba_read_range and decode yourself. BEHAVIOR: No side effects ā pure read. mGBA's native emu.read32 is intermittently flaky when called via pcall on certain builds, so the bridge transparently routes 32-bit reads through readRange(addr, 4) and reassembles them little-endian ā you get a stable answer either way. Returns an error only if the address is unmapped or the underlying readRange itself fails. RETURNS: Single line 'ADDR_HEX: VAL_DEC (0xVAL_HEX)'.
mgba_read_rangePURPOSE: Read a contiguous range of bytes from emulated memory and return them as a hex-formatted dump. USAGE: Use whenever you need more than ~4 bytes ā one round-trip vs N frame-latency hops compared to looping mgba_read8. Maximum 4096 bytes per call (bridge serialization limit); for larger reads, batch in 4 KiB chunks. The classic two-snapshot RAM-hunt workflow uses this: snapshot before a known change, snapshot after, diff for matching deltas. Also useful for inspecting unknown structures and for 'capture, modify, restore' write_range workflows. This is the same primitive that mgba_read32 routes through internally. BEHAVIOR: No side effects ā pure read. Reads `length` consecutive bytes starting at `address`. Returns an error if length > 4096, length < 1, the start address is unmapped, or the read crosses an unmapped region. RETURNS: Header line 'ADDR_HEX [N bytes]:' followed by space-separated 2-digit uppercase hex bytes.
dmang-dev/mcp-mgba MCP server gives an MCP client control over a running mGBA instance. It supports both Game Boy Advance and Game Boy/Game Boy Color ROMs, with platform information reported through mgba_get_info. Agents can inspect emulator metadata, read memory, write values directly to mapped addresses, queue controller input, advance execution by exact frame counts, pause or resume emulation, reset the ROM, save PNG screenshots, and manage emulator save states.
The memory tools cover 8-bit, 16-bit, 32-bit, and contiguous byte-range operations. Save states can use mGBA-managed slots from 0 through 9 or explicit filesystem paths. This makes the server suitable for workflows such as examining game state, applying controlled memory changes, replaying input sequences, and restoring a known baseline after an experiment.
The project has two cooperating parts. The Lua script runs inside mGBA's scripting engine and opens a loopback TCP listener on port 8765. The Node.js MCP process communicates with that bridge using newline-delimited JSON, then exposes the emulator operations to the client over standard MCP stdio.
Start a session with mgba_ping to check connectivity, then call mgba_get_info to identify the loaded ROM and inspect which optional emulator methods are available. Features such as pause, reset, frame advancement, screenshots, and state files depend on the loaded mGBA build. The bridge reports those capabilities so clients can avoid calling unavailable methods.
Use mGBA 0.10 or newer with Lua scripting and Node.js 22 or newer. Install the server from npm with npx -y mcp-mgba or install it globally with npm install -g mcp-mgba.
In mGBA, load a ROM first, open Tools > Scripting, and load lua/bridge.lua from the repository. The MCP process then runs through stdio, while the Lua bridge accepts its emulator requests. Set MGBA_HOST to change the bridge host and MGBA_PORT to change the TCP port; the defaults are 127.0.0.1 and 8765.
The README documents Claude Desktop and Claude Code registration. Other clients that support standard MCP stdio can run the same server process. Restart a client after changing its server configuration so it re-enumerates the tools.
A, B, Select, Start, directional buttons, R, and L, with configurable hold and release durations.Direct memory writes are destructive and bypass the cartridge bus model. On GB/GBC systems, they do not perform MBC bank switching or RAM-enable behavior, so ROM-region writes do not trigger mapper commands and SRAM writes bypass mapper gates. Use a prepared save state when cartridge SRAM needs to be initialized with normal mapper semantics.
Range operations are limited to 4096 bytes and must remain within mapped memory. Save states are tied to the ROM and a compatible mGBA version. Loading a mismatched state can fail or produce a corrupted run. Frame advancement is synchronous but scales with emulation time, so large jumps can take several seconds. The bridge must be loaded only once per mGBA process after a clean restart if a prior script reload leaves an old callback active.
For dmang-dev/mcp-mgba MCP server sessions, pause before a multi-read or write sequence when a consistent snapshot matters, and save state before risky mutations if rollback is required.
Factual signals from GitHub, npm, and our automated checks ā not a rating.
No reviews yet ā be the first to share how this listing worked for you.
Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.
[](https://allmcps.com/mcp/dmang-dev-mcp-mgba)<a href="https://allmcps.com/mcp/dmang-dev-mcp-mgba"><img src="https://allmcps.com/api/badge/dmang-dev-mcp-mgba?style=directory" alt="MCP Mgba on AllMCPs" /></a>