depthview-mcp 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +144 -2
- package/dist/cli.js +1233 -0
- package/package.json +33 -4
- package/skill/SKILL.md +309 -0
package/README.md
CHANGED
|
@@ -1,3 +1,145 @@
|
|
|
1
|
-
#
|
|
1
|
+
# depthview-mcp
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Local server between the Depthview browser extension, your source code and your AI coding
|
|
4
|
+
agent. The agent can read the three.js scene that is really running, change values on the live
|
|
5
|
+
page (like a dat.GUI it can drive), look at the result, and write the final values into your
|
|
6
|
+
files. It runs on your machine, listens on `127.0.0.1` only, and never contacts the network.
|
|
7
|
+
|
|
8
|
+
## Quick start with Claude Code
|
|
9
|
+
|
|
10
|
+
Easiest: install the plugin (server, skill and slash commands in one step), see
|
|
11
|
+
[`plugins/claude-code`](../../plugins/claude-code/README.md):
|
|
12
|
+
|
|
13
|
+
```text
|
|
14
|
+
/plugin marketplace add himavamsi12/depthview
|
|
15
|
+
/plugin install depthview@depthview
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Or set the project up by hand:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
cd my-r3f-project
|
|
22
|
+
npx depthview-mcp init # adds the server to .mcp.json and the skill to .claude/skills/
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Restart Claude Code, open your dev site, click the Depthview icon, then ask Claude to
|
|
26
|
+
"pair with Depthview" and type the code it gives into the side panel under
|
|
27
|
+
**AI agent & code sync**. After that: "make the fill light brighter and a bit higher", or
|
|
28
|
+
change things yourself in the inspector and say "write my Depthview changes into the code".
|
|
29
|
+
|
|
30
|
+
No agent connection? The **Copy for AI** button under Changes copies the same change list
|
|
31
|
+
(object, file and line, old value to new value) as a message you can paste into any AI tool.
|
|
32
|
+
|
|
33
|
+
## Without an agent
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
cd my-r3f-project
|
|
37
|
+
npx depthview-mcp # prints a 6-digit pairing code
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
1. Open your dev site, open Depthview, switch to **Scene mode**.
|
|
41
|
+
2. In the side panel under **Code sync**, enter the pairing code.
|
|
42
|
+
3. Change something, click **Apply to code**.
|
|
43
|
+
|
|
44
|
+
Simple literal props (`position`, `rotation`, `scale`, `intensity`, `color`, `fov`, …) are
|
|
45
|
+
rewritten immediately with AST editing: no AI involved, formatting and comments untouched.
|
|
46
|
+
Edits that cannot be mapped exactly (values computed in code, props spread from a variable) are
|
|
47
|
+
queued for an AI agent through MCP.
|
|
48
|
+
|
|
49
|
+
Your project needs `@depthview/r3f-bridge` so objects know which JSX element created them.
|
|
50
|
+
|
|
51
|
+
## Connecting Claude Code or Cursor
|
|
52
|
+
|
|
53
|
+
Terminal mode serves MCP over HTTP:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
claude mcp add --transport http depthview http://127.0.0.1:7411/mcp
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Or let the client start the server itself (stdio). The pairing code is then available from the
|
|
60
|
+
`get_pairing_code` tool and on stderr:
|
|
61
|
+
|
|
62
|
+
```json
|
|
63
|
+
{
|
|
64
|
+
"mcpServers": {
|
|
65
|
+
"depthview": { "command": "npx", "args": ["depthview-mcp", "--stdio", "--root", "."] }
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
`npx depthview-mcp init` writes that config and copies `skill/SKILL.md` into
|
|
71
|
+
`.claude/skills/depthview/`, which teaches Claude Code the workflow.
|
|
72
|
+
|
|
73
|
+
## Tools
|
|
74
|
+
|
|
75
|
+
| Tool | What it does |
|
|
76
|
+
| -------------------- | ------------------------------------------------------------- |
|
|
77
|
+
| `list_pending_edits` | Edits from the inspector, by status (default: queued) |
|
|
78
|
+
| `get_edit_context` | Source around the target element, and why the edit was queued |
|
|
79
|
+
| `apply_edit` | Exact JSX prop replacement by AST; optional `expression` |
|
|
80
|
+
| `mark_edit_done` | Report an edit the agent made with its own tools |
|
|
81
|
+
| `get_scene_snapshot` | Live scene tree and values as JSON |
|
|
82
|
+
|
|
83
|
+
Live scene (the inspector must be open on the page):
|
|
84
|
+
|
|
85
|
+
| Tool | What it does |
|
|
86
|
+
| ----------------------- | ------------------------------------------------------------------------------------------ |
|
|
87
|
+
| `get_status` | Paired? Which page, what is selected, how many values are changed |
|
|
88
|
+
| `find_objects` | Search the scene by name, type or kind |
|
|
89
|
+
| `describe_scene` | Scene scale in scene units, camera focus, camera, lights, counts |
|
|
90
|
+
| `get_object` | All values of one object, editable paths, world bounds, source location |
|
|
91
|
+
| `set_value` | Change one value on the live page (recorded, undoable; `degrees: true` for rotation/angle) |
|
|
92
|
+
| `set_values` | Change several values at once; all checked first, one undo step |
|
|
93
|
+
| `select_object` | Select an object in the inspector |
|
|
94
|
+
| `take_screenshot` | Picture of the site, the 3D view or the tab; `compare: true` adds the previous one |
|
|
95
|
+
| `undo_change` | Undo the latest live change |
|
|
96
|
+
| `reset_changes` | Put every value back |
|
|
97
|
+
| `get_changes` | Everything changed, by you or the agent, with source info and JSX |
|
|
98
|
+
| `apply_changes_to_code` | Write all changes into the source ("Apply to code") |
|
|
99
|
+
|
|
100
|
+
Measure, diagnose and try things live:
|
|
101
|
+
|
|
102
|
+
| Tool | What it does |
|
|
103
|
+
| --------------------- | -------------------------------------------------------------------- |
|
|
104
|
+
| `get_performance` | Frame rate, frame time, draw calls, triangles, render passes |
|
|
105
|
+
| `get_resources` | Textures, geometries and materials by GPU memory |
|
|
106
|
+
| `get_errors` | Uncaught errors, console errors and warnings, failed shader programs |
|
|
107
|
+
| `get_lighting` | Lights and shadow set-up, with the problems found |
|
|
108
|
+
| `get_animated_values` | Which values the site's own code drives, over time or on scroll |
|
|
109
|
+
| `get_camera_path` | The site camera along the scroll |
|
|
110
|
+
| `get_shader` | The GLSL that runs, with line numbers |
|
|
111
|
+
| `set_shader` | Try a shader live; compile errors come back, a broken one is undone |
|
|
112
|
+
| `add_object` | Add a copy, a primitive, a group or a light; returns its JSX |
|
|
113
|
+
| `remove_object` | Take an object out of the live scene |
|
|
114
|
+
| `set_scroll` | Scroll the site to a position |
|
|
115
|
+
| `set_time` | Hold, step or release the site's animation |
|
|
116
|
+
| `set_viewport` | Resize the window, set the pixel ratio; `reset` to undo |
|
|
117
|
+
|
|
118
|
+
`take_screenshot` takes a `view`: `site` (the page as a visitor sees it), `scene` (the
|
|
119
|
+
inspector's 3D view) or the whole tab.
|
|
120
|
+
|
|
121
|
+
## What every client gets on connect
|
|
122
|
+
|
|
123
|
+
Not only Claude Code with the skill: any MCP client (Claude Desktop, Cursor, …) receives
|
|
124
|
+
|
|
125
|
+
- **Server instructions**: the workflow in ten lines (status first, describe the scene, small
|
|
126
|
+
steps checked with screenshots, then write to source).
|
|
127
|
+
- **`next` in results**: `get_status`, `find_objects`, `get_object`, `set_value(s)`,
|
|
128
|
+
`get_changes` and `apply_changes_to_code` say which step to take now. `set_value(s)` report
|
|
129
|
+
`overwritten: true` when the site's own code moved the value back (it is animated).
|
|
130
|
+
- **Prompts** (slash commands in the client): `pair`, `tune` (with a goal), `apply`,
|
|
131
|
+
`performance`. In Claude Code: `/mcp__depthview__tune warmer light`.
|
|
132
|
+
- **Resources**: `depthview://status`, `depthview://scene`, `depthview://selection`,
|
|
133
|
+
`depthview://changes`.
|
|
134
|
+
|
|
135
|
+
## Options
|
|
136
|
+
|
|
137
|
+
`--root <dir>` project root (default: cwd; nothing outside it is read or written) ·
|
|
138
|
+
`--port <n>` (default 7411) · `--stdio` · `init` (set the project up for Claude Code)
|
|
139
|
+
|
|
140
|
+
## Security
|
|
141
|
+
|
|
142
|
+
- Binds to `127.0.0.1`. WebSocket connections from web pages are refused (only the extension's
|
|
143
|
+
origin is accepted) and every socket must present the one-time pairing code first.
|
|
144
|
+
- The code is replaced as soon as it is used, and after 5 wrong attempts.
|
|
145
|
+
- File paths are resolved (symlinks included) and must be source files inside the project root.
|