openscad-mcp
Exposes OpenSCAD CLI as MCP tools for validating, rendering, and exporting parametric 3D models. Enables LLM clients to interactively create and manipulate OpenSCAD designs.
README
OpenSCAD MCP Server
Overview
OpenSCAD MCP Server exposes the OpenSCAD CLI as Model Context Protocol (MCP) tools so MCP-compatible clients (including LLM-based clients) can validate, render, and export parametric 3D models using OpenSCAD.
This repo targets a v1.0 tool surface: stable, minimal, deterministic, and local-first (stdio transport only).
Tools
All tool details (args, options, response payloads) are documented in docs/TOOLING.md.
Core:
ping: server + OpenSCAD discovery metadatalist_formats: supported export/preview formatsvalidate_scad: compile validation + parsed diagnosticsexport_model: exportstl/3mf/offrender_preview: exportpngrender_scad: export model + preview in one callbatch_render_scad: run multiple parameter variants sequentially
Templates & modules:
list_templates/render_template: built-in parametric templates shipped with the serverlist_modules/render_module: render from a simple module registry (OPENSCAD_MCP_MODULE_ROOT)
Artifact ergonomics (opt-in, per call via options):
inline_artifact_bytes: return base64 bytes in responses (size-limited)introspect_artifacts: basic artifact metadata inspection (size-limited)use_cache: content-addressed cache (requiresOPENSCAD_MCP_CACHE_ROOT)
Quickstart (Local)
Prerequisites:
- Python 3.10+
- OpenSCAD installed and
openscadavailable on yourPATH(or setOPENSCAD_MCP_OPENSCAD_PATH)
Install (editable, recommended via venv):
python -m venv .venv
. .venv/bin/activate
python -m pip install -U pip
python -m pip install -e ".[dev]"
Run the MCP server (stdio):
openscad-mcp
Example tool call arguments (conceptual JSON payload):
{
"tool": "render_scad",
"args": {
"scad_source": "cube([w,h,d]);",
"params": {
"w": 10,
"h": 20,
"d": 5
},
"options": {
"format": "stl",
"imgsize": [
512,
512
],
"inline_artifact_bytes": true
}
}
}
Artifacts are produced in a per-request build directory:
- If your MCP client can read local paths, set
OPENSCAD_MCP_KEEP_ARTIFACTS=true(and optionallyOPENSCAD_MCP_ARTIFACT_ROOT) so returnedartifact.pathvalues remain valid after the tool returns. - If your MCP client cannot read local paths, use
inline_artifact_bytes=true(subject toOPENSCAD_MCP_MAX_INLINE_BYTES).- For some clients,
inline_artifact_bytes=truealso results in an image attachment forrender_preview/render_scadresponses.
- For some clients,
When OPENSCAD_MCP_ARTIFACT_ROOT is set, each request writes to a unique subdirectory (for example:
./artifacts/<uuid>/preview.png).
Run tests:
pytest -q
pytest -q -m "not integration"
Run integration tests inside the Docker image (real OpenSCAD):
./scripts/pytest-integration-docker
Docker (Recommended for Isolation)
This server uses MCP stdio transport (no network listener). To run it in Docker while still exposing a stdio MCP process to a host MCP client, use the provided wrapper which forwards stdin/stdout to a container.
Build the image and create a host-visible artifacts directory:
mkdir -p artifacts
docker compose build
Run the MCP server via Docker (stdio passthrough):
./scripts/openscad-mcp-docker
Windows PowerShell:
.\scripts\openscad-mcp-docker.ps1
Artifacts are written inside the container under /artifacts and are volume-mounted to ./artifacts on the host.
If you need to enforce output size limits, set OPENSCAD_MCP_MAX_OUTPUT_BYTES.
Note: the container entrypoint uses an openscad-headless wrapper that prefers xvfb-run for PNG rendering, but
falls back to QT_QPA_PLATFORM (default minimal) if xvfb-run/xauth are unavailable.
MCP Client Configuration Example (JetBrains AI)
Set the working directory to the project root folder.
{
"mcpServers": {
"openscad": {
"command": "powershell.exe",
"args": [
"-NoProfile",
"-ExecutionPolicy",
"Bypass",
"-File",
".\\scripts\\openscad-mcp-docker.ps1"
]
}
}
}
Screenshots
Model generation + validation:

Preview rendering + model export:

Module Registry Format
If OPENSCAD_MCP_MODULE_ROOT is set, it must contain an index.json manifest plus *.scad files:
{
"modules": [
{
"id": "my_part",
"description": "Example module.",
"entry": "my_part"
}
]
}
The server will load my_part.scad and call my_part() (or entry if it already includes parentheses).
Configuration
Environment variables:
OPENSCAD_MCP_LOG_LEVEL: log level (defaultINFO)OPENSCAD_MCP_OPENSCAD_PATH: optional path toopenscad(overridesPATHdiscovery)OPENSCAD_MCP_QT_QPA_PLATFORM: Qt platform plugin for headless fallback (defaultminimal)OPENSCAD_MCP_TIMEOUT_S: OpenSCAD subprocess timeout in seconds (default30)OPENSCAD_MCP_ARTIFACT_ROOT: optional root directory for per-request build dirsOPENSCAD_MCP_KEEP_ARTIFACTS: iftrue, keep per-request build dirsOPENSCAD_MCP_MAX_OUTPUT_BYTES: fail if the generated artifact exceeds this sizeOPENSCAD_MCP_MAX_INLINE_BYTES: max bytes to inline wheninline_artifact_bytes=true(default 5 MB)OPENSCAD_MCP_MAX_INTROSPECT_BYTES: max bytes to read for introspection (default 2 MB)OPENSCAD_MCP_CACHE_ROOT: root directory for artifact cache (enablesuse_cache=true)OPENSCAD_MCP_MODULE_ROOT: module registry root containingindex.json+*.scadfilesOPENSCAD_MCP_INCLUDE_ROOTS: comma-separated allowlist foruse/include(best-effort enforcement)
Security Notes
This server is designed to be local-first and run over stdio. Do not expose it directly to the internet.
OpenSCAD compilation should be treated as untrusted workload (CPU/memory heavy models, file use/include, etc). See
docs/SECURITY.md for the project security stance and recommendations.
Documentation & Examples
- Tool surface and payloads:
docs/TOOLING.md - Security posture:
docs/SECURITY.md - Example prompts (copy/paste for MCP clients):
examples/README.md - Contributing:
CONTRIBUTING.md - Code of Conduct:
CODE_OF_CONDUCT.md - Security policy:
SECURITY.md - Changelog:
CHANGELOG.md
Roadmap
The v1.0 tool surface is implemented. Future enhancements are tracked via GitHub issues (e.g. more templates, deeper OpenSCAD diagnostics coverage, additional formats, optional session-like workflows).
License
MIT
Acknowledgement
Pretty much the whole project was generated With ChatGPT 5.1 using Codex CLI inside JetBrains PyCharm. The goal of this project is to investigate the implementation of MCP protocol in Python.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。