forge3d
Health Uyari
- License — License: NOASSERTION
- Description — Repository has a description
- Active repo — Last push 0 days ago
- Low visibility — Only 5 GitHub stars
Code Basarisiz
- exec() — Shell command execution in pyproject.toml
Permissions Gecti
- Permissions — No dangerous permissions requested
Bu listing icin henuz AI raporu yok.
3D model creation for AI agents — MCP server + agent skill: 6 geometry engines (procedural, image, OpenSCAD, Blender, CadQuery, hosted), 15 equation-defined shape families, a procedural planet generator, profile-based validation, and a single-file Three.js viewer. Text-to-3D providers: Meshy, Tripo, Rodin.
forge3d
A 3D-model toolchain any AI agent can drive. One MCP server, one agent skill,
six interchangeable geometry engines, a validation layer that knows what
"correct" means for print vs web vs game, and a Three.js viewer that turns a
mesh into a single HTML file you can send to anyone.
Most "AI makes 3D" demos stop at a pretty mesh in a viewport. The hard parts are
everything after: is it watertight, is it the right size in millimetres, will it
survive a 60k-triangle budget, can the next agent pick up where this one left
off without re-reading a megabyte of vertices. forge3d is built around those.

The whole flow, rendered by forge3d itself — create_shape → validate_model →make_viewer. Every frame comes from the library's own CPU renderer, so the GIF
cannot show anything the code does not produce.
At a glance
- Six engines, one interface — procedural (equation-driven), image-to-3D,
OpenSCAD, Blender, CadQuery (real B-rep, STEP export) and hosted text-to-3D
providers. Switch engine without rewriting the agent. - Validation that knows the target — watertightness, millimetre scale,
triangle budgets and print-vs-web rules, with a repair step that re-checks
dimensions after it fixes a mesh. - The agent can see its own work — a PNG preview after every build, and
model_cardsummaries instead of raw vertex data in the context window. - Ship one HTML file —
make_viewerwrites a self-contained Three.js page
anyone can open, no host required. - Nothing to install to try it —
forge3d demoruns end to end with no
Blender, no OpenSCAD, no API key and no network.
Contents
- Try it in one command · Install
- Quick start (agent) · Quick start (human)
- The six engines · Image to 3D · Cloud providers
- Make anything from an equation · Procedural planets and scenes
- Production behaviour · Three.js · Multi-agent, multi-person
- Security · Honest limitations · Licence
Try it in one command
pip install "forge3d @ git+https://github.com/chaudharyvivek1/forge3d.git"
forge3d demo
forge3d demo needs no Blender, no OpenSCAD, no API key and no network. It builds
a shape from an equation, validates it, renders previews and writes a
self-contained viewer page, then prints every path. Everything else in this README
is optional on top of that.
Nothing in that image is stock: the geometry came from examples/procedural_chair.py
and the render from forge3d.render — the same loop an agent runs.
Open examples/chair.html for the interactive version.
What it actually does
brief ──► plan_model ──► create_model ──► validate_model ──► repair_model ──► review_model
│ │
├──► previews (PNG, so the agent can *see* it) │
└──► viewer (single-file Three.js page) ◄─────────┘
| Step | Tool | What it prevents |
|---|---|---|
| Brief | plan_model |
generating from a vague prompt with no scale or purpose |
| Build | create_model |
being locked into one engine |
| Inspect | inspect_model / model_card |
pasting geometry into a context window |
| Check | validate_model |
shipping a non-manifold mesh to a printer |
| Fix | repair_model |
silent holes, flipped normals, absurd poly counts |
| Verify the fix | repair_report (inside repair_model) |
a repair that "worked" but changed the part's dimensions |
| Look | render_model |
the agent guessing instead of iterating |
| Ship | make_viewer |
needing a host to show someone the result |
| Hand off | create_handoff / checklist |
two agents diverging on the same model |
| Stop | cancel_job |
a generation you no longer want, running until the process is killed |
Install
Straight from the repository — one line, no clone:
pip install "forge3d @ git+https://github.com/chaudharyvivek1/forge3d.git"
Or for development, with the preview renderer:
git clone https://github.com/chaudharyvivek1/forge3d.git
cd forge3d
pip install -e ".[render,dev]"
PyPI: publishing is automated —
.github/workflows/release.ymlbuilds the
sdist and wheel, runstwine check, installs the wheel in a clean venv and smoke
tests it, then publishes via PyPI trusted publishing on av*tag. It is
waiting on a one-time setup step (below); until that is done,pip install forge3ddoes not resolve and thegit+https://line above is the
install path.
Optional engines — install only what you need:
# exact CSG parts (brackets, enclosures)
sudo apt install openscad # macOS: brew install --cask openscad
# Windows: winget install OpenSCAD.OpenSCAD
# organic forms, bevels, materials, animation
sudo snap install blender --classic # macOS: brew install --cask blender
# Windows: winget install BlenderFoundation.Blender
# real B-rep CAD with STEP export
pip install cadquery
# decimation in repair_model
pip install fast-simplification
# boolean unions in trimesh (procedural backend)
pip install manifold3d
Check what this machine can actually do — never guess:
forge3d doctor # OS, Python, engines, packages, workdir, and how to fix gaps
forge3d backends # just the engine list
doctor is also an MCP tool, so an agent can diagnose its own runtime instead of
guessing why a backend is unavailable. It reports whether an env var is set,
never its value — an API key is not echoed back.
Works on Linux, macOS and Windows, in Docker, and in CPU-only agent
sandboxes. The full matrix, including what does not work where, is in
docs/platforms.md.
Quick start (agent)
Add to Claude Desktop, Cursor, or any MCP client:
{
"mcpServers": {
"forge3d": {
"command": "forge3d-mcp",
"env": { "FORGE3D_WORKDIR": "/absolute/path/to/forge3d-work" }
}
}
}
For a remote agent or your own app, run it over HTTP instead:
pip install "forge3d[http]"
forge3d-mcp --http 8000 # loopback only, no auth
FORGE3D_HTTP_TOKEN=$(openssl rand -hex 32) \
forge3d-mcp --http 8000 --host 0.0.0.0 # network, one owner
# several callers: one key each, narrowest scope that works
FORGE3D_API_KEYS='{
"sk-readonly": {"id": "ci", "scopes": ["read"]},
"sk-design": {"id": "design", "scopes": ["read", "write"]},
"sk-builder": {"id": "build", "scopes": ["read", "write", "exec"]}
}' forge3d-mcp --http 8000 --host 0.0.0.0
The HTTP transport binds 127.0.0.1 by default and refuses a public bind
without a credential — v0.2.0 bound 0.0.0.0 with no authentication, which
meant anyone who could reach the port could run arbitrary model code. HTTP mode
also forces subprocess isolation for that code.
Since 0.7.0 a request resolves to a principal: a key's id, its scopes
(read, write, exec, admin), and — when the server holds more than one key —
its own work directory, so one caller cannot read another's models. exec is
required before any backend runs caller-supplied code. The singleFORGE3D_HTTP_TOKEN still works and is treated as the owner, so nothing about an
existing deployment changes. Read docs/security.md before
exposing it anywhere; it states plainly what is still not protected.
Then a single call gets you from brief to shareable page:
create_model(
prompt="a modern side chair with cross braces",
name="chair",
purpose="game",
backend="procedural",
source=open("examples/procedural_chair.py").read(),
dimensions={"x": 450, "y": 480, "z": 850},
units="mm",
scale_to_spec=True,
)
# -> { "ok": true, "path": ".../chair.glb", "viewer": ".../chair.html",
# "validation": { "ok": true, "summary": "PASS with 1 warning(s) ..." }, ... }
Quick start (human, no agent)
forge3d plan --prompt "wall bracket for a 32mm pipe" --purpose print --dims x=120,y=60,z=40
forge3d create --name chair --purpose game --backend procedural \
--source examples/procedural_chair.py --dims x=450,y=480,z=850 \
--scale-to-spec --viewer
forge3d validate output/chair.glb --profile print
forge3d render output/chair.glb
forge3d viewer output/chair.glb --out chair.html
The six engines
| Backend | Needs | Best for | Weak at |
|---|---|---|---|
procedural |
nothing (trimesh) | precise dimensions, repeated structure, editable output, offline | organic forms |
image |
nothing (PIL) | real geometry from a real image: relief plaques, lithophanes, extruded logos with holes | reconstructing what the photo does not show |
openscad |
openscad binary |
hard-surface CSG, brackets, enclosures, jigs | sculpting, texturing |
blender |
blender binary |
bevels, subdivision, materials, rigging, animation | exact mechanical dims |
cadquery |
pip install cadquery |
manufacturing, STEP deliverables, fillets | organic forms |
hosted |
a provider key or FORGE3D_HOSTED_URL |
stylised props, characters, textured meshes fast | exact scale, watertight print geometry |
backend="auto" routes from the spec: print → OpenSCAD if present, cad →
CadQuery, game → Blender, web with references → hosted, otherwise
procedural. The routing table is data (backends/registry.py), so it is
testable and easy to change.
Image to 3D
Two different things get called "image to 3D", and conflating them is how a demo
never ships. Reconstruction (infer the unseen side of an object) needs a
neural model and a GPU — route that to backend="hosted". Derivation —
computing real geometry from pixels — is the image backend, and it is
deterministic, needs no GPU, and produces a watertight solid:
forge3d create --name plaque --purpose print --backend image \
--source portrait.jpg --dims x=100,y=75,z=8 # relief / lithophane
forge3d create --name sign --purpose print --backend image \
--source logo.png --dims x=80,y=80,z=4 # extruded silhouette
A relief costs exactly $$4(g-1)^2 + 8(g-1)$$ triangles at grid $$g$$, and the grid
is shrunk automatically to fit poly_budget before generating. Holes in a mask
survive as real holes. Full detail, including what it will not do:
docs/image-to-3d.md.
Cloud providers
Real adapters for Meshy, Tripo and Rodin behind one job-shaped
interface, plus the original generic worker — existing FORGE3D_HOSTED_URL
deployments keep working unchanged.
forge3d providers # what is configured here
forge3d providers --check # live authenticated request
create_model(backend="hosted", mode="cloud", prompt="a ceramic teapot")
Every adapter reports verified — whether it has been run against a live account.
Only the generic worker has; the commercial three are written from public docs and
say so, in the CLI, in list_providers, and in the job metadata. --check settles
it in one command. Interface, status normalisation and how to add one:
docs/providers.md.
Make anything from an equation
15 shape families defined by maths, callable by name. No vertex loops, no noise
code, no "almost watertight" caps:
create_shape(shape="supershape", params={"m": 6, "n1": 0.3}, resolution=96)
create_shape(shape="involute_gear", params={"teeth": 24}, export_format="stl")
create_shape(shape="torus_knot", params={"p": 2, "q": 3})
supershape (Gielis superformula) covers flowers, stars and organic blobs.involute_gear is a real meshing tooth profile, not a decorative one.lathe turns any 2D silhouette into a solid of revolution. Plusspherical_harmonic, superellipsoid, lissajous, spring, seashell,twisted_prism, bumpy_sphere, and the open surfaces mobius, helicoid,catenoid. list_shapes returns every equation with its parameters.
All 11 solids are watertight and pass the print profile — asserted per shape in
the test suite, because "looks right" and "is printable" are different claims.
Exports to GLB, STL, OBJ, PLY, OFF, glTF and DAE. Equations and parameter tables:
docs/surfaces.md.
Procedural planets and scenes
A website hero scene needs four rocky planets, not four bracket models. Theplanets generator is that shape family, done once and tested:
create_planet(radius=55, seed=11, canyon=True, subdivisions=5, texture_resolution=512)
# -> GLB with baked albedo + normal + metallic-roughness, spherical UVs, watertight
make_scene_viewer(items=[
{"path": "mars-prime.glb", "position": [0, 0, 0]},
{"path": "mars-canyon.glb", "position": [105, -60, -80]},
], title="Four-Planet Mars Scene")
# -> one self-contained Three.js page: shared sun, 9k-point starfield, orbit controls
Noise is sampled in 3D on the sphere (no UV seam), craters are analytic bowls
with rims, and textures are baked from the same fields as the geometry so the
colour and the silhouette always agree. Everything is seeded, so the hero image
is reproducible. Reference scene: 51k triangles, ~17 s, 3.5 MB page — see
docs/geometry.md for the size budget and what it will not do.
ModelSpec.mode — local never routes to a paid provider, cloud never
routes to a local engine, auto decides on fit. A tool that quietly upgrades you
into a billable API call is not being helpful.
Production behaviour
GET /health— no token needed, reports version, uptime, exec mode,
sandbox in force, job counts.- Concurrency —
FORGE3D_MAX_CONCURRENT(default 2) with a bounded queue
(FORGE3D_QUEUE_WAIT, default 30 s), then an honest "server busy" rather than
a silent wait. - Rate limiting —
FORGE3D_RATE_LIMITper token/IP,429+Retry-After. - Retries — hosted calls back off exponentially with jitter on 5xx and
connection errors, never on 4xx. - Logs —
FORGE3D_LOG_JSON=1gives one JSON object per tool call and per
HTTP request. - Job recovery — atomic records, job-scoped output dirs, and orphaned jobs
markedinterruptedon restart.
Full detail, including what is not handled: docs/reliability.md.
Three.js
Two ways, both in the repo:
Single-file page — make_viewer embeds the GLB as a data URI, so the HTML
needs no server, no CORS and no hosting. The model is embedded; three.js still
loads from a CDN by default, so for an air-gapped machine pointFORGE3D_THREE_URL at a local mirror of three before building the page:
forge3d viewer output/chair.glb --out chair.html
FORGE3D_THREE_URL=http://localhost:8080/three forge3d viewer output/chair.glb --out chair.html
Embeddable element — for your own app, a custom element that takes a URL:
<script type="importmap">
{"imports":{"three":"https://unpkg.com/[email protected]/build/three.module.js",
"three/addons/":"https://unpkg.com/[email protected]/examples/jsm/"}}
</script>
<script type="module" src="/forge3d-viewer.js"></script>
<forge3d-viewer src="/models/chair.glb" height="480" autorotate grid></forge3d-viewer>
Events: forge3d:loaded (detail.triangles), forge3d:error.
See docs/threejs.md.
Why the context-window rules matter
A 100k-triangle GLB is a few megabytes; as text it is millions of tokens. So
every tool in forge3d takes and returns paths, never geometry. The one way to
describe a model in context is model_card — roughly 300 tokens:
**chair.glb** — glb
96 tris · 418.77 x 412.56 x 850 mm · watertight · 8 body
validation: PASS with 1 warning(s) — game profile (single_body)
ship as: .glb
Multi-agent, multi-person
handoff.py defines the packet that lets a second agent — or a designer and a
3D artist — take over without re-deriving anything: spec, artifacts, checks,
owners, open questions, and who is next. It writes both JSON (for agents) and
Markdown (for humans). See docs/multi-agent.md.
create_handoff(
spec=spec, artifacts={"model": "chair.glb", "viewer": "chair.html"},
backend="procedural",
checks=checklist("game"),
owners={"design": "priya", "geometry": "agent-a"},
next_agent="review-agent",
)
Releasing
Tagging is the release:
git tag v0.6.7 && git push origin v0.6.7
The workflow verifies the build before it uploads anything, so a broken README or
bad metadata fails in CI rather than on PyPI.
One-time setup, on PyPI (not in this repo): add a trusted publisher at
https://pypi.org/manage/account/publishing/ with owner chaudharyvivek1,
repository forge3d, workflow release.yml, environment pypi. No API token is
stored anywhere. If you would rather use a token, add the secret PYPI_API_TOKEN
and swap the with: block in the workflow.
To check the pipeline without publishing, run the workflow manually — the publish
job only runs on a v* tag.
Repository layout
src/forge3d/
spec.py the brief as data — purpose, units, dimensions, budget
backends/ procedural · image · openscad · blender · cadquery · hosted
providers/ meshy · tripo · rodin · generic worker (one job-shaped contract)
geometry/ generators: planets (terrain, craters, PBR bake), surfaces (15 equation families)
validate.py profile-based checks, every failure carries a fix hint
repair.py merge, drop, fill, re-orient, decimate — plus a before/after report
render.py CPU previews (matplotlib) — works headless, no GPU
viewer.py single-file Three.js page
viewer_assets/ template.html + forge3d-viewer.js custom element
platform_support.py binary discovery, UTF-8 subprocess, thread-safe timeouts, doctor
auth.py principals, API keys, scopes, per-tenant work directories
http_server.py HTTP transport: loopback default, key auth, health, rate limit
sandbox_runner.py the child process for FORGE3D_EXEC_MODE=subprocess
context.py model cards — the only sanctioned way to describe a mesh
handoff.py checklists + multi-agent handoff packets
jobs.py durable job records: heartbeat, crash recovery, cancellation
server.py the MCP surface (22 tools)
cli.py same capabilities without an agent
skill/ agent skill: SKILL.md + references
docs/ architecture, security, reliability, providers, image-to-3d, geometry, surfaces,
platforms, backends, threejs, multi-agent, licensing
docs/audit/ the 0.7.0 audit: architecture, feature verification, security, quality,
issues, roadmap, ratings
examples/ chair (trimesh), bracket (OpenSCAD), gear (bpy), plate (CadQuery)
tests/ pytest — unit, platform and regression suites
Dockerfile CPU-only image, non-root, /work volume
Security
Two things worth knowing before you point this at anything other than your own
machine:
Agent code execution. The procedural, cadquery and blender backends run
code the agent wrote — and all three are now refused centrally whenFORGE3D_ALLOW_CODE_EXEC=false, not just the procedural one.FORGE3D_EXEC_MODE=subprocess runs them in a killable child with rlimits, andFORGE3D_SANDBOX wraps that in bubblewrap where available. Neither is a sandbox
against a determined attacker — for that, use the container and keep the caller
trusted.
Remote images are fetched through a guard that refuses loopback, private and
link-local addresses (revalidated after every redirect), caps the body size, and
requires the bytes to decode as an image inside a pixel budget.
The HTTP transport requires a credential for any non-loopback bind, compares
it in constant time, forces subprocess isolation, and has an in-process token
bucket (FORGE3D_RATE_LIMIT). That limiter is per-process and in-memory — it is
not a distributed or billing-grade quota. It does not do TLS; put a reverse proxy
in front for that.
Authentication is not authorization, so 0.7.0 added the second half. A key
maps to a principal with scopes: read (inspect, validate, list), write
(create, repair, convert, render, cancel), exec (additionally required before a
backend runs code you supplied) and admin (doctor, which discloses the host's
inventory). A tool with no declared scope is closed by default. With more than one
key, each principal gets <workdir>/tenants/<id> and reads outside it are
refused — a guessed path is not enough to fetch someone else's mesh.
Still not implemented, and not pretended otherwise: per-object ACLs (two keys
cannot share one project), user accounts or OAuth, an audit log beyond the
structured stderr lines, and multi-instance rate limiting.
Full detail, including the threat model and what is deliberately not covered:
docs/security.md.
Honest limitations
- Textures. The local engines produce geometry, not painted PBR materials.
For textured output, route to a hosted text-to-3D service. - Hosted adapter. Provider APIs (Meshy, Tripo, Rodin, Hunyuan3D) differ.
hosted.pyspeaks one small documented contract — point it at a thin worker.
It does not pretend to be a drop-in client for all of them. - Rigging. Blender can rig; forge3d does not generate skeletons or weights
for you. Auto-rig quality varies badly. - Preview renders are review-quality, not beauty shots. For beauty, the
Three.js viewer with an environment map is the better tool. - Licensing. Output rights differ sharply between hosted services. That is
your provider's terms, not this repo's. Seedocs/licensing.md. - Provider adapters exist but are not live-verified. Meshy, Tripo and Rodin
have real adapters written from their public docs; only the generic worker has
been run against a live endpoint.list_providersandforge3d providers --checkreport the difference rather than hiding it. - Subprocess isolation is not a security boundary. It gives real cancellation
and resource ceilings; it does not stop a child process reading your files.
Licence
MIT — see LICENSE. Built by Vivek Chaudhary.
Yorumlar (0)
Yorum birakmak icin giris yap.
Yorum birakSonuc bulunamadi