CoplayDev/unity-mcp · error · RuntimeError

MCPB file was not created: {output_path}

Error message

MCPB file was not created: {output_path}

What it means

Raised by generate_mcpb after the @modelcontextprotocol/create-server pack step completes but the expected output_path file is not present. It means the npx pack invocation did not fail outright yet produced no bundle (or wrote it elsewhere).

Source

Thrown at tools/generate_mcpb.py:103

                ["npx", "@anthropic-ai/mcpb", "pack", ".", str(output_path.absolute())],
                cwd=build_dir,
                capture_output=True,
                text=True,
                check=True,
            )
            print(result.stdout)
        except subprocess.CalledProcessError as e:
            print(f"MCPB pack failed:\n{e.stderr}", file=sys.stderr)
            raise
        except FileNotFoundError:
            print(
                "Error: npx not found. Please install Node.js and npm.",
                file=sys.stderr,
            )
            raise

    if not output_path.exists():
        raise RuntimeError(f"MCPB file was not created: {output_path}")

    print(f"Generated: {output_path} ({output_path.stat().st_size:,} bytes)")
    return output_path


def main() -> int:
    parser = argparse.ArgumentParser(
        description="Generate MCPB bundle for Unity MCP",
        formatter_class=argparse.RawDescriptionHelpFormatter,
        epilog=__doc__,
    )
    parser.add_argument(
        "version",
        help="Version string for the bundle (e.g., 9.0.8)",
    )
    parser.add_argument(
        "--output",
        "-o",

View on GitHub (pinned to c21bf496bc)

Solutions

  1. Inspect the pack stdout/stderr printed just before the raise for the real output location.
  2. Ensure manifest.json and the handler files are present in the temp build dir before pack runs.
  3. Update or pin the @modelcontextprotocol/create-server version and retry; verify npx/node are installed.

Example fix

# before
python tools/generate_mcpb.py 9.0.8  # pack produces nothing at expected path
# after (diagnose then pin tool version)
npx @modelcontextprotocol/create-server@latest --help
python tools/generate_mcpb.py 9.0.8 --output dist/unity-mcp-9.0.8.mcpb
Defensive patterns

Strategy: try-catch

Validate before calling

if not output_path.exists():
    raise SystemExit(f'pack produced no output at {output_path}; check build_dir contents')

Type guard

def bundle_produced(p: pathlib.Path) -> bool:
    return p.exists()

Try / catch

try:
    generate_mcpb(version, output_path, icon_path)
except RuntimeError as e:
    print(f'MCPB not created: {e}'); sys.exit(1)

Prevention

When it happens

Trigger: The subprocess.run of npx @modelcontextprotocol/create-server ... returns, but output_path.exists() is false at generate_mcpb.py:101-102. Pack wrote to a different filename, the temp build dir was empty, or output_path was redirected.

Common situations: npx version mismatch changed the output location; the build_dir lacked manifest.json/handlers so pack silently produced nothing; disk full or permissions stripped the file; wrong output_path passed.

Related errors


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