@modelcontextprotocol/server-threejs 0.4.1 → 0.4.2
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 +49 -0
- package/dist/index.js +3644 -44
- package/dist/mcp-app.html +215 -219
- package/dist/server.js +1755 -1753
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -4,6 +4,27 @@
|
|
|
4
4
|
|
|
5
5
|
Interactive 3D scene renderer using Three.js. Demonstrates streaming code preview and full MCP App integration.
|
|
6
6
|
|
|
7
|
+
## MCP Client Configuration
|
|
8
|
+
|
|
9
|
+
Add to your MCP client configuration (stdio transport):
|
|
10
|
+
|
|
11
|
+
```json
|
|
12
|
+
{
|
|
13
|
+
"mcpServers": {
|
|
14
|
+
"threejs": {
|
|
15
|
+
"command": "npx",
|
|
16
|
+
"args": [
|
|
17
|
+
"-y",
|
|
18
|
+
"--silent",
|
|
19
|
+
"--registry=https://registry.npmjs.org/",
|
|
20
|
+
"@modelcontextprotocol/server-threejs",
|
|
21
|
+
"--stdio"
|
|
22
|
+
]
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
```
|
|
27
|
+
|
|
7
28
|
## Features
|
|
8
29
|
|
|
9
30
|
- **Interactive 3D Rendering**: Execute JavaScript code to create and animate Three.js scenes
|
|
@@ -108,3 +129,31 @@ React component that:
|
|
|
108
129
|
- Displays streaming preview from `toolInputsPartial.code` as code arrives
|
|
109
130
|
- Executes final code from `toolInputs.code` when complete
|
|
110
131
|
- Renders to a pre-created canvas with configurable height
|
|
132
|
+
|
|
133
|
+
## Performance
|
|
134
|
+
|
|
135
|
+
### Visibility-Based Pause
|
|
136
|
+
|
|
137
|
+
Animation automatically pauses when the view scrolls out of view:
|
|
138
|
+
|
|
139
|
+
- Uses `IntersectionObserver` to track visibility (browser-native, no polling)
|
|
140
|
+
- Wraps `requestAnimationFrame` to skip frames when not visible
|
|
141
|
+
- Animation loop stops completely → zero CPU usage while hidden
|
|
142
|
+
- Queued callbacks resume instantly when scrolled back into view
|
|
143
|
+
|
|
144
|
+
This is transparent to user code - just use `requestAnimationFrame` normally.
|
|
145
|
+
|
|
146
|
+
### Transparent Background
|
|
147
|
+
|
|
148
|
+
Supports alpha transparency for seamless host UI integration:
|
|
149
|
+
|
|
150
|
+
```javascript
|
|
151
|
+
const renderer = new THREE.WebGLRenderer({
|
|
152
|
+
canvas,
|
|
153
|
+
antialias: true,
|
|
154
|
+
alpha: true,
|
|
155
|
+
});
|
|
156
|
+
renderer.setClearColor(0x000000, 0); // Fully transparent
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
This is the default - 3D objects composite directly over the host background.
|