Pokemon-HGSS-MCP
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
Pokemon-HGSS-MCP
A tool kit for AI agents to play Pokémon HeartGold and SoulSilver. It's an MCP server that drives the game in the BizHawk emulator and gives the agent compact, game-aware tools instead of raw screenshots and button presses.
It was built while Claude played a HeartGold Nuzlocke, and every tool exists because something was slow, expensive or error-prone without it.
Why it's cheap to play with
Agents usually play by looking at full screenshots and pressing one button per turn. That burns tokens fast: every image stays in the conversation and gets re-read on each turn. This server reads the game's memory and the ROM's map data instead, and only sends images when the agent asks:
What the agent needs | Tool | Typical cost |
Location, party (HP, moves, PP), live battle state |
| ~150 tokens of text |
One screen / both screens at native resolution |
| ~65 / ~130 tokens |
Just the message box |
| ~12 tokens |
A whole conversation |
| ~15 tokens per message |
Walk across a route |
| one call |
A whole battle turn |
| one call |
Related MCP server: mcp-bizhawk
Tools
Tool | What it does |
| Location (map name, area, x/y), money, party with HP/moves/PP, live battle HP and stat stages, whether this area's Nuzlocke encounter is free, message-box status |
| Native-resolution screenshot: |
| Buttons in order: |
| Press through dialogue until it closes or a real Yes/No choice appears. Handles phone calls too |
| Same, for cutscenes that walk you around between messages |
| Answer a Yes/No prompt by steering the highlight |
| Movement with position checks from RAM; stops for battles, trainers and events |
| Doors/warps on the current map with coordinates and destinations |
| Walk to the nearest tall grass and pace until a wild battle starts |
| Use a move by name or slot and follow the turn; repeat until the battle ends (hands back control at low HP) |
| Throw a ball from the Poké Balls pocket / flee |
| Inside a Pokémon Center: talk to the nurse and heal |
| Inside a Poké Mart: talk to the clerk, buy by item name, confirm, leave; checks the money spent from RAM |
| Field menu entries; in-game save written to disk |
| Type on naming keyboards (player, nicknames, rival) |
| Optional Nuzlocke journal: the run's memory between sessions |
There is deliberately no savestate or reload tool, so outcomes can't be undone.
Requirements
Windows 10/11 (tested). BizHawk also has a Linux build; this project hasn't been tested there.
Python 3.10+
Your own legally obtained Pokémon HeartGold or SoulSilver ROM (
.nds). Tested with HeartGold (USA). No ROMs, BIOS files or game data are included or downloaded.
Setup
git clone https://github.com/HeliosImmersive/Pokemon-HGSS-MCP.git
cd Pokemon-HGSS-MCP
python -m venv .venv
.venv\Scripts\pip install -r requirements.txt
.venv\Scripts\python setup.py --rom "C:\path\to\your\HeartGold.nds"setup.py downloads BizHawk 2.11.1 from its official GitHub release (checked against a SHA-256), builds the
data tables (data/gen4.json) from PokeAPI and pret/pokeheartgold sources, and saves your ROM path in
work/config.json.
Settings can also come from environment variables: HGSS_ROM, HGSS_BIZHAWK (path to EmuHawk.exe),
HGSS_WORKDIR (screenshots, IPC files, run journal; default work/), HGSS_DATA (default data/).
Connect your agent
Any MCP client that speaks stdio works. For Claude Code, put this in a .mcp.json (adjust paths):
{
"mcpServers": {
"hgss": {
"command": "C:\\path\\to\\Pokemon-HGSS-MCP\\.venv\\Scripts\\python.exe",
"args": ["C:\\path\\to\\Pokemon-HGSS-MCP\\hgss_mcp\\server.py"]
}
}
}The first tool call launches BizHawk and loads your save (or the title screen for a new game). For agents
without MCP there's a CLI with the same functions: python hgss_mcp/cli.py state, ... fight tackle, etc.
skills/hgss-mcp/SKILL.md is an Agent Skill
with play habits that keep token use low; drop it into your agent's skills folder.
How it works
Emulator bridge.
hgss_mcp/bridge.luaruns inside BizHawk and exchanges small command/response files with Python each frame. (BizHawk's Lua socket API blocks the emulator while waiting, so file IPC keeps the game running when no agent is connected.)Memory. Party Pokémon are found by scanning RAM for Gen 4 party structures and decrypting them (
pkm.py). The player's location and money sit at fixed offsets from the party in the save block. Live battle HP and stat stages come from the in-battle structures. Shop stock is matched against the Mart lists in pret'sscrcmd_mart.c.Maps. Collision, tall grass, water and ledges come from the ROM's own land data and map matrices (
rom.py,mapdata.py), sowalk_toplans real routes. Map names, doors and NPCs come from pret/pokeheartgold.Screen. Text boxes, choice prompts, battle menus, phone calls and naming keyboards are recognised from native screenshots (
screen.py,actions.py), so tools know when to press A and when to stop.
Known limitations
Touch input doesn't work: BizHawk's melonDS core ignores Lua touch coordinates. Everything goes through buttons, which covers HG/SS's menus, battles and the field menu.
Some bottom-screen-only messages aren't read by
read_text(); uselook("bottom")andpress().Double battles, moves that need a target and the PC box don't have helpers yet.
buy()handles the first page of a shop (six items); paging through longer shop lists isn't scripted yet.RAM offsets were verified on HeartGold (USA). SoulSilver and other regions likely work but are untested.
Windows pauses BizHawk while its window is being dragged.
Contributions welcome, especially helpers for the gaps above.
Credits
BizHawk (MIT), with the melonDS core
PokeAPI data (BSD-3-Clause), downloaded at setup
pret/pokeheartgold map constants and event data, downloaded at setup
Pokémon is © Nintendo, Creatures Inc. and GAME FREAK inc. This project is unofficial and not affiliated with them. Use your own legally obtained copy of the game.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
AI game assets for agents: consistent sprites, 2D animations, tiles, maps, music and engine exports.
Your personal world model for any agent.
Memory, reflection and safety for AI agents. Hosted or local, no vector database.
Persistent memory and knowledge management for AI agents with semantic search and 50+ tools.
Related MCP Servers
- FlicenseAqualityDmaintenanceEnables 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.103-
- AlicenseAqualityCmaintenanceMCP server for BizHawk, the multi-system emulator. Drive NES, SNES, GB/GBC/GBA, Genesis, N64, PSX, Saturn and more through one Lua bridge — memory r/w across named domains, joypad input, frame-advance, screenshot, save/load state.2051 npm6MIT
- AlicenseBqualityBmaintenanceEnables Claude and other MCP clients to play Pokémon games on emulated Game Boy/GBA or real Switch hardware by exposing tools for button input, reading RAM-decoded game state, screenshots, save states, and persistent markdown notes.19MIT
- AlicenseNot gradedqualityCmaintenanceEnables vision-capable models to play Pokemon Emerald through mGBA by providing screenshots, OCR dialogue transcription, movement and button controls, and persistent session journals.1MIT