viewer-mcp
Lets an AI agent build and edit a live three.js scene, with tools to add, update, and remove objects, set the camera, and clear the scene; changes are synced to the browser viewer over WebSocket.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@viewer-mcp Build a small table with four legs and put a blue vase on it"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
viewer-mcp
An MCP (Model Context Protocol) server that lets an AI agent build and edit a live three.js / WebGL scene in plain language. Ask Claude "put a red sphere on top of the box", and the scene in your browser updates as the tools run.

What it shows
Area | How it's done |
MCP tools | 7 tools ( |
Guardrails | Coordinate bounds, scale limits, a cap on object count and hex-only colors. When a request breaks a rule, the tool returns an error the model can act on instead of crashing. A failed update leaves the scene unchanged. |
Human-in-the-loop |
|
Traceability | Every tool call writes one structured JSON trace line (trace id, args, outcome, duration) to stderr. stdout stays reserved for the protocol. |
Evaluation harness |
|
Tests & CI | 22 tests with Vitest: unit, MCP integration and viewer bridge. GitHub Actions runs typecheck, tests and build on Node 20 and 22. |
Viewer | three.js + WebGL, kept in sync over WebSocket. Meshes are matched by object id, so only objects that changed are rebuilt. |
Claude / MCP host ──stdio──▶ MCP server ──▶ SceneStore (guardrails) ──WebSocket──▶ three.js viewer
│
└─▶ JSON traces (stderr)Related MCP server: canvas3d-mcp
Run it
npm install
npm run build
npm run demo # builds a sample scene through real MCP tool calls
# open http://127.0.0.1:5174Use it from Claude Desktop / Claude Code
{
"mcpServers": {
"viewer": { "command": "node", "args": ["/absolute/path/to/viewer-mcp/dist/src/main.js"] }
}
}Open http://127.0.0.1:5174, then ask: "Build a small table with four legs and put a blue vase on it."
Test and evaluate
npm test # unit + integration + scripted eval scenarios
npm run eval:llm # optional: Claude runs every scenario (uses API credits)The LLM eval uses claude-opus-5-5 by default (override with EVAL_MODEL). It reads credentials from ANTHROPIC_API_KEY or an ant auth login profile. Set EVAL_ONLY=<text> to run matching scenarios and EVAL_VERBOSE=1 to print Claude's tool calls and replies.
Latest results (Nov 2026, claude-opus-5-5, effort medium)
7/7 scenarios passed, using about 32K tokens in total.
Scenario | Result |
Add a red cube | Pass |
Stack a sphere on a box | Pass |
Recolor by name, leave others alone | Pass |
Out-of-bounds move is refused | Pass |
Clear scene, user confirms | Pass |
Clear scene, user declines | Pass |
Clear scene, client cannot ask the user | Pass |
On the first run, the out-of-bounds scenario failed (6/7). The transcript showed Claude read the ±50 limit in the tool schema, never made the invalid call, and explained the limit to the user. The scenario had required the server guardrail to fire, which tested how the move was blocked rather than whether it was. It now checks that the object didn't move. The server-side guardrail still has its own test in test/server.test.ts.
Layout
src/scene.ts scene model + guardrails
src/server.ts MCP tools, tracing wrapper, elicitation
src/bridge.ts HTTP + WebSocket bridge to the viewer
viewer/index.html three.js / WebGL viewer
evals/ scenarios, harness, Claude-driven eval
test/ Vitest suitesLicense
MIT, see LICENSE.
Available Tools
7 toolsadd_objectC
Add a primitive to the scene. At most 50 objects.
Inputs: shape (required), name, color, scale, +1 more.
clear_sceneADestructive
Remove ALL objects. The server asks the human to confirm (MCP elicitation); if they decline or the client cannot ask, nothing is deleted.
Inputs: no named parameters.
get_sceneARead-only
Return every object in the scene plus the camera. Call this before editing so you use real ids.
Inputs: no named parameters.
list_objectsBRead-only
List objects, optionally filtered by shape or by a case-insensitive name match.
Inputs: shape, nameContains.
remove_objectBDestructive
Remove one object by id.
Inputs: id (required).
set_cameraB
Move the camera. target defaults to the current look-at point.
Inputs: position (required), target.
update_objectB
Change an object's color, position, scale or name. Only the fields you pass change.
Inputs: id (required), name, color, scale, +1 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 7 tools
Most tools map to a distinct action (add/update/remove/clear/set_camera), but list_objects and get_scene both return scene contents, which could cause an agent to pick the wrong one. The descriptions do differentiate them (filtered list vs. full scene plus camera), so confusion is limited.
All seven tools follow a clean snake_case verb_noun pattern (list_objects, get_scene, add_object, update_object, remove_object, clear_scene, set_camera). No mixed conventions or vague verbs.
Seven tools is a well-scoped surface for a 3D scene viewer, and each one clearly earns its place. There are no redundant or filler tools.
The object lifecycle is fully covered (list, read, add, update, remove, bulk clear) plus camera positioning and reading via get_scene. Minor gaps exist, such as no way to read or reset the camera independently or duplicate objects, but core workflows are complete.
Related MCP Connectors
A shared 3D world that agents build in. Look around, claim a space, place things, propose edits.
3D avatars, embeds, glTF tools, agent memory, and on-chain agent identity from three.ws.
A shared programmable world where AI agents explore, build, and create interactive objects.
A web-based 3D sandbox world where AI agents can play with humans and build all kinds of things.
Related MCP Servers
- AlicenseAqualityDmaintenanceEnables AI agents to control and manipulate live 3D scenes across frameworks like Three.js, A-Frame, and Babylon.js using a comprehensive set of object and environment tools. It features an integrated in-world chat system that allows for real-time scene modifications directly from within the 3D canvas.333MIT
- FlicenseAqualityDmaintenanceEnables AI agents to create, render, and validate 3D scenes, 2D art, and games in HTML canvas using Three.js, WebGL, or Canvas 2D, with multi-angle screenshots, structured validation reports, and interactive playtesting.5-
- AlicenseNot gradedqualityAmaintenanceEnables AI agents to inspect and modify live Three.js scenes in real time through 59 tools covering objects, materials, shaders, textures, animations, performance monitoring, memory diagnostics, and code generation. Works with vanilla Three.js, React Three Fiber, and any framework without changing your project, using an injected browser bridge and in-page devtools overlay.6,808 npmMIT
- AlicenseNot gradedqualityAmaintenanceEnables AI agents to inspect a running Three.js scene in the browser and try out live edits to objects, materials, shaders, lights, camera and animation without touching project files. Every change is recorded and can be exported as ready-to-paste vanilla Three.js or React Three Fiber code, alongside performance audits and frame capture.6,808 npmMIT