Skip to main content
Glama

Server Configuration

Describes the environment variables required to run the server.

NameRequiredDescriptionDefault
MGBA_HOSTNoBridge host to dial127.0.0.1
MGBA_PORTNoBridge port to dial8765

Capabilities

Features and capabilities supported by this server

CapabilityDetails
tools
{}

Tools

Functions exposed to the LLM to take actions

NameDescription
mgba_pingA

Check connectivity to the mGBA bridge. Returns 'pong' if the emulator is running and the Lua bridge is loaded.

mgba_get_infoA

Get the currently-loaded game title, game code (e.g. AGBE), platform identifier, current frame count, and a capabilities object listing which optional emu methods this build of mGBA supports (pause, frameAdvance, saveStateSlot, etc.). Use the capabilities map to feature-detect before calling tools that depend on optional methods.

mgba_read8A

Read a single unsigned byte (u8) from a GBA memory address.

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_read16A

Read an unsigned 16-bit little-endian value from a GBA memory address. Address should be 2-byte aligned.

mgba_read32A

Read an unsigned 32-bit little-endian value from a GBA memory address. Address should be 4-byte aligned.

mgba_write8A

Write a single byte value to a memory address. Only works on RAM regions; writes to ROM are no-ops.

NOTE: writes use mGBA's debug-direct memory access, which bypasses the cartridge bus model. On Game Boy with an MBC cartridge, this means writes to ROM region (0x0000-0x7FFF) won't trigger MBC bank-switch / RAM-enable commands, and writes to SRAM (0xA000-0xBFFF) hit the underlying buffer regardless of MBC enable state. To seed cartridge SRAM cleanly, use mgba_save_state / mgba_load_state with a pre-prepared state file.

mgba_write16A

Write a 16-bit value (little-endian) to a memory address. Address must be 2-byte aligned.

NOTE: writes use mGBA's debug-direct memory access, which bypasses the cartridge bus model. On Game Boy with an MBC cartridge, this means writes to ROM region (0x0000-0x7FFF) won't trigger MBC bank-switch / RAM-enable commands, and writes to SRAM (0xA000-0xBFFF) hit the underlying buffer regardless of MBC enable state. To seed cartridge SRAM cleanly, use mgba_save_state / mgba_load_state with a pre-prepared state file.

mgba_write32A

Write a 32-bit value (little-endian) to a memory address. Address must be 4-byte aligned.

NOTE: writes use mGBA's debug-direct memory access, which bypasses the cartridge bus model. On Game Boy with an MBC cartridge, this means writes to ROM region (0x0000-0x7FFF) won't trigger MBC bank-switch / RAM-enable commands, and writes to SRAM (0xA000-0xBFFF) hit the underlying buffer regardless of MBC enable state. To seed cartridge SRAM cleanly, use mgba_save_state / mgba_load_state with a pre-prepared state file.

mgba_read_rangeA

Read a contiguous range of bytes from emulated memory and return them as an array of integers. Maximum 4096 bytes per call.

mgba_write_rangeA

Write a contiguous range of bytes to emulated RAM in one call. Useful for seeding SRAM, patching code blocks, or installing cheats. Maximum 4096 bytes per call.

NOTE: writes use mGBA's debug-direct memory access, which bypasses the cartridge bus model. On Game Boy with an MBC cartridge, this means writes to ROM region (0x0000-0x7FFF) won't trigger MBC bank-switch / RAM-enable commands, and writes to SRAM (0xA000-0xBFFF) hit the underlying buffer regardless of MBC enable state. To seed cartridge SRAM cleanly, use mgba_save_state / mgba_load_state with a pre-prepared state file.

mgba_press_buttonsA

Queue a button-press: hold the given buttons for frames frames, then release for release_frames frames before the next queued press starts. Each call appends to the queue rather than overwriting, so consecutive calls produce distinct edge events that ROMs see as separate presses (rather than one continuous hold). Returns immediately; the press fires asynchronously on the emulator's frame callback. Valid button names: A, B, Select, Start, Right, Left, Up, Down, R, L.

mgba_advance_framesA

Advance emulation by N frames without returning to the event loop. Useful for precise timing in tests.

mgba_pauseB

Pause emulation.

mgba_unpauseA

Resume emulation after a pause.

mgba_resetA

Reset the currently-loaded ROM (equivalent to pressing the GBA reset button).

mgba_screenshotA

Take a screenshot of the current display and save it to a file. Returns the saved file path.

mgba_save_stateA

Save the current emulator state. Pass either slot (0-9, mGBA-managed slot file) or path (absolute file path; only works on builds that expose the file API). Useful for capturing checkpoints to load later — and as a clean way to seed cartridge SRAM on Game Boy without fighting the MBC.

mgba_load_stateA

Load a previously-saved emulator state. Pass either slot (0-9) or path (absolute file path). The state must come from the same ROM and a compatible mGBA version.

Prompts

Interactive templates invoked by user choice

NameDescription

No prompts

Resources

Contextual data attached and managed by the client

NameDescription

No resources

Latest Blog Posts

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