$git clone https://github.com/Gennadiyev/STS2MCPA mod for **Slay the Spire 2** that lets AI agents play the game. Exposes game state and actions via a localhost REST API, with an optional MCP server for Claude Desktop / Claude Code integration.
| 1 | <p align="center"> |
| 2 | <img src="docs/teaser.png" alt="STS2 MCP" width="90%" /> |
| 3 | </p> |
| 4 | |
| 5 | <p align="center"><em>An Experimental Research Project to Fully-Automate your Slay the Spire 2 Runs</em></p> |
| 6 | |
| 7 | A mod for [**Slay the Spire 2**](https://store.steampowered.com/app/2868840/Slay_the_Spire_2/) that lets AI agents play the game. Exposes game state and actions via a localhost REST API, with an optional MCP server for Claude Desktop / Claude Code integration. |
| 8 | |
| 9 | Singleplayer and multiplayer (co-op) supported, plus full menu and lobby control: profile switching, character select (SP and MP host/client) with optional seed, multiplayer host / Steam-friend join / FastMP localhost join, multiplayer load lobby for resuming saved co-op runs, game-over dismissal, FTUE/tutorial popup handling, and Timeline visibility. Tested against STS2 `v0.103.2`. |
| 10 | |
| 11 | > [!warning] |
| 12 | > This mod allows external programs to read and control your game via a localhost API. Use at your own risk with runs you care less about. |
| 13 | |
| 14 | > [!caution] |
| 15 | > Multiplayer support is in **beta** — expect bugs. Any multiplayer issues encountered with this mod installed are very likely caused by the mod, not the game. Please disable the mod and verify the issue persists before reporting bugs to the STS2 developers. |
| 16 | |
| 17 | ## For Players |
| 18 | |
| 19 | ### 1. Install the Mod |
| 20 | |
| 21 | Grab the [latest release](https://github.com/Gennadiyev/STS2MCP/releases/latest) and follow the instructions: |
| 22 | |
| 23 | 1. Copy `STS2_MCP.dll` and `STS2_MCP.json` to `<game_install>/mods/` |
| 24 | 2. Launch the game and enable mods in settings (a consent dialog appears on first launch) |
| 25 | 3. The mod starts an HTTP server on `localhost:15526` automatically |
| 26 | |
| 27 | > [!note] |
| 28 | > The release DLL is a platform-agnostic .NET assembly — the same `STS2_MCP.dll` and `STS2_MCP.json` work on Windows, Linux, and macOS. No separate builds are needed. |
| 29 | |
| 30 | #### macOS install |
| 31 | |
| 32 | On macOS, the mods directory lives inside the app bundle. The default Steam install path is: |
| 33 | |
| 34 | ``` |
| 35 | ~/Library/Application Support/Steam/steamapps/common/Slay the Spire 2/ |
| 36 | SlayTheSpire2.app/Contents/MacOS/mods/ |
| 37 | ``` |
| 38 | |
| 39 | To install, right-click `SlayTheSpire2.app` → **Show Package Contents**, navigate to `Contents/MacOS/`, and create a `mods` folder. Or from the terminal: |
| 40 | |
| 41 | ```bash |
| 42 | GAME_DIR="$HOME/Library/Application Support/Steam/steamapps/common/Slay the Spire 2" |
| 43 | MODS_DIR="$GAME_DIR/SlayTheSpire2.app/Contents/MacOS/mods" |
| 44 | mkdir -p "$MODS_DIR" |
| 45 | cp STS2_MCP.dll "$MODS_DIR/" |
| 46 | cp STS2_MCP.json "$MODS_DIR/" |
| 47 | ``` |
| 48 | |
| 49 | Launch the game and open **Settings → Mods**. The mod should appear in the list. A consent dialog appears on first launch — accept it to enable mod loading. Once enabled, verify the HTTP server is running: |
| 50 | |
| 51 | ```bash |
| 52 | curl -s http://localhost:15526/ |
| 53 | ``` |
| 54 | |
| 55 | A successful response looks like: |
| 56 | |
| 57 | ```json |
| 58 | {"message": "Hello from STS2 MCP v0.3.4", "status": "ok"} |
| 59 | ``` |
| 60 | |
| 61 | If you get "Connection refused", the mod is not loaded — check that mods are enabled in the game's settings. |
| 62 | |
| 63 | ### 2. Give Your AI Instructions to Interact with the Game |
| 64 | |
| 65 | **Clone or download the repository**, then: |
| 66 | |
| 67 | | I prefer a skill | I prefer an MCP Server | |
| 68 | |---|---| |
| 69 | | Tell AI to reference docs/raw-*.md. Sit back, and watch it play. | Requires [Python 3.11+](https://www.python.org/) and [uv](https://docs.astral.sh/uv/). Follow the instructions below ⬇️ | |
| 70 | |
| 71 | #### MCP server setup |
| 72 | |
| 73 | Install [uv](https://docs.astral.sh/uv/) if you don't have it (macOS: `brew install uv`). Then run the server once to install dependencies: |
| 74 | |
| 75 | ```bash |
| 76 | uv run --directory /path/to/STS2_MCP/mcp python server.py --help |
| 77 | ``` |
| 78 | |
| 79 | `uv` reads `mcp/pyproject.toml`, creates an isolated virtual environment, and installs the pinned dependencies from `mcp/uv.lock`. Subsequent runs reuse the environment instantly. |
| 80 | |
| 81 | Add the server to your AI client's MCP config: |
| 82 | |
| 83 | ```json |
| 84 | { |
| 85 | "mcpServers": { |
| 86 | "sts2": { |
| 87 | "command": "uv", |
| 88 | "args": ["run", "--directory", "/path/to/STS2_MCP/mcp", "python", "server.py"] |
| 89 | } |
| 90 | } |
| 91 | } |
| 92 | ``` |
| 93 | |
| 94 | **Claude Code**: add to your project's `.mcp.json`. |
| 95 | **Claude Desktop**: add to `claude |