/ 目錄 / 演練場 / Godot MCP
● 社群 Coding-Solo ⚡ 即開即用

Godot MCP

作者 Coding-Solo · Coding-Solo/godot-mcp

讓 Claude 執行 Godot 4 — 啟動專案、無頭執行場景、擷取 stdout/stderr,無需切換視窗即可迭代 GDScript。

Godot MCP 封裝了 Godot 4 執行檔,並暴露編輯器與執行時工具。Claude 可以啟動編輯器、無頭執行專案、執行單一場景,並將 stdout/stderr 拉回文字格式。搭配 filesystem MCP,迴圈變為:Claude 編輯 .gd 檔案 → 執行場景 → 讀取錯誤 → 修復 — 全程在聊天視窗中完成。

為什麼要用

核心特性

即時演示

實際使用效果

godot-mcp-coding-solo.replay ▶ 就緒
0/0

安裝

選擇你的客戶端

~/Library/Application Support/Claude/claude_desktop_config.json  · Windows: %APPDATA%\Claude\claude_desktop_config.json
{
  "mcpServers": {
    "godot-mcp-coding-solo": {
      "command": "npx",
      "args": [
        "-y",
        "godot-mcp"
      ],
      "env": {
        "GODOT_PATH": "/Applications/Godot.app/Contents/MacOS/Godot"
      }
    }
  }
}

開啟 Claude Desktop → Settings → Developer → Edit Config。儲存後重啟應用。

~/.cursor/mcp.json · .cursor/mcp.json
{
  "mcpServers": {
    "godot-mcp-coding-solo": {
      "command": "npx",
      "args": [
        "-y",
        "godot-mcp"
      ],
      "env": {
        "GODOT_PATH": "/Applications/Godot.app/Contents/MacOS/Godot"
      }
    }
  }
}

Cursor 使用與 Claude Desktop 相同的 mcpServers 格式。專案級設定優先於全域。

VS Code → Cline → MCP Servers → Edit
{
  "mcpServers": {
    "godot-mcp-coding-solo": {
      "command": "npx",
      "args": [
        "-y",
        "godot-mcp"
      ],
      "env": {
        "GODOT_PATH": "/Applications/Godot.app/Contents/MacOS/Godot"
      }
    }
  }
}

點擊 Cline 側欄中的 MCP Servers 圖示,然後選 "Edit Configuration"。

~/.codeium/windsurf/mcp_config.json
{
  "mcpServers": {
    "godot-mcp-coding-solo": {
      "command": "npx",
      "args": [
        "-y",
        "godot-mcp"
      ],
      "env": {
        "GODOT_PATH": "/Applications/Godot.app/Contents/MacOS/Godot"
      }
    }
  }
}

格式與 Claude Desktop 相同。重啟 Windsurf 生效。

~/.continue/config.json
{
  "mcpServers": [
    {
      "name": "godot-mcp-coding-solo",
      "command": "npx",
      "args": [
        "-y",
        "godot-mcp"
      ]
    }
  ]
}

Continue 使用伺服器物件陣列,而非映射。

~/.config/zed/settings.json
{
  "context_servers": {
    "godot-mcp-coding-solo": {
      "command": {
        "path": "npx",
        "args": [
          "-y",
          "godot-mcp"
        ]
      }
    }
  }
}

加入 context_servers。Zed 儲存後熱重載。

claude mcp add godot-mcp-coding-solo -- npx -y godot-mcp

一行命令搞定。用 claude mcp list 驗證,claude mcp remove 移除。

使用場景

實戰用法: Godot MCP

緊密迭代迴圈修復 GDScript bug

👤 獨立/獨立遊戲開發者 ⏱ ~20 min intermediate

何時使用: 重構後玩家移動壞掉了;你想讓 Claude 修復而不用每分鐘切回 Godot。

前置條件
  • 已安裝 Godot 4 — 從 godotengine.org 下載
  • GODOT_PATH 環境變數 — 指向 Godot 執行檔(macOS 上不是 .app)
步驟
  1. 取得專案背景資訊
    Godot:取得 /Users/me/games/Platformer 的專案資訊。列出 autoload 與主場景。✓ 已複製
    → 回傳專案名稱、版本、autoload 清單
  2. 執行失敗的場景
    以無頭模式執行場景 scenes/Level1.tscn,逾時 10 秒。顯示 stderr。✓ 已複製
    → 擷取到 stderr;可見錯誤行與堆疊追蹤
  3. 修復並重新執行
    錯誤是「Invalid call to method move_and_slide on null」。讀取 scripts/Player.gd,找出原因,修復,然後重新執行場景。✓ 已複製
    → 檔案已編輯,場景重新執行,null 錯誤不再出現

結果: 在 5 分鐘內找到並修復 bug,無需離開聊天視窗。

注意事項
  • 無頭執行卡在強制對話框 — 使用逾時;在 stderr 中查找對話框標題
  • GODOT_PATH 指向錯誤架構(Intel vs ARM mac) — 使用 file $GODOT_PATH 驗證
搭配使用: filesystem · github

從零建立玩家狀態機

👤 開始新專案的開發者 ⏱ ~25 min intermediate

何時使用: 你想要狀態機樣板程式碼(Idle/Run/Jump/Attack),不想手動複製貼上。

前置條件
  • 空的 Godot 專案 — 從 Project Manager 建立
步驟
  1. 產生檔案
    建立 scripts/State.gd(基底類別)以及繼承它的 IdleState/RunState/JumpState/AttackState。使用訊號(signal)進行轉移。儲存到 res://scripts/states/ 下。✓ 已複製
    → 正確位置有 5 個新的 .gd 檔案
  2. 接入 Player.gd
    更新 scripts/Player.gd,實例化狀態機並將 _physics_process 委派給 current_state。保持輸入處理精簡。✓ 已複製
    → Player.gd 中有 state_machine、current_state、transitions
  3. 冒煙測試
    執行 scenes/Player.tscn 3 秒。查找執行時錯誤。✓ 已複製
    → 乾淨執行;可以開始新增遊戲邏輯

結果: 可運作的狀態機樣板 — 準備好新增真實狀態。

注意事項
  • 忘記在 State.gd 上宣告 class_name — 加上它,這樣子類別才能使用該類型
搭配使用: filesystem

從 CI 無頭執行 gut 測試

👤 建立 CI 的開發者 ⏱ ~30 min advanced

何時使用: 你想在每次推送時在 GitHub Actions 執行單元測試。

前置條件
  • Gut 測試插件 — 透過 Asset Library 或 git submodule 安裝
步驟
  1. 先在本機執行
    Godot:以無頭模式執行場景 addons/gut/gui/GutRunner.tscn。擷取退出碼。✓ 已複製
    → 測試執行;綠燈時退出碼為 0
  2. 產生工作流程
    現在撰寫一個 .github/workflows/test.yml,在 Ubuntu 上使用 godot-headless 4.x 執行相同操作。✓ 已複製
    → 包含正確 Godot 設定動作的工作流程檔案

結果: Godot 測試的可重複 CI 流程。

注意事項
  • 無頭模式在顯示呼叫時崩潰 — 使用 --headless 並在測試中避免 OS.window_*
搭配使用: github

組合

與其他 MCP 搭配,撬動十倍槓桿

godot-mcp-coding-solo + filesystem

編輯 GDScript 並在緊密迴圈中重新執行場景

Filesystem:編輯 scripts/Player.gd 加入跳躍冷卻。Godot:執行 scenes/Player.tscn 3 秒。顯示 stderr。✓ 已複製
godot-mcp-coding-solo + github

在 Claude 修復遊戲 bug 後開一個 PR

Godot:重新執行場景確認 bug 已修復。GitHub:開一個包含修復和相關日誌片段的 PR。✓ 已複製

工具

此 MCP 暴露的能力

工具輸入參數何時呼叫成本
get_project_info project_path: str 第一次呼叫,健全性檢查 free
launch_editor project_path: str 開啟 Godot 介面 free
run_project project_path, headless?: bool, timeout?: int 完整專案冒煙測試 free
run_scene project_path, scene_path, headless?, timeout? 迭代單一場景 free
stop_process pid: int 終止卡住的執行程序 free

成本與限制

運行它的成本

API 配額
無 — 本機
每次呼叫 Token 數
200–8000(stdout/stderr 可能很大)
費用
免費開源;Godot 免費
提示
在 run_scene 上積極使用逾時;不要讓無限迴圈消耗 token

安全

權限、密鑰、影響範圍

最小權限: 執行 Godot 執行檔
憑證儲存:
資料出站: 僅限本機
切勿授予: 任意 shell

故障排查

常見錯誤與修復

找不到 GODOT_PATH

設定指向 Godot 執行檔的絕對路徑;在 mac 上使用 .app 內的執行檔

驗證: $GODOT_PATH --version
無頭執行卡住

務必傳入逾時;在 stderr 中查找強制對話框或著色器編譯

Godot 版本錯誤

MCP 僅支援 Godot 4.x;3.x 場景無法載入

驗證: godot --version

替代方案

Godot MCP 對比其他方案

替代方案何時用它替代權衡
godot.unitynoid (mcp-godot)你想要不同的分支版本實戰考驗較少
Bevy / Rapier MCPs你使用 Rust/Bevy完全不同的引擎

更多

資源

📖 閱讀 GitHub 上的官方 README

🐙 查看未解決的 issue

🔍 瀏覽全部 400+ MCP 伺服器和 Skills