"""Create this new lab's portable MCP configuration with absolute paths."""
import json
from pathlib import Path
import sys

directory = Path(__file__).resolve().parent
configuration = directory / ".mcp.json"
if configuration.exists():
    raise SystemExit(".mcp.json already exists; keep it and review it manually")
server = directory / "label_server.py"
if not server.is_file():
    raise SystemExit("Save label_server.py beside configure_client.py")
configuration.write_text(json.dumps({
    "mcpServers": {
        "label-lab": {
            "type": "stdio",
            "command": sys.executable,
            "args": ["-u", str(server)],
        }
    }
}, ensure_ascii=False, indent=2) + "\n", encoding="utf-8")
print("Created", configuration)
