hi3d-studio-mcp
# hi3d-studio-mcp
[](https://github.com/BipoXDXD/hi3d-studio-mcp/actions/workflows/ci.yml)
[](https://www.python.org/downloads/)
[](LICENSE)
A local, subscription-only **Model Context Protocol (MCP)** stdio server for **Hi3D** (`hi3d.ai`) paired with a **headless Blender (4.2+/5.x)** 3D-modeling, rigging, rendering, and 3D-printing maker studio — exposing **60 tools** compatible with **Claude Code**, **OpenAI Codex**, **Antigravity**, **Claude Desktop**, **Cursor**, and any standard MCP stdio client.
> **Community Disclaimer:** This is an independent, unofficial open-source project and is **not** affiliated with, endorsed by, or maintained by Hi3D or Blender Foundation. All Hi3D cloud operations use only your own official `hi3d.ai` website subscription session or official OAuth 2.1 flow to `https://agent.hi3d.ai/mcp`.
---
## Key Highlights
- **Strict Subscription-Only Billing Guard (Zero Paid Open API):** Strips `HI3D_CLIENT_ID`, `HI3D_CLIENT_SECRET`, `HI3D_BASE_URL`, `HI3D_AK`, and `HI3D_SK` from every subprocess environment and blocks any `mode != "web"` CLI profile so cloud calls never spend separate paid Open API credits.
- **Dual Subscription Cloud Bridge (20 tools):**
- **Official OAuth 2.1 (`https://agent.hi3d.ai/mcp`):** PKCE S256 + RFC 7591 Dynamic Client Registration + token auto-refresh, stored in **macOS Keychain** or an atomic `0600` file (`~/.config/hi3d-studio-mcp/oauth.json`) on Linux/Windows.
- **Web Session Bridge (`@hi3d/hi3d-cli --mode web`):** 3D generation (single & multi-view with sparse-slot protection and v3.0 resolution guard), task polling, downloads, and live balance.
- **Zero-Credit Local Makers (8 tools):** Relief meshes (luminance or local **Depth Anything V2 Small ONNX**), planar/angled model splitting with real boolean connectors (`pin`, `dovetail`, `ball`, `magnet` + `clearance_mm`), k-means++ multicolor AMS `.3mf` export, Quad/Voxel retopology, binary **Tajima `.dst`** embroidery digitizing, universal mesh conversion, and cross-OS slicer handoff.
- **Persistent Headless Blender Studio (32 tools):** Hot `.blend` session across calls, Cycles GPU/CPU preview & contact-sheet renders (multimodal PNGs returned directly to your MCP client), 360° MP4/GIF turntables, 3D-printing audits, hollowing with surface-snapped drain holes, auto-rigging (21-bone Humanoid or Rigify IK/FK) + posing, UV baking, LOD chains, and named undo checkpoints.
- **Minimal Footprint:** Pure Python 3.11+ stdlib MCP JSON-RPC 2.0 server with a single runtime dependency (`Pillow`).
---
## Quick Installation
### Option 1: Run directly with `uvx` (recommended, zero manual venv setup)
```bash
uvx --from git+https://github.com/BipoXDXD/hi3d-studio-mcp.git hi3d-studio-mcp --version
```
### Option 2: Install globally or into an existing environment with `pip`
```bash
pip install "git+https://github.com/BipoXDXD/hi3d-studio-mcp.git"
hi3d-studio-mcp --version
```
### Option 3: Clone and install in a local `.venv`
```bash
git clone https://github.com/BipoXDXD/hi3d-studio-mcp.git
cd hi3d-studio-mcp
python3 -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install -e .
hi3d-studio-mcp --list-tools
```
---
## MCP Client Configuration
### Claude Code
**CLI one-liner:**
```bash
claude mcp add hi3d-studio -- uvx --from git+https://github.com/BipoXDXD/hi3d-studio-mcp.git hi3d-studio-mcp
```
**Project-level `.mcp.json`** (or user-level **`~/.claude.json`** under `"mcpServers"`):
```json
{
"mcpServers": {
"hi3d-studio": {
"command": "uvx",
"args": [
"--from",
"git+https://github.com/BipoXDXD/hi3d-studio-mcp.git",
"hi3d-studio-mcp"
]
}
}
}
```
### OpenAI Codex
**CLI one-liner:**
```bash
codex mcp add hi3d-studio -- uvx --from git+https://github.com/BipoXDXD/hi3d-studio-mcp.git hi3d-studio-mcp
```
**`~/.codex/config.toml`:**
```toml
[mcp_servers.hi3d-studio]
command = "uvx"
args = [
"--from",
"git+https://github.com/BipoXDXD/hi3d-studio-mcp.git",
"hi3d-studio-mcp"
]
```
### Antigravity / Claude Desktop / Cursor (generic stdio MCP JSON)
```json
{
"mcpServers": {
"hi3d-studio": {
"command": "uvx",
"args": [
"--from",
"git+https://github.com/BipoXDXD/hi3d-studio-mcp.git",
"hi3d-studio-mcp",
"--workspace",
"/path/to/your/3d-workspace"
]
}
}
}
```
*(If you installed via `pip` or `.venv`, replace `"command": "uvx"` and `"args"` with `"command": "hi3d-studio-mcp"` or `"/path/to/.venv/bin/hi3d-studio-mcp"`.)*
---
## Optional Prerequisites by Module
The server starts and serves all schemas with only Python 3.11+ and `Pillow`. Install optional runtimes only for the modules you use:
| Module | Requirement | Notes |
| --- | --- | --- |
| **OAuth 2.1 Cloud Bridge** (`generate_image`, `text_to_3d`, quotes, task history) | Hi3D website account + browser | Run `oauth_login` once. Tokens are stored in macOS Keychain or `~/.config/hi3d-studio-mcp/oauth.json` (`0600`). |
| **Web Session Bridge** (`who_am_i`, `balance`, `image_to_3d`, `query_task`, `download_asset`) | Node.js >= 18 + `@hi3d/hi3d-cli` | Install with `npm i -g @hi3d/hi3d-cli` (or set `HI3D_CLI_MJS`), then run `auth_login_web` or `hi3d-cli login --mode web`. |
| **Headless Blender Studio & Local 3D Makers** | Blender 4.2+ / 5.x | Auto-detected from `HI3D_BLENDER`, `PATH`, or standard install paths. Uses Metal/CUDA/CPU Cycles automatically. |
| **Neural Depth Relief** (`image_to_relief(depth_mode="neural")`) | `uv` | `depth_setup` creates an isolated venv (`~/.local/share/hi3d-studio-mcp/depth-venv`) and caches Depth Anything V2 Small ONNX (~99 MB). |
| **360° Turntable Video/GIF** (`blender_render_turntable`) | `ffmpeg` | Must be on `PATH` to encode rendered frames into MP4 or GIF. |
| **Slicer Handoff** (`send_to_slicer`) | Local 3D slicer app | Detects Bambu Studio, OrcaSlicer, PrusaSlicer, Creality Print, ElegooSlicer, Snapmaker, and UltiMaker Cura on macOS, Linux, and Windows. |
---
## Tool Catalog (60 Tools)
### 1. Hi3D Subscription Cloud Tools (20 tools)
| Tool | Purpose |
| --- | --- |
| `who_am_i` | Verify web-session mode (`open_api_blocked: true`), balance, OAuth status, and Blender readiness. |
| `balance` | Query live Hi3D website subscription point balance (0 credits spent). |
| `auth_login_web` | Run browser PKCE login for `hi3d.ai` web subscription mode. |
| `oauth_status` | Inspect OAuth 2.1 connection status to `https://agent.hi3d.ai/mcp`. |
| `oauth_login` | Authorize OAuth 2.1 PKCE bridge in browser and save tokens securely. |
| `oauth_logout` | Remove stored OAuth 2.1 tokens. |
| `get_capabilities` | Query live models, versions, and capabilities from `agent.hi3d.ai/mcp`. |
| `quote_generation` | Free exact server-side credit quote for 3D generation (auto-uploads local images). |
| `create_generation` | Submit a quoted 3D generation (`confirmed=true` required). |
| `quote_image_generation` | Free exact credit quote for 2D text-to-image, edit, or multi-view generation. |
| `generate_image` | Generate 2D concept art or 4-view sheets, auto-save PNGs, and return inline previews. |
| `edit_image` | Edit a local image or historical Hi3D task image on your subscription. |
| `list_tasks` | List recent subscription MCP tasks for recovery and reuse. |
| `oauth_get_task` | Inspect or poll an OAuth 2D/3D task, optionally downloading and auto-loading into Blender. |
| `get_task_outputs` | Refresh output links for an OAuth task, optionally downloading and loading into Blender. |
| `image_to_3d` | Generate 3D models from 1–4 images on subscription (`hi3dv3.0`, `hitem3dv2.1`, etc.) with `auto_load`. |
| `retexture_model` | Guarded AI retexture entrypoint (blocks known upstream `@hi3d/hi3d-cli` v2.1.2 billing bug). |
| `query_task` | Check or poll a web-session task and optionally download + load into Blender. |
| `download_asset` | Download a finished task or validated public HTTPS URL with optional `auto_load`. |
| `text_to_3d` | One-step pipeline: 2D/4-view concept -> poll -> quote -> 3D v3.0 (`confirmed=true` required). |
### 2. Zero-Credit Local Makers (8 tools)
| Tool | Purpose |
| --- | --- |
| `depth_setup` | Install or verify the isolated local Depth Anything V2 Small ONNX environment. |
| `image_to_relief` | Build watertight 3D relief meshes (`luminance` or `neural` depth) and export `stl`/`glb`/`3mf`/`obj`/`png`/`exr`. |
| `split_model` | Planar/angled split with real boolean joints (`pin`/`dovetail`/`ball`/`magnet` + `clearance_mm`), `preview_only`, `loose`, and `material` modes. |
| `multicolor_model` | Perceptual k-means++ color quantization (1–8 colors or `palette_hex`) + AMS-ready `.3mf` (`by_material` or `single`). |
| `retopology` | Local Quad (Quadriflow with auto manifold prep) or Voxel retopology (20k–200k faces) + optional texture rebake. |
| `image_to_embroidery` | Convert an image into a binary Tajima `.dst` embroidery stitch file + PNG preview. |
| `convert_mesh` | Convert across `glb`, `gltf`, `obj`, `stl`, `fbx`, `usdz`, `ply`, `3mf`, and `blend` with optional repair/scale. |
| `send_to_slicer` | Detect installed slicers (`list_only=true`) or export and open `.3mf`/`.stl` directly in your local slicer. |
### 3. Headless Blender Studio (32 tools)
| Category | Tools |
| --- | --- |
| **Lifecycle & Session** | `blender_status`, `blender_doctor`, `blender_load`, `blender_inspect`, `blender_session`, `blender_checkpoint`, `blender_run_script` |
| **Rendering & Media** | `blender_render_preview`, `blender_render_contact_sheet`, `blender_render_turntable` |
| **Export & Print Prep** | `blender_export`, `blender_export_3mf`, `blender_print_audit`, `blender_maker_preset`, `blender_hollow`, `blender_add_base`, `blender_lay_flat` |
| **Transform & Topology** | `blender_scale_to_size`, `blender_center`, `blender_transform`, `blender_decimate`, `blender_repair`, `blender_split_loose`, `blender_join`, `blender_delete_objects`, `blender_apply_modifiers`, `blender_boolean`, `blender_sculpt_smooth` |
| **Game & Character** | `blender_uv_bake`, `blender_lod_chain`, `blender_auto_rig`, `blender_pose_rig` |
---
## CLI Flags & Environment Variables
### CLI Flags
| Flag | Description |
| --- | --- |
| `--workspace PATH` | Working directory for `.hi3d/` session state, checkpoints, renders, and default `hi3d-out/` exports. |
| `--confine-workspace` | Restrict all local file reads and writes strictly inside `--workspace`. |
| `--no-scripts` | Disable arbitrary Python execution in `blender_run_script`. |
| `--list-tools` | Print the full 60-tool JSON catalog to stdout and exit. |
| `--version` | Print the package version and exit. |
### Environment Variables
| Variable | Description |
| --- | --- |
| `HI3D_STUDIO_WORKSPACE` / `HI3D_WORKSPACE` | Default workspace path when `--workspace` is omitted. |
| `HI3D_OUT_DIR` | Override default output directory (defaults to `<workspace>/hi3d-out`). |
| `HI3D_BLENDER` | Pin Blender executable (`app:/path/to/blender`, `python:/path/to/python`, or direct path). |
| `HI3D_BLENDER_HOME` | Directory to search for managed `bpy` virtualenvs (default `~/.hi3d/blender`). |
| `HI3D_WEB_PROFILE` | Specific `@hi3d/hi3d-cli` web profile name to use. |
| `HI3D_NODE_BIN` | Explicit path to Node.js binary (>= 18). |
| `HI3D_CLI_MJS` | Explicit path to `@hi3d/hi3d-cli/bin/hi3d-cli.mjs`. |
| `HI3D_DEPTH_VENV` | Override isolated Depth Anything V2 virtualenv directory (default `~/.local/share/hi3d-studio-mcp/depth-venv`). |
---
## Billing & Security Guarantees
- **Zero Paid Open API Usage:** Open Platform environment variables (`HI3D_CLIENT_ID`, `HI3D_CLIENT_SECRET`, `HI3D_BASE_URL`, `HI3D_AK`, `HI3D_SK`) are stripped before every CLI invocation; profiles with `mode != "web"` are rejected.
- **Explicit Spend Confirmation:** `create_generation` and `text_to_3d` require `confirmed=true`.
- **SSRF & Download Hardening:** All HTTPS fetches (`oauth_bridge.py`, `download_https_file`, `download_asset`) enforce `https://` on port 443, reject embedded userinfo (`user:pass@`), resolve DNS to verify every target IP is strictly global/public (blocking loopback, RFC1918 private, link-local/metadata `169.254.169.254`, multicast, reserved, and IPv4-mapped non-public addresses), validate up to 3 redirect hops, enforce a streaming byte cap, and write atomically via `os.replace`.
- **Path-Traversal Protection:** Output filename prefixes and `name` parameters are sanitized with `safe_filename_stem` before constructing paths in `out_dir`; `--confine-workspace` enforces strict workspace boundaries.
- **Credential Hygiene:** OAuth tokens are stored in **macOS Keychain** (`hi3d-studio-mcp-oauth`) on macOS and `~/.config/hi3d-studio-mcp/oauth.json` (mode `0600`, atomic write) on Linux/Windows — never inside your workspace or repository.
---
## Development & Testing
```bash
# Run the full offline unit test suite (0 skips, warnings as errors)
PYTHONPATH=src python3 -W error -m unittest discover -s tests -v
# Verify CLI tool catalog
PYTHONPATH=src python3 -m hi3d_studio_mcp --list-tools
# Run optional local end-to-end Blender integration tests (requires Blender installed)
PYTHONPATH=src python3 -m unittest tests/integration_blender_e2e.py -v
```
---
## License
MIT License — see [LICENSE](LICENSE).
TDQS
Scored across 60 tools
Multiple clusters of overlapping tools create real misselection risk: export is served by both blender_export and blender_export_3mf, task polling by oauth_get_task, query_task, get_task_outputs and list_tasks, quoting by quote_generation and quote_image_generation, and auth by oauth_login, auth_login_web, oauth_status, oauth_logout and who_am_i. The blender_* prefix helps scope local geometry ops, but generation/pipeline tools (image_to_3d, text_to_3d, create_generation, download_asset) and relief/split/retopo utilities have blurry boundaries that only careful reading resolves.
The dominant pattern is snake_case verb_noun with a blender_ namespace, which is readable and largely consistent. However, prefixing is uneven (split_model, retopology, convert_mesh, multicolor_model, send_to_slicer have no blender_ prefix despite operating on Blender scenes), and a few names are noun-only or bare (balance, who_am_i, retopology), breaking the verb_noun convention.
60 tools is far past a manageable surface for an agent to choose from reliably, and the description lengths suggest many niche one-off operations. The domain is genuinely broad (auth, 2D/3D generation, Blender mesh ops, printing, rigging, slicing), but the count still forces the agent to wade through near-duplicates rather than a tight, curated set.
Coverage is unusually thorough for the stated purpose: auth/session, quoting, 2D and 3D generation, download, mesh repair/boolean/LOD/UV/retopo/rig/pose, print audit, multi-color 3MF, rendering, and slicer handoff are all present. Gaps are minor, mostly at the edges (e.g. no explicit material/texture assignment tool independent of bake, and task cancellation is absent).