Skip to main content

CadQuery MCP Server

An MCP (Model Context Protocol) server that enables AI assistants like Claude to execute CadQuery scripts and render 3D CAD models.

Features

  • render - Execute CadQuery code and return SVG images of the 3D model

    • Multiple camera angles: isometric, front, back, top, bottom, left, right
    • Multi-view mode for complex models
    • Configurable image dimensions
    • Hidden line rendering
  • inspect - Get geometry information about a shape

    • Bounding box dimensions
    • Volume and surface area
    • Center of mass
    • Topology counts (solids, faces, edges, vertices)
  • get_parameters - Extract customizable parameters from CadQuery scripts

  • export - Export models to various formats

    • STEP, STL, SVG, DXF, AMF, 3MF, VRML, BREP

Installation

Prerequisites

CadQuery must be installed first. The recommended method is via conda:

conda install -c conda-forge cadquery

Install from Source

git clone https://github.com/CadQuery/cadquery-contrib.git
cd cadquery-contrib/mcp-server
pip install .

For development (editable install):

pip install -e .

Run Tests

pip install pytest
pytest test_cadquery_mcp_server.py -v

Configuration

Claude Code

Add to your ~/.claude/settings.json:

{
    "mcpServers": {
        "cadquery": {
            "command": "cadquery-mcp"
        }
    }
}

Claude Desktop

Add to your Claude Desktop configuration (~/Library/Application Support/Claude/claude_desktop_config.json on macOS):

{
    "mcpServers": {
        "cadquery": {
            "command": "cadquery-mcp"
        }
    }
}

Note: If using conda, you may need to specify the full path:

{
    "mcpServers": {
        "cadquery": {
            "command": "/path/to/conda/envs/yourenv/bin/cadquery-mcp"
        }
    }
}

Usage Examples

Once configured, you can ask Claude to create 3D models:

"Create a box with a hole through it"

Claude will execute:

import cadquery as cq

result = (
    cq.Workplane('XY')
    .box(20, 20, 10)
    .faces('>Z')
    .workplane()
    .hole(5)
)

And return a rendered SVG image of the model.

Multi-View Rendering

For complex models, request multiple views:

"Show me this bracket from multiple angles"

The server will return isometric, front, top, and right views.

Parametric Models

CadQuery scripts can define parameters:

height = 10.0  # Height of the box
width = 20.0   # Width of the box
depth = 5.0    # Depth of the box

import cadquery as cq
result = cq.Workplane('XY').box(width, height, depth)

Use the get_parameters tool to extract these for modification.

Exporting Models

Export to STEP for manufacturing or STL for 3D printing:

"Export this model as a STEP file to ~/models/bracket.step"

API Reference

render

Execute CadQuery code and return rendered image(s).

Parameter Type Default Description
code string required CadQuery Python code to execute
view string "isometric" Camera angle (isometric, front, back, top, bottom, left, right, isometric_back)
multi_view boolean false Return multiple views
width integer 800 Image width in pixels
height integer 600 Image height in pixels
show_hidden boolean true Show hidden lines

inspect

Get geometry information about the resulting shape.

Parameter Type Default Description
code string required CadQuery Python code to execute

get_parameters

Extract customizable parameters from a script.

Parameter Type Default Description
code string required CadQuery Python code to parse

export

Export the model to a file.

Parameter Type Default Description
code string required CadQuery Python code to execute
filename string required Output filename
format string auto Export format (STEP, STL, SVG, DXF, AMF, 3MF, VRML, BREP)

Writing CadQuery Scripts for MCP

Scripts should either:

  1. Assign the final shape to a variable named result:

    result = cq.Workplane('XY').box(1, 2, 3)
    
  2. Use show_object() to output shapes:

    box = cq.Workplane('XY').box(1, 2, 3)
    show_object(box)
    

License

Apache License 2.0 - see LICENSE for details.

Contributing

Contributions are welcome! Please see the cadquery-contrib repository for guidelines.

Metadata

Release files for cadquery-mcp 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cadquery-mcp 0.1.0
File Size Uploaded Provenance
cadquery_mcp-0.1.0.tar.gz 7.2 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for cadquery-mcp 0.1.0
File Interpreter ABI Platform
cadquery_mcp-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 14.7 kB

Release files / cadquery_mcp-0.1.0.tar.gz

Download URL cadquery_mcp-0.1.0.tar.gz
Size 7.2 kB
Tags Source
SHA-256 checksum
How to use checksums
1d839b8a0ccfaa48031c628905062a1af9be03c4cafbe3747338a49e822ae372
BLAKE2b-256 checksum
How to use checksums
b61498d5a78124d8f211981d4dc4d7b9d3f5412949b85f8bc4eff74cd6dab430
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.5

Release files / cadquery_mcp-0.1.0-py3-none-any.whl

Download URL cadquery_mcp-0.1.0-py3-none-any.whl
Size 7.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
70d5288c724532d1b2fa479c35af0fd17bb60bfdec98c28cbb8c3647e12a11b7
BLAKE2b-256 checksum
How to use checksums
6eed5948ec5c8fdc17fdc04d6790540ef01377e185badeba0f1892fd56e4b2e5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.5

Security for cadquery-mcp 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page