modelforge-mcp

v0.1.0
modelforge-mcp Checked 3 days ago Published 1 month ago

Local stdio MCP server for ModelForge: generate 3D models (GLB) from text or images and save them into a folder on your machine.

A local MCP server (stdio) for Claude Code, Gemini CLI, Cursor and any other MCP client. It calls the ModelForge REST API with your API key, waits for the job, and writes the results into a folder on your machine (for example your game's Assets/Models): Existing files are never overwritten: a second download of the same job writes model-2.glb, preview-2.png, … Install nothing up front: npx -y modelforge-mcp downloads and runs the published package.

Summary extracted from the README.

modelforge-mcp — save ModelForge models into your project folder

A local MCP server (stdio) for Claude Code, Gemini CLI, Cursor and any other MCP client. It calls the ModelForge REST API with your API key, waits for the job, and writes the results into a folder on your machine (for example your game's Assets/Models):

<output_dir>/<slug>-<first 8 of job id>/
  model.glb          the generated model (TRELLIS.2, PBR textures)
  preview.png        server-rendered preview (when available)
  concept.<ext>      the concept / input image the model was built from
  manifest.json      run manifest (parameters, face count, timings)
  provenance.json    licence-provenance record

Existing files are never overwritten: a second download of the same job writes model-2.glb, preview-2.png, …

Install nothing up front: npx -y modelforge-mcp downloads and runs the published package.

Requires Node.js 20 or newer.

Configuration (environment)

Variable Required Default
MODELFORGE_API_KEY yes — an mf_… (or legacy gf_…) key from the web app's API keys page —
MODELFORGE_URL no https://gameforge-web-556467290298.us-central1.run.app
MODELFORGE_OUTPUT_DIR no — absolute, or relative to the server's working directory <cwd>/modelforge-models

The key is only sent to MODELFORGE_URL (never to image URLs or signed download URLs) and is never logged.

Claude Code

claude mcp add modelforge-local \
  -e MODELFORGE_API_KEY=mf_YOUR_KEY \
  -e MODELFORGE_OUTPUT_DIR=/path/to/MyGame/Assets/Models \
  -- npx -y modelforge-mcp

From a checkout (until the npm package is published):

claude mcp add modelforge-local \
  -e MODELFORGE_API_KEY=mf_YOUR_KEY \
  -e MODELFORGE_OUTPUT_DIR=/path/to/MyGame/Assets/Models \
  -- node /path/to/GameForgeCloud/packages/mcp-local/dist/index.js

Gemini CLI

~/.gemini/settings.json (or .gemini/settings.json in the project):

{
  "mcpServers": {
    "modelforge-local": {
      "command": "npx",
      "args": ["-y", "modelforge-mcp"],
      "env": {
        "MODELFORGE_API_KEY": "mf_YOUR_KEY",
        "MODELFORGE_OUTPUT_DIR": "/path/to/MyGame/Assets/Models"
      },
      "timeout": 2400000
    }
  }
}

The timeout (ms) must cover a full generation when wait is true (default 30 min wait). From a checkout use "command": "node", "args": ["/path/to/GameForgeCloud/packages/mcp-local/dist/index.js"].

Cursor

.cursor/mcp.json in your project (or ~/.cursor/mcp.json):

{
  "mcpServers": {
    "modelforge-local": {
      "command": "npx",
      "args": ["-y", "modelforge-mcp"],
      "env": {
        "MODELFORGE_API_KEY": "mf_YOUR_KEY",
        "MODELFORGE_OUTPUT_DIR": "/path/to/MyGame/Assets/Models"
      }
    }
  }
}

Tools

Tool What it does
generate_model Exactly one source: prompt (text-to-3D), image_path (local PNG/JPEG/WebP ≤ 20 MB) or image_url (downloaded locally, 20 s timeout, then uploaded). changes (3–500 chars, images only) redraws the image first. Options: name, resolution (512/1024/1536, default: plan max), texture_size (1024/2048/4096), seed, output_dir, wait (default true), timeout_minutes (default 30). With wait, polls every 10 s, sends MCP progress notifications when the client asks for them, saves the files and returns { job_id, status, folder, files, seconds, elapsed_seconds, provenance }. With wait: false returns the job id at once.
download_model Saves a succeeded job's files the same way (job_id, optional output_dir).
get_job Job JSON (status, error, signed URLs, manifest, provenance).
list_models Recent jobs (limit, default 20).
account Plan, models left and plan limits.

output_dir: absolute paths are used as is; relative paths resolve against the server's working directory (usually the project your client was started in). The folder is created if missing.

Errors come back as tool errors with a code: unauthorized (401, bad key), no_credits (402, no models left), concurrency_limit (429, wait for a running job), resolution_not_allowed (403, omit resolution), server_error (5xx, retry in a minute), job_failed (the server's failure reason). Status polling survives transient network errors (3 attempts per poll). Job creation is never retried automatically, so a network error cannot create a second job.

Example prompt

Use modelforge-local. Generate a model from ./concepts/goblin-shaman.png named "goblin-shaman" at 1536
and save it into Assets/Models/Characters. Then tell me the files and the licence classification.

Development

npm ci
npm test        # typecheck + vitest (mocked fetch, temp dirs)
npm run build   # tsc -> dist/, bin is dist/index.js
MODELFORGE_API_KEY=mf_... node dist/index.js   # speaks MCP on stdin/stdout