Slay the Spire 2 MCP
You can use this MCP server to inspect and control a local Slay the Spire 2 run through the game bridge.
Check whether the game is running with the STS2_MCP bridge enabled.
Read the current screen, player, cards, enemies, intents, visible options, state_id, and detected mode.
Get parameter syntax for supported gameplay actions.
Perform one gameplay action at a time, including menu selection, playing cards, ending turns, potions, rewards, events, rest options, shop purchases, map navigation, card/relic selection, crystal sphere actions, and undo end turn.
Wait through enemy turns/loading until a player screen is available.
Search discovered card and relic rules text in the active profile.
Read active profile progress and discoveries.
Use single-player, multiplayer, or auto mode, with optional stale-state rejection via expected_state_id.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Slay the Spire 2 MCP continue my current run and make one decision at a time"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Slay the Spire 2 MCP
Wanted to test how a small local model can play strategy games and this project happened.
Let an LLM play your local Slay the Spire 2 through standard MCP tools. Tested with Codex and Unsloth Studio, including local models.
A C# game mod exposes structured state and actions on loopback HTTP. A Python adapter provides seven tools over MCP STDIO. The MCP client supplies the model; this project requires no model API key.
Windows alpha: the tested game version is 0.107.1. Early Access updates can break the bridge. See the support matrix for the difference between tested features and unverified platforms or multiplayer.
Quick start on Windows
You need:
Your own Steam installation of Slay the Spire 2.
Git, uv, and the .NET 9 SDK. The .NET runtime alone cannot build the mod.
Python 3.11 or newer. uv can download a compatible Python automatically.
An MCP client and a model that supports tool calling. Codex is optional.
Open PowerShell and run:
git clone https://github.com/Isendoum/slay-the-spire-mcp.git
cd slay-the-spire-mcp
# Close the game before installing the mod.
.\scripts\setup.ps1 -InstallModThe script finds Steam libraries, creates a locked Python environment in
.venv, builds the mod against your game, and installs it. Existing mod files
are backed up in artifacts/backups/; the installed port config is preserved.
The source release requires a local build and does not include game assemblies.
For Codex CLI registration during setup, use:
.\scripts\setup.ps1 -InstallMod -RegisterCodexIf PowerShell blocks downloaded scripts, you can run setup with a policy that applies only to that process:
powershell.exe -NoProfile -ExecutionPolicy Bypass -File .\scripts\setup.ps1 -InstallModFor a custom game location:
.\scripts\setup.ps1 -GameDir 'D:\Steam Library\steamapps\common\Slay the Spire 2' -InstallModAlternatively, set STS2_GAME_DIR. Without -InstallMod, setup builds into
artifacts/mod/ without installing. To set up only the Python adapter, use
-SkipMod; this needs neither the game nor .NET, but gameplay needs the mod.
Launch the game, accept its mod consent prompt, enable STS2 MCP in Mods, and restart the game if prompted.
Related MCP server: STS2 Modding MCP
Connect your MCP client
Generate configuration containing the actual absolute Python path:
.\scripts\client-config.ps1
# For Codex TOML:
.\scripts\client-config.ps1 -Format codexUse STDIO transport with that executable and the two arguments -m and
sts2_mcp.server. No working directory, environment variables, or OAuth are
required. Keep the checkout in its installed location; moving it requires
rerunning setup and updating the client's executable path.
For Unsloth Studio/Desktop, open Chat -> MCP -> Add custom MCP. Use
slay-the-spire-2 as the name, the generated Python path as URL or executable,
and add -m and sts2_mcp.server as separate argument rows. Test the connection,
add the server, and enable both its toggle and Use MCP Servers.
The client guide includes Codex registration, generic JSON, and Unsloth troubleshooting.
Verify and play
With the game open and the mod enabled:
.\.venv\Scripts\python.exe -m sts2_mcp.server --doctor
.\.venv\Scripts\python.exe scripts\smoke-test.py --liveThese checks read game state without making gameplay decisions. To check only
MCP startup and tool discovery without contacting the game, omit --live.
Ask your model:
Use the slay-the-spire-2 MCP to continue my current run. Start with health_check, get_game_state, and get_action_help. Make one decision at a time using current state, and wait through transitions. Do not abandon my run or change profiles.
To start a new run, explicitly ask for the character and difficulty you want.
Tool | Purpose |
| Check the game connection |
| Read the current screen, cards, enemies, intents, and choices |
| Get argument syntax for the 29 gameplay actions |
| Play cards, navigate, choose rewards/events, and buy items |
| Wait through enemy turns and loading |
| Look up discovered card and relic rules |
| Read active profile progress |
Indices start at zero and can shift after every action. Use target IDs from the
current state. Actions are never automatically retried. A timeout can mean the
action executed; read state before deciding whether to try again. The returned
after state can still show a transition; use wait_for_player or read again.
Supply expected_state_id to reject an already stale decision; it is a
best-effort check, not a transaction with the game's animation queue.
Connection and troubleshooting
The mod's http://127.0.0.1:15526 address is a REST game bridge, not an MCP
HTTP endpoint. Connect your MCP client to the Python executable over STDIO.
Missing prerequisite: follow the installer error, then reopen PowerShell.
Game not found: pass
-GameDiror setSTS2_GAME_DIR.Missing game DLL or compile errors after an update: verify the game files in Steam and check the supported version. Rebuild using
.\scripts\build-mod.ps1; source changes may be needed after game updates.Connection refused: keep the game open, confirm mod consent and activation, and check the game's Godot log for
[STS2 MCP]messages.Port conflict: edit the
portinSTS2_MCP.confbeside the installed mod, restart the game, and pass the matching--bridge-url http://127.0.0.1:PORTto the Python server or setSTS2_BRIDGE_URL.No tools: restart or refresh the client after registration and enable its MCP server toggle. For Unsloth remote/LAN settings, see the client guide.
Only loopback bridge origins are accepted. Environment proxies are ignored, and the mod rejects browser-origin requests. Other processes on the computer can access the bridge; it has no authentication. See SECURITY.md.
Updates and removal
Close the game, pull the latest source, and rerun the same setup command. Backups are made before existing mod files are replaced.
To uninstall, close the game and remove STS2_MCP.dll, STS2_MCP.json, and
optionally STS2_MCP.conf from its mods folder. For Codex, run
codex mcp remove slay-the-spire-2; remove the server entry from other clients.
You may then delete the checkout. To restore an older mod, copy its two files
from the matching directory in artifacts/backups/ with the game closed.
Development and licensing
See CONTRIBUTING.md for tests and local development, CHANGELOG.md for release history, and docs/bridge-api.md for the game protocol.
MIT licensed. The bridge is adapted from Gennadiyev/STS2MCP; its original copyright and license are retained. See THIRD_PARTY_NOTICES.md. This community project is not affiliated with or endorsed by Mega Crit. The license covers this integration, not Slay the Spire 2 or its assets.
Available Tools
7 toolsget_action_helpARead-only
Get action names and required/optional parameters for take_action.
Omit action to see all supported gameplay actions. This describes argument syntax; the current game state supplies the actual available choices and indices.
Inputs: action.
get_game_stateARead-only
Read the current screen, player, cards, enemies, intents, and visible options.
Returns state_id, detected mode, and the complete state. Read again after each action. auto detects singleplayer/co-op. This tool works at menus as well as during a run.
Inputs: mode.
get_profileBRead-only
Read the active profile's progress and discoveries.
Inputs: no named parameters.
health_checkBRead-only
Check whether Slay the Spire 2 is running with the STS2_MCP bridge enabled.
Inputs: no named parameters.
search_wikiBRead-only
Look up discovered card/relic rules text by name in the active game profile.
Inputs: query (required), limit, item_type.
take_actionA
Perform one game action and return the result plus a fresh game state.
Call get_action_help for parameter names. Examples: play_card: {"card_index": 0, "target": "CULTIST_0"}; end_turn: {}; choose_map_node: {"index": 0}; menu_select: {"option": "singleplayer"}. Use current state indices and target IDs. Actions are serialized and never retried. Optionally supply expected_state_id from get_game_state to reject stale decisions.
Inputs: action (required), mode, parameters, expected_state_id.
wait_for_playerARead-only
Poll through enemy turns/loading until a player screen is available.
Returns ready=false with the last state on timeout. Performs no gameplay actions. A visible screen is not a guarantee that every action on that screen is legal.
Inputs: mode, timeout_seconds.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 7 tools
Most tools are clearly distinct: state reading (get_game_state), action discovery (get_action_help), acting (take_action), waiting (wait_for_player), and reference lookups (search_wiki, get_profile) target different needs. The descriptions explicitly clarify the tricky boundary between get_action_help (syntax) and get_game_state (actual choices), though health_check and get_game_state overlap slightly since both report game status.
All tools use consistent snake_case with clear verb_noun or verb_object patterns (get_game_state, take_action, search_wiki, wait_for_player). The get_* family is predictable and no casing or verb-style mixing appears.
Seven tools is well-scoped for an agent-driven game controller, covering status, read, help, act, wait, and profile/reference lookups without redundancy. Each tool earns its place in the gameplay loop.
The core agent loop (health, state, help, action, wait) plus profile/wiki lookups is well covered. Minor gaps exist around save/load, restart, or deck-management operations, but these are workable given the bridge exposes actions through take_action.
Maintenance
Related MCP Connectors
Persistent memory, hybrid search and a goal graph for AI agents, over stdio or remote HTTP.
OpenAI-compatible LLM MCP (7 tools); chat via balance key or x402 USDC on Base
Live Texas Hold'em for AI agents. The tools teach the rules; the bluffing is up to your model.
Operate Linux, macOS and Windows from your LLM. Every action runs through an auditable allowlist.
Related MCP Servers
- FlicenseNot gradedqualityAmaintenanceEnables AI agents to play Slay the Spire 2 by exposing game state and actions through an MCP server, supporting combat, rewards, and run management.366-
- FlicenseNot gradedqualityDmaintenanceProvides 151 tools for reverse-engineering, code generation, building, deploying, live scene inspection, and automated playtesting for Slay the Spire 2 modding.27-
- FlicenseNot gradedqualityDmaintenanceEnables AI-assisted gameplay for Slay the Spire by reading game state and providing strategy advice or automated actions via Claude Code.1-
- AlicenseNot gradedqualityCmaintenanceEnables an MCP agent to observe and command Slay the Spire 2 game state via HTTP, and optionally autopilot combat with a local deterministic policy, without LLM in the critical path.MIT