Skip to main content
Glama
README.md
# Sunfield SDK, Remote MCP & SunfieldBench

**Cloud 3D runtime for autonomous AI agents — *"E2B / Browserbase for Blender."***

Sunfield ([sunfield.dev](https://sunfield.dev)) runs warm, isolated headless Blender 4.5 GPU sandboxes (`--network=none`, read-only rootfs, cgroup limits) over a zero-install **Streamable HTTP Remote MCP** (`https://sunfield.dev/mcp`, OAuth 2.1) and typed **Python SDK** — with `2.4 ms` stateful `bpy` execution, `392 ms` automatic crash recovery, `459 ms` multi-view EEVEE/Cycles inspection + exact `BVHTree` collision telemetry, 149 pre-cached CC0 Poly Haven assets, `fork()` scene branching, and elastic Cycles OptiX burst rendering behind hard `max_cost_usd` caps.

![Sunfield Multi-Lighting Product Studio Cycles OptiX Proof](assets/proof-product-studio.jpg)
*One 4K product model branched via `fork()` across three studio lighting setups (Obsidian Tungsten · Daylight Loft · Amber Noir) on Sunfield Cycles OptiX AgX.*

![Sunfield Ground-Truth 4-Pass AOV Proof](assets/proof-aovs-4pass.jpg)
*Frame-aligned ground truth from one headless Blender 4.5 camera pose: Cycles OptiX RGB · Wireframe topology · World normals · Linear Z-depth.*

---

## 10-Second Setup: Hosted Remote MCP (No Local Blender or GPU)

Every new account starts with **$1.00 in free GPU credits** (~2,500 Cycles OptiX GPU-seconds, no credit card required).

### Claude Code (1-Command OAuth 2.1)
```bash
claude mcp add --transport http sunfield https://sunfield.dev/mcp
```
Claude Code discovers OAuth 2.1 + PKCE automatically, opens a browser tab to claim your free credits, and exposes all **15 native MCP tools** (`sunfield_create_session`, `sunfield_exec`, `sunfield_inspect`, `sunfield_fork`, `sunfield_render`, `sunfield_search_assets`, `sunfield_stage_assets`, `sunfield_stash`, `sunfield_topup`, etc.).

### Cursor, Windsurf, or VS Code (`mcp.json`)
```json
{
  "mcpServers": {
    "sunfield": {
      "url": "https://sunfield.dev/mcp"
    }
  }
}
```

### Local STDIO Bridge (`sunfield-mcp`)
For MCP hosts that only support STDIO transport:
```bash
export SUNFIELD_API_KEY="sunfield_sk_..."  # claim at https://sunfield.dev/start
uvx sunfield-mcp
```

---

## Python SDK Quickstart (`sdk/python/`)

```bash
uv add sunfield
export SUNFIELD_API_KEY="sunfield_sk_..."  # $1.00 free at https://sunfield.dev/start
```

```python
import os
from sunfield import Sunfield

with Sunfield(api_key=os.environ["SUNFIELD_API_KEY"]) as sf:
    with sf.sessions.create(preset="studio") as s:
        s.stage_assets(["hdri.brown_photostudio_01"])
        s.exec(
            "load_hdri('assets/hdri.brown_photostudio_01/brown_photostudio_01_2k.hdr', strength=1.2)\n"
            "bpy.ops.mesh.primitive_torus_add(location=(0, 0, 0.45), major_radius=0.45, minor_radius=0.14)"
        )

        # Sub-second visual + exact BVHTree spatial feedback
        check = s.inspect(views=["camera", "iso_3q"], passes=["rgb", "depth", "normals"])
        assert check.telemetry["collisions"] == []

        # Metered Cycles OptiX render behind a hard dollar ceiling
        render = s.render(
            engine="cycles",
            samples=64,
            resolution=(1920, 1080),
            aov_passes=["rgb", "depth", "normals"],
            max_cost_usd=0.05,
        )
        render.save_all(sf, "./outputs/hero")
        print(f"Rendered in {render.actual_gpu_s:.2f}s (${render.actual_cost_usd:.5f})")
```

---

## Runnable Examples (`examples/`)
- [`examples/product_studio_agent.py`](examples/product_studio_agent.py) — Autonomous product-shot loop: build/upload geometry, detect & auto-fix floating parts via `inspect()`, `fork(3)` studio lighting branches, and Cycles OptiX burst-render under `$0.50`.
- [`examples/robotics_domain_rand.py`](examples/robotics_domain_rand.py) — Robotics / Physical AI synthetic dataset loop: domain-randomize tabletop scenes, filter colliding grasps via `BVHTree`, and export RGB + linear Z-depth + world normals + instance segmentation + 3D world AABB JSON.
- [`examples/claude_code_remote_mcp.md`](examples/claude_code_remote_mcp.md) — Copy-paste Remote MCP configs and verification prompts for Claude Code, Cursor, Windsurf, and OpenAI Agents SDK.

---

## SunfieldBench v0.1 (`sunfieldbench/`)
A deterministic 8-task benchmark suite for evaluating 3D agents and headless Blender infrastructure on spatial correctness (`BVHTree` zero-collision, zero-floating, frustum framing coverage), `tmpfs` crash recovery, multi-branch `fork()`, AOV completeness, and metered GPU cost:

```bash
# Inspect all 8 deterministic tasks offline
uv run --with sunfield python -m sunfieldbench --list

# Run live against https://sunfield.dev
export SUNFIELD_API_KEY="sunfield_sk_..."
uv run --with sunfield python -m sunfieldbench --run --out results.json
```

### Live Measured Baseline (`2026-12-06`, `https://sunfield.dev` · RTX 3090 · 33s full suite)

| Task | Category | Result | `exec()` RTT | Cold `inspect()` | Cycles GPU-s | Cycles Cost |
| :--- | :--- | :---: | :---: | :---: | :---: | :---: |
| `studio_product_grounding` | product_photography | PASS | 89.4 ms | 788 ms | 1.677 s | $0.000671 |
| `collision_free_tabletop` | robotics_synthetic | PASS | 96.1 ms | 1,062 ms | — | $0.000000 |
| `multi_lighting_fork` (3× `fork`) | product_photography | PASS | 85.5 ms | 608 ms | — | $0.000000 |
| `camera_framing_precision` | spatial_reasoning | PASS | 64.3 ms | 803 ms | — | $0.000000 |
| `robotics_aov_completeness` (4-pass) | robotics_synthetic | PASS | 66.5 ms | 1,227 ms | 1.706 s | $0.000682 |
| `material_roughness_sweep` | lookdev | PASS | 102.5 ms | 918 ms | 1.583 s | $0.000633 |
| `stacked_contact_geometry` | spatial_reasoning | PASS | 64.3 ms | 718 ms | — | $0.000000 |
| `budget_guardrail_probe` | infrastructure | PASS | 66.4 ms | 613 ms | 1.577 s | $0.000631 |
| **Total (`8 / 8`, 100% pass)** | — | **8 / 8** | **76.0 ms med** | **795 ms med** | **6.543 s** | **$0.002617** |

*Measured end-to-end over public HTTPS against `https://sunfield.dev` (fresh `--network=none` Docker sandbox per task with isolated pre-warmed EEVEE shader cache; Cycles OptiX 32 spp @ 512×512 billed at `$0.00040/GPU-s`).*

---

## Links & Docs
- **Get $1.00 free GPU credits:** [sunfield.dev/start](https://sunfield.dev/start)
- **Pricing & workload cost estimator:** [sunfield.dev/pricing](https://sunfield.dev/pricing) (`$0.00025/s` interactive · `$0.00040/s` Cycles OptiX · Studio `$299/mo` · Production `$999/mo`)
- **Hosted Blender MCP guide:** [sunfield.dev/guides/hosted-blender-mcp](https://sunfield.dev/guides/hosted-blender-mcp)
- **BlenderProc Cloud API guide:** [sunfield.dev/guides/blenderproc-cloud-api](https://sunfield.dev/guides/blenderproc-cloud-api)
- **Agent operating manual:** [sunfield.dev/skill.md](https://sunfield.dev/skill.md) · [llms.txt](https://sunfield.dev/llms.txt)
- **Browse 149 CC0 Poly Haven assets:** [sunfield.dev/assets](https://sunfield.dev/assets)

## License
MIT © 2026 Strange Metal, Inc. (`Camera_01` and `pocket_watch` proof renders use CC0 assets from Poly Haven.)