MCP Mgba logo

MCP Mgba

by dmang-dev

Controls an mGBA session through MCP, including memory access, input, frame stepping, screenshots, and emulator state management.

Install MCP Mgba

Pick your client, then add it in one click or paste the config.

STDIONode.js
~/Library/Application Support/Claude/claude_desktop_config.json
claude_desktop_config.json
{
  "mcpServers": {
    "dmang-dev-mcp-mgba": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-mgba"
      ],
      "env": {
        "MGBA_HOST": "YOUR_VALUE_HERE",
        "MGBA_PORT": "YOUR_VALUE_HERE"
      }
    }
  }
}

Settings → Developer → Edit Config, merge this into mcpServers, then fully quit and reopen Claude Desktop.

Values are written into the snippet above so you can paste it as is. They never leave your browser.

Automated check passed— started and listed 18 tools correctly (1mo ago).

Overview

dmang-dev/mcp-mgba MCP server connects MCP clients to a running mGBA emulator through a Node.js stdio process and a Lua bridge over TCP. It exposes tools for inspecting and modifying emulated memory, queuing Game Boy or GBA button presses, advancing frames, capturing screenshots, and saving or restoring emulator state. The bridge listens on localhost port 8765 by default, while the server uses MGBA_HOST and MGBA_PORT to locate it. Reach for it when an agent needs to automate, inspect, or test a loaded GBA or GB/GBC ROM from an MCP-compatible client.

Use cases

  • Inspect game memory while debugging a ROM
  • Inject button sequences for gameplay automation
  • Advance emulation for frame-precise tests
  • Capture screenshots from selected emulator states
  • Save and restore reproducible emulator snapshots

Key features

  • GBA and GB/GBC memory access
  • Queued controller input
  • Synchronous frame stepping
  • Pause, resume, and reset controls
  • PNG screenshot capture
  • Slot and file-based save states

Tools18

What MCP Mgba lets your agent do. Expand a tool for its parameters.

Verified live~7.2k tokens of context

Security & health

What it can reach and how reliably it runs — from our own checks, not the maintainer’s claims.

ActiveLast checked 2d ago

Recent health check succeeded.

19/19 checks healthy over the last 80d

Supply-chain signal

No high-severity advisories surfaced by our automated scan.

Critical 0High 0Medium 0Low 0

Scanned 8d ago via OSV.dev · mcp-mgba (npm)

Adoption & maintenance

Factual signals from GitHub, npm, and our automated checks — not a rating.

GitHub stars5Stargazers on the source repository.
npm downloads89Package downloads in the last 30 days.
Last commit5d agoMost recent push to the default branch.
Availability100%Our rolling endpoint + install checks that succeeded.
Install checkPassedOur sandbox started it and listed its tools.
Tools exposed18Callable tools this server registers over MCP.
Directory activity9 viewsConfig copies, upvotes, and views on AllMCPs.

How MCP Mgba works

What dmang-dev/mcp-mgba MCP server does

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.

How it works

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.

Setup and configuration

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.

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.

Tools and capabilities

  • Check bridge liveness and retrieve ROM title, code, platform, frame count, and optional capabilities.
  • Read or write individual 8-, 16-, and 32-bit values, or transfer up to 4096 bytes per range call.
  • Queue presses for A, B, Select, Start, directional buttons, R, and L, with configurable hold and release durations.
  • Advance the emulator by a specified number of frames without changing its pause state.
  • Pause, resume, or reset the loaded ROM when the corresponding mGBA methods are available.
  • Save and restore complete emulator state through slots or filesystem paths, and save the current display as a PNG.

Limitations and notes

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.

Reviews

No reviews yet — be the first to share how it worked for you.

Frequently Asked Questions about MCP Mgba

Run `npx -y mcp-mgba` for an on-demand installation, or run `npm install -g mcp-mgba` and then use the `mcp-mgba` command.

Yes. The README provides Claude Desktop configuration using the `mcp-mgba` command or Node.js with the server's `dist/index.js` path.

Run mGBA 0.10 or newer, load a ROM, open Tools > Scripting, and load `lua/bridge.lua`. The bridge listens on `127.0.0.1:8765` by default.

It can write to SRAM through direct memory access, but those writes bypass MBC enable and mapper behavior. Use a prepared save state when proper cartridge semantics are required.

Related MCP servers

Add a badge to your READMEShow it’s listed — live SVG, Markdown or HTML.

AllMCPs Directory Badge

Full Badge Customizer

Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.

Badge Style:
Live Dynamic SVG PreviewMCP Mgba AllMCPs Directory Badge
Markdown (GitHub README)
[![AllMCPs](https://allmcps.com/api/badge/dmang-dev-mcp-mgba?style=directory)](https://allmcps.com/mcp/dmang-dev-mcp-mgba)
HTML Embed
<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>