跳到主内容
智客 ZICQ

技能库 智客分类:Agent 工作流 threejs-devtools-mcp

Threejs Devtools Mcp

MCP服务器,用于实时3.js场景检查,材料编辑,阴影调试,以及AI代理的性能监测

194 安装量

官方网址:skills.sh

技能介绍

先看中文介绍;官方 description 原文单独保留,不改写 SKILL.md。

做什么

MCP服务器,用于实时3.js场景检查,材料编辑,阴影调试,以及AI代理的性能监测

何时用

官方 description 未单独写出 Use when。按规范,代理会在用户任务与这段 description 的关键词匹配时激活本技能。

代理如何加载

按 Agent Skills 渐进披露:启动时只加载 name 与 description(约 100 token);任务匹配后才读入整份 SKILL.md 正文;scripts/、references/、assets/ 仅在需要时再读。 本文件正文结构:threejs-devtools-mcp、Installation、Claude Code、Claude Desktop、Cursor、Windsurf。

文件分析

文件分析:这是一份仅含 SKILL.md 的指令型技能,代理激活后整份正文进入上下文。

官方 description(原文)

MCP server for real-time Three.js scene inspection, material editing, shader debugging, and performance monitoring from AI agents

threejs-devtools-mcpInstallationClaude CodeClaude DesktopCursorWindsurfVS Code (Copilot)How It WorksCore Tool CategoriesScene InspectionMaterial & Shader ManagementObject Manipulation

来源分类:skills.sh agent-skill

SKILL.md 与 Agent 调用

官方规范 ↗
name
threejs-devtools-mcp
description
MCP server for real-time Three.js scene inspection, material editing, shader debugging, and performance monitoring from AI agents
  1. 发现技能客户端向 Agent 提供名称与描述目录。
  2. 匹配与调用用户指定或任务匹配后,载入 SKILL.md 指令。
  3. 按需加载按步骤读取参考文档、使用脚本与素材。

具体调用语法与可用工具以目标 Agent 客户端为准。 查看调用机制说明 ↗

安装这个技能

Skills CLI ↗

先选择目标 Agent 和安装范围,保留技能包的附属文件,安装后检查客户端能否发现该技能。

交给 Agent 安装

复制安装指令给支持 Agent Skills 的代理,确认其中的目标目录与客户端匹配。

把 Agent Skill「threejs-devtools-mcp」安装到我的项目:SKILL.md 原文与官方 description 见 https://zicq.com/zh/skills/skl-01f8314e4f7a4ab3-Threejs-Devtools-%E9%BA%A6%E5%85%8B%E6%99%AE.html
请存为 .cursor/skills/threejs-devtools-mcp/SKILL.md 或 .claude/skills/threejs-devtools-mcp/SKILL.md,frontmatter 的 name 与 description 保持原样,不要改写。

GitHub 完整包 ↗

终端安装 · Skills CLI

需要 Node.js 与 npx。先查看仓库技能列表,确认实际名称。

npx skills add 'https://github.com/reason-machines/devtools-skills' --list

npx skills add 'https://github.com/reason-machines/devtools-skills' --skill 'threejs-devtools-mcp'

CLI 会交互选择目标 Agent,默认安装到项目;用户级安装使用 -g。先通过查看命令核对仓库内容,再用 npx skills list 检查已安装技能。

阅读排版
--- name: threejs-devtools-mcp description: MCP server for real-time Three.js scene inspection, material editing, shader debugging, and performance monitoring from AI agents triggers: - "inspect my Three.js scene" - "debug Three.js materials and shaders" - "show me the scene graph" - "optimize Three.js performance" - "edit materials in real time" - "generate React Three Fiber components" - "check for Three.js memory leaks" - "analyze rendering bottlenecks" --- # threejs-devtools-mcp > Skill by [ara.so](https://ara.so) — Devtools Skills collection. MCP server providing 59 tools for inspecting and modifying Three.js scenes in real time. Works with vanilla Three.js, React Three Fiber, and any framework. Zero code changes required — connects via Chrome DevTools Protocol. ## Installation ### Claude Code ```bash claude mcp add threejs-devtools-mcp -- npx threejs-devtools-mcp ``` ### Claude Desktop Add to `claude_desktop_config.json`: ```json { "mcpServers": { "threejs-devtools-mcp": { "command": "npx", "args": ["-y", "threejs-devtools-mcp"] } } } ``` ### Cursor Add to `.cursor/mcp.json`: ```json { "mcpServers": { "threejs-devtools-mcp": { "command": "npx", "args": ["-y", "threejs-devtools-mcp"] } } } ``` ### Windsurf Add to `~/.codeium/windsurf/mcp_config.json`: ```json { "mcpServers": { "threejs-devtools-mcp": { "command": "npx", "args": ["-y", "threejs-devtools-mcp"] } } } ``` ### VS Code (Copilot) Add to `.vscode/mcp.json`: ```json { "servers": { "threejs-devtools-mcp": { "command": "npx", "args": ["-y", "threejs-devtools-mcp"] } } } ``` ## How It Works 1. **Start your dev server** — `npm run dev` or your usual command 2. **MCP server auto-detects port** from package.json and opens Chrome at `localhost:9222` 3. **Keep the browser tab open** — MCP connects via WebSocket bridge 4. **Ask the AI** — "show me the scene tree", "make the car red", etc. The browser tab must stay open for tools to work. The MCP server injects a WebSocket bridge that communicates with the Three.js scene. ## Core Tool Categories ### Scene Inspection - `get_scene_tree` — Full scene hierarchy with objects, materials, geometries - `get_object_details` — Properties, transforms, visibility, parent/child info - `find_objects` — Search by name, type, or material - `get_cameras` — List all cameras with properties - `get_lights` — All lights (ambient, directional, point, spot, hemisphere) ### Material & Shader Management - `get_materials` — All materials with properties (color, opacity, metalness, roughness) - `update_material` — Modify color, opacity, metalness, roughness, emissive, wireframe - `get_shaders` — List custom ShaderMaterial and RawShaderMaterial - `update_shader` — Edit vertex/fragment shaders, uniforms - `get_textures` — All textures with size, format, mipmaps, anisotropy ### Object Manipulation - `update_object_transform` — Position, rotation, scale - `toggle_object_visibility` — Show/hide objects - `get_object_bounds` — Bounding box and sphere - `clone_object` — Duplicate with transform offset ### Performance Monitoring - `get_performance_stats` — FPS, frame time, memory, draw calls, triangles - `start_performance_monitoring` — Continuous tracking with warnings - `get_memory_info` — Geometries, textures, programs, heap usage - `get_render_info` — Draw calls, triangles, points, lines, programs ### Animation - `get_animations` — All AnimationClip data - `play_animation` — Start animation by name with loop/speed control - `pause_animation` — Pause running animation - `get_animation_state` — Current playback state ### Code Generation - `generate_react_component` — Create React Three Fiber component from GLTF/GLB - `generate_material_code` — Export material as Three.js or R3F code - `export_scene` — Export scene as JSON or R3F JSX ### Debugging - `toggle_overlay` — Show/hide in-browser devtools panel - `check_common_issues` — Detect invisible objects, missing materials, zero-scale, etc. - `get_object_world_position` — World space coordinates ## Workflow Examples ### Debugging Invisible Objects ```typescript // User: "My model isn't showing up" // 1. Get scene tree to find objects await use_mcp_tool("threejs-devtools-mcp", "get_scene_tree", {}); // 2. Check common issues await use_mcp_tool("threejs-devtools-mcp", "check_common_issues", {}); // 3. If object found but invisible, get details await use_mcp_tool("threejs-devtools-mcp", "get_object_details", { objectPath: "Scene/MyModel" }); // 4. Check if it's visible and has material // If not visible: await use_mcp_tool("threejs-devtools-mcp", "toggle_object_visibility", { objectPath: "Scene/MyModel", visible: true }); // 5. Check if it's inside camera frustum await use_mcp_tool("threejs-devtools-mcp", "get_object_world_position", { objectPath: "Scene/MyModel" }); ``` ### Editing Materials ```typescript // User: "Make the car red and metallic" // 1. Find the car object await use_mcp_tool("threejs-devtools-mcp", "find_objects", { name: "car" }); // 2. Update material await use_mcp_tool("threejs-devtools-mcp", "update_material", { materialPath: "Scene/Car/Body/material", properties: { color: "#ff0000", metalness: 0.8, roughness: 0.2 } }); ``` ### Performance Optimization ```typescript // User: "Why is my scene laggy?" // 1. Get current performance stats await use_mcp_tool("threejs-devtools-mcp", "get_performance_stats", {}); // 2. Check render info for draw call count await use_mcp_tool("threejs-devtools-mcp", "get_render_info", {}); // 3. Check memory usage await use_mcp_tool("threejs-devtools-mcp", "get_memory_info", {}); // 4. Start continuous monitoring await use_mcp_tool("threejs-devtools-mcp", "start_performance_monitoring", { duration: 10, interval: 1 }); // Identify issues: // - High draw calls → merge geometries // - High triangle count → use LOD // - Memory growth → check for leaks, dispose unused resources ``` ### Shader Debugging ```typescript // User: "My custom shader isn't working" // 1. List all shaders await use_mcp_tool("threejs-devtools-mcp", "get_shaders", {}); // 2. Get shader source // (shader details included in get_shaders response) // 3. Update shader with fixes await use_mcp_tool("threejs-devtools-mcp", "update_shader", { shaderPath: "Scene/CustomMesh/material", vertexShader: ` varying vec2 vUv; void main() { vUv = uv; gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0); } `, fragmentShader: ` uniform float time; varying vec2 vUv; void main() { gl_FragColor = vec4(vUv, sin(time), 1.0); } `, uniforms: { time: { value: 0.0 } } }); ``` ### Generating React Components ```typescript // User: "Create a React component from my GLTF model" await use_mcp_tool("threejs-devtools-mcp", "generate_react_component", { modelPath: "/models/character.glb", componentName: "Character", includeAnimations: true, includeLights: false }); // Returns JSX code ready to use: /* import { useGLTF, useAnimations } from '@react-three/drei' import { useRef, useEffect } from 'react' export function Character(props) { const group = useRef() const { nodes, materials, animations } = useGLTF('/models/character.glb') const { actions } = useAnimations(animations, group) useEffect(() => { actions['Idle']?.play() }, [actions]) return ( ) } */ ``` ## Object Path Format Tools use hierarchical paths to identify objects: - `Scene` — root scene - `Scene/Player` — direct child named "Player" - `Scene/Group/Mesh` — nested object - `Scene/Car/(unnamed)/Wheel` — unnamed intermediate object **Tip:** Name your objects for easier access: ```javascript // Three.js mesh.name = "player"; // React Three Fiber ``` ## Common Material Properties When using `update_material`: ```typescript { color: "#ff0000", // hex color opacity: 0.5, // 0-1 transparent: true, // boolean metalness: 0.8, // 0-1 (MeshStandardMaterial) roughness: 0.2, // 0-1 (MeshStandardMaterial) emissive: "#00ff00", // hex color emissiveIntensity: 0.5, // 0-1 wireframe: true, // boolean side: "DoubleSide", // "FrontSide" | "BackSide" | "DoubleSide" visible: true // boolean } ``` ## Animation Control ```typescript // Play animation await use_mcp_tool("threejs-devtools-mcp", "play_animation", { clipName: "Walk", loop: true, timeScale: 1.0 }); // Pause await use_mcp_tool("threejs-devtools-mcp", "pause_animation", { clipName: "Walk" }); // Check state await use_mcp_tool("threejs-devtools-mcp", "get_animation_state", {}); ``` ## Configuration Create `threejs-devtools.config.json` in project root: ```json { "port": 5173, "chromePath": "/usr/bin/google-chrome", "debugPort": 9222, "autoOpenOverlay": true, "performanceThresholds": { "fps": 30, "frameTime": 33, "drawCalls": 100 } } ``` **Environment variables:** - `THREEJS_DEVTOOLS_PORT` — override dev server port - `THREEJS_DEVTOOLS_CHROME_PATH` — custom Chrome/Chromium path - `THREEJS_DEVTOOLS_DEBUG_PORT` — Chrome DevTools Protocol port ## In-Browser Overlay Toggle with `toggle_overlay` tool or activated automatically. Provides: - **Performance panel** — real-time FPS, frame time, memory - **Scene graph** — interactive tree with expand/collapse - **Material editor** — live color picker, sliders for metalness/roughness - **Object inspector** — transform, bounds, visibility - **3D preview** — isolated object rendering ## Troubleshooting ### Browser tab closes immediately - Check if port is correct: `THREEJS_DEVTOOLS_PORT=3000 npx threejs-devtools-mcp` - Verify dev server is running before starting MCP server ### Tools return "not connected" - Ensure browser tab stays open - Check browser console for WebSocket errors - Restart MCP server if connection lost ### Objects not found - Use `get_scene_tree` to see actual object paths - Objects may be unnamed — shows as `(unnamed)` in path - Wait for GLTF models to load before querying ### Material changes not visible - Check if material is used by multiple objects - Some properties require `transparent: true` (e.g., opacity < 1) - ShaderMaterial requires manual uniform updates ### Performance monitoring shows zeros - Ensure renderer.info.autoReset is not disabled - Check if scene is actually rendering (camera, lights present) ### Memory leaks detected - Call dispose() on geometries, materials, textures when removing objects - Use `get_memory_info` to track resource counts over time - Check for retained references in closures or event listeners ## Token-Efficient Practices 1. **Use `find_objects` before `get_scene_tree`** — narrower scope 2. **Chain related operations** — get details + update in one turn 3. **Cache object paths** — reuse in conversation context 4. **Use `check_common_issues` first** — catches 80% of problems 5. **Request specific properties** — not full object dumps ## React Three Fiber Integration Works seamlessly with R3F. Use `ref` to name objects: ```jsx import { useRef } from 'react' import { useFrame } from '@react-three/fiber' function Box() { const ref = useRef() useFrame((state, delta) => { ref.current.rotation.x += delta }) return ( ) } ``` Then from AI: ```typescript // "Stop the box rotation" await use_mcp_tool("threejs-devtools-mcp", "get_object_details", { objectPath: "Scene/rotating-box" }); // Developer removes useFrame hook based on AI suggestion ``` ## Advanced: HTTP Transport (Cursor) For environments where stdio doesn't work: ```json { "mcpServers": { "threejs-devtools-mcp": { "command": "npx", "args": ["-y", "threejs-devtools-mcp", "--transport", "http"] } } } ``` Server runs on `http://localhost:3000` by default. Set `THREEJS_DEVTOOLS_HTTP_PORT` to change. ## Example: Complete Debug Session ```typescript // User: "My 3D character model loads but is invisible and the scene is slow" // 1. Check scene structure const sceneTree = await use_mcp_tool("threejs-devtools-mcp", "get_scene_tree", {}); // Found: Scene/Character with multiple children // 2. Check common issues const issues = await use_mcp_tool("threejs-devtools-mcp", "check_common_issues", {}); // Found: Character has scale (0,0,0) // 3. Fix scale await use_mcp_tool("threejs-devtools-mcp", "update_object_transform", { objectPath: "Scene/Character", scale: { x: 1, y: 1, z: 1 } }); // 4. Check performance const perf = await use_mcp_tool("threejs-devtools-mcp", "get_performance_stats", {}); // FPS: 15, Draw calls: 450 // 5. Get render info to understand why const renderInfo = await use_mcp_tool("threejs-devtools-mcp", "get_render_info", {}); // 450 draw calls → character has 450 separate meshes // Suggestion: Merge geometries or use instancing // Character now visible, identified performance bottleneck ```

相关技能

Agent 工作流

Skill Creator

创造有效技能指南。 当用户想创造出新的技能(或更新现有的技能),以专业知识,工作流程,或工具集成来扩展克洛德的能力时,应该使用这种技能.

Agent 工作流

Clawdhub

使用ClawdHub CLI搜索,安装,更新并发布从taladhub.com的代理技能. 需要获取苍蝇上的新技能时使用,将安装的技能同步到最新版本或特定版本,或者发布 npm-instainddhub CLI 的新/更新的技能文件夹.

Agent 工作流

Agent Team Orchestration

管弦乐团多代理团队,任务设定周期,交接协议,审查工作流程. 使用时间: (1)建立2+特派员队伍,具有不同专业,(2)确定任务路线和生命周期(收录框_ spec_建设_审查_完成),(3)在特派员之间制定交接协议,(4)建立审查和质量关口,(5)管理特派员之间的交流和文物共享.

Agent 工作流

Superpowers

Spec-first,TDD,子代理驱动的软件开发工作流程. 当:(1)构建任何新功能或应用——触发脑暴_计划_子代理执行回路,(2)调试出一个bug或测试失败——触发系统性的根起过程,(3)用户说"让我们构建","帮助我计划","我想添加X",或"这个被打破",(4)完成一个功…