Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.
JavaScript 3d-generationai-agentsanimationavatardigital-humangenerative-aiglbgltfimage-to-3dllmmcpmcp-servermodel-context-protocolsolanatext-to-3dthreejsweb-componentswebglwebxrx402
refactor(studio): retire api/_studio now that the free lane runs through _mcp-studio
nirholas398821361cc4
diff --git a/ARCHITECTURE.md b/ARCHITECTURE.mdindex d5110283f..925df624e 100644--- a/ARCHITECTURE.md+++ b/ARCHITECTURE.md@@ -770,7 +770,7 @@ Beyond the feature areas above, the `api/` tree exposes many more surfaces. Comp| `/api/users/*` (16) vs `/api/user/*` (5) | — | Two namespaces: `users/` = public profiles/follows/referrals/earnings; `user/` = account wallet/settings || `/api/rider/*`, `/api/play/*`, `/api/seed/*`, `/api/club/*` (incl. `tips-stream` SSE), `/api/tournaments/*`, `/api/clash/*` | — | Rider passes / play-pass / fixtures-seed / 3D-club tips / tournament + Coin Clash game surfaces |-> Internal MCP handler implementations live in `api/_mcp`, `api/_mcp3d`, `api/_mcpagent`, `api/_mcpbazaar`, `api/_mcpibm`, `api/_mcp-studio`, `api/_studio` — see [MCP Layer](#mcp-layer).+> Internal MCP handler implementations live in `api/_mcp`, `api/_mcp3d`, `api/_mcpagent`, `api/_mcpbazaar`, `api/_mcpibm`, `api/_mcp-studio` — see [MCP Layer](#mcp-layer).---@@ -2349,7 +2349,7 @@ The serverless tree holds **146 feature directories + 115 top-level handler file| x402 & payments | `x402/` · `x402-pay/` · `pay/` · `payments/` · `bazaar/` · `ca2x402/` · `billing/` · `credits/` · `onramp/` · `purchase/` · `subscriptions/` · `monetization/` · `ledger/` · `tx/` · `usage/` || Marketplace & assets | `marketplace/` · `creators/` · `skills/` · `plugins/` · `assets/` · `cosmetics/` · `rider/` · `referral/` || Community & worlds | `agora/` · `agenc/` · `clash/` · `club/` · `community/` · `crews/` · `friends/` · `social/` · `stage/` · `play/` · `world/` · `galaxy/` · `irl/` · `share/` · `tournaments/` · `bounties/` · `labor/` |-| MCP servers | `_mcp/` · `_mcp3d/` · `_mcp-studio/` · `_mcpagent/` · `_mcpbazaar/` · `_mcpibm/` · `_studio/` · `_providers/` |+| MCP servers | `_mcp/` · `_mcp3d/` · `_mcp-studio/` · `_mcpagent/` · `_mcpbazaar/` · `_mcpibm/` · `_providers/` || AI / voice / LLM | `chat/` · `llm/` · `tts/` · `watsonx/` · `ibm/` · `guardian/` · `inference/` · `tutor/` || Naming & on-chain | `threews/` · `three/` · `nft/` · `pinning/` · `reputation/` · `sdp/` || Infra, SEO & ops | `cron/` · `sitemap/` · `rss/` · `og/` · `webhooks/` · `push/` · `notifications/` · `developer/` · `platform/` · `jobs/` · `embed/` · `widgets/` · `dashboard/` · `demo/` · `actions/` · `v1/` · `api/` |@@ -3116,9 +3116,8 @@ All **150+ directories** under `api/` plus many top-level single-file endpoints.| Directory | Files | Purpose ||---|---|---|| `_lib/` | 326 `.js` + 19 sub-pkgs | Shared utility layer (see catalog below). |-| `_mcp/` `_mcp3d/` `_mcp-studio/` `_mcpagent/` `_mcpbazaar/` `_mcpibm/` | 17/7/5/3/3/5 | Impl dirs behind the remote MCP servers (auth, catalog, dispatch, pricing, render, tools). |+| `_mcp/` `_mcp3d/` `_mcp-studio/` `_mcpagent/` `_mcpbazaar/` `_mcpibm/` | 21/11/7/3/3/5 | Impl dirs behind the remote MCP servers (auth, catalog, dispatch, pricing, render, tools). || `_providers/` | 10 | 3D/image gen provider adapters (gcp, huggingface, meshy, nvidia, nvidia-cosmos, replicate, rodin, stability, tripo) + BYOK registry. |-| `_studio/` | 3 | Studio MCP tool registry/dispatch. || `actions/` | avatar, avatar-icon | Farcaster/embed action endpoints. || `admin/` | 16 | Admin console (revenue, health, bulk-launch, withdrawals, register-agents, club/news/user subdirs) + `all-systems`, `circulation-health`, `flags`, `launcher`, `seeder`, `ops`. || `agenc/` | [action] | AgenC / watsonx Orchestrate dispatcher. |diff --git a/api/_studio/catalog.js b/api/_studio/catalog.jsdeleted file mode 100644index 5e3f34541..000000000--- a/api/_studio/catalog.js+++ /dev/null@@ -1,25 +0,0 @@-// Catalog + compiled validators for the FREE 3D Studio MCP (/api/mcp-studio).-//-// Exactly the five generation tools — no getting-started/discovery helper tool,-// no payment tool, nothing token- or wallet-shaped. The schema list (sent on-// tools/list) strips the handler; TOOLS binds each name to its handler and an-// Ajv-compiled validator for defense-in-depth arg checking (same pattern as-// api/_mcp3d/catalog.js).--import Ajv from 'ajv';-import addFormats from 'ajv-formats';--import { studioTools } from './tools.js';--// Schema objects for tools/list — strip the handler, keep title + annotations.-export const TOOL_CATALOG = studioTools.map(({ handler: _h, ...schema }) => schema);--const ajv = new Ajv({ allErrors: true, useDefaults: true, coerceTypes: true, strict: false });-addFormats(ajv);--export const TOOLS = Object.fromEntries(- studioTools.map(({ name, handler, inputSchema }) => [- name,- { handler, validate: inputSchema ? ajv.compile(inputSchema) : null },- ]),-);diff --git a/api/_studio/dispatch.js b/api/_studio/dispatch.jsdeleted file mode 100644index 9bd665e2c..000000000--- a/api/_studio/dispatch.js+++ /dev/null@@ -1,27 +0,0 @@-// JSON-RPC dispatch for the FREE 3D Studio MCP server — binds the shared,-// payment-free dispatcher (api/_lib/mcp-dispatch.js) to this server's catalog.-// No scope checks, no x402: every tool is free and operator-funded, bounded by-// the per-IP rate limits in api/mcp-studio.js.-import { makeDispatcher, PROTOCOL_VERSION } from '../_lib/mcp-dispatch.js';-import { TOOL_CATALOG, TOOLS } from './catalog.js';--export { PROTOCOL_VERSION };--const INSTRUCTIONS = [- 'three.ws 3D Studio turns text or images into downloadable, interactive 3D models — for free.',- 'forge_free(prompt) makes a textured 3D model from text (fast, free TRELLIS lane).',- 'mesh_forge(prompt | image_url | image_urls) makes a mesh from text, an image, or 1–4 multi-view images.',- 'text_to_avatar(prompt | image_url) makes a 3D avatar. rig_mesh(glb_url) adds a skeleton so a model can',- 'animate. forge_avatar(prompt | image_url) does generate + rig in one call. Every tool returns a GLB URL',- 'under `glbUrl`, a viewer link, and an inline <model-viewer> artifact — display that as an interactive 3D',- 'preview. Generation is asynchronous server-side and can take 30–180s; the call returns when the model is',- 'ready.',-].join(' ');--export const dispatch = makeDispatcher({- serverInfo: { name: 'three-ws-3d-studio-free', version: '1.0.0' },- instructions: INSTRUCTIONS,- catalog: TOOL_CATALOG,- tools: TOOLS,- logName: 'mcp-studio',-});diff --git a/api/_studio/tools.js b/api/_studio/tools.jsdeleted file mode 100644index 2b4a69bc8..000000000--- a/api/_studio/tools.js+++ /dev/null@@ -1,385 +0,0 @@-// three.ws 3D Studio (FREE) — tool definitions for /api/mcp-studio.-//-// Five generation tools, exposed FREE: no x402, no wallet, no payment surface.-// They reuse the REAL production generation handlers (mcp-server/src/tools/-// _studio-core.js — the same cores the paid stdio MCP server runs), so there is-// no fork and no mock. The provider cost is operator-funded by server-side keys;-// abuse is bounded by per-IP rate limits in the endpoint (api/mcp-studio.js).-//-// OpenAI Apps SDK submission posture (developers.openai.com/apps-sdk):-// • Zero token/crypto/payment surface — no coin, mint, price, or x402 field-// appears in any tool name, description, input, or response.-// • Responses carry ONLY what a caller needs: the GLB URL (documented key-// `glbUrl`), a viewer link, minimal task metadata, and an inline-// <model-viewer> artifact. Internal identifiers (job/creation/prediction-// ids, resume URLs, pinned model versions, backend internals) are STRIPPED.-// • Inputs are minimal and task-specific — a prompt, an optional image, and-// the few knobs that change the result. No chat-history requests.--import {- runForgeFree,- runMeshForge,- runRigMesh,- runTextToAvatar,- runForgeAvatar,-} from '../../mcp-server/src/tools/_studio-core.js';-import { renderModelViewerHtml } from '../_mcp/render.js';-import { buildArLaunchUrl, buildIrlUrl } from '../_lib/ar-launch.js';--// Public origin used to build viewer / pose-studio links in the SANITIZED-// response — independent of whichever internal origin the cores call. Always a-// public three.ws URL the Apps SDK component can open.-const PUBLIC_BASE = (process.env.STUDIO_PUBLIC_BASE || 'https://three.ws').replace(/\/$/, '');--const viewerUrl = (glbUrl) => `${PUBLIC_BASE}/viewer?src=${encodeURIComponent(glbUrl)}`;-const poseUrl = (glbUrl) => `${PUBLIC_BASE}/pose?src=${encodeURIComponent(glbUrl)}`;-// Device-aware AR launch (/api/ar): iPhone → Quick Look, Android → Scene-// Viewer, desktop → WebGL viewer. The SAME one-tap "place it in your home"-// flow the forge site uses; every generation response carries it. `live`-// marks an avatar (an agent's body): the launch page then leads with the-// IRL living handoff instead of static placement.-const arUrl = (glbUrl, live = false) => buildArLaunchUrl(PUBLIC_BASE, glbUrl, '', { live });-// IRL living-agent link: the avatar walks, animates, and talks with the user-// through their camera in their real room. AR here bridges the agent economy-// into physical space; static placement is for props.-const irlUrl = (glbUrl) => buildIrlUrl(PUBLIC_BASE, glbUrl);--// Generation annotations (per Apps SDK guidance): these tools mint a fresh-// external artifact, so they are writes, non-destructive, non-idempotent, and-// open-world (they reach external model APIs).-const GEN_ANNOTATIONS = {- readOnlyHint: false,- destructiveHint: false,- idempotentHint: false,- openWorldHint: true,-};--// Build the MCP CallToolResult for a SUCCESSFUL generation. `structured` is the-// already-sanitized public payload; `glbUrl` drives the inline 3D artifact and-// the human-readable text mirror. The component reads `structuredContent.glbUrl`.-function ok(structured, glbUrl, name, { live = false } = {}) {- const artifact = {- type: 'resource',- resource: {- uri: glbUrl,- mimeType: 'text/html',- text: renderModelViewerHtml({- src: glbUrl,- name: name || '3D model',- background: 'transparent',- height: '480px',- width: '100%',- autoRotate: true,- ar: true,- arHref: arUrl(glbUrl, live),- }),- },- };- return {- content: [- { type: 'text', text: JSON.stringify(structured) },- artifact,- ],- structuredContent: structured,- };-}--// Build the MCP CallToolResult for a FAILED generation. Only the stable-// { ok:false, error, message, retryAfter? } contract is surfaced — every-// internal id / resume URL / raw provider output the core attached is dropped.-function fail(raw) {- const structured = { ok: false, error: raw.error || 'error', message: raw.message || 'failed' };- if (raw.retryAfter != null) structured.retryAfter = raw.retryAfter;- return {- content: [{ type: 'text', text: JSON.stringify(structured) }],- structuredContent: structured,- isError: true,- };-}--// ── forge_free ──────────────────────────────────────────────────────────────-const forgeFree = {- name: 'forge_free',- title: 'Text → 3D model',- description:- 'Turn a text prompt into a textured, downloadable 3D model (GLB). Describe a single object or ' +- 'character — e.g. "a friendly round robot mascot, glossy white plastic" — and get back a 3D model ' +- 'URL plus an interactive viewer you can rotate in the browser. Choose quality draft (fast, default), ' +- 'standard, or high. Text only; for image → 3D use mesh_forge. Feed the result to rig_mesh to make it ' +- 'animation-ready.',- inputSchema: {- type: 'object',- additionalProperties: false,- required: ['prompt'],- properties: {- prompt: {- type: 'string',- minLength: 3,- maxLength: 1000,- title: 'Prompt',- description:- 'What to model — lead with the subject and its key materials and colors, e.g. "a worn leather armchair, brass studs".',- },- tier: {- type: 'string',- enum: ['draft', 'standard', 'high'],- default: 'draft',- title: 'Quality',- description: 'draft = fast preview (default), standard = balanced, high = densest mesh.',- },- },- },- annotations: GEN_ANNOTATIONS,- handler: async (args) => {- const r = await runForgeFree({ prompt: args.prompt, tier: args.tier });- if (r.ok === false) return fail(r);- const structured = {- ok: true,- kind: 'mesh',- glbUrl: r.glbUrl,- viewerUrl: viewerUrl(r.glbUrl),- arUrl: arUrl(r.glbUrl),- prompt: r.prompt,- tier: r.tier,- durationMs: r.durationMs,- };- return ok(structured, r.glbUrl, args.prompt);- },-};--// ── text_to_avatar ──────────────────────────────────────────────────────────-const textToAvatar = {- name: 'text_to_avatar',- title: 'Text/Image → 3D avatar',- description:- 'Generate a textured 3D avatar (GLB) from a text prompt or a reference image. Returns the 3D model ' +- 'URL and an interactive viewer. Provide a prompt describing the character, optionally an image URL to ' +- 'reconstruct from. For a non-character object use forge_free or mesh_forge; to make the avatar ' +- 'animation-ready use forge_avatar (one call) or rig_mesh on the result.',- inputSchema: {- type: 'object',- additionalProperties: false,- properties: {- prompt: {- type: 'string',- maxLength: 1000,- title: 'Prompt',- description: 'Description of the avatar/character to generate. Provide this or an image.',- },- image_url: {- type: 'string',- format: 'uri',- title: 'Reference image',- description:- 'Optional http(s) URL to a reference image. When set, the avatar is reconstructed from the image.',- },- },- },- annotations: GEN_ANNOTATIONS,- handler: async (args) => {- const images = typeof args.image_url === 'string' && args.image_url.trim() ? [args.image_url.trim()] : undefined;- const r = await runTextToAvatar({ prompt: args.prompt, images });- if (r.ok === false) return fail(r);- const structured = {- ok: true,- kind: 'avatar',- glbUrl: r.glbUrl,- viewerUrl: viewerUrl(r.glbUrl),- arUrl: arUrl(r.glbUrl, true),- irlUrl: irlUrl(r.glbUrl),- prompt: r.prompt,- durationMs: r.durationMs,- };- return ok(structured, r.glbUrl, args.prompt || 'avatar', { live: true });- },-};--// ── mesh_forge ──────────────────────────────────────────────────────────────-const meshForge = {- name: 'mesh_forge',- title: 'Text/Image → 3D mesh',- description:- 'Generate a textured 3D mesh (GLB) from a text prompt, a single reference image, or 1–4 reference ' +- 'views of the same object (front/back/left/right) for higher-fidelity reconstruction with no ' +- 'hallucinated back. Returns the 3D model URL and an interactive viewer. Feed the result to rig_mesh to ' +- 'make it animation-ready.',- inputSchema: {- type: 'object',- additionalProperties: false,- properties: {- prompt: {- type: 'string',- minLength: 3,- maxLength: 1000,- title: 'Prompt',- description:- 'Text → 3D: description of the single object to model. Optional when an image is provided.',- },- image_url: {- type: 'string',- format: 'uri',- title: 'Reference image',- description: 'Image → 3D: an http(s) URL to reconstruct directly.',- },- image_urls: {- type: 'array',- items: { type: 'string', format: 'uri' },- minItems: 1,- maxItems: 4,- title: 'Multi-view images',- description:- 'Multi-view → 3D: 1–4 http(s) URLs of the SAME object from different angles. Takes precedence over image_url.',- },- },- },- annotations: GEN_ANNOTATIONS,- handler: async (args) => {- const r = await runMeshForge({- prompt: args.prompt,- image_url: args.image_url,- image_urls: args.image_urls,- });- if (r.ok === false) return fail(r);- const structured = {- ok: true,- kind: 'mesh',- mode: r.mode,- glbUrl: r.glbUrl,- viewerUrl: viewerUrl(r.glbUrl),- arUrl: arUrl(r.glbUrl),- prompt: r.prompt,- viewsUsed: r.viewsUsed,- durationMs: r.durationMs,- };- return ok(structured, r.glbUrl, args.prompt || 'mesh');- },-};--// ── rig_mesh ────────────────────────────────────────────────────────────────-const rigMesh = {- name: 'rig_mesh',- title: 'Rig a 3D model',- description:- 'Turn a static 3D model (GLB) into an animation-ready one: adds a humanoid skeleton and skin weights. ' +- 'Pass a GLB URL (e.g. the result of forge_free or mesh_forge) and get back a rigged GLB plus a ' +- 'pose-studio link to animate it.',- inputSchema: {- type: 'object',- additionalProperties: false,- required: ['glb_url'],- properties: {- glb_url: {- type: 'string',- format: 'uri',- title: 'Model URL',- description: 'http(s) URL to the static GLB mesh to rig.',- },- },- },- annotations: GEN_ANNOTATIONS,- handler: async (args) => {- const r = await runRigMesh({ glb_url: args.glb_url });- if (r.ok === false) return fail(r);- const structured = {- ok: true,- kind: 'rigged',- glbUrl: r.riggedGlbUrl,- sourceGlbUrl: r.sourceGlbUrl,- viewerUrl: viewerUrl(r.riggedGlbUrl),- arUrl: arUrl(r.riggedGlbUrl, true),- irlUrl: irlUrl(r.riggedGlbUrl),- poseStudioUrl: poseUrl(r.riggedGlbUrl),- durationMs: r.durationMs,- };- return ok(structured, r.riggedGlbUrl, 'rigged model', { live: true });- },-};--// ── forge_avatar ────────────────────────────────────────────────────────────-const forgeAvatar = {- name: 'forge_avatar',- title: 'Text/Image → rigged avatar',- description:- 'Generate a rigged, animation-ready 3D avatar from a text prompt or reference image(s) in ONE call: ' +- 'it generates a textured mesh and then adds a humanoid skeleton + skin weights, so the result loads ' +- 'straight into the pose studio and plays the idle/walk animation library. A humanoid check runs first; ' +- 'a clearly non-humanoid subject (furniture, vehicle, quadruped) is declined — use mesh_forge or ' +- 'forge_free for those, or set allow_non_humanoid to rig it anyway. Returns the rigged GLB URL, the ' +- 'intermediate mesh URL, a viewer, and a pose-studio link.',- inputSchema: {- type: 'object',- additionalProperties: false,- properties: {- prompt: {- type: 'string',- minLength: 3,- maxLength: 1000,- title: 'Prompt',- description:- 'Description of a single humanoid character. Optional when an image is provided.',- },- image_url: {- type: 'string',- format: 'uri',- title: 'Reference image',- description: 'http(s) URL to a reference image of a character to reconstruct and rig.',- },- image_urls: {- type: 'array',- items: { type: 'string', format: 'uri' },- minItems: 1,- maxItems: 4,- title: 'Multi-view images',- description:- '1–4 http(s) URLs of the SAME character from different angles. Takes precedence over image_url.',- },- allow_non_humanoid: {- type: 'boolean',- default: false,- title: 'Allow non-humanoid',- description: 'Rig even when the prompt does not look like a humanoid character.',- },- },- },- annotations: GEN_ANNOTATIONS,- handler: async (args) => {- const r = await runForgeAvatar({- prompt: args.prompt,- image_url: args.image_url,- image_urls: args.image_urls,- allow_non_humanoid: args.allow_non_humanoid,- });- if (r.ok === false) return fail(r);- // A rig-stage failure degrades to the unrigged mesh (rigged:false in the- // shared core) instead of discarding finished work — reflect it honestly:- // the caller still gets a viewable GLB, flagged not-animation-ready, with- // the rig error attached so they can rig_mesh it once the lane recovers.- const rigged = r.rigged !== false;- const glbUrl = r.riggedGlbUrl || r.meshGlbUrl;- const structured = {- ok: true,- kind: rigged ? 'rigged_avatar' : 'avatar_mesh',- mode: r.mode,- glbUrl,- meshGlbUrl: r.meshGlbUrl,- viewerUrl: viewerUrl(glbUrl),- arUrl: arUrl(glbUrl, rigged),- irlUrl: irlUrl(glbUrl),- ...(rigged- ? { poseStudioUrl: poseUrl(glbUrl) }- : { rigError: r.rigError?.message || 'rigging failed — retry with rig_mesh' }),- prompt: r.prompt,- animationReady: rigged,- durationMs: r.durationMs,- };- return ok(structured, glbUrl, args.prompt || 'avatar', { live: true });- },-};--// The five FREE generation tools, in the order discovery clients should see them.-export const studioTools = [forgeFree, textToAvatar, meshForge, rigMesh, forgeAvatar];--// Names of the tools that submit a real GPU job — the endpoint applies the-// generation rate limits (per-IP hourly + global breaker) only to these, not to-// discovery calls.-export const GENERATION_TOOL_NAMES = new Set(studioTools.map((t) => t.name));diff --git a/mcp-server/src/tools/_studio-core.js b/mcp-server/src/tools/_studio-core.jsindex b5a2141dc..2f2132bd0 100644--- a/mcp-server/src/tools/_studio-core.js+++ b/mcp-server/src/tools/_studio-core.js@@ -6,18 +6,17 @@// text_to_avatar, Replicate: no GPU/LLM work happens here, all of it runs on// the operator-funded backend that holds the provider keys.//-// One implementation, two transports:-// • the npx-distributed stdio MCP server wraps each core in `paid()`/`free()`-// (mcp-server/src/tools/*.js) — x402 USDC gates the call.-// • the hosted, FREE 3D Studio endpoint (api/_studio/*, /api/mcp-studio) calls-// the SAME cores directly with no payment surface — abuse is bounded by-// server-side rate limits instead.+// One implementation behind the npx-distributed stdio MCP server: every tool in+// mcp-server/src/tools/*.js wraps a core in `paid()`/`free()`, and x402 USDC+// gates the paid ones. The hosted FREE 3D Studio endpoint (/api/mcp-studio) is a+// separate lane over the same /api/forge pipeline, with its own client+// (api/_mcp-studio/forge-client.js), no payment surface, and per-IP rate limits.//-// Keeping the generation logic here (not forked into each transport) means the-// stdio and the free HTTP lanes can never drift. This module imports nothing-// payment- or schema-related: only the global `fetch` and the dependency-free-// humanoid classifier, so it loads in the Vercel `api/` bundle (which carries-// neither the @x402 stack nor zod-to-json-schema) unchanged.+// Keeping the generation logic here (not forked across the stdio tools) means+// the five generators and refine_model can never drift. This module imports+// nothing payment- or schema-related: only the global `fetch` and the+// dependency-free humanoid classifier, so it loads without the @x402 stack or+// zod-to-json-schema.import { classifyHumanoidPrompt } from './_humanoid.js';import { composeRefinement, seedLineage, appendVersion, buildLineageChain, branchFrom } from './_lineage.js';@@ -25,8 +24,8 @@ import { resolveLogoPrompt, BRAND_MARK_DIRECTIVE } from './_logo-lexicon.js';// Standard tool error envelope — identical shape to payments.js `toolError`, so// a core's error is indistinguishable whether it is surfaced through the paid-// stdio wrapper or the free HTTP endpoint. Duplicated (not imported) because-// payments.js pulls the @x402 stack, which the api/ bundle must not load.+// wrapper or the free one. Duplicated (not imported) because payments.js pulls+// the @x402 stack, which a core must stay loadable without.export function coreError(code, message, extra) {return { ok: false, error: code, message, ...(extra || {}) };}diff --git a/mcp-server/src/tools/forge-avatar.js b/mcp-server/src/tools/forge-avatar.jsindex d4a9e4c0e..0be6c4a69 100644--- a/mcp-server/src/tools/forge-avatar.js+++ b/mcp-server/src/tools/forge-avatar.js@@ -12,9 +12,10 @@// USDC payment gates the call and all GPU work runs on prod.//// The full chain (humanoid gate → Granite director → generate → auto-rig) lives-// in `_studio-core.js` (runForgeAvatar) so the paid stdio transport and the-// hosted FREE 3D Studio endpoint (api/_studio, /api/mcp-studio) share ONE-// implementation and never drift.+// in `_studio-core.js` (runForgeAvatar) so every stdio tool that bundles the+// chain shares ONE implementation and never drifts. The hosted FREE 3D Studio+// endpoint (/api/mcp-studio) runs the same chain over /api/forge through its own+// client, api/_mcp-studio/forge-client.js.//// Money safety (real users, real funds): a humanoid gate runs BEFORE any work —// a confidently non-humanoid prompt returns a toolError (which the x402 wrapperdiff --git a/mcp-server/src/tools/forge-free.js b/mcp-server/src/tools/forge-free.jsindex 52d4f6763..b80b2ebd4 100644--- a/mcp-server/src/tools/forge-free.js+++ b/mcp-server/src/tools/forge-free.js@@ -6,9 +6,10 @@// drafts — so anyone can turn a text prompt into a downloadable, viewable 3D// model with NO x402 payment and NO API key.//-// The generation logic lives in `_studio-core.js` (runForgeFree) so the stdio-// (paid-transport) server and the hosted FREE 3D Studio endpoint-// (api/_studio, /api/mcp-studio) share ONE implementation and never drift.+// The generation logic lives in `_studio-core.js` (runForgeFree), the same core+// the rest of the stdio server's generators are built on, so none of them drift.+// The hosted FREE 3D Studio endpoint (/api/mcp-studio) pins the same free lane+// over /api/forge through its own client, api/_mcp-studio/forge-client.js.//// Environment (all optional — sensible prod defaults):// FORGE_FREE_API_BASE — three.ws origin. Default https://three.wsdiff --git a/mcp-server/src/tools/mesh-forge.js b/mcp-server/src/tools/mesh-forge.jsindex 70a7f0568..3481a78ad 100644--- a/mcp-server/src/tools/mesh-forge.js+++ b/mcp-server/src/tools/mesh-forge.js@@ -8,9 +8,10 @@// holds the Replicate / watsonx keys). The x402 USDC payment is what gates the// call.//-// The generation logic lives in `_studio-core.js` (runMeshForge) so the paid-// stdio transport and the hosted FREE 3D Studio endpoint (api/_studio,-// /api/mcp-studio) share ONE implementation and never drift. Two modes:+// The generation logic lives in `_studio-core.js` (runMeshForge) so every stdio+// tool that generates a mesh shares ONE implementation and never drifts. The+// hosted FREE 3D Studio endpoint (/api/mcp-studio) drives the same /api/forge+// pipeline through its own client, api/_mcp-studio/forge-client.js. Two modes:// • text→3D — IBM Granite directs the prompt, FLUX renders a reference image,// then TRELLIS / Hunyuan3D reconstruct a textured GLB.// • image→3D — a caller-supplied image_url (or 1–4 multi-view image_urls) isdiff --git a/mcp-server/src/tools/rig-mesh.js b/mcp-server/src/tools/rig-mesh.jsindex 2b16fc9a0..92773a87f 100644--- a/mcp-server/src/tools/rig-mesh.js+++ b/mcp-server/src/tools/rig-mesh.js@@ -9,9 +9,10 @@// credentials; the USDC payment gates the call and all GPU work runs on// three.ws prod.//-// The rig logic lives in `_studio-core.js` (runRigMesh) so the paid stdio-// transport and the hosted FREE 3D Studio endpoint (api/_studio,-// /api/mcp-studio) share ONE implementation and never drift.+// The rig logic lives in `_studio-core.js` (runRigMesh) so every stdio tool that+// rigs shares ONE implementation and never drifts. The hosted FREE 3D Studio+// endpoint (/api/mcp-studio) rigs over the same /api/forge pipeline through its+// own client, api/_mcp-studio/forge-client.js.//// Environment (all optional — sensible prod defaults):// MESH_FORGE_API_BASE — three.ws origin. Default https://three.wsdiff --git a/mcp-server/src/tools/text-to-avatar.js b/mcp-server/src/tools/text-to-avatar.jsindex daa39d261..571a2dbe8 100644--- a/mcp-server/src/tools/text-to-avatar.js+++ b/mcp-server/src/tools/text-to-avatar.js@@ -5,9 +5,10 @@//// Pricing: $0.15 USDC, settled `exact` in USDC on Solana mainnet.//-// The generation logic lives in `_studio-core.js` (runTextToAvatar) so the paid-// stdio transport and the hosted FREE 3D Studio endpoint (api/_studio,-// /api/mcp-studio) share ONE implementation and never drift. It synchronously+// The generation logic lives in `_studio-core.js` (runTextToAvatar), the shared+// core the stdio server's generators are built on, so none of them drift. The+// hosted FREE 3D Studio endpoint (/api/mcp-studio) has its own avatar lane in+// api/_mcp-studio/forge-client.js. It synchronously// submits a Replicate prediction and polls until terminal/timeout; the returned// GLB URL is the Replicate-hosted output (optionally rehosted on three.ws R2// when MCP_TEXT_TO_AVATAR_REHOST is enabled).