tripo-studio-mcp
# tripo-studio-mcp
[](https://github.com/BipoXDXD/tripo-studio-mcp/actions/workflows/ci.yml)
[](https://www.python.org/downloads/)
[](pyproject.toml)
[](LICENSE)
A local, **zero-dependency (Python 3.11+ stdlib-only)** **Model Context Protocol (MCP)** stdio server for the **Tripo V3 OpenAPI**, exposing **28 tools** with strict spending guards, dry-run-by-default paid execution, SSRF-hardened downloads, and macOS Keychain support — ready for **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 VAST or Tripo. It communicates directly with the official Tripo V3 OpenAPI using your own API key.
---
## Architecture
```
src/tripo_studio_mcp/
├── __init__.py # Package version (1.0.0)
├── __main__.py # CLI (--version, --list-tools, --region, --output-dir) & stdio entrypoint
├── app.py # Dependency wiring (config, client, job store, tool registry, MCP server)
├── protocol.py # Spec-compliant MCP JSON-RPC 2.0 over stdio (NDJSON) + error redaction
├── config.py # Region URLs (ov/cn), TRIPO_BASE_URL validation, env & macOS Keychain auth
├── security.py # SSRF HTTPS+DNS validation, NoRedirectHandler, atomic downloads, redaction
├── pricing.py # Local Tripo V3 credit tables & dry-run / max_credits spending guards
├── validators.py # Strict wire-model aliases, face limits, multiview, 2D, mesh & rig rules
├── client.py # Stdlib HTTP client: Bearer auth, presigned PUT (no auth), read-only 429 retry
├── job_store.py # Atomic local JSON history (0600) with redacted payloads
└── tools.py # All 28 MCP tools (12 free + 16 paid dry-run-by-default)
```
---
## Security & Spending Guarantees
1. **Dry-Run by Default on All 16 Paid Tools (`approved_spend=false`):** Every paid tool validates all parameters locally and returns `{ dry_run: true, endpoint, payload, pricing, hint }` with **zero network calls and zero file uploads**.
2. **Explicit Credit Caps (`max_credits`):** Setting `approved_spend=true` on known-cost operations (`v3.1-20260211`, `P2-20260801`) requires a finite `max_credits >= estimated_credits`. Variable server-billed operations validate any supplied `max_credits > 0` and always require `approved_spend=true`.
3. **Zero Auto-Retry on Paid or Mutating Endpoints:** HTTP `429` rate-limit retries (respecting `Retry-After` and `X-RateLimit-Reset`) run **only** on idempotent read endpoints (`GET /v3/account/balance`, `GET /v3/account/usage`, `GET /v3/tasks/{task_id}`, `POST /v3/tasks/list`). Paid/mutating `POST`/`PUT` requests never auto-retry.
4. **No Auth Forwarding on Redirects or Presigned Uploads:** All authenticated OpenAPI requests use `NoRedirectHandler` (blocking any `3xx` response). Presigned model uploads (`POST /v3/files/presign` + `PUT`) validate the target URL and **never** send an `Authorization` header.
5. **SSRF-Hardened URLs & Atomic Downloads:** `validate_https_url` enforces `https://`, port `443` only, no userinfo (`@`), DNS resolution via `socket.getaddrinfo`, and blocks all non-global IPs (loopback, private, link-local, `169.254.169.254`, IPv4-mapped IPv6, multicast, reserved, unspecified). `download_https_file` validates every redirect hop (max 3), enforces `max_bytes`, writes atomically via `.tmp` + `os.replace`, and sanitizes filenames with `safe_filename_stem`.
6. **Secret Hygiene:** API keys are never accepted in tool arguments, never logged, and are redacted from errors and local job history. On macOS, `TRIPO_KEYCHAIN_ONLY=1` enforces Keychain-only credentials (ignoring `TRIPO_API_KEY`).
---
## Quick Installation
### Option 1: Run directly with `uvx` (recommended, zero manual venv setup)
```bash
uvx --from git+https://github.com/BipoXDXD/tripo-studio-mcp.git tripo-studio-mcp --version
```
### Option 2: Install globally or into an existing Python >= 3.11 environment with `pip`
```bash
pip install "git+https://github.com/BipoXDXD/tripo-studio-mcp.git"
tripo-studio-mcp --version
```
### Option 3: Clone and install in a local `.venv`
```bash
git clone https://github.com/BipoXDXD/tripo-studio-mcp.git
cd tripo-studio-mcp
python3 -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install -e .
tripo-studio-mcp --list-tools
```
---
## Storing Your API Key Safely (macOS Keychain Recommended)
```bash
security add-generic-password -a "$USER" -s "tripo-api-key" -w "<YOUR_TRIPO_API_KEY>" -U
```
On Linux/Windows (or CI), export `TRIPO_API_KEY` in your MCP server environment configuration instead.
---
## MCP Client Configuration
### Claude Code
**CLI one-liner (macOS Keychain):**
```bash
claude mcp add tripo-studio -e TRIPO_KEYCHAIN_SERVICE=tripo-api-key -e TRIPO_KEYCHAIN_ONLY=1 -- uvx --from git+https://github.com/BipoXDXD/tripo-studio-mcp.git tripo-studio-mcp
```
**Project-level `.mcp.json`** (or user-level **`~/.claude.json`** under `"mcpServers"`):
```json
{
"mcpServers": {
"tripo-studio": {
"command": "uvx",
"args": [
"--from",
"git+https://github.com/BipoXDXD/tripo-studio-mcp.git",
"tripo-studio-mcp"
],
"env": {
"TRIPO_API_KEY": "${TRIPO_API_KEY}",
"TRIPO_REGION": "ov"
}
}
}
}
```
### OpenAI Codex
**CLI one-liner (recommended macOS Keychain-only mode):**
```bash
codex mcp add tripo-studio \
--env TRIPO_KEYCHAIN_SERVICE=tripo-api-key \
--env TRIPO_KEYCHAIN_ONLY=1 \
-- uvx --from git+https://github.com/BipoXDXD/tripo-studio-mcp.git tripo-studio-mcp
```
**`~/.codex/config.toml`:**
```toml
[mcp_servers.tripo-studio]
command = "uvx"
args = [
"--from",
"git+https://github.com/BipoXDXD/tripo-studio-mcp.git",
"tripo-studio-mcp",
]
[mcp_servers.tripo-studio.env]
TRIPO_KEYCHAIN_SERVICE = "tripo-api-key"
TRIPO_KEYCHAIN_ONLY = "1"
TRIPO_REGION = "ov"
```
### Other MCP Stdio Clients (Antigravity, Claude Desktop, Cursor)
```json
{
"mcpServers": {
"tripo-studio": {
"command": "uvx",
"args": [
"--from",
"git+https://github.com/BipoXDXD/tripo-studio-mcp.git",
"tripo-studio-mcp",
"--output-dir",
"/path/to/your/tripo-outputs"
],
"env": {
"TRIPO_REGION": "ov",
"TRIPO_KEYCHAIN_SERVICE": "tripo-api-key"
}
}
}
}
```
*(If installed via `pip` or `.venv`, replace `"command": "uvx"` and `"args"` with `"command": "tripo-studio-mcp"` or `"/path/to/.venv/bin/tripo-studio-mcp"`.)*
---
## Tool Catalog (28 Tools)
### Free Tools (12)
| Tool | Endpoint / Behavior | Purpose |
| --- | --- | --- |
| `tripo_plan` | Local offline | Inspect supported models, upload limits, pricing tables, and estimate credits locally. |
| `tripo_balance` | `GET /v3/account/balance` | Query current account credit balance (auto-retries 429). |
| `tripo_usage` | `GET /v3/account/usage` | Query account usage history (auto-retries 429). |
| `tripo_upload_image` | `POST /v3/files` | Upload PNG/JPG/WEBP image (<= 20 MB) via multipart form-data. |
| `tripo_upload_model` | `POST /v3/files` or `/v3/files/presign` + `PUT` | Upload 3D model (<= 60 MB direct; `.gltf` or 60–150 MB via unauthenticated presigned `PUT`). |
| `tripo_import_model` | `POST /v3/models/import` | Import a 3D model (`file_token`, HTTPS `url`, or local `file_path`). |
| `tripo_task_status` | `GET /v3/tasks/{task_id}` | Fetch task status (`step=true` passes `?step=1`; auto-retries 429). |
| `tripo_task_wait` | Polls `GET /v3/tasks/{task_id}` | Wait until terminal status (`success`/`failed`/`cancelled`/`banned`/`expired`) or timeout. |
| `tripo_task_list` | `POST /v3/tasks/list` | Batch-query up to 100 task IDs (auto-retries 429). |
| `tripo_recent_jobs` | Local offline | List locally tracked task submissions, statuses, and downloaded files. |
| `tripo_rig_check` | `POST /v3/animations/rig-check` | Check whether a 3D model is eligible for rigging (free). |
| `tripo_download` | SSRF-validated HTTPS `GET` | Download finished task outputs or a public HTTPS URL atomically. |
### Paid Tools (16 — All Dry-Run by Default with `approved_spend=false`)
| Tool | Endpoint | Notes / Pricing |
| --- | --- | --- |
| `tripo_text_to_3d` | `POST /v3/generation/text-to-model` | Default `v3.1-20260211` (known pricing); supports `P2`, `P1`, `v3.0`, `v2.5`. |
| `tripo_image_to_3d` | `POST /v3/generation/image-to-model` | Single image to 3D; known pricing for `v3.1` & `P2`. |
| `tripo_multiview_to_3d` | `POST /v3/generation/multiview-to-model` | 2–4 views (`front` required) or `[{ task_id }]`; known pricing for `v3.1` & `P2`. |
| `tripo_image_to_splat` | `POST /v3/generation/image-to-splat` | Image to 3D Gaussian Splat (`model_seed` optional); variable billing. |
| `tripo_generate_image` | `POST /v3/generation/text-to-image` / `image-to-image` | Routes automatically: `text-to-image` (default `seedream_v4`) or `image-to-image` (default `seedream_v5`, rejects `seedream_v4`). |
| `tripo_image_to_multiview` | `POST /v3/generation/image-to-multiview` | Generate a 4-view turnaround sheet from one image. |
| `tripo_edit_multiview` | `POST /v3/generation/edit-multiview` | Edit 1–4 specific views (`front`/`left`/`back`/`right`). |
| `tripo_texture` | `POST /v3/models/texture` | Texture generation/retexturing (`v3.5-20260815`, `v3.0`, `v2.5`). |
| `tripo_convert` | `POST /v3/models/convert` | Export to `GLTF`, `USDZ`, `FBX`, `OBJ`, `STL`, or `3MF` (`fbx_preset`, `flatten_bottom`, etc.). |
| `tripo_decimate` | `POST /v3/mesh/decimate` | Mesh decimation (`v3.0`, `v2.0`, `v1.0`; `smart_uv` only on `v3.0`). |
| `tripo_smart_uv` | `POST /v3/mesh/uv` | Automatic clean UV unwrapping. |
| `tripo_segment` | `POST /v3/mesh/segment` | Semantic mesh segmentation (`v2.0-20260430`, `v1.0-20250506`). |
| `tripo_mesh_complete` | `POST /v3/mesh/complete` | Complete segmented parts from a segmentation `task_id` (`ai_completion` \| `quick_cap`). |
| `tripo_smart_segment` | `POST /v3/mesh/smartsegment` | Smart segment `model` (requires 16-float `transform`) or `image` (`file_token`/`url` only — rejects `task_id`). |
| `tripo_rig` | `POST /v3/animations/rig` | Auto-rigging (`v3.0-20260909`, `v2.5-20260210`, `v1.0-20240301`; `glb`/`fbx`). |
| `tripo_animate` | `POST /v3/animations/retarget` | Retarget 1–5 animations onto a rig `task_id`. |
---
## Environment Variables
| Variable | Default | Description |
| --- | --- | --- |
| `TRIPO_API_KEY` | *(unset)* | Tripo V3 OpenAPI key (ignored when `TRIPO_KEYCHAIN_ONLY=1`). |
| `TRIPO_KEYCHAIN_SERVICE` | `tripo-api-key` | macOS Keychain generic password service name. |
| `TRIPO_KEYCHAIN_ACCOUNT` | *(unset)* | Optional macOS Keychain account name filter (`-a`). |
| `TRIPO_KEYCHAIN_ONLY` | `0` | Set to `1`/`true` to ignore `TRIPO_API_KEY` and read only from macOS Keychain. |
| `TRIPO_REGION` | `ov` | `ov` (`https://openapi.tripo3d.ai`) or `cn` (`https://openapi.tripo3d.com`). |
| `TRIPO_BASE_URL` | *(unset)* | Optional custom HTTPS base URL (strictly validated with `validate_https_url`). |
| `TRIPO_OUTPUT_DIR` | `./tripo_outputs` | Default directory for downloaded assets. |
| `TRIPO_STATE_DIR` | `~/.local/share/tripo-studio-mcp` | Directory for local job history (`jobs.json`, `0600`). |
| `TRIPO_TIMEOUT_S` | `60` | Per-request HTTP timeout in seconds. |
| `TRIPO_POLL_INTERVAL_S` | `3` | Default polling interval for `tripo_task_wait`. |
| `TRIPO_POLL_TIMEOUT_S` | `600` | Default max wait time for `tripo_task_wait`. |
| `TRIPO_MAX_DOWNLOAD_MB` | `512` | Max file size allowed per `tripo_download` call. |
---
## Development & Testing
```bash
PYTHONPATH=src python3 -W error -m unittest discover -s tests -v
PYTHONPATH=src python3 -m tripo_studio_mcp --version
PYTHONPATH=src python3 -m tripo_studio_mcp --list-tools
```
All tests are 100% offline, deterministic, and require zero third-party packages.
## License
MIT — see [LICENSE](LICENSE).
TDQS
Scored across 28 tools
Most tools map to distinct pipeline stages, but a few pairs overlap: tripo_upload_model vs tripo_import_model both ingest 3D models, tripo_segment vs tripo_smart_segment are similar segmentation operations, and the task status/wait/list/recent tools require careful reading to distinguish. Descriptions generally clarify the boundaries, so misselection is possible but not severe.
All tool names use a consistent tripo_ prefix and snake_case, with mostly verb_noun or clear domain-specific compounds. Minor deviations exist, such as noun-only tools (tripo_balance, tripo_usage, tripo_plan, tripo_recent_jobs) and mixed compound patterns like text_to_3d vs generate_image vs image_to_splat, but the overall convention is predictable.
28 tools is heavy for an agent-facing set, though the broad 3D generation, mesh processing, rigging, and account-management scope justifies many of them. Some consolidation is possible, especially around upload/import, task-query variants, and segment/smart_segment, making the surface feel borderline over-scoped.
The set covers the full asset pipeline: ingestion, generation from text/image/multiview, image generation, rigging/animation, texturing, conversion, mesh processing, downloads, task monitoring, and account checks. Minor gaps remain, such as no explicit task cancellation or asset deletion/list operation, but agents can work around these for most workflows.