Three.js代码生成服务器

一个基于Three.js的代码生成MCP服务器,用于自动化生成3D场景、渲染器、几何体、材质等相关的代码。

  • by CharlieKerfoot
  • Python
  • 本地部署
  • 2 星标
  • 更新于
在 GitHub 查看 CharlieKerfoot/threejs-mcp

使用说明

Threejs mcp

Three.js代码生成MCP服务器。

工具

类别 工具
场景和渲染器 scene_setup, html_template
摄像头 perspective_camera, orthographic_camera
几何学 geometry, extrude_geometry, lathe_geometry, tube_geometry
材料 material, shader_material
网格 mesh, instanced_mesh, group
照明设备 ambient_light, directional_light, point_light, spot_light, hemisphere_light, rect_area_light
控制装置 orbit_controls, fly_controls, pointer_lock_controls, transform_controls
装载机 gltf_loader, texture_loader, cube_texture_loader, hdr_environment, fbx_loader
动画 animation_loop, keyframe_animation, tween_animation
互动 raycaster
助手 debug_helpers, light_helpers
后处理 postprocessing_setup
环境 ground_plane, skybox, water_surface, particles, reflective_surface, lensflare
UI css2d_label
物理学 rapier_physics
XR webxr_setup
公用事业 math_utils, dispose_resources

先决条件

安装

克隆此存储库,然后更新中的路径 run.sh 指向克隆的目录:

#!/bin/zsh
source ~/.zshrc
exec uv run --directory /path/to/threejs-mcp threejs-mcp

使脚本可执行:

chmod +x run.sh

然后按照下面MCP客户端的说明进行操作。替换 /path/to/threejs-mcp/run.sh 带有脚本的实际路径。

克劳德代码

claude mcp add threejs -s user -- /path/to/threejs-mcp/run.sh

范围(-s)可以是 user, project,或 local.

克劳德桌面版

打开 设置>开发人员>编辑配置 并添加到 claude_desktop_config.json:

{
  "mcpServers": {
    "threejs": {
      "command": "/path/to/threejs-mcp/run.sh"
    }
  }
}

光标

打开 设置>MCP>添加新的全局MCP服务器 并添加到 ~/.cursor/mcp.json:

{
  "mcpServers": {
    "threejs": {
      "command": "/path/to/threejs-mcp/run.sh"
    }
  }
}

或添加到 .cursor/mcp.json 在项目根目录中进行项目范围配置。

帆板运动

打开 设置>MCP>添加服务器>添加自定义服务器 并添加到您的MCP配置中:

{
  "mcpServers": {
    "threejs": {
      "command": "/path/to/threejs-mcp/run.sh"
    }
  }
}

VS代码/GitHub副本

添加到您的用户或工作区 settings.json:

{
  "mcp": {
    "servers": {
      "threejs": {
        "command": "/path/to/threejs-mcp/run.sh"
      }
    }
  }
}

或创建 .vscode/mcp.json 在项目根目录中:

{
  "servers": {
    "threejs": {
      "command": "/path/to/threejs-mcp/run.sh"
    }
  }
}

泽德

添加到Zed设置(~/.config/zed/settings.json):

{
  "context_servers": {
    "threejs": {
      "command": {
        "path": "/path/to/threejs-mcp/run.sh"
      }
    }
  }
}

克莱恩

打开 设置>MCP服务器>编辑MCP设置 并添加到配置中:

{
  "mcpServers": {
    "threejs": {
      "command": "/path/to/threejs-mcp/run.sh"
    }
  }
}

继续

添加到您的 ~/.continue/config.yaml:

mcpServers:
  - name: threejs
    command: /path/to/threejs-mcp/run.sh

Roo 代码

打开 设置>MCP>编辑MCP设置 并添加:

{
  "mcpServers": {
    "threejs": {
      "command": "/path/to/threejs-mcp/run.sh"
    }
  }
}

任何其他MCP客户端

这是一个标准的stdio MCP服务器。运行它:

/path/to/threejs-mcp/run.sh

报废单据

这 docs/ 该目录包含从Three.js文档中抓取的精简markdown。要重新生成,请执行以下操作:

uv run python scrape_docs.py

这需要 httpx 和 beautifulsoup4 包(不包含在主要依赖项中)。