brotato-controller
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., "@brotato-controller start an auto-play run as Ranger through wave 5"
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.
auto-brotato-agent-kit
把原版《土豆兄弟(Brotato)》變成 AI Agent 可直接操作的結構化 MCP 服務。
跨機器、跨 Harness(Claude Code / Cursor / Antigravity / Codex)可復用的自動通關 MCP 套件,支援原版 v1.0–v1.2.0.4(Steam 版)。
不需要任何第三方工作坊 Mod——只需部署本套件自帶的 LocalAI-AgentBridge v0.5.5 通訊橋接器。
項目 | 值 |
GitHub 倉庫 |
|
Python 套件名 |
|
CLI 指令 |
|
橋接器版本 |
|
Python |
|
唯一第三方依賴 |
|
目錄
Related MCP server: battle-arena-mcp
這是什麼
本專案讓 AI Agent 能自動遊玩並通關《土豆兄弟》。做法是:不讓 AI 看遊戲畫面,而是把遊戲內部狀態暴露成結構化資料。
遊戲內部署
LocalAI-AgentBridge橋接器,將玩家屬性、敵人位置、商店、升級選項、陣亡原因等以 JSON 即時輸出。由兩套 MCP Server 包裝成 Agent 可直接呼叫的工具:
brotato-controller(控制)與brotato-rag(知識檢索)。高頻走位(60Hz)交給橋接器內建的威脅度熱力圖演算法,LLM 只負責慢決策:買什麼、選什麼、策略哪裡出錯。
AI 可在執行期透過
manage_extensions自我發現並聲明式拓展策略與行為邏輯。
結果:LLM 不需要看圖、不需要 GPU,每秒數十次的微操完全由本機處理。
架構總覽
┌──────────────────────────────────────────────────────────────┐
│ Agent Harness(Claude Code / Cursor / Antigravity / Codex) │
└───────────────────────────────┬──────────────────────────────┘
│ MCP stdio
│ brotato-kit mcp controller / brotato-kit mcp rag
┌─────────────────────┴─────────────────────┐
▼ ▼
┌──────────────────────────┐ ┌──────────────────────────┐
│ brotato-controller │ │ brotato-rag │
│ 16 工具 · Detached Job │ │ 2 唯讀工具 │
│ 50 角色內建策略 │ │ search_wiki / get_page │
│ manage_extensions 拓展 │ └────────────┬─────────────┘
│ plugins.py entry_points│ │ SQLite FTS5
└────────────┬─────────────┘ │ + 中英雙語詞典
│ AgentBridge Protocol v1 ▼
│ (本機 TCP NDJSON · Token · 控制租約) ┌──────────────────────────┐
▼ │ 隨包離線 Wiki 語料 │
┌──────────────────────────┐ │ 595 篇 .md(純文本) │
│ LocalAI-AgentBridge │ │ 零圖片/零向量化/零 GPU │
│ v0.5.5(Godot ModLoader)│ └──────────────────────────┘
│ + 60Hz 威脅度熱力圖走位 │
└────────────┬─────────────┘
▼
《土豆兄弟》原版 v1.0–v1.2.0.4(Steam)分工:controller 負責「動」遊戲,rag 負責「查」知識;兩者互不依賴。
四大核心能力
1. LocalAI-AgentBridge v0.5.5(遊戲內橋接器)
AgentBridge Protocol v1:本機 TCP NDJSON 通訊、Token 認證、控制租約、
client_id跨重連冪等、env_capabilities能力偵測(max_weapons、dlc_ids、loaded_mods)。60Hz 威脅度熱力圖自動走位,參數可透過
set_threat_config動態調整(如prefer_stationary、greed、kite_radius、prefer_perimeter)。透過
brotato-kit deploy-mod部署至遊戲內建的 Godot ModLoader6.0.0,無需任何第三方工作坊 Mod。
2. brotato-controller MCP(遊戲控制層)
16 個結構化工具,非同步防阻塞設計。
Detached Job:
start_session以獨立子程序背景執行長跑,立即回傳job_id,不會觸發 MCP 逾時。50 個全角色內建策略,支援
dry_run預覽 diff、expect_base樂觀鎖套用與回滾。結構化死因遙測(
get_recent_deaths)。
類別 | 工具 |
狀態查詢 |
|
單局控制 |
|
長跑調度 |
|
策略拓展 |
|
3. brotato-rag MCP(離線知識層)
2 個純文本唯讀工具:
search_wiki、get_page。以 Python 標準庫 SQLite FTS5 + 中英雙語詞典檢索隨包附帶的 595 篇官方 Wiki
.md。零圖片、零向量化、零 GPU,不需任何機器學習套件或語料更新爬蟲;若 Python 未編譯 FTS5,自動退回純 Python BM25。
4. AI 運行期高拓展性
任何 AI 接入後先呼叫 manage_extensions(action="schema") 自我發現:取得所有 kind、behavior hooks(含範本)、條件語言合法變數/函式(ALLOWED_VARS / ALLOWED_FUNCS)、威脅設定鍵範圍與 macro ops。
kind | 用途 |
| 角色策略、局部補丁、設定檔 |
| 決策掛鉤: |
| 聲明式多步驟安全巨集(≤ 20 步、無迴圈、無遞迴、白名單 op,預設 |
標準工作流程:schema → validate(迭代至合法)→ upsert(dry_run=True) 取得 base_version → upsert(dry_run=False, expect_base=...) → 必要時 rollback(steps=1)。
所有 when 條件由白名單 AST 直譯器評估(禁止屬性存取、下標、lambda、import)。此外亦支援透過 plugins.py 的 entry_points 外掛機制擴充。完整規格見 docs/EXTENSIBILITY.md。
5 分鐘快速上手
前置條件
已透過 Steam 安裝原版《土豆兄弟》(
v1.0–v1.2.0.4),且至少啟動過一次遊戲(建立user://目錄)。首次安裝需使用具備網路權限的終端機(Codex 沙盒請允許連網)。
步驟
# 1. 取得專案(勿從舊機器複製 .venv/)
git clone https://github.com/dzhen1515/auto-brotato-agent-kit.git
cd auto-brotato-agent-kit
# 2. 安裝 uv(若尚未安裝);安裝後請重啟 Harness 讓 PATH 生效
# Windows:
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
# macOS / Linux:
curl -LsSf https://astral.sh/uv/install.sh | sh
# 3. 安裝依賴並初始化
uv sync
uv run brotato-kit setup --check --json # 檢查尚缺項目(依 steps[].next_action 處理)
uv run brotato-kit setup --yes # 逐項套用(含部署 LocalAI-AgentBridge)
uv run brotato-kit doctor # 環境健檢
uv run brotato-kit launch # 啟動遊戲若需單獨部署橋接器,可執行
uv run brotato-kit deploy-mod。
更省事的做法
在 Claude Code / Cursor / Antigravity / Codex 中開啟本專案資料夾,直接對 Agent 說 「初始化」,它會依 AGENTS.md 的首次啟動協議自動完成:
uv --version(找不到則停止並提供官方安裝指令,Agent 嚴禁自行執行網路安裝腳本)uv syncuv run brotato-kit setup --check --json;needs_user=true的步驟先取得使用者同意再帶--yes重跑needs_restart="harness"→ 重新載入 MCP/重啟 Harness;needs_restart="game"→uv run brotato-kit launch直到
ready=true才開始呼叫遊戲控制工具
兩種操作模式
模式 | 適用情境 | 主要流程 |
A — Detached Runner 無人值守 + 總教練復盤(推薦) | 自動刷完整局、陣亡後復盤修正 |
|
B — 逐波手動 MCP 控制 | 逐步觀察、精細微操 |
|
wait_for_phase逾時回傳reached: false不算錯誤,可繼續等待。 詳細波次營運與走位原則見skills/auto-brotato/SKILL.md(此技能僅在使用者明確點名/auto-brotato時啟用)。
文件導覽
文件 | 主要讀者 | 一句話說明 |
| 所有人 | 專案定位、架構、快速上手與文件索引 |
Agent 必讀 | 首次啟動協議、禁止事項、兩種核心操作模式 | |
Claude Code 使用者 | 引用 | |
安裝與除錯者 | 依賴清單、版本需求、原版遊戲與橋接器說明 | |
跨 Harness 使用者 | 各家自動發現檔、設定匯出、逾時與診斷指令 | |
拓展開發者/AI |
| |
Agent | 通關策略技能:啟動檢查、調度模式、W1–20 營運原則 | |
所有人 | 隨包 Wiki 語料來源與 CC BY-SA 授權說明 |
Agent 禁止事項(摘自 AGENTS.md):禁止修改 repo 以外、setup 未列出的任何檔案;禁止在 repo 內寫入本機絕對路徑(路徑一律由 brotato-kit config show --resolved 解析)。
Harness 支援
所有 Harness 共用同一組 MCP stdio 入口(brotato-kit mcp controller、brotato-kit mcp rag)與 AGENTS.md 首次啟動協議。
重要:Harness 工具執行逾時上限請設為 ≥ 60 秒。長時間對局一律透過 Detached Job(
start_session)背景執行,不會阻塞 MCP 連線。
Harness | 狀態 | 專案內建自動發現檔 | 生效範圍 | 注意事項 |
Claude Code | ✅ |
| 專案級 | 首次開啟資料夾時請核准專案 MCP Server |
Cursor | ✅ |
| 專案級 | 使用 |
Antigravity | ✅ |
| 混合 |
|
Codex CLI | ✅ |
| 專案/使用者級 | 已內建 |
# 手動匯出各家 MCP 設定
uv run brotato-kit export-config --harness claude-code
uv run brotato-kit export-config --harness cursor
uv run brotato-kit export-config --harness antigravity
uv run brotato-kit export-config --harness codex執行環境與依賴
組件 | 最低需求 | 說明 |
Python |
|
|
套件管理 |
|
|
Python 依賴 |
| 僅 MCP stdio 伺服器需要; |
SQLite FTS5 | 內建於標準 |
|
遊戲本體 | 原版《土豆兄弟》 | 內建 Godot ModLoader |
設計原則
不打包任何二進位:無 Python 虛擬環境、無圖片素材、無外部執行檔、無向量資料庫或模型權重。
標準庫優先:Runner、FTS5 檢索、AST 條件求值均使用 Python 標準庫;唯一第三方依賴
mcp僅用於 stdio 伺服器。安全邊界明確:策略與拓展條件經白名單 AST 直譯器評估;寫入操作支援
dry_run、expect_base與回滾;macro 預設僅規劃不寫入。零第三方 Mod:只依賴原版遊戲內建 ModLoader 與本套件自帶橋接器。
Harness 無關:同一組 MCP 入口與
AGENTS.md協議,四家 Harness 共用。
疑難排解
症狀 | 處理方式 |
工具回傳 | 執行 |
工具回傳 | 執行 |
找不到 | 依官方指令安裝後重啟 Harness(Cursor 需重啟以套用 PATH) |
工具呼叫逾時 | 確認 Harness 工具逾時 ≥ 60 秒;長跑改用 |
Codex 中 | 允許沙盒連網後重試 |
新機器遊戲無法連線 | 確認已啟動過一次遊戲以建立 |
精簡版 Python 缺 FTS5 | 自動退回純 Python BM25,功能不受影響 |
設定路徑或 Runner 異常 |
|
聲明與授權
本專案為非官方工具,與《土豆兄弟》開發團隊無任何關聯。
僅支援原版 Steam 版
v1.0–v1.2.0.4;遊戲更新若變更相關 API,可能需等待套件跟進。LocalAI-AgentBridge透過本機 TCP 通訊(含 Token 認證與控制租約),請勿將該埠暴露至外部網路。src/brotato_kit/_assets/wiki/內 595 篇.md為離線固定純文本語料(不含遊戲圖片素材與第三方工作坊 Mod 文件),整理自社群 Brotato Wiki(https://brotato.wiki.spellsandguns.com/),採 CC BY-SA(姓名標示—相同方式分享) 授權,原始貢獻者保留著作權。詳見NOTICE.md。本專案原始碼授權見
LICENSE。
Available Tools
16 toolsdecide_wave_rewardCDestructive
Handle item_box (take|recycle) or upgrade (choose with index 0..3 | reroll).
Inputs: action (required), index.
get_game_stateARead-only
Get current Brotato state (compact summary by default; verbose=True or include=[progress|threats|inventory|shop]).
Inputs: include, verbose.
get_recent_deathsBRead-only
Retrieve the N most recent structured death telemetry reports from state_dir.
Inputs: n.
get_runner_statusARead-only
Get status of a specific runner job_id, or summaries of the 5 most recent jobs if omitted.
Inputs: job_id.
get_strategyBRead-only
Read the effective merged strategy (base ⊕ capability patches ⊕ overrides) and version hash.
Inputs: character_id (required).
inspect_gameBRead-only
Inspect scene tree or singletons (bounded: max_depth<=6, max_nodes<=500, <=64KB).
Inputs: path, target, max_depth, max_nodes.
manage_extensionsA
Discover, inspect, create, hot-update, delete, rollback, or run AI extensions under state_dir/extensions/.
START HERE: action="schema" (kind optional) returns every kind, hook, condition variable/function,
limit and a ready-to-edit template, so you never need to guess formats.
- action: schema | validate | list | get | upsert | delete | rollback | run
- kind: strategy | patch | profile | behavior (combat/shop/upgrade/item_box/reroll/lock/death hooks) | macro
- run (kind=macro): payload={"state"?: snapshot, "character_id"?: str, "execute"?: bool}; execute=False
(default) only plans writes; execute=True drives the live game and requires no active runner.
All writes are schema + whitelist-AST validated, atomic, versioned, and allowed while runner is active.
Inputs: action (required), kind, name, steps, +3 more.
ping_gameARead-only
Check connection to LocalAI-AgentBridge, protocol version, phase, and env_capabilities.
Inputs: no named parameters.
rollback_strategyB
Rollback character strategy overrides by N steps (up to 10 archived versions).
Inputs: character_id (required), steps.
run_controlCDestructive
Run lifecycle control: action in {start, menu, autopilot_on, autopilot_off}.
Inputs: action (required), danger, zone_id, weapon_id, +1 more.
set_threat_configB
Update (or read when called with no args) 60Hz autopilot and 2D spatial threat-map parameters.
Inputs: greed, aggression, kite_radius, tree_priority, +5 more.
shop_actionCDestructive
Execute shop action (buy|lock|unlock|reroll|combine|recycle|next_wave) and return post-action shop summary.
Inputs: action (required), slot, weapon_index.
start_sessionC
Launch a detached autonomous runner job immediately returning {job_id}.
Inputs: danger, zone_id, max_waves, weapon_id, +1 more.
stop_sessionA
Gracefully stop an active autonomous runner job (force-kills after 10s).
Inputs: job_id (required).
update_strategyA
Dry-run or apply (with expect_base optimistic lock) a validated strategy override under state_dir.
Inputs: patch (required), character_id (required), dry_run, expect_base.
wait_for_phaseARead-only
Wait until game reaches one of target phases (timeout 1..50s; timeout returns reached=False, not an error).
Inputs: phases, timeout_sec.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 16 tools
Most tools have clearly distinct purposes across the game-control domain (state read, strategy CRUD, shop, reward, runner lifecycle). There is a notable ambiguity between start_session and run_control with action='start', and mild overlap between get_game_state's progress/inventory view and shop_action's summary, but descriptions mostly disambiguate.
Predominantly consistent verb_noun pattern (ping_game, get_game_state, update_strategy, start_session, decide_wave_reward, manage_extensions). The lone deviation is shop_action, which is noun-first rather than verb-first, but it remains readable and predictable.
16 tools is at the higher edge but well-scoped for a complex game controller covering state, strategy, runner, shop, rewards, and extensions. Each tool maps to a genuine distinct capability, with only minor consolidation possible (start_session vs run_control).
The surface covers the full lifecycle: connection check, state inspection, strategy read/update/rollback, runner start/stop/status, phase waiting, shop, reward decisions, and extensions. Gaps are minor, such as no explicit combat-input tool beyond autopilot toggles, but core workflows are well covered.
Maintenance
Related MCP Connectors
Live competitive-game predictions, meta data and decision tools for AI agents.
Run your Krtuworks apps from an AI agent: setup, remote config, stats, players, bug reports.
Analytics, A/B tests, remote configs and player sentiment for games and apps, run by your AI agent.
The game engine built for AI. Any agent makes a multiplayer game and publishes it.
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-
- AlicenseAqualityDmaintenanceEnables AI agents to run battles, tournaments, and analyze strategies in the Battle Arena game programmatically.5MIT
- AlicenseAqualityCmaintenanceEnables AI assistants to interact with running games in real time — introspecting game state, simulating keyboard and mouse input to actually play, capturing screenshots, executing Lua code, hot-reloading files, and receiving push notifications when state changes.8MIT
- AlicenseAqualityBmaintenanceWindows-local MCP for Steam Balatro: tool-calling AI reads player-visible state, chooses and executes native actions, confirms results, and saves local experience. Glama's Linux sandbox can introspect MCP and run game-independent tools such as calculate, but cannot connect to Balatro on the user's Windows machine. Without the local game, health reports disconnected.125MIT