Godot引擎与AI助手之间的一整套综合解决方案,采用模型上下文协议(MCP)实现。此插件允许AI助手与您的Godot项目进行交互,提供强大的代码辅助、场景操作和项目管理功能。
Godot兼容性工具:
detect_godot_version - 测试项目的Godot版本check_godot_api_compatibility - 检查API兼容性问题fix_godot_api_compatibility - 自动修复兼容性问题get_godot_migration_advice - 获取版本迁移建议标准开发工具:
增强开发工具:
Godot MCP基于Godot 4.x引擎构建,是我们技术基础和AI自动化开发平台。
godot-mcp通过MCP协议无缝集成AI能力与Godot引擎:
🎉 专为新手用户 执行
./setup-mcp-tools.sh(Linux/macOS) 或setup-mcp-tools.bat(Windows) 一键配置所有AI技能!
📖 详细指南 查看快速AI技能配置指南或5分钟快速入门指南
Linux/macOS用户:
git clone https://github.com/hhhh124hhhh/godot-mcp.git
cd godot-mcp
./setup-mcp-tools.sh
Windows用户:
git clone https://github.com/hhhh124hhhh/godot-mcp.git
cd godot-mcp
setup-m
脚本将自动:
git clone https://github.com/hhhh124hhhh/godot-mcp.git
cd godot-mcp
系统要求 Godot 4.2+(推荐版本4.3或更高)
# macOS(使用Homebrew)
brew install --cask godot
# Windows(使用Chocolatey)
choco install godot
# Ubuntu/Debian
sudo apt update
sudo apt install godot4
提示:也可以从Godot官方网站或Steam商店下载
godot --version
# 应显示: 4.x.stable.official [hash]
cd server
npm install
npm run build
# 返回项目根目录
cd ..
编辑Claude Desktop配置文件:
# macOS
nano ~/Library/Application\ Support/Claude/claude_desktop_config.json
# Linux
nano ~/.config/claude/claude_desktop_config.json
# Windows
# 使用VS Code或其他编辑器编辑
# %APPDATA%\Claude\claude_desktop_config.json
添加以下配置:
{
"mcpServers": {
"godot-mcp": {
"command": "node",
"args": [
"PATH_TO_YOUR_PROJECT/server/dist/index.js"
],
"env": {
"MCP_TRANSPORT": "stdio"
}
}
}
}
注意:将
PATH_TO_YOUR_PROJECT替换为仓库的绝对路径。
重启Claude Desktop
🎉 特别为新手用户设计 我们提供了一键配置脚本,自动设置所有四个核心AI技能所需的MCP工具。
运行自动配置脚本:
# 进入项目目录
cd godot-mcp
# 运行一键配置脚本
./setup-mcp-tools.sh
脚本将自动完成:
如果需要手动配置,请按照以下步骤操作:
步骤1:安装MCP工具
# Chrome DevTools MCP(网页调试)
npm install -g chrome-devtools-mcp
# 顺序思维MCP(逻辑推理)
npm install -g sequential-thinking-mcp
# Context7 MCP(文档研究)
npm install -g context7-mcp-server
步骤2:配置Claude Desktop 编辑配置文件并添加以下MCP服务器:
{
"mcpServers": {
"godot-mcp": {
"command": "node",
"args": ["YOUR_PROJECT_PATH/server/dist/index.js"],
"env": {
"MCP_TRANSPORT": "stdio"
}
},
"chrome-devtools": {
"command": "npx",
"args": ["chrome-devtools-mcp@latest"]
},
"sequential-thinking": {
"command": "npx",
"args": ["sequential-thinking-mcp"]
},
"context7": {
"command": "npx",
"args": ["context7-mcp-server"]
}
}
}
配置完成后,您将获得以下四种强大的AI技能:
用户: "如何实现 Godot 4.x 彩色粒子效果"
→ AI 自动查询官方文档,返回完整实现方案
用户: "遇到错误:Invalid assignment of property 'emission_amount'"
→ AI 自动识别问题并提供修复方案
用户: "创建一个完整的游戏主菜单系统"
→ AI 自动协调 UI设计、脚本编写、测试验证等步骤
用户: "如何配置中文开发环境"
→ AI 提供完整的中文化配置方案
测试AI技能:
"如何实现一个简单的 Godot 粒子效果"context7-auto-research技能技能状态检查:
# 检查技能文件是否存在
ls -la .claude/skills/
# 验证MCP工具连接
claude mcp list
# 运行完整验证脚本
./verify-mcp-setup.sh
examples/bubble-game-demo/文件夹现在您可以:
用户: "如何实现 Godot 4.x 的彩色爆炸粒子效果"
→ 自动触发 context7-auto-research 技能
→ 调用 Context7 MCP 查询相关文档
→ 返回完整的实现方案
用户: "遇到 Godot 兼容性错误:Invalid assignment of property 'emission_amount'"
→ 自动触发 godot-compatibility-checker 技能
→ 调用 Godot MCP 检测和修复问题
→ 返回修复后的代码
用户: "检查我的 Godot 项目版本兼容性"
→ 自动调用 detect_godot_version 工具
→ 返回版本信息和兼容性建议
用户: "修复这些 Godot 3.x 到 4.x 的兼容性问题"
→ 自动调用 fix_godot_api_compatibility 工具
→ 返回修复后的代码和迁移说明
功能 检查项目使用的Godot版本和配置信息 使用场景:
功能 检查GDScript代码中的API兼容性问题 参数:
code 要检查的GDScript代码targetVersion 目标版本('3.x', '4.x', 'auto')projectPath 项目路径(可选)功能 自动修复GDScript代码中的API兼容性问题 支持的修复:
interpolate_property() → tween_property()get_color_at_offset() → get_color(index)ParticlesMaterial → ParticleProcessMaterial功能 获取Godot版本迁移建议和最佳实践 输出 详细的迁移指南和代码示例
get-scene-tree - 返回场景树结构get-node-properties - 获取特定节点的属性create-node - 创建新节点delete-node - 删除节点modify-node - 更新节点属性list-project-scripts - 列出项目中的所有脚本read-script - 读取特定脚本modify-script - 更新脚本内容create-script - 创建新脚本analyze-script - 提供脚本分析list-project-scenes - 列出项目中的所有场景read-scene - 读取场景结构create-scene - 创建新场景save-scene - 保存当前场景get-project-settings - 获取项目设置list-project-resources - 列出项目资源get-project-info - 获取项目元数据godot://script/current - 当前打开的脚本godot://scene/current - 当前打开的场景godot://project/info - 项目元数据和设置godot://scripts/list - 脚本列表godot://scenes/list - 场景列表godot://resources/list - 资源列表如果您想在Godot项目中使用MCP插件:
addons/godot_mcp翻译成英文的文件夹复制到您的项目的addons目录.claude/skills/目录是否有技能文件detect_godot_version工具检查项目版本