godot-mcp

godot-mcp

A safe, standards-compliant Model Context Protocol server for the Godot Engine editor. It lets an AI client read a Godot project, author scenes/nodes/scripts, run the game and read diagnostics.

Category
访问服务器

README

Godot MCP

A safe, standards-compliant Model Context Protocol server for the Godot Engine editor. It lets an AI client (Claude, etc.) read a Godot project, author scenes/nodes/scripts, run the game and read diagnostics — through a transactional, permission-controlled kernel that maps every operation onto real Godot editor APIs (EditorInterface, EditorFileSystem, EditorUndoRedoManager, ProjectSettings, ResourceLoader/Saver).

This project is a Godot reimplementation of the cocos-mcp design: the same layered architecture (contracts → core/execution kernel → adapter → editor), the same safety model (typed I/O schemas, dry-run, optimistic revision, permission tiers, audit), adapted to Godot's object model.

MCP client (Claude …)
   │  stdio (JSON-RPC)
@godot-mcp/mcp-server  ── ExecutionKernel ── ToolRegistry ── Policy
   │  newline-delimited JSON-RPC over TCP (127.0.0.1:6040)
addons/godot_mcp (GDScript EditorPlugin)
   └─ EditorInterface / EditorFileSystem / EditorUndoRedoManager

Why this shape

  • Faithful to the editor. Every tool resolves to a real Godot API in the addon. No hand-editing of .tscn/.import/.godot internals.
  • Godot's addressing, not Cocos's. Nodes are addressed by NodePath (scene-relative, e.g. /Player/Sprite); resources/scripts/scenes by res:// paths. There are no UUIDs to keep in sync.
  • Safe by default. read/write on, destructive/build off. Writes are serial, undoable, dry-run-able, revision-checked and audited.
  • Stable, machine-readable results. Tools never return ad-hoc { success: false }; failures carry a stable error.code.

Repository layout

packages/
  contracts/       Zod schemas, domain types, the GodotAdapter contract
  core/            ToolRegistry, ExecutionKernel, PolicyEngine, operations, audit, tools
  godot-adapter/   TCP JSON-RPC bridge + GodotAdapter implementation
  testkit/         In-memory Godot adapter for tests
apps/
  mcp-server/      Standalone stdio MCP server CLI
  godot-editor-addon/  GDScript EditorPlugin (addons/godot_mcp)
docs/              ARCHITECTURE, GODOT_INTEGRATION, TOOL_SPECIFICATION

Quickstart

1. Build the server

pnpm install
pnpm build          # -> dist/mcp-server/index.js
pnpm test           # unit/integration tests

Requires Node.js ≥ 20.19.

2. Install the editor addon

Copy apps/godot-editor-addon/addons/godot_mcp into your Godot 4 project:

<your-project>/addons/godot_mcp/   (plugin.cfg, plugin.gd, bridge.gd, rpc_handler.gd)

In Godot: Project → Project Settings → Plugins → enable "Godot MCP". On enable the plugin starts a TCP bridge on 127.0.0.1:6040 (printed to the editor output). Restart it any time via Godot MCP: Restart server in the tool menu.

Targets Godot 4.2+ (tested profile: 4.3). The addon only uses public, stable editor APIs.

3. Connect your AI client

Add the server to your MCP client config. For Claude Code / Claude Desktop:

{
  "mcpServers": {
    "godot-mcp": {
      "command": "node",
      "args": ["<repo>/dist/mcp-server/index.js"],
      // optional:
      // "env": { "GODOT_MCP_ADDON_URL": "tcp://127.0.0.1:6040" }   // default
    },
  },
}

CLI flags: --addon-url tcp://host:port, --profile readonly|standard|trusted.

4. Use it

Ask the model: "What's in the current scene?" → it calls system_status, then node_query/node_get. "Add a Player node with a Sprite2D child and a script" → it dry-runs scene_build, then applies it. "Run the game and tell me if there are errors"run_start (needs the trusted profile), then logs_query.

Tools (25)

Domain Tools
System / project system_status, project_get
Scene scene_list, scene_get, scene_open, scene_save, scene_create, scene_build
Node / property node_query, node_get, node_create, node_update, node_reparent, node_duplicate, node_delete, property_set
Script script_read, script_write
Asset asset_query
Selection selection_get, selection_set
Run run_status, run_start, run_stop
Logs logs_query

Read tools are read tier. Writes are write tier and support dryRun, expectedRevision and idempotencyKey. node_delete is destructive; run_start/run_stop are build (both off by default).

Full per-tool schemas and semantics: docs/TOOL_SPECIFICATION.md.

Permission profiles

Profile Grants Notes
readonly read only Safe to share
standard (default) read + write Author scenes/scripts
trusted read + write + destructive + build Run game, delete nodes

deny always wins; confirm returns CONFIRMATION_REQUIRED. Permissions are server-enforced on every call, independent of what the client advertised.

Development

pnpm typecheck     # tsc --noEmit across the workspace
pnpm test          # vitest
pnpm lint          # eslint
pnpm format        # prettier
pnpm verify        # format:check + lint + typecheck + test + build

Status & limitations (v1)

  • Godot 4.2+ only. Godot 3 is not supported.
  • Loopback only. The bridge binds 127.0.0.1; do not expose it.
  • Logs are the editor-side buffer. v1 does not capture the running game's stdout; logs_query returns the addon's own ring buffer. Use the editor Output panel for full runtime logs.
  • Cross-call undo. Each write RPC records its own EditorUndoRedoManager action, so Ctrl+Z works in the editor. A write that fails mid-flight is reported failed_dirty — undo it manually rather than retried blindly.
  • No arbitrary code execution. There is no eval/execute-script tool. script_write writes .gd files under res:// only.

License

MIT.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选