<a href="https://github.com/Arodoid/UnityMCP/pulls"><img src="https://img.shields.io/github/issues-pr/Arodoid/UnityMCP" alt="Pull Requests Badge"/></a>
<a href="https://github.com/Arodoid/UnityMCP/issues"><img src="https://img.shields.io/github/issues/Arodoid/UnityMCP" alt="Issues Badge"/></a>
<a href="https://github.com/Arodoid/UnityMCP/stargazers"><img src="https://img.shields.io/github/stars/Arodoid/UnityMCP" alt="Stars Badge"/></a> <a href="https://github.com/Arodoid/UnityMCP/network/members"><img src="https://img.shields.io/github/forks/Arodoid/UnityMCP" alt="Forks Badge"/></a>
UnityMCP 是一个强大的 Unity 编辑器插件,实现了模型上下文协议(MCP),使 Unity 和 AI 助手之间能够无缝集成。它提供了实时编辑器状态监控、远程命令执行以及全面的日志记录功能。
该项目由两个主要组件组成:
这是一个 Unity 编辑器插件,提供以下功能:
这是一个基于 TypeScript 的 MCP 服务器,通过标准化工具暴露 Unity 编辑器的功能:
get_editor_state
execute_editor_command
get_logs
要通过 Smithery 自动安装 UnityMCP 到 Claude Desktop:
npx -y @smithery/cli install @Arodoid/unitymcp --client claude
UnityMCPPlugin 文件夹复制到您的 Unity 项目的 Assets 目录cd unity-mcp-server
npm install
npm run build
cd unity-mcp-server
node build/index.js
// 将选中的对象居中
Selection.activeGameObject.transform.position = Vector3.zero;
// 切换播放模式
EditorApplication.isPlaying = !EditorApplication.isPlaying;
// 创建一个新的立方体
GameObject.CreatePrimitive(PrimitiveType.Cube);
cd unity-mcp-server
npm run build
npm run watch
npm run inspector
系统提供了全面的错误处理机制,包括:
git checkout -b feature/amazing-feature)git commit -m '添加了惊人的功能')git push origin feature/amazing-feature)此项目根据知识共享署名-非商业性使用 4.0 国际许可协议(CC BY-NC 4.0)授权。