MCP+
Provides tools for interacting with a live FreeCAD session, enabling AI assistants to build and inspect 3D models, run Python scripts, drive the GUI, manage CAM jobs, and perform document, object, PartDesign, export, import, and macro operations.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@MCP+show me the path statistics for the active CAM job"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
MCP+
MCP+ lets AI assistants (Claude Code and other MCP clients) work in your live FreeCAD session: build and inspect models, run Python, drive the GUI the way a user would, and review CAM jobs. It works with FreeCAD 1.1 and newer development builds.
MCP+ is built on spkane's Robust MCP Server and adds:
CAM tools: path statistics, A/B comparisons between two code trees, geometry finders, test fixtures, posting and G-code diffs, gouge and coverage checks, headless test runs, demo recording.
GuiDriver: run toolbar commands, fill in task panels, answer modal dialogs by rule (see GuiDriver).
Runs that outlast their timeout keep going: the answer carries a
job_token, andget_output_pagereads the rest of the output and the result page by page (after CREATeNG/freecad-mcp-bridge).bridge_status: what FreeCAD is busy with, or which modal dialog is blocking it, answered even while every other call would wait (after neka-nat/freecad-mcp).execute_python_file: run a script with__file__set and__name__ == "__main__".Safer bridge: every request must carry a per-user token, and requests from foreign web pages are refused (see Security and your data).
Fixes: Addon Manager crash on install, Qt imports through FreeCAD's
PySidewrapper, PartDesign/Sketcher tools on FreeCAD 1.x, screenshots,.envhandling.
Install it with the Addon Manager: Edit → Preferences → Addon Manager → Custom repositories → +,
add https://github.com/Connor9220/freecad-mcp-plus with branch main, then install MCP+ from
Tools → Addon Manager and restart FreeCAD. The MCP server half installs with
pip install git+https://github.com/Connor9220/freecad-mcp-plus (command freecad-mcp).
The rest of this README is spkane's original documentation; it still applies, with "Robust MCP Bridge" now shown as "MCP+".
Security and your data
What MCP+ allows. MCP+ lets an AI assistant run any Python code in your FreeCAD session, with your user's permissions, the same as a macro you run yourself. There is no sandbox: the code can read and write your files, start programs and reach the network. Your MCP client is the guardrail: use one you trust, and have it ask for your approval before it runs tool calls.
Who can reach the bridge. The bridge only runs while you start it (auto-start is off unless you
turn it on in Edit → Preferences → MCP+). It listens on localhost (ports 9875 and 9876 by
default), so other computers can't reach it. Every request must also carry a token:
On its first start the bridge creates a random token in a file only your user can read:
~/.config/mcp-plus/tokenon Linux,~/Library/Application Support/mcp-plus/tokenon macOS,%APPDATA%\mcp-plus\tokenon Windows. The MCP server reads the same file, so nothing needs configuring, while other users' programs on the same computer can't get in.Edit → Preferences → MCP+ → Security shows the token file, copies the token, or replaces it (takes effect at once). Turning the token off is possible for localhost only, and not recommended.
Requests sent by web pages in your browser (an
Originother than localhost) are refused.To use FreeCAD from another computer, prefer an ssh tunnel to its port. If you do set Listen on to another address, the MCP server there needs the token in
FREECAD_AUTH_TOKEN; the bridge never listens beyond localhost without one.
Where your data goes. The add-on and the MCP server collect nothing and send nothing to anyone; there is no telemetry. But whatever the assistant asks FreeCAD for becomes part of its conversation: object names and properties, file names and paths, geometry, the output of code it runs, and screenshots of your 3D view. Your MCP client sends that to your AI provider, under that provider's terms. Don't use MCP+ on designs you aren't allowed to share with your AI provider. Code the assistant runs can also reach the network, as any macro can.
Reporting a security problem. Please use GitHub's private vulnerability reporting (the repository's Security tab) rather than a public issue.
Related MCP server: FreeCAD MCP
Table of Contents
The macros that were originally in this repo under the
/macrosdirectory have been permanently moved to two new GitHub repos:
FreeCAD Forum: addon discussion post
Features
150+ MCP Tools: Comprehensive CAD operations including primitives, PartDesign, booleans, export
Multiple Connection Modes: XML-RPC (recommended), JSON-RPC socket, or embedded
GUI & Headless Support: Full modeling in headless mode, plus screenshots/colors in GUI mode
Macro Development: Create, edit, run, and template FreeCAD macros via MCP
Installation Requirements / Dependencies
FreeCAD 1.1 or newer
Python 3.11 (required for FreeCAD ABI compatibility)
For Users
This section covers installation and usage for end users who want to use the Robust MCP Server with AI assistants.
Quick Links
Resource | Description |
Full documentation, guides, and API reference | |
Pre-built Docker images for easy deployment | |
Python package for pip installation | |
Release archives and changelogs |
Robust MCP Server
Note: The Linux container and PyPI package are both named
freecad-robust-mcpwhich differs slightly from this git repository name.
Installation
Using pip (recommended)
pip install freecad-robust-mcpUsing mise and just (from source)
git clone https://github.com/spkane/freecad-addon-robust-mcp-server.git
cd freecad-addon-robust-mcp-server
# Install mise via the Official mise installer script (if not already installed)
curl https://mise.run | sh
mise trust
mise install
just setupUsing Docker
Run the Robust MCP Server in a container. This is useful for isolated environments or when you don't want to install Python dependencies on your host.
# Pull from Docker Hub (when published)
docker pull spkane/freecad-robust-mcp
# Or build locally
git clone https://github.com/spkane/freecad-addon-robust-mcp-server.git
cd freecad-addon-robust-mcp-server
docker build -t freecad-robust-mcp .
# Or use just commands (if you have mise/just installed)
just docker::build # Build for local architecture
just docker::build-multi # Build multi-arch (amd64 + arm64)Note: The containerized Robust MCP Server only supports xmlrpc and socket modes since FreeCAD runs on your host machine (not in the container). The container connects to FreeCAD via host.docker.internal.
Configuration
Environment Variables
Variable | Description | Default |
| Connection mode: |
|
| Path to FreeCAD's lib directory (embedded mode only) | Auto-detect |
| Socket/XML-RPC server hostname |
|
| JSON-RPC socket server port |
|
| XML-RPC server port |
|
| Execution timeout in ms |
|
Connection Modes
Mode | Description | Platform Support |
| Connects to FreeCAD via XML-RPC (port 9875) | All platforms (recommended) |
| Connects via JSON-RPC socket (port 9876) | All platforms |
| Imports FreeCAD directly into process | Linux only (crashes on macOS) |
Note: Embedded mode crashes on macOS because FreeCAD's FreeCAD.so links to @rpath/libpython3.11.dylib, which conflicts with external Python interpreters. Use xmlrpc or socket mode on macOS and Windows.
MCP Client Configuration
Add something like the following to your MCP client settings. For Claude Code, this is ~/.claude/claude_desktop_config.json or a project .mcp.json file:
{
"mcpServers": {
"freecad": {
"command": "freecad-mcp",
"env": {
"FREECAD_MODE": "xmlrpc"
}
}
}
}If installed from source with mise/uv:
{
"mcpServers": {
"freecad": {
"command": "/path/to/mise/shims/uv",
"args": ["run", "--project", "/path/to/freecad-addon-robust-mcp-server", "freecad-mcp"],
"env": {
"FREECAD_MODE": "xmlrpc"
}
}
}
}If using Docker:
{
"mcpServers": {
"freecad": {
"command": "docker",
"args": [
"run", "--rm", "-i",
"--add-host=host.docker.internal:host-gateway",
"-e", "FREECAD_MODE=xmlrpc",
"-e", "FREECAD_SOCKET_HOST=host.docker.internal",
"spkane/freecad-robust-mcp"
]
}
}
}Docker configuration notes:
--rmremoves the container after it exits-ikeeps stdin open for MCP communication--add-host=host.docker.internal:host-gatewayallows the container to connect to FreeCAD on your host (Linux only; macOS/Windows have this built-in)FREECAD_SOCKET_HOST=host.docker.internaltells the Robust MCP Server to connect to FreeCAD on your host machine
Usage
Starting the MCP Bridge in FreeCAD
Before your AI assistant can connect, you need to start the MCP bridge inside FreeCAD:
Option A: Using the Workbench (Recommended)
Install the Robust MCP Bridge workbench via FreeCAD's Addon Manager:
Edit -> Preferences -> Addon Manager
Search for "Robust MCP Bridge"
Install and restart FreeCAD
Start the bridge:
Switch to the Robust MCP Bridge workbench
Click the Start MCP Bridge button in the toolbar
Or use the menu: MCP Bridge -> Start Bridge
You should see in the FreeCAD console:
MCP Bridge started! - XML-RPC: localhost:9875 - Socket: localhost:9876
Option B: Using just commands (from source)
# Start FreeCAD with MCP bridge auto-started
just freecad::run-gui
# Or for headless/automation mode:
just freecad::run-headlessAfter starting the bridge, start/restart your MCP client (Claude Code, etc.) - it will connect automatically
Uninstalling the MCP Bridge
To uninstall the Robust MCP Bridge workbench:
Open FreeCAD
Go to Edit -> Preferences -> Addon Manager
Find "Robust MCP Bridge" in the list
Click Uninstall
Restart FreeCAD
Checking for Legacy Components
If you previously used older versions of this project, you may have legacy components installed. Run this command to check what's installed and get cleanup instructions:
just install::statusManual Cleanup (if needed)
Remove any legacy files that may conflict with the workbench:
# macOS - remove legacy plugin and macro
rm -rf ~/Library/Application\ Support/FreeCAD/Mod/MCPBridge/
rm -f ~/Library/Application\ Support/FreeCAD/Macro/StartMCPBridge.FCMacro
# Linux - remove legacy plugin and macro
rm -rf ~/.local/share/FreeCAD/Mod/MCPBridge/
rm -f ~/.local/share/FreeCAD/Macro/StartMCPBridge.FCMacroRunning Modes
XML-RPC Mode (Recommended)
Connects to a running FreeCAD instance via XML-RPC. Works on all platforms.
FREECAD_MODE=xmlrpc freecad-mcpSocket Mode (JSON-RPC)
Connects via JSON-RPC socket. Works on all platforms.
FREECAD_MODE=socket freecad-mcpHeadless Mode
Run FreeCAD in console mode without GUI. Useful for automation.
# If installed from source:
just freecad::run-headlessNote: Screenshot and view features are not available in headless mode.
Embedded Mode (Linux Only)
Runs FreeCAD in-process. Only works on Linux - crashes on macOS/Windows.
FREECAD_MODE=embedded freecad-mcpAvailable Tools
The Robust MCP Server provides 150+ tools organized into categories. Tools marked with GUI require FreeCAD to be running in GUI mode; they will return an error in headless mode.
Execution & Debugging (8 tools)
Tool | Description | Mode |
| Execute arbitrary Python code in FreeCAD's context | All |
| Run a .py file as | All |
| Read a run that outlasted its timeout, page by page | All |
| What FreeCAD is busy with; answers even when FreeCAD is stuck | All |
| Get FreeCAD version, build date, and Python version | All |
| Check MCP bridge connection status and latency | All |
| Get recent FreeCAD console output (up to N lines) | All |
| Get Robust MCP Server environment (OS, hostname, instance_id) | All |
Document Management (7 tools)
Tool | Description | Mode |
| List all open documents with metadata | All |
| Get information about the active document | All |
| Create a new FreeCAD document | All |
| Open an existing .FCStd file | All |
| Save a document to disk | All |
| Close a document (with optional save) | All |
| Force recomputation of all objects | All |
Object Creation - Primitives (8 tools)
Tool | Description | Mode |
| Create a generic FreeCAD object by type ID | All |
| Create a Part::Box with length, width, height | All |
| Create a Part::Cylinder with radius, height, angle | All |
| Create a Part::Sphere with radius | All |
| Create a Part::Cone with two radii and height | All |
| Create a Part::Torus (donut) with radii and angles | All |
| Create a Part::Wedge (tapered box) | All |
| Create a Part::Helix curve for sweeps and threads | All |
Object Management (12 tools)
Tool | Description | Mode |
| List all objects in a document | All |
| Get detailed object info (properties, shape, etc.) | All |
| Modify properties of an existing object | All |
| Delete an object from a document | All |
| Set object position and rotation | All |
| Scale an object uniformly or non-uniformly | All |
| Rotate an object around an axis | All |
| Create a copy of an object | All |
| Mirror an object across a plane (XY, XZ, YZ) | All |
| Fuse, cut, or intersect objects | All |
| Get currently selected objects | GUI |
| Select specific objects by name | GUI |
| Clear all selections | GUI |
PartDesign - Sketching (14 tools)
Tool | Description | Mode |
| Create a PartDesign::Body container | All |
| Create a sketch on a plane or face | All |
| Add a rectangle to a sketch | All |
| Add a circle to a sketch | All |
| Add a line (with optional construction flag) | All |
| Add an arc by center, radius, and angles | All |
| Add a point (useful for hole centers) | All |
| Extrude a sketch (additive) | All |
| Cut into solid using a sketch (subtractive) | All |
| Revolve a sketch around an axis (additive) | All |
| Revolve a sketch around an axis (subtractive) | All |
| Create parametric holes with optional threading | All |
| Create a loft through multiple sketches | All |
| Sweep a profile along a spine path | All |
PartDesign - Patterns & Edges (5 tools)
Tool | Description | Mode |
| Create linear pattern of a feature | All |
| Create polar/circular pattern of a feature | All |
| Mirror a feature across a plane | All |
| Add fillets (rounded edges) | All |
| Add chamfers (beveled edges) | All |
View & Display (11 tools)
Tool | Description | Mode |
| Capture a screenshot of the 3D view | GUI |
| Set camera to standard views (Front, Top, etc.) | GUI |
| Zoom to fit all objects in view | GUI |
| Zoom in by a factor | GUI |
| Zoom out by a factor | GUI |
| Set camera position and look-at point | GUI |
| Show/hide objects | GUI |
| Set display mode (Shaded, Wireframe, etc.) | GUI |
| Set object color as RGB values | GUI |
| List available FreeCAD workbenches | All |
| Switch to a different workbench | All |
Undo/Redo (3 tools)
Tool | Description | Mode |
| Undo the last operation | All |
| Redo a previously undone operation | All |
| Get available undo/redo operations | All |
Export/Import (7 tools)
Tool | Description | Mode |
| Export to STEP format (ISO CAD exchange) | All |
| Export to STL format (3D printing) | All |
| Export to 3MF format (modern 3D printing) | All |
| Export to OBJ format (Wavefront) | All |
| Export to IGES format (older CAD exchange) | All |
| Import a STEP file | All |
| Import an STL file as mesh | All |
Macro Management (6 tools)
Tool | Description | Mode |
| List all available FreeCAD macros | All |
| Execute a macro by name | All |
| Create a new macro file | All |
| Read macro source code | All |
| Delete a user macro | All |
| Create macro from template (basic, part, etc.) | All |
Parts Library (2 tools)
Tool | Description | Mode |
| List parts in FreeCAD's parts library | All |
| Insert a part from the library | All |
CAM review and testing (11 tools)
Tools for reviewing and testing CAM (Path) changes. "Local" tools run on the machine of the MCP server (headless FreeCADCmd, file comparisons) and don't need the bridge.
Tool | Description | Mode |
| Counts, cut/rapid length, Z levels, link heights, upward feeds of an op | All |
| Run a probe against two git refs of the CAM code and compare the results | Local |
| Find faces and edges by normal, height or radius | All |
| Build a test Job with stock, tool controller and operation | All |
| Post a job; upload, username and remote dialogs are cancelled | All |
| Compare two G-code outputs | Local |
| Sweep the tool along link moves and report gouges | All |
| Grid check of the material an operation leaves uncut | All |
| Run CAM unit tests, optionally against a baseline tree | Local |
| Run a script in headless FreeCADCmd and return its real exit code | Local |
| Record a captioned GUI demo on an off-screen display | GUI |
GUI health (2 tools)
Tool | Description | Mode |
| Open panels, stray dialogs, active document, new Report-view errors | GUI |
| Close stray panels and dialogs; gets in even while a run is stuck on a dialog | GUI |
GuiDriver - drive the GUI like a user (6 tools)
The add-on ships guidriver (in freecad/RobustMCPBridge/guidriver/, importable inside
FreeCAD as import guidriver; CAM parts in guidriver.cam). It runs real GUI commands,
reads and sets task panel widgets through their own Qt API (GUI gating included), presses
the task view's OK/Cancel and answers modal dialogs by rule; a dialog no rule matches is
rejected after 3 s and reported. See its README.
Tool | Description | Mode |
| Run a command like a toolbar click, with modal-dialog rules | GUI |
| Dump / set / click / OK / Cancel the open task panel | GUI |
| Open an object's editor like a tree double-click | GUI |
| Base Geometry "Add" on the open CAM operation panel | GUI |
| Pre-post warnings (and summary) for a CAM job | GUI |
| Post a job, answering the post's dialogs by rule (never uploads) | GUI |
For Developers
This section covers development setup, contributing, and working with the codebase.
Robust MCP Server Development
Prerequisites
Initial Setup
# Clone the repository
git clone https://github.com/spkane/freecad-addon-robust-mcp-server.git
cd freecad-addon-robust-mcp-server
# Install mise via the Official mise installer script (if not already installed)
curl https://mise.run | sh
# Install all tools (Python 3.11, uv, just, pre-commit)
mise trust
mise install
# Set up the development environment
just setupThis installs:
Python 3.11 - Required for FreeCAD ABI compatibility
uv - Fast Python package manager
just - Command runner for development workflows
pre-commit - Git hooks for code quality
MCP Client Configuration (Development)
Create a .mcp.json file in the project directory:
{
"mcpServers": {
"freecad": {
"command": "/path/to/mise/shims/uv",
"args": ["run", "--project", "/path/to/freecad-addon-robust-mcp-server", "freecad-mcp"],
"env": {
"FREECAD_MODE": "xmlrpc",
"FREECAD_SOCKET_HOST": "localhost",
"FREECAD_XMLRPC_PORT": "9875",
"PATH": "/path/to/mise/shims:/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin"
}
}
}
}Replace the paths with your actual paths:
Placeholder | Description | Example |
| Full path to uv via mise shims |
|
| Project directory |
|
| mise shims directory for PATH |
|
Finding your mise shims path:
mise where uv | sed 's|/installs/.*|/shims|'
# Example: /home/user/.local/share/mise/shims (on Linux) or ~/.local/share/mise/shims (on macOS)Development Workflow
Commands are organized into modules. Use just to see top-level commands, or just list-<module> to see module-specific commands.
# Show top-level commands and available modules
just
# Show commands in a specific module
just list-mcp # Robust MCP Server commands
just list-freecad # FreeCAD plugin/macro commands
just list-install # Installation commands
just list-quality # Code quality commands
just list-testing # Test commands
just list-docker # Docker commands
just list-documentation # Documentation commands
just list-dev # Development utilities
# List ALL commands from all modules
just list-all
# Install/update dependencies
just install::mcp-server
# Run all checks (linting, type checking, tests)
just all
# Quality commands
just quality::lint # Run ruff linter
just quality::typecheck # Run mypy type checker
just quality::format # Format code
just quality::check # Run all pre-commit hooks
# Testing commands
just testing::unit # Run unit tests
just testing::cov # Run tests with coverage
just testing::integration # Run integration tests
# Run the Robust MCP Server (or with debug logging)
just mcp::run
just mcp::run-debug
# Docker commands
just docker::build # Build image for local architecture
just docker::build-multi # Build multi-arch image (amd64 + arm64)
just docker::run # Run containerRunning FreeCAD with the MCP Bridge
GUI Mode (recommended for development)
# Start FreeCAD with auto-started bridge
just freecad::run-guiHeadless Mode (for automation/CI)
just freecad::run-headlessRunning Tests
# Unit tests only (no FreeCAD required)
just testing::unit
# Unit tests with coverage
just testing::cov
# Integration tests (requires running FreeCAD bridge)
just testing::integration
# Integration tests with automatic FreeCAD startup
just testing::integration-autoCode Quality
The project uses strict code quality checks via pre-commit:
Ruff - Linting and formatting
MyPy - Type checking
Bandit - Security scanning
Codespell - Spell checking
Secrets scanning - Gitleaks, detect-secrets, TruffleHog
# Run all pre-commit hooks
just quality::check
# Run security/secrets scans
just quality::security
just quality::secretsArchitecture
See the detailed architecture document for design documentation covering:
Module structure
Bridge communication protocols
Tool registration patterns
FreeCAD plugin architecture
Acknowledgements
MCP+ is a copy of spkane/freecad-addon-robust-mcp-server by Sean P. Kane, extended by Billy Huddleston. It also takes ideas from neka-nat/freecad-mcp (bridge status, version check) and CREATeNG/freecad-mcp-bridge (paged output for long runs, Origin check, running files). All three are MIT licensed; their notices are in LICENSE.
spkane's original acknowledgements:
This project was developed after analyzing several existing FreeCAD Robust MCP implementations. We are grateful to these projects for their pioneering work and the ideas they contributed to the FreeCAD + AI ecosystem:
Related Projects
neka-nat/freecad-mcp (MIT License) - The queue-based thread safety pattern and XML-RPC protocol design (port 9875) were directly inspired by this project. Our implementation maintains protocol compatibility while being a complete rewrite with additional features.
jango-blockchained/mcp-freecad - Inspired our connection recovery mechanisms and multi-mode architecture approach.
contextform/freecad-mcp - Informed our comprehensive PartDesign and Part workbench tool coverage.
ATOI-Ming/FreeCAD-MCP - Inspired our macro development toolkit including templates, validation, and automatic imports.
bonninr/freecad_mcp - Influenced our simple socket-based communication approach.
See docs/COMPARISON.md for a detailed analysis of these implementations and the design decisions they informed.
License
MIT License - see LICENSE for details.
This server cannot be deployed
Maintenance
Related MCP Connectors
Use your Mac, Windows or Linux computer from ChatGPT, Claude or Codex: files, commands, documents.
Live browser debugging for AI assistants — DOM, console, network via MCP.
Connect AI assistants to explicitly paired computers, servers, and VMs for permitted remote actions.
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
Related MCP Servers
- AlicenseAqualityDmaintenanceBridges Claude with a live FreeCAD instance to provide deep access to runtime state, document structure, and shape topology. It enables AI-assisted CAD work, sketch diagnostics, and development debugging through direct interaction with FreeCAD's internal data and viewport.934GNU Lesser General Public v2.1 or later
- AlicenseAqualityDmaintenanceEnables AI assistants to control FreeCAD 3D modeling software, allowing creation and manipulation of 3D objects, execution of Python code, and interaction with FreeCAD's parts library through natural language.10MIT
- FlicenseBqualityDmaintenanceEnables AI assistants to perform 3D modeling and CAD operations in FreeCAD, including geometry creation, boolean operations, and document management.79-
- AlicenseCqualityDmaintenanceAllows AI agents like Claude to create, edit, and query 3D models in FreeCAD through natural language.579MIT