Skip to main content
Glama

Godot MCP

派生自 Coding-Solo/godot-mcp,提交版本为 1209744 (MIT)。此分支由 @jamesdowzard 独立维护,并增加了 Android 导出验证器支持及其他 AI 友好型工具。上游分支关系已在 git 层面断开;版权/署名根据 MIT 协议保留。

Made with Godot

                           (((((((             (((((((
                        (((((((((((           (((((((((((
                        (((((((((((((       (((((((((((((
                        (((((((((((((((((((((((((((((((((
                        (((((((((((((((((((((((((((((((((
         (((((      (((((((((((((((((((((((((((((((((((((((((      (((((
       (((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((
     ((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((
    ((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((
      (((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((
        (((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((
         (((((((((((@@@@@@@(((((((((((((((((((((((((((@@@@@@@(((((((((((
         (((((((((@@@@,,,,,@@@(((((((((((((((((((((@@@,,,,,@@@@(((((((((
         ((((((((@@@,,,,,,,,,@@(((((((@@@@@(((((((@@,,,,,,,,,@@@((((((((
         ((((((((@@@,,,,,,,,,@@(((((((@@@@@(((((((@@,,,,,,,,,@@@((((((((
         (((((((((@@@,,,,,,,@@((((((((@@@@@((((((((@@,,,,,,,@@@(((((((((
         ((((((((((((@@@@@@(((((((((((@@@@@(((((((((((@@@@@@((((((((((((
         (((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((
         (((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((
         @@@@@@@@@@@@@((((((((((((@@@@@@@@@@@@@((((((((((((@@@@@@@@@@@@@
         ((((((((( @@@(((((((((((@@(((((((((((@@(((((((((((@@@ (((((((((
         (((((((((( @@((((((((((@@@(((((((((((@@@((((((((((@@ ((((((((((
          (((((((((((@@@@@@@@@@@@@@(((((((((((@@@@@@@@@@@@@@(((((((((((
           (((((((((((((((((((((((((((((((((((((((((((((((((((((((((((
              (((((((((((((((((((((((((((((((((((((((((((((((((((((
                 (((((((((((((((((((((((((((((((((((((((((((((((
                        (((((((((((((((((((((((((((((((((


                          /$$      /$$  /$$$$$$  /$$$$$$$
                         | $$$    /$$$ /$$__  $$| $$__  $$
                         | $$$$  /$$$$| $$  \__/| $$  \ $$
                         | $$ $$/$$ $$| $$      | $$$$$$$/
                         | $$  $$$| $$| $$      | $$____/
                         | $$\  $ | $$| $$    $$| $$
                         | $$ \/  | $$|  $$$$$$/| $$
                         |__/     |__/ \______/ |__/

一个用于与 Godot 游戏引擎交互的模型上下文协议 (MCP) 服务器。

简介

Godot MCP 使 AI 智能体能够启动 Godot 编辑器、运行项目、捕获调试输出并控制项目执行。这种直接的反馈循环有助于智能体理解 Godot 项目中哪些部分有效,哪些无效,从而提供更好的代码生成和调试辅助。

Related MCP server: Gear

功能

  • 启动 Godot 编辑器:为特定项目打开 Godot 编辑器

  • 运行 Godot 项目:以调试模式执行 Godot 项目

  • 捕获调试输出:检索控制台输出和错误消息

  • 控制执行:以编程方式启动和停止 Godot 项目

  • 获取 Godot 版本:检索已安装的 Godot 版本

  • 列出 Godot 项目:查找指定目录中的 Godot 项目

  • 项目分析:获取有关项目结构的详细信息

  • 场景管理:

    • 使用指定的根节点类型创建新场景

    • 向现有场景添加具有可自定义属性的节点

    • 将精灵和纹理加载到 Sprite2D 节点中

    • 将 3D 场景导出为 GridMap 的 MeshLibrary 资源

    • 保存场景,并提供创建变体的选项

  • UID 管理 (适用于 Godot 4.4+):

    • 获取特定文件的 UID

    • 通过重新保存资源来更新 UID 引用

要求

  • 系统中已安装 Godot Engine

  • Node.js (>=18.0.0) 和 npm

  • 支持 MCP 的 AI 智能体

快速入门

Claude Code

claude mcp add godot -- npx @coding-solo/godot-mcp

完成。重启 Claude Code,您的 Godot MCP 工具即可使用。

使用环境变量:

claude mcp add godot -e GODOT_PATH=/path/to/godot -e DEBUG=true -- npx @coding-solo/godot-mcp

添加到您的 Cline MCP 设置文件 (~/Library/Application Support/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json) 中:

{
  "mcpServers": {
    "godot": {
      "command": "npx",
      "args": ["@coding-solo/godot-mcp"],
      "env": {
        "DEBUG": "true"
      },
      "disabled": false,
      "autoApprove": [
        "launch_editor",
        "run_project",
        "get_debug_output",
        "stop_project",
        "get_godot_version",
        "list_projects",
        "get_project_info",
        "create_scene",
        "add_node",
        "load_sprite",
        "export_mesh_library",
        "save_scene",
        "get_uid",
        "update_project_uids"
      ]
    }
  }
}

使用 Cursor UI:

  1. 前往 Cursor Settings > Features > MCP

  2. 点击 + Add New MCP Server 按钮

  3. 填写表单:

    • Name: godot

    • Type: command

    • Command: npx @coding-solo/godot-mcp

  4. 点击 "Add"

  5. 您可能需要点击 MCP 服务器卡片右上角的刷新按钮来填充工具列表

使用项目特定配置:

在您的项目目录中创建 .cursor/mcp.json 文件:

{
  "mcpServers": {
    "godot": {
      "command": "npx",
      "args": ["@coding-solo/godot-mcp"],
      "env": {
        "DEBUG": "true"
      }
    }
  }
}

对于任何兼容 MCP 的客户端,请使用此配置:

{
  "mcpServers": {
    "godot": {
      "command": "npx",
      "args": ["@coding-solo/godot-mcp"],
      "env": {
        "GODOT_PATH": "/path/to/godot",
        "DEBUG": "true"
      }
    }
  }
}

环境变量

变量

描述

GODOT_PATH

Godot 可执行文件的路径(覆盖自动检测)

DEBUG

设置为 "true" 以启用详细的服务器端调试日志

git clone https://github.com/Coding-Solo/godot-mcp.git
cd godot-mcp
npm install
npm run build

然后将您的 MCP 客户端指向 build/index.js,而不是使用 npx。

架构

Godot MCP 服务器针对复杂操作使用了捆绑的 GDScript 方法:

  1. 直接命令:启动编辑器或获取项目信息等简单操作直接使用 Godot 的内置 CLI 命令。

  2. 捆绑操作脚本:创建场景或添加节点等复杂操作使用一个全面的 GDScript 文件 (godot_operations.gd) 来处理所有操作。

捆绑脚本以 JSON 格式接收操作类型和参数,从而允许灵活且动态地执行操作,而无需为每个操作生成临时文件。

故障排除

  • 未找到 Godot:将 GODOT_PATH 环境变量设置为您的 Godot 可执行文件路径

  • 连接问题:确保服务器正在运行并重启您的 AI 助手

  • 项目路径无效:确保路径指向包含 project.godot 文件的目录

  • 构建问题:确保通过运行 npm install 安装了所有依赖项

  • 确保 MCP 服务器在 Cursor 设置中显示并已启用 (Settings > MCP)

  • MCP 工具只能在 Agent 聊天配置文件中使用 (需要 Cursor Pro 或 Business 订阅)

  • 使用 "Yolo Mode" 自动运行 MCP 工具请求

许可证

本项目采用 MIT 许可证授权 - 有关详细信息,请参阅 LICENSE 文件。

Available Tools

14 tools
add_nodeB

Add a node to an existing scene

Inputs: projectPath (required), scenePath (required), nodeType (required), nodeName (required), +2 more.

create_sceneA

Create a new Godot scene file

Inputs: projectPath (required), scenePath (required), rootNodeType.

export_mesh_libraryB

Export a scene as a MeshLibrary resource

Inputs: projectPath (required), scenePath (required), outputPath (required), meshItemNames.

get_debug_outputB

Get the current debug output and errors

Inputs: no named parameters.

get_godot_versionA

Get the installed Godot version

Inputs: no named parameters.

get_project_infoB

Retrieve metadata about a Godot project

Inputs: projectPath (required).

get_uidB

Get the UID for a specific file in a Godot project (for Godot 4.4+)

Inputs: projectPath (required), filePath (required).

launch_editorC

Launch Godot editor for a specific project

Inputs: projectPath (required).

list_projectsA

List Godot projects in a directory

Inputs: directory (required), recursive.

load_spriteC

Load a sprite into a Sprite2D node

Inputs: projectPath (required), scenePath (required), nodePath (required), texturePath (required).

run_projectC

Run the Godot project and capture output

Inputs: projectPath (required), scene.

save_sceneC

Save changes to a scene file

Inputs: projectPath (required), scenePath (required), newPath.

stop_projectA

Stop the currently running Godot project

Inputs: no named parameters.

update_project_uidsB

Update UID references in a Godot project by resaving resources (for Godot 4.4+)

Inputs: projectPath (required).

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    B3.4/5.0

    Scored across 14 tools

    Disambiguation4/5

    Most tools have distinct purposes targeting different aspects of Godot project management, scene manipulation, and debugging. However, there is some potential overlap between 'create_scene' and 'add_node' as both involve scene creation/modification, and 'get_debug_output' and 'run_project' both relate to runtime output, though their specific focuses differ enough to avoid major confusion.

    Naming Consistency4/5

    The naming follows a consistent verb_noun pattern throughout (e.g., 'add_node', 'create_scene', 'get_debug_output'), which is clear and predictable. There are minor deviations like 'export_mesh_library' using a compound noun and 'update_project_uids' being slightly longer, but overall the convention is well-maintained and readable.

    Tool Count5/5

    With 14 tools, the count is well-scoped for a Godot MCP server, covering project management, scene editing, debugging, and runtime operations. Each tool appears to earn its place by addressing specific needs in the Godot development workflow, without being overly sparse or bloated.

    Completeness4/5

    The tool set provides comprehensive coverage for core Godot operations, including project listing, scene CRUD, debugging, and runtime management. Minor gaps exist, such as the lack of tools for editing node properties directly or handling more advanced resource types, but agents can likely work around these with the available tools for most common tasks.

    Maintenance

    ActivityNo data
    ResponsivenessSyncing

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      C
      maintenance
      An MCP server that gives AI assistants direct control over Godot 4 game development projects. It enables launching the editor, running projects, creating and editing scenes, writing GDScript, and inspecting assets through natural language commands.
      44
      4
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      An MCP server that enables AI assistants to directly run, inspect, modify, and debug Godot game development projects through 110+ tools covering scenes, scripts, resources, runtime debugging, and asset management.
      33
      3
      MIT
    • A
      license
      B
      quality
      D
      maintenance
      An enhanced MCP server for interacting with the Godot game engine, enabling AI assistants to launch the editor, run projects, manage scenes and nodes, and handle scripts.
      16
      MIT
    • A
      license
      A
      quality
      C
      maintenance
      An MCP server that lets AI coding agents work on Godot 4 projects, including reading and editing scenes, writing and validating GDScript, running the game, and capturing screenshots.
      25
      18 npm
      MIT