depthview-mcp
Local server between the Depthview browser extension, your source code and your AI coding
agent. The agent can read the three.js scene that is really running, change values on the live
page (like a dat.GUI it can drive), look at the result, and write the final values into your
files. It runs on your machine, listens on 127.0.0.1 only, and never contacts the network.
Quick start with Claude Code
Easiest: install the plugin (server, skill and slash commands in one step), see
the plugin repository:
/plugin marketplace add himavamsi12/depthview-plugin
/plugin install depthview@depthview
Or set the project up by hand:
cd my-r3f-project
npx depthview-mcp init # adds the server to .mcp.json and the skill to .claude/skills/
Restart Claude Code, open your dev site, click the Depthview icon, then ask Claude to
"pair with Depthview" and type the code it gives into the side panel under
AI agent & code sync. After that: "make the fill light brighter and a bit higher", or
change things yourself in the inspector and say "write my Depthview changes into the code".
No agent connection? The Copy for AI button under Changes copies the same change list
(object, file and line, old value to new value) as a message you can paste into any AI tool.
Without an agent
cd my-r3f-project
npx depthview-mcp # prints a 6-digit pairing code
- Open your dev site, open Depthview, switch to Scene mode.
- In the side panel under Code sync, enter the pairing code.
- Change something, click Apply to code.
Simple literal props (position, rotation, scale, intensity, color, fov, …) are
rewritten immediately with AST editing: no AI involved, formatting and comments untouched.
Edits that cannot be mapped exactly (values computed in code, props spread from a variable) are
queued for an AI agent through MCP.
Your project needs depthview-r3f-bridge so objects know which JSX element created them.
Connecting Claude Code or Cursor
Terminal mode serves MCP over HTTP:
claude mcp add --transport http depthview http://127.0.0.1:7411/mcp
Or let the client start the server itself (stdio). The pairing code is then available from the
get_pairing_code tool and on stderr:
{
"mcpServers": {
"depthview": { "command": "npx", "args": ["depthview-mcp", "--stdio", "--root", "."] }
}
}
npx depthview-mcp init writes that config and copies skill/SKILL.md into
.claude/skills/depthview/, which teaches Claude Code the workflow.
Without the extension
The agent can work on a scene with no extension installed. open_preview { url } starts the
Chrome (or Chromium, Edge, Brave) on your machine in headless mode with a throw-away profile,
loads your dev page and gives it the same hook the extension uses. From then on the live
tools below work on that page: screenshots, the scene, values, shaders, effects, the realism
look, the visual audit, performance. It can emulate any screen (width, height,
pixelRatio: 390 × 844 at 3 is a phone). Set DEPTHVIEW_CHROME to use a particular browser.
Not in the preview: camera-path recording and editing, and seeing it yourself. Pair the
extension for those; when it is paired, it is used instead.
Tools
| Tool |
What it does |
list_pending_edits |
Edits from the inspector, by status (default: queued) |
get_edit_context |
Source around the target element, and why the edit was queued |
apply_edit |
Exact JSX prop replacement by AST; optional expression |
mark_edit_done |
Report an edit the agent made with its own tools |
get_scene_snapshot |
Live scene tree and values as JSON |
Live scene (the inspector must be open on the page):
| Tool |
What it does |
get_status |
Paired? Which page, what is selected, how many values are changed |
find_objects |
Search the scene by name, type or kind |
describe_scene |
Scene scale in scene units, camera focus, camera, lights, counts |
get_object |
All values of one object, editable paths, world bounds, source location |
set_value |
Change one value on the live page (recorded, undoable; degrees: true for rotation/angle) |
set_values |
Change several values at once; all checked first, one undo step |
select_object |
Select an object in the inspector |
take_screenshot |
Picture of the site, the 3D view or the tab; compare: true adds the previous one |
undo_change |
Undo the latest live change |
reset_changes |
Put every value back |
get_changes |
Everything changed, by you or the agent, with source info and JSX |
apply_changes_to_code |
Write all changes into the source ("Apply to code") |
Measure, diagnose and try things live:
| Tool |
What it does |
get_performance |
Frame rate, frame time, draw calls, triangles, render passes |
get_resources |
Textures, geometries and materials by GPU memory |
get_errors |
Uncaught errors, console errors and warnings, failed shader programs |
get_lighting |
Lights and shadow set-up, with the problems found |
get_animated_values |
Which values the site's own code drives, over time or on scroll |
get_camera_views |
The view on load and at each section: pose, hold, changed |
set_camera_view |
Set a view: frame an object, exact pose, or the developer's own view |
get_camera_path |
The site camera along the scroll |
edit_camera_path |
Edit the scroll path live: start, move/add/remove keys, preview |
get_camera_path_edit |
The edited path: keys, changes, JSON and code |
save_camera_path |
Write it into the project as camera-path.json |
get_realism |
Realism score out of 100, what is missing, and the current look |
fix_realism |
One-click fixes: tone mapping, pixel ratio, world, shadows, bevels |
set_look |
Tune colour, world lighting, shadows, bevels and lens effects |
set_surface |
What one object is made of: a preset or single values |
measure_look_cost |
Frame rate with and without the look, and what each part costs |
lighten_look |
Step the look down until the frame rate is back |
adapt_model |
Fit the look to a new model; measure its size and grounding |
compare_to_reference |
Differences from a reference picture, with a look change for each |
find_assets |
Search free CC0 models, textures and lighting panoramas (Poly Haven) |
import_asset |
Download one into the project within a size budget, with its code |
create_scene |
Write a starter scene: objects, look, camera path, controls |
save_look |
Write the look into the project as depthview-look.json |
get_site_controls |
Controls the site declares with depthviewControls |
set_site_control |
Change one of them live |
save_site_controls |
Write changed control values back into the source |
get_shader |
The GLSL that runs, with line numbers |
set_shader |
Try a shader live; compile errors come back, a broken one is undone |
add_object |
Add a copy, a primitive, a group or a light; returns its JSX |
open_preview |
Open the page in a headless Chrome: every live tool, no extension |
close_preview |
Close that browser |
patch_shader |
Inject GLSL into a built-in material; returns the onBeforeCompile |
list_effects |
Effect kinds, presets and every uniform with its range |
add_effect |
Particles, smoke, clouds, fog or a custom GLSL object, live |
set_effect |
Tune an effect: uniforms, count, blending, shader source |
get_effect_code |
The effect as an R3F component or a three.js module |
audit_visuals |
Visual bugs from the set-up and the pixels of a real frame |
audit_camera_motion |
Is the scroll camera cinematic: jumps, reversals, pacing, roll |
get_guide |
Reference guides: award-level sites, rendering, shaders, particles… |
remove_object |
Take an object out of the live scene |
set_scroll |
Scroll the site to a position |
set_time |
Hold, step or release the site's animation |
set_viewport |
Resize the window, set the pixel ratio; reset to undo |
take_screenshot takes a view: site (the page as a visitor sees it), scene (the
inspector's 3D view) or the whole tab.
What every client gets on connect
Not only Claude Code with the skill: any MCP client (Claude Desktop, Cursor, …) receives
- Server instructions: the workflow in ten lines (status first, describe the scene, small
steps checked with screenshots, then write to source).
next in results: get_status, find_objects, get_object, set_value(s),
get_changes and apply_changes_to_code say which step to take now. set_value(s) report
overwritten: true when the site's own code moved the value back (it is animated).
- Prompts (slash commands in the client):
pair, tune (with a goal), apply,
camera-views (with what each view should show), camera-path, realism (with the look
you are after), new-scene (with what the page is
for), performance. In Claude Code:
/mcp__depthview__tune warmer light, /mcp__depthview__realism silver product shot.
- Resources:
depthview://status, depthview://scene, depthview://selection,
depthview://changes.
Options
--root <dir> project root (default: cwd; nothing outside it is read or written) ·
--port <n> (default 7411) · --stdio · init (set the project up for Claude Code)
Security
- Binds to
127.0.0.1. WebSocket connections from web pages are refused (only the extension's
origin is accepted) and every socket must present the one-time pairing code first.
- The code is replaced as soon as it is used, and after 5 wrong attempts.
- File paths are resolved (symlinks included) and must be source files inside the project root.