Godot

io.github.sterion66由 GitHub 账号 sterion66 发布v1.0.2更新于 Oct 24, 2026

The most complete Godot 4 MCP: secure sandbox, 40+ tools (projects–runtime), major MCP clients.

已验证STDIO仅桌面文件与存储开发者工具

概览

AI 生成的概览

一个本地 MCP 服务器,让助手管理 Godot 4 游戏项目:场景、GDScript、资源,以及可选的游戏运行。

可以做什么
提供约 40 个面向 Godot 4.x 开发的工具:创建和列出项目,读写场景、脚本和资源,生成 GDScript 模板,查找资源与未使用文件,用正则搜索文件内容,并搜索或下载 Godot 资源库和 GitHub 上的内容。它还能定位 Godot 可执行文件、检查版本、无头运行游戏、执行 GDScript 并读取日志。所有文件操作都限制在一个工作区目录内。
适用场景
适合让助手直接在专用文件夹内的 Godot 4 项目上工作:搭建场景和脚本、重构 GDScript、审查资源,或无头运行项目查看输出。如果只是想在 Godot 之外做普通文件编辑,则不需要它。
运行要求
本地进程;需要 Python 3.10+ 以及 fastmcp 和 urllib3,从 godot-mcp-server 包安装。需要一个工作区目录(默认 ~/godot-games,可用 GODOT_MCP_ROOT 覆盖)来存放项目。运行游戏或执行 GDScript 需要将 GODOT_MCP_ALLOW_GODOT_EXEC 设为可接受的开启值。运行时工具还需要本机安装 Godot。仅支持桌面端。
安装前请注意
随附的示例配置把 GODOT_MCP_ALLOW_GODOT_EXEC 设为 1,这会允许助手以你的用户身份运行游戏并执行 GDScript;删除该变量或设为 0 可禁用执行。工具会在工作区内写入、替换和创建文件,并能从资源库下载和解压资源。HTTP 模式没有身份验证,应绑定 127.0.0.1 而不是 0.0.0.0。GODOT_MCP_ROOT 解析时会跟随符号链接,请指向你自己控制的目录。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Godot,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

Godot MCP Server

[CI] [Python 3.10+] [License: MIT]

A comprehensive FastMCP server for Godot 4.x game development. Provides tooling for AI-assisted workflows: project management, file operations, asset discovery, GDScript development, and optional Godot execution.

Contributing · Security

Security model: All Godot projects, file writes, and Asset Library downloads are restricted to a single workspace directory on your machine (default ~/godot-games). The server refuses paths outside that tree. See Workspace setup.

Code execution: godot_run_game and godot_execute_script require GODOT_MCP_ALLOW_GODOT_EXEC in the server environment. The shipped MCP JSON configs set it to 1 so these tools work after copy-paste. Running python godot_mcp_server.py without that env still leaves execution off until you export it. To lock down an IDE install, remove the variable or set it to 0. See Godot execution (environment).

HTTP transport: Binding to 0.0.0.0 or :: exposes the MCP server on all network interfaces; prefer 127.0.0.1 unless you use a firewall or VPN.

Symlinks: GODOT_MCP_ROOT is resolved with symlinks followed; point it at a real directory you control.

Features

Project Management

  • Auto-detect Godot projects (project.godot); list all projects under the workspace (godot_list_projects)
  • Create new projects under the workspace (godot_create_project)
  • Parse project settings and configuration; list autoloads and editor plugin state (read-only for plugins)
  • Refresh project cache after changes

File Operations

  • Read/write scenes (.tscn), scripts (.gd), resources (.tres)
  • Create new scripts, scenes, resources from templates
  • Edit existing files with content replacement
  • Validate scene and script syntax

Code Generation

  • CharacterBody2D/3D movement controllers
  • State machine patterns
  • Custom resources
  • Node scripts with signals/exports

Asset Management

  • Discover assets by extension, pattern, glob
  • Find unused assets
  • Search file contents with regex
  • Search & download from Godot Asset Library
  • Browse Godot repos on GitHub

Runtime Integration

  • Find Godot executable
  • Check Godot version
  • Run game headless
  • Execute GDScript code
  • Read Godot logs
  • File watcher configuration

Installation

bash
# From PyPI-style editable install (recommended for contributors)pip install -e .
# Or minimal deps onlypip install -r requirements.txt

Console entry point (after pip install -e .): godot-mcp-server (same as python godot_mcp_server.py).

Workspace setup (required)

The MCP server only operates on Godot projects that live under one root folder. This keeps assistants from reading or writing arbitrary paths on your system.

  1. Create the default folder (once per machine):

    bash
    mkdir -p ~/godot-games
  2. Put every Godot game there — each game is its own subdirectory containing project.godot, for example:

    text
    ~/godot-games/  my-platformer/     ← open this folder in your editor    project.godot    ...  another-game/    project.godot
  3. Open your IDE workspace inside ~/godot-games/.../your-game (or a parent folder under ~/godot-games) so the MCP process can discover project.godot from the current working directory.

  4. Custom location: Set an absolute path before starting the server:

    bash
    export GODOT_MCP_ROOT="/path/to/your/godot-games"python godot_mcp_server.py

    In Cursor / Claude / other MCP configs, add env:

    json
    "env": {  "GODOT_MCP_ROOT": "/path/to/your/godot-games"}

    If unset, the default is $HOME/godot-games. The server creates that directory on startup if it does not exist.

  5. Inspect at runtime: call the tool godot_get_workspace or read the resource project://workspace to see the active workspace path.

If tools report that no project was found, your cwd is probably outside the workspace, or project_path points outside GODOT_MCP_ROOT.

Godot execution (environment)

Running the game or executing GDScript runs code as your user (same as starting Godot from a terminal). The server only enables godot_run_game / godot_execute_script when GODOT_MCP_ALLOW_GODOT_EXEC is set to an accepted “on” value.

Shipped configs (default yes): every example JSON in this repo (mcp_config.json, mcp_config.cursor.json, etc.) includes:

json
"env": {  "GODOT_MCP_ALLOW_GODOT_EXEC": "1"}

So if you copy one of those into your IDE, execution is allowed without extra steps. Merge other keys (e.g. GODOT_MCP_ROOT) into the same env object.

CLI without MCP config: running python godot_mcp_server.py does not set this variable; execution tools stay blocked until you export GODOT_MCP_ALLOW_GODOT_EXEC=1 (or use a wrapper script).

Stricter setups: delete GODOT_MCP_ALLOW_GODOT_EXEC from env, or set it to 0 / false / no / off, then restart the MCP client.

Accepted “on” values: 1, true, yes, on (case-insensitive). Call godot_get_workspace and check godot_exec_allowed to confirm.

Usage

CLI (stdio - for Claude Code/Cursor)

bash
python godot_mcp_server.py

HTTP Server

bash
python godot_mcp_server.py --transport http --port 8765

Configuration

Set GODOT_MCP_ROOT in the MCP server env if you do not use the default ~/godot-games. See Workspace setup. Shipped snippets below include GODOT_MCP_ALLOW_GODOT_EXEC; see Godot execution (environment).

Path to the server: Examples use "args": ["godot_mcp_server.py"] assuming the MCP process runs with its working directory at the folder that contains the script (e.g. you cloned this repo). If the server fails to start, replace that with the absolute path to godot_mcp_server.py on your machine.

Install in your editor

Expand a section and paste the JSON into the file your tool expects. The same godot server block is in the repo as mcp_config.*.json for copy-paste.

Cursor

macOS / Linux (project or user config) — Settings → MCP → Add new global MCP server or create .cursor/mcp.json in a project root:

json
{  "mcpServers": {    "godot": {      "command": "python3",      "args": ["godot_mcp_server.py"],      "env": {        "GODOT_MCP_ALLOW_GODOT_EXEC": "1"      }    }  }}

Windows — if python is not on PATH for the MCP host, use the launcher or full path to python.exe, and prefer an absolute path in args:

json
{  "mcpServers": {    "godot": {      "command": "cmd",      "args": ["/c", "python", "C:\\path\\to\\godot-mcp-server\\godot_mcp_server.py"],      "env": {        "GODOT_MCP_ALLOW_GODOT_EXEC": "1"      }    }  }}

Merge GODOT_MCP_ROOT into env if you do not use ~/godot-games (see Workspace setup).

Visual Studio Code

Use the MCP / agent settings your VS Code build provides (often Settings → MCP or a project .vscode/mcp.json, depending on version and extensions). Paste the same structure as Cursor:

json
{  "mcpServers": {    "godot": {      "command": "python3",      "args": ["godot_mcp_server.py"],      "env": {        "GODOT_MCP_ALLOW_GODOT_EXEC": "1"      }    }  }}

Use an absolute path in args if the workspace folder is not the repo root.

Claude Desktop

Edit the app config file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
json
{  "mcpServers": {    "godot": {      "command": "python3",      "args": ["/absolute/path/to/godot_mcp_server.py"],      "env": {        "GODOT_MCP_ALLOW_GODOT_EXEC": "1"      }    }  }}

Restart Claude Desktop after saving.

Claude Code (CLI)

Merge into ~/.claude/settings.json (or use claude mcp add if your CLI supports it — check claude mcp --help):

json
{  "mcpServers": {    "godot": {      "command": "python3",      "args": ["godot_mcp_server.py"],      "env": {        "GODOT_MCP_ALLOW_GODOT_EXEC": "1"      },      "description": "Godot 4.x game development server"    }  }}
Windsurf (Codeium)

macOS / Linux: edit ~/.codeium/windsurf/mcp_config.json, or use CMD+SHIFT+P → “Windsurf: Configure MCP Servers”.

json
{  "mcpServers": {    "godot": {      "command": "python3",      "args": ["godot_mcp_server.py"],      "env": {        "GODOT_MCP_ALLOW_GODOT_EXEC": "1"      },      "description": "Godot 4.x game development - project, scenes, scripts, assets, runtime"    }  }}
Roo Code

Paste into Roo’s MCP settings (project or global), same JSON shape as above. Repo copy: roo_code_mcp.json.

json
{  "mcpServers": {    "godot": {      "command": "python3",      "args": ["godot_mcp_server.py"],      "env": {        "GODOT_MCP_ALLOW_GODOT_EXEC": "1"      },      "description": "Godot 4.x game dev - project, scenes, scripts, assets, runtime"    }  }}
Generic JSON (any MCP host)

Minimal stdio config — same as mcp_config.json in this repo:

json
{  "mcpServers": {    "godot": {      "command": "python3",      "args": ["godot_mcp_server.py"],      "env": {        "GODOT_MCP_ALLOW_GODOT_EXEC": "1"      },      "description": "Godot 4.x game development server - file ops, asset management, runtime integration"    }  }}

Limits (DoS / abuse)

  • Regex search (godot_search_content): Pattern length capped; match list capped; files larger than 2 MiB are skipped. Malicious regex can still be expensive—keep patterns simple.
  • Asset zip download: Maximum download size, per-file uncompressed size, total uncompressed size, and file count are enforced before extraction (see constants near the top of godot_mcp_server.py).
  • Asset Library IDs: asset_id for godot_get_asset_info / godot_download_asset must be numeric digits only.

HTTP Mode (Remote)

Use loopback unless you know what you are doing:

bash
python godot_mcp_server.py --transport http --host 127.0.0.1 --port 8765

Binding to all interfaces (--host 0.0.0.0) logs a warning and exposes MCP to your LAN with no authentication in this server.

Then use serverUrl instead of command:

json
{  "mcpServers": {    "godot": {      "serverUrl": "http://localhost:8765/mcp"    }  }}
Why not duplicate HTTP + stdio?

Only run one transport to the same project (stdio or HTTP), not both at once, to avoid conflicting MCP sessions.

Tools Reference

40 MCP tools are registered in godot_mcp_server.py (search for @mcp.tool). Summary:

ToolDescription
godot_get_workspaceShow MCP sandbox directory (GODOT_MCP_ROOT)
godot_find_projectLocate project root (walk-up or workspace scan)
godot_list_projectsList every project.godot under the workspace
godot_create_projectCreate project.godot + starter scene under the workspace
godot_get_project_infoGet project details
godot_get_project_settingsParse project.godot (includes editor_plugins_enabled read-only)
godot_get_project_filesList all project files
godot_refresh_projectRescan scenes/scripts/resources counts
godot_list_scenesList .tscn files
godot_list_scriptsList .gd files
godot_list_resourcesList .tres files
godot_list_autoloadList autoload singletons
godot_list_editor_pluginsInstalled addons vs enabled in project.godot (enable plugins in the Godot editor)
godot_find_assetsFind by extension
godot_find_unused_filesFind unreferenced assets
godot_find_by_patternGlob pattern search
godot_search_contentRegex search in files
godot_create_scriptCreate new GDScript
godot_create_sceneCreate new scene
godot_create_resourceCreate new resource
godot_create_code_templateTemplate scripts
godot_read_sceneParse scene file
godot_read_scriptParse GDScript
godot_validate_sceneValidate scene
godot_validate_scriptValidate syntax
godot_edit_fileReplace content
godot_write_fileWrite file
godot_get_file_infoFile metadata
godot_find_godot_executableLocate Godot
godot_check_versionGodot version
godot_run_gameRun headless
godot_execute_scriptRun GDScript
godot_get_logRead logs
godot_watch_filesConfigure watcher
godot_get_node_infoNode type hints
godot_generate_uidGenerate UID
godot_search_assetlibSearch Asset Library
godot_get_asset_infoAsset details
godot_download_assetDownload / extract asset (promotes nested addons/)
godot_browse_githubSearch GitHub

Editor plugins: this server does not write [editor_plugins] in project.godot (avoids conflicting with an open editor). Install addons via tools above; the user enables plugins in Project Settings → Plugins in Godot; use godot_list_editor_plugins to verify.

Resources

ResourceURIDescription
Project Infoproject://infoBasic project info
Project Overviewproject://overviewFile counts
Workspaceproject://workspaceMCP sandbox path (GODOT_MCP_ROOT)
Runtimeproject://runtimeGodot version + workspace path

Examples

Create a Platformer Player

python
# Using templatecreate_code_template("character_body_2d", "Player")

Find Assets

python
# All PNG filesfind_assets([".png", ".jpg"])
# Unused assetsfind_unused_files()

Search Asset Library

python
search_assetlib("platformer")# => [{title: "PlatformerController2D", ...}]
get_asset_info("1062")# => {title, author, description, license, download_url}

Run Game Headless

Requires GODOT_MCP_ALLOW_GODOT_EXEC (included in the shipped MCP JSON configs).

python
run_game(headless=True, quit_after_seconds=30)

Requirements

  • Python 3.10+
  • Dependencies: fastmcp, urllib3 (see pyproject.toml)

Development

bash
pip install -e ".[dev]"ruff check godot_mcp_server.py testspytest

Continuous integration runs on Python 3.10–3.14 (see .github/workflows/ci.yml). Dependabot opens weekly PRs for pip and GitHub Actions.

Optional: pip install pre-commit && pre-commit install uses .pre-commit-config.yaml.

Publish to GitHub

  1. Create an empty repository on GitHub (no README/license if you already have them locally), e.g. godot-mcp-server.
  2. Add the remote and push:
bash
cd /path/to/godot-mcp-servergit remote add origin https://github.com/YOUR_USER/godot-mcp-server.gitgit push -u origin main

Or with GitHub CLI: gh repo create godot-mcp-server --public --source=. --remote=origin --push

After the first push, CI runs on every push and PR. Replace sterion66 in the README badge URLs if you use a different account or organization.

License

MIT

来源:README.md,提交 b7e6e32

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

1
  1. v1.0.2最新Sep 16, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分