CoplayDev/unity-mcp · error · RuntimeError

Source MCPForUnity folder not found: {source_mcp}

Error message

Source MCPForUnity folder not found: {source_mcp}

What it means

Raised when repo_root / 'MCPForUnity' is not a directory. The script copies this folder as the source for Asset Store packaging, so its absence is fatal. repo_root defaults to the script's parent-of-parent but can be overridden with --repo-root.

Source

Thrown at tools/prepare_unity_asset_store_release.py:110

        help="Backup existing Assets/MCPForUnity before replacing.",
    )
    parser.add_argument(
        "--dry-run",
        action="store_true",
        help="Only validate that operations would succeed; do not write/copy/delete.",
    )
    args = parser.parse_args()

    repo_root = Path(args.repo_root).expanduser().resolve()
    asset_project = Path(args.asset_project).expanduser().resolve(
    ) if args.asset_project else (repo_root / "TestProjects" / "AssetStoreUploads")
    remote_url = args.remote_url.strip()
    if not remote_url:
        raise RuntimeError("--remote-url must be a non-empty URL")

    source_mcp = repo_root / "MCPForUnity"
    if not source_mcp.is_dir():
        raise RuntimeError(
            f"Source MCPForUnity folder not found: {source_mcp}")

    assets_dir = asset_project / "Assets"
    if not assets_dir.is_dir():
        raise RuntimeError(f"Assets folder not found: {assets_dir}")

    dest_mcp = assets_dir / "MCPForUnity"

    if args.dry_run:
        print("[dry-run] Validated paths. No changes applied.")
        print("[dry-run] Would stage a temporary copy of MCPForUnity and apply Asset Store edits there.")
        print(
            f"[dry-run] Would replace:\n- {dest_mcp}\n  with\n- {source_mcp}")
        return 0

    # 1) Stage a temporary copy of MCPForUnity and apply Asset Store-specific edits there.
    with tempfile.TemporaryDirectory(prefix="mcpforunity_assetstore_") as tmpdir:
        staged_mcp = Path(tmpdir) / "MCPForUnity"

View on GitHub (pinned to c21bf496bc)

Solutions

  1. Verify the MCPForUnity directory exists: ls <repo_root>/MCPForUnity.
  2. Pass --repo-root explicitly pointing at the actual repo root containing MCPForUnity/.
  3. If the directory was renamed, update the constant or the --repo-root argument to match.

Example fix

# before
python tools/prepare_unity_asset_store_release.py --repo-root /wrong/path --remote-url https://...

# after
python tools/prepare_unity_asset_store_release.py --repo-root /path/to/unity-mcp --remote-url https://...
Defensive patterns

Strategy: validation

Validate before calling

from pathlib import Path

repo_root = Path(".").resolve()
source_mcp = repo_root / "MCPForUnity"
if not source_mcp.is_dir():
    raise SystemExit(f"MCPForUnity not found at {source_mcp}. Check --repo-root.")

Prevention

When it happens

Trigger: Running the script with --repo-root pointing at the wrong location; running from a shallow/partial clone that lacks the MCPForUnity directory; the directory was renamed or relocated in a repo restructure.

Common situations: Wrong working directory; the script was copied outside the repo tree so REPO_ROOT_DEFAULT resolves incorrectly; a fresh checkout that didn't fetch submodules or LFS-tracked content (though MCPForUnity is a plain directory, not a submodule).

Related errors


AI-assisted analysis of CoplayDev/unity-mcp@c21bf496bc (2026-08-13). Data as JSON: /api/errors/0c55e4b494782aa7. Report an issue: GitHub.