Skip to main content
Glama

Godot MCP Server

godot-mcp 让 MCP 客户端能够检查、验证、测试、导出和查询 Godot 项目。它支持无头 Godot 命令,并可选择从打开的 Godot 编辑器中获取实时状态。

环境要求

  • Node.js 18 或更高版本

  • 本地安装 Godot 4.1 或更高版本

  • 包含 project.godot 的 Godot 项目

实时编辑器工具还需要下文所述的 MCP Bridge 插件。其余工具以无头模式运行。

Related MCP server: godot-correctness-mcp

安装

从本地检出安装

npm install
npm run build

从 npm 安装(发布后)

npx -y @zbrkic/godot-mcp --project /path/to/godot-project --godot /path/to/godot

配置 MCP 客户端

始终提供项目路径。MCP 桌面客户端通常在其自己的工作目录中启动服务器,因此仅靠自动项目发现并不可靠。

{
  "mcpServers": {
    "godot": {
      "command": "npx",
      "args": ["-y", "@zbrkic/godot-mcp"],
      "env": {
        "GODOT_PROJECT_PATH": "C:/Source/my-game",
        "GODOT_PATH": "C:/Program Files/Godot/Godot_v4.5.1-stable_win64_console.exe"
      }
    }
  }
}

等效的命令行选项为:

godot-mcp --project /path/to/godot-project --godot /path/to/godot

仅当 godot 可执行文件已在 PATH 中时,GODOT_PATH/--godot 才是可选的。在 Windows 上,优先使用 _console.exe 可执行文件。

启用实时编辑器工具

  1. 将 godot-plugin/addons/mcp_bridge 复制到 <your-project>/addons/mcp_bridge。

  2. 在 Godot 中,打开 项目 > 项目设置 > 插件 并启用 MCP Bridge。

  3. 使用实时工具时保持 Godot 编辑器处于打开状态。

该桥接默认监听 127.0.0.1:7000。在 project.godot 中设置 mcp/plugin/port 可覆盖该端口;服务器会从上述配置的项目中读取该设置。请在生产导出预设中排除 addons/mcp_bridge/*。

工具

  • 项目与导出:get_project_settings、list_export_presets、export_project

  • 测试与验证:run_tests、validate_scene、validate_script、run_scene、format_gdscript

  • 场景与资源:inspect_scene_tree、find_nodes、get_node_properties、get_node_connections、list_resources、get_resource_dependencies、resolve_path、get_resource_info

  • 文档:verify_api、get_help

  • 实时编辑器:get_editor_selection、get_open_scenes

大多数工具返回结构化的 JSON 结果,包含 success、data、errors、warnings 以及计时元数据。

开发与验证

npm test              # TypeScript build plus MCP handshake and parser tests
npm run test:godot    # GDScript syntax checks; requires GODOT_PATH or godot on PATH
npm pack --dry-run    # Inspect the files that would be published

GitHub Actions 会在推送和拉取请求时运行 Node/MCP 测试和 Godot 插件检查。

发布清单

  1. 更新 package.json 中的版本号。

  2. 运行 npm test、npm run test:godot 和 npm pack --dry-run。

  3. 使用 npm publish 发布,并创建对应的 GitHub 发布。

许可证

本项目采用 MIT 许可证 授权。

Available Tools

20 tools
export_projectD

Exports project

Inputs: output (required), preset (required).

find_nodesD

Finds nodes in scene

Inputs: scene_path (required), type_filter, name_pattern.

format_gdscriptC

Formats GDScript

Inputs: script_path (required).

get_editor_selectionB

Gets current editor selection (requires open editor)

Inputs: no named parameters.

get_helpC

Gets Godot documentation

Inputs: search_term (required).

get_node_connectionsD

Gets node signals

Inputs: node_path (required), scene_path (required).

get_node_propertiesD

Gets node properties

Inputs: node_path (required), scene_path (required).

get_open_scenesB

Lists open scenes in editor (requires open editor)

Inputs: no named parameters.

get_project_settingsC

Parses project.godot

Inputs: prefix.

get_resource_dependenciesD

Gets resource deps

Inputs: resource_path (required).

get_resource_infoD

Gets detailed info about a resource

Inputs: resource_path (required).

inspect_scene_treeC

Returns node hierarchy

Inputs: scene_path (required).

list_export_presetsB

Returns export presets

Inputs: no named parameters.

list_resourcesC

Lists project resources

Inputs: type_filter.

resolve_pathC

Resolves a UID to a path or vice versa

Inputs: path_or_uid (required).

run_sceneC

Runs scene headlessly

Inputs: scene_path (required), timeout_ms.

run_testsB

Executes tests using GUT or a custom runner

Inputs: test_script.

validate_sceneC

Validates .tscn

Inputs: scene_path (required).

validate_scriptD

Validates .gd

Inputs: script_path (required).

verify_apiD

Checks Godot API

Inputs: class_name (required), method_name.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    C2.5/5.0

    Scored across 20 tools

    Disambiguation4/5

    The tools are mostly distinct in purpose, covering different aspects like testing, scene inspection, resource management, and editor interactions. There is slight potential confusion between `inspect_scene_tree` and `find_nodes`, but they serve different goals (hierarchy vs. search). Overall, an agent can reliably select the right tool based on descriptions.

    Naming Consistency5/5

    All tool names follow a consistent verb_noun pattern in snake_case, such as `run_tests`, `get_project_settings`, `validate_script`, and `list_resources`. The verbs are action-oriented and the nouns clearly indicate the target resource. This makes the toolset predictable and easy to navigate.

    Tool Count3/5

    With 20 tools, this exceeds the typical 3-15 range, leaning toward the heavier side. However, each tool addresses a specific need in Godot development (testing, export, scene analysis, resource handling, editor access), so the count is justifiable albeit on the upper end. It feels slightly bloated but not excessive.

    Completeness4/5

    The toolset covers a broad range of Godot workflows, including project configuration, validation, running, formatting, scene/node introspection, resource management, and editor state. Missing features like creating or editing scenes/scripts are not core for an MCP that primarily aids analysis and execution. Minor gaps exist (e.g., no explicit node deletion), but agents can work around them.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      B
      maintenance
      Offline static correctness MCP server for Godot 4.x GDScript projects that lints code, looks up API symbols, and validates scenes/resources, all without a running editor.
      430 npm
      Creative Commons Attribution Non Commercial No Derivatives 4.0 International
    • A
      license
      B
      quality
      D
      maintenance
      Connects MCP-capable AI clients to a running Godot 4 editor for scene, node, project, and debug runtime operations via a local-first architecture.
      36
      1
      MIT