RO

robertcoop/openscad-mcp

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

167 stars 21 forks 质量 84 趋势 25MIT

用于 OpenSCAD 3D 建模和渲染的模型上下文协议(MCP)服务器

概览

一款模型上下文协议(MCP)服务器,使AI助手能够使用OpenSCAD渲染、导出和分析3D模型。采用FastMCP构建,支持Python。 - 安装在你的系统上 - (推荐)或 Python 3.10+ 使用 --scope 标志来控制配置保存的位置: - : ~/库/应用支持/Claude/claude_desktop_config.json - : %APPDATA%\Claude\claude_desktop_config.json 在你的项目根节点添加一个.mcp.json文件: 每个工具响应都包含从OpenSCAD输出解析出来的错误、警告和提示。检查它们:OpenSCAD在断言失败()或未知模块时退出0,并绘制空白场景。 零件以内联形式表示为 parts=[{name, code, place?, frame?, ghost?, mass_g?, motion?}] 或在检查文件中(frames, quality, parts, check, model)。OpenSCAD-MCP 检查从壳中运行带有有意义退出码的检查文件,因此 make check 只需调用一次。

概述(AI 翻译)

一个模型上下文协议(MCP)服务器,允许人工智能 助手们在OpenSCAD中设计可3D打印的零件和组件: 用标明的比例渲染,测量精确几何形状,检查组件是否有干涉 以及清理、提取孔洞和特征、判断打印性及出口。构建 Python的FastMCP;OpenSCAD 2021.01是支持的底层 并且在存在时使用开发快照。

先修条件

  • OpenSCAD 已安装在您的系统上
  • uv(推荐)或 Python 3.10+

安装

服务器在 PyPI 上发布为 openscad-mcp,因此 uv 运行时没有克隆,也没有虚拟化:uvx openscad-mcp。UV保留缓存 复制;uv tool upgrade openscad-mcp(或uvx openscad-mcp@latest)拉取 新发行,uvx [email protected]第一名。

克劳德·科德

用一个命令添加服务器:

或者,如果OpenSCAD不在你的路径上:

使用 --scope 标志来控制配置的保存位置:

范围 旗帜 效果
本地(默认) --scope local 仅限当前项目中可用
项目 --scope project 通过.mcp.json

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

OpenSCAD MCP Server

A Model Context Protocol (MCP) server that lets AI assistants design 3D-printable parts and assemblies in OpenSCAD: render with a stated scale, measure exact geometry, check assemblies for interference and clearance, extract holes and features, judge printability, and export. Built with FastMCP for Python; OpenSCAD 2021.01 is the supported floor and dev snapshots are used when present.

Prerequisites

  • OpenSCAD installed on your system
  • uv (recommended) or Python 3.10+

Installation

The server is published on PyPI as openscad-mcp, so uv runs it with no clone and no virtualenv: uvx openscad-mcp. uv keeps a cached copy; uv tool upgrade openscad-mcp (or uvx openscad-mcp@latest) pulls a new release, and uvx [email protected] pins one.

Claude Code

Add the server with a single command:

claude mcp add openscad --transport stdio -- uvx openscad-mcp

Or, if OpenSCAD is not on your PATH:

claude mcp add openscad --transport stdio \
  --env OPENSCAD_PATH=/path/to/openscad -- uvx openscad-mcp

Use the --scope flag to control where the configuration is saved:

Scope Flag Effect
Local (default) --scope local Available only to you in the current project
Project --scope project Shared with the team via .mcp.json
User --scope user Available to you across all projects

The repository is also a Claude Code plugin (skill plus server): /plugin marketplace add robertcoop/openscad-mcp then /plugin install openscad-mcp@openscad-mcp.

Claude Desktop

Add to your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
{
  "mcpServers": {
    "openscad": {
      "command": "uvx",
      "args": ["openscad-mcp"],
      "env": {
        "OPENSCAD_PATH": "/usr/bin/openscad"
      }
    }
  }
}

Then restart Claude Desktop.

Cursor / Windsurf / VS Code

Add a .mcp.json file to your project root:

{
  "mcpServers": {
    "openscad": {
      "command": "uvx",
      "args": ["openscad-mcp"]
    }
  }
}

Manual / Standalone

# From PyPI (no install required)
在 GitHub 查看完整 README

安装

uvx openscad-mcp
新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "openscad": { "command": "uvx", "args": ["openscad-mcp"], "env": { "OPENSCAD_PATH": "/usr/bin/openscad" } } } }