FreeCAD Robust MCP User Guide¶
This guide explains how to use AI assistants with FreeCAD via the MCP (Model Context Protocol) server to create and manipulate 3D CAD models.
Table of Contents¶
- Getting Started
- Running Modes
- Basic Workflows
- Object Creation Examples
- PartDesign Workflow
- Complete Example: Mounting Bracket
- Tips and Best Practices
Getting Started¶
Prerequisites¶
- FreeCAD installed - Version 1.0.x or later
- An MCP client (Claude Code, or other MCP-compatible AI assistant) configured
- Python 3.11 - Must match FreeCAD's bundled Python version
Starting FreeCAD with MCP Bridge¶
You have two options depending on your workflow:
Headless Mode (Command-line only)¶
Best for automated workflows, batch processing, or when you don't need visual feedback.
Capabilities: All modeling operations, export, scripting. Limitations: No screenshots, no visual feedback, no color/visibility control.
GUI Mode (Full graphical interface)¶
Best for interactive design work where you want to see results visually.
Capabilities: Everything headless mode can do, plus screenshots, colors, view control.
Verifying Connection¶
Once FreeCAD is running with the MCP bridge, you can verify the connection:
Claude will use the get_connection_status tool to confirm the bridge is working.
Running Modes¶
Headless vs GUI Mode¶
| Feature | Headless Mode | GUI Mode |
|---|---|---|
| Object creation | Yes | Yes |
| Boolean operations | Yes | Yes |
| Export (STEP, STL, etc.) | Yes | Yes |
| Save documents | Yes | Yes |
| Screenshots | No | Yes |
| Object colors | No | Yes |
| Object visibility | No | Yes |
| Camera control | No | Yes |
| Interactive selection | No | Yes |
Detecting the Current Mode¶
When working with Claude, it will automatically detect whether FreeCAD is in GUI or headless mode and adapt accordingly. GUI-only operations will return informative errors in headless mode rather than crashing.
Basic Workflows¶
Creating a Document¶
Every FreeCAD project needs a document. You can ask Claude:
Claude will use the create_document tool.
Creating Simple Shapes¶
Ask Claude to create primitive shapes:
"Create a box that's 50mm long, 30mm wide, and 10mm tall"
"Add a cylinder with radius 5mm and height 20mm"
"Create a sphere with 15mm radius"
Positioning Objects¶
Move and rotate objects:
Boolean Operations¶
Combine shapes:
"Fuse the box and cylinder together"
"Cut a hole through the box using the cylinder"
"Find the intersection of the two shapes"
Saving and Exporting¶
"Save the document as MyProject.FCStd"
"Export the model to STEP format"
"Export for 3D printing as STL"
Object Creation Examples¶
Example 1: Simple Box with Hole¶
Request:
What Claude does:
- Creates a document
- Creates a box (50x50x20)
- Creates a cylinder (radius 5, height 30) positioned at center
- Performs boolean cut operation
- Returns the result
Example 2: Pipe/Tube Shape¶
Request:
What Claude does:
- Creates outer cylinder (radius 20, height 100)
- Creates inner cylinder (radius 15, height 100)
- Cuts inner from outer to create hollow tube
Example 3: L-Bracket¶
Request:
Create an L-shaped bracket:
- Horizontal part: 100mm x 50mm x 5mm
- Vertical part: 5mm x 50mm x 80mm standing on the horizontal part
What Claude does:
- Creates horizontal box
- Creates vertical box positioned at correct location
- Fuses them together
PartDesign Workflow¶
For parametric modeling that maintains design history, use the PartDesign workflow.
Understanding PartDesign Concepts¶
Body: A container for a single solid model built from features.
Sketch: A 2D drawing that defines profiles for 3D operations.
Features: Operations like Pad (extrude), Pocket (cut), Fillet, etc.
Basic PartDesign Example¶
Request:
Create a parametric mounting plate:
1. Start with a PartDesign body
2. Create a sketch on the XY plane with a 100x60mm rectangle
3. Pad it 8mm thick
4. Add four 5mm holes near each corner for mounting screws
5. Fillet all edges with 2mm radius
What Claude does:
create_partdesign_body()- Creates the Body containercreate_sketch(body_name="Body", plane="XY_Plane")- Creates attached sketchadd_sketch_rectangle(...)- Adds the profile geometrypad_sketch(sketch_name="Sketch", length=8)- Extrudes to solid- Creates new sketches with points for hole locations
create_hole(...)for each mounting holefillet_edges(...)- Rounds the edges
Revolving Profiles¶
Request:
What Claude does:
- Creates body and sketch on XZ plane
- Draws the profile using lines and arcs
- Uses
revolution_sketch()to create the solid
Pattern Operations¶
Request:
What Claude does:
- Creates the base plate
- Creates one hole feature
- Uses
linear_pattern()to repeat the hole
Complete Example: Mounting Bracket¶
This detailed example shows a complete workflow for creating a practical part.
Design Requirements¶
Create a mounting bracket with:
- Base plate: 80mm x 60mm x 5mm
- Vertical support: 5mm thick, 50mm tall, 60mm wide
- Two mounting holes (6mm diameter) on the base
- One slot (10mm x 20mm) on the vertical support
- 3mm fillets on external corners
Step-by-Step Workflow¶
Step 1: Ask Claude to create the bracket¶
Create a mounting bracket with the following specifications:
Base plate:
- Size: 80mm x 60mm x 5mm
- Two 6mm diameter mounting holes, centered 15mm from each short edge
Vertical support:
- Attached to one end of the base
- 5mm thick, 60mm wide, 50mm tall
- One slot: 10mm wide x 20mm tall, centered
Finish:
- 3mm fillet on all outer edges
- Export as STEP file when done
Step 2: Claude's approach¶
Claude will break this down into manageable operations:
# 1. Create document and PartDesign body
create_document(name="MountingBracket")
create_partdesign_body(name="Body")
# 2. Create base plate sketch and pad
create_sketch(body_name="Body", plane="XY_Plane", name="BaseSketch")
add_sketch_rectangle(sketch_name="BaseSketch", x=0, y=0, width=80, height=60)
pad_sketch(sketch_name="BaseSketch", length=5)
# 3. Add vertical support
create_sketch(body_name="Body", plane="XZ_Plane", name="SupportSketch")
# ... add geometry
pad_sketch(sketch_name="SupportSketch", length=60)
# 4. Add mounting holes
create_sketch(body_name="Body", plane="XY_Plane", name="HoleSketch")
add_sketch_point(sketch_name="HoleSketch", x=15, y=30)
add_sketch_point(sketch_name="HoleSketch", x=65, y=30)
create_hole(sketch_name="HoleSketch", diameter=6, hole_type="ThroughAll")
# 5. Add slot (as pocket)
create_sketch(body_name="Body", plane="Face...", name="SlotSketch")
add_sketch_rectangle(...)
pocket_sketch(sketch_name="SlotSketch", length=5, type="ThroughAll")
# 6. Add fillets
fillet_edges(object_name="...", radius=3)
# 7. Export
export_step(file_path="/path/to/bracket.step")
Step 3: View the result (GUI mode)¶
Claude will use get_screenshot(view_angle="Isometric") to capture and display the result.
Tips and Best Practices¶
1. Be Specific with Dimensions¶
Good: "Create a box 50mm x 30mm x 10mm"
Vague: "Create a small box"
2. Specify Units¶
FreeCAD uses millimeters by default. Always include units to avoid confusion:
3. Use Meaningful Names¶
This makes it easier to reference objects later.
4. Work Incrementally¶
For complex parts, build step by step:
- Create the basic shape
- Verify it looks correct
- Add features one at a time
- Check after each major operation
5. Save Frequently¶
FreeCAD can crash, and you don't want to lose work.
6. Use PartDesign for Parametric Parts¶
If you might need to modify dimensions later, use the PartDesign workflow with sketches rather than direct Part operations.
7. Export to Multiple Formats¶
For manufacturing or 3D printing:
8. Use the execute_python Tool for Advanced Operations¶
For operations not covered by the standard tools, Claude can execute custom Python:
Claude will use execute_python() to run the necessary FreeCAD Python commands.
9. Check GUI Mode for Visual Features¶
Before asking for screenshots or colors:
10. Use Patterns for Repetitive Features¶
Instead of creating many individual features:
Common Operations Quick Reference¶
| Task | How to Ask |
|---|---|
| Create box | "Create a box 50x30x10mm" |
| Create cylinder | "Create a cylinder with 10mm radius and 20mm height" |
| Move object | "Move MyBox to position (100, 50, 0)" |
| Rotate object | "Rotate MyCylinder 45 degrees around Z axis" |
| Boolean union | "Fuse Box and Cylinder together" |
| Boolean subtract | "Cut Cylinder from Box" |
| Create hole | "Add a 6mm through hole at (25, 15)" |
| Fillet edges | "Add 3mm fillet to all edges" |
| Chamfer edges | "Add 2mm chamfer to selected edges" |
| Export STEP | "Export to STEP format" |
| Export STL | "Export for 3D printing" |
| Save document | "Save the document as MyPart.FCStd" |
| Screenshot | "Take a screenshot from the front view" (GUI mode only) |
| Change color | "Make the box red" (GUI mode only) |
Troubleshooting¶
"GUI not available" Error¶
You're running in headless mode and trying to use a GUI-only feature. Either:
- Switch to GUI mode:
just freecad::run-gui - Use an alternative approach (e.g., skip visual operations)
Objects Not Appearing¶
Make sure to recompute the document:
Boolean Operations Failing¶
Ensure:
- Both objects have valid shapes
- The objects actually intersect
- Objects are in the same document
Sketch Errors¶
Sketches need to be fully constrained for PartDesign operations. Ask Claude to:
Connection Issues¶
If the MCP bridge isn't responding:
- Check FreeCAD is running with the bridge started
- Verify ports 9875 (XML-RPC) and 9876 (socket) are available
- Restart FreeCAD with
just freecad::run-guiorjust freecad::run-headless
Next Steps¶
- See MCP_TOOLS_REFERENCE.md for detailed API documentation
- Explore the FreeCAD wiki for advanced techniques
- Practice with simple parts before attempting complex assemblies