MCP for Unity 的 uv 配置与故障排查

MCP for Unity open-source implementation guides 2026-11-05T21:36:13.078289

解决的问题与适用场景

如果 uv 未安装或不在 PATH 中,Cursor、Windsurf、VS Code 无法启动服务器。

工具、版本与前置条件

操作步骤与工作流衔接

1. 运行 python3 --version 和 uv --version 验证版本

2. macOS 上可用 brew install python@3.12 安装 Python

3. macOS、Linux、WSL 上可用 curl -LsSf https://astral.sh/uv/install.sh | sh 安装 uv,或用 brew install uv

4. Windows PowerShell 上可用 powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex" 安装 uv,或用 winget install --id=astral-sh.uv -e

5. 在 MCP 客户端配置中把 command 设为 uvx,参数使用 --from mcpforunityserver mcp-for-unity --transport stdio

6. 若未找到 uv,使用 "Choose UV Install Location" 定位 uv 二进制并保存路径

7. 点击 "Repair Python Env" 会删除服务器的 .venv 和 .python-version(若存在),并在 Unity MCP Server 的 src 目录运行 uv sync 重建干净环境

8. 手动修复或运行时,进入 UnityMcpServer/src 目录执行 uv sync 和 uv run server.py

原作者的结果与限制

原文与来源

本文为基于原文整理的中文导读,效果与结论归属于原作者。

查看原文