FreeCAD MCP Server

Local setup required. This server has to be cloned and prepared on your machine before you register it in Claude Code.
1

Set the server up locally

Run this once to clone and prepare the server before adding it to Claude Code.

Run in terminal
git clone https://github.com/theosib/FreeCAD-MCP-Server.git
cd FreeCAD-MCP-Server
python3 -m venv .venv
source .venv/bin/activate
pip install -e .
2

Register it in Claude Code

After the local setup is done, run this command to point Claude Code at the built server.

Run in terminal
claude mcp add freecad-mcp-server -- node "<FULL_PATH_TO_FREECAD_MCP_SERVER>/dist/index.js"

Replace <FULL_PATH_TO_FREECAD_MCP_SERVER>/dist/index.js with the actual folder you prepared in step 1.

README.md

Bridges Claude with a live FreeCAD instance for deep runtime state access.

FreeCAD MCP Server

An MCP (Model Context Protocol) server that bridges Claude with a live FreeCAD instance. It gives Claude deep access to FreeCAD's runtime state — document structure, object properties, shape topology, sketch constraint health, and more — enabling AI-assisted CAD work and FreeCAD development debugging.

What It Does

Unlike simple script-execution MCP servers, this project provides rich context extraction that lets Claude genuinely understand what's happening inside FreeCAD:

Tool What It Returns
list_documents All open documents with names, file paths, object counts
get_document_graph Full feature tree — every object with TypeId, properties, dependency links, validity state
inspect_object Complete property dump for a single object, with shape metadata
analyze_shape Topological analysis — face classifications (Plane/Cylinder/Cone/...), edge details, bounding box, volume
get_sketch_diagnostics Constraint health — DOF, conflicts, redundancies, every constraint and geometry element with coordinates
tracked_recompute Recompute with before/after diff — new errors, resolved errors, persistent errors
execute_script Run arbitrary Python inside FreeCAD (escape hatch for anything not covered above)
get_screenshot Capture the 3D viewport as a base64 PNG
reload_handlers Hot-reload handler code without restarting FreeCAD

Architecture

Claude (Code/Desktop)  ←stdio MCP→  Bridge Server  ←TCP:9876→  FreeCAD Addon
                                     (this project)              (inside FreeCAD)

The project has two components:

  1. FreeCAD addon (freecad_addon/) — runs inside FreeCAD as a workbench. Starts a threaded TCP server that accepts JSON-RPC requests and executes them on FreeCAD's main thread via a QTimer-polled work queue.

  2. MCP bridge server (src/freecad_mcp_agent/) — spawned by Claude via stdio. Connects to the addon over TCP and translates MCP tool calls into JSON-RPC requests.

Installation

1. Install the MCP bridge

# Clone the repo
git clone https://github.com/theosib/FreeCAD-MCP-Server.git
cd FreeCAD-MCP-Server

# Create a venv and install
python3 -m venv .venv
source .venv/bin/activate
pip install -e .

2. Install the FreeCAD addon

FreeCAD doesn't reliably follow symlinks on macOS, so we use a thin loader file.

Find your FreeCAD Mod directory:

  • macOS: ~/Library/Application Support/FreeCAD/Mod/ (or ~/Library/Application Support/FreeCAD/v1-2/Mod/ for weekly builds)
  • Linux: ~/.local/share/FreeCAD/Mod/
  • Windows: %APPDATA%/FreeCAD/Mod/

Tip: Run FreeCAD.getUserAppDataDir() in FreeCAD's Python console to find the exact path.

Create the loader:

mkdir -p "<your-mod-dir>/FreeCADMCPAgent"

Create <your-mod-dir>/FreeCADMCPAgent/InitGui.py with:

import sys
_ADDON_DIR = "/absolute/path/to/FreeCAD-MCP-Server/freecad_addon"
if _ADDON_DIR not in sys.path:
    sys.path.insert(0, _ADDON_DIR)
_project_init = _ADDON_DIR + "/InitGui.py"
_ns = dict(globals())
_ns["__file__"] = _project_init
with open(_project_init) as _f:
    exec(compile(_f.read(), _project_init, "exec"), _ns)

Replace /absolute/path/to/FreeCAD-MCP-Server with the actual path to your clone.

3. Configure Claude Code

Add a .mcp.json to your working directory (or FreeCAD source tree):

{
  "mcpServers": {
    "freecad-debug": {
      "command": "/absolute/path/to/FreeCAD-MCP-Server/.venv/bin/freecad-mcp-agent",
      "env": {
        "FREECAD_MCP_HOST": "127.0.0.1",
        "FREECAD_MCP_PORT": "9876"
      }
    }
  }
}

Usage

  1. Start FreeCAD. The RPC server auto-starts on port 9876 (you'll see "MCP Debug Agent: RPC server auto-started" in FreeCAD's console). Set FREECAD_MCP_NO_AUTOSTART=1 to disable auto-start.

  2. Launch Claude Code in a directory with the .mcp.json config.

  3. Use the tools. Claude can now inspect your FreeCAD model:

"What objects are in the current document?"

"The Pocket001 feature looks wrong — can you diagnose it?"

"Is Sketch003 fully constrained? Are there any conflicts?"

"Recompute the document and tell me what changed."

Use Case: FreeCAD Development Debugging

This project was designed for debugging FreeCAD itself. When the .mcp.json is placed in a FreeCAD source tree, Claude Code gets simultaneous access to:

  • Source code — C++ and Python files, git history, build system (via Claude Code's native file access)
  • Live runtime state — object properties, shape topology, constraint solver state (via MCP tools)

This lets Claude correlate what the code should do with what the runtime actually produced. See docs/freecad-fork-instructions.md for detailed workflows and a TypeId-to-source-file mapping table.

Environment Variables

Variable Default Purpose

Tools (9)

list_documentsReturns all open documents with names, file paths, and object counts.
get_document_graphReturns the full feature tree including TypeId, properties, dependency links, and validity state.
inspect_objectProvides a complete property dump for a single object with shape metadata.
analyze_shapePerforms topological analysis including face classifications, edge details, bounding box, and volume.
get_sketch_diagnosticsReturns constraint health, DOF, conflicts, redundancies, and coordinates for geometry elements.
tracked_recomputeRecomputes the document and returns a diff of new, resolved, and persistent errors.
execute_scriptRuns arbitrary Python code inside the FreeCAD instance.
get_screenshotCaptures the 3D viewport as a base64 PNG.
reload_handlersHot-reloads handler code without restarting FreeCAD.

Environment Variables

FREECAD_MCP_HOSTThe host address for the FreeCAD TCP server.
FREECAD_MCP_PORTThe port number for the FreeCAD TCP server.
FREECAD_MCP_NO_AUTOSTARTSet to 1 to disable the automatic start of the RPC server in FreeCAD.

Configuration

claude_desktop_config.json
{"mcpServers": {"freecad-debug": {"command": "/absolute/path/to/FreeCAD-MCP-Server/.venv/bin/freecad-mcp-agent", "env": {"FREECAD_MCP_HOST": "127.0.0.1", "FREECAD_MCP_PORT": "9876"}}}}

Try it

What objects are currently in the active FreeCAD document?
The Pocket001 feature is failing; can you diagnose the issue using the sketch diagnostics?
Is Sketch003 fully constrained, or are there any conflicts I should know about?
Recompute the document and tell me if any new errors were introduced.
Take a screenshot of the current 3D viewport and analyze the topology of the main object.

Frequently Asked Questions

What are the key features of FreeCAD MCP Server?

Deep access to FreeCAD runtime state and document structure. Topological analysis of shapes including face and edge details. Comprehensive sketch constraint health diagnostics. Live recompute tracking with error diffing. Direct 3D viewport screenshot capture.

What can I use FreeCAD MCP Server for?

Debugging FreeCAD source code by correlating C++ logic with live runtime state. Automated CAD model validation and constraint checking. AI-assisted troubleshooting of complex parametric models. Rapid prototyping of FreeCAD Python scripts with AI feedback.

How do I install FreeCAD MCP Server?

Install FreeCAD MCP Server by running: git clone https://github.com/theosib/FreeCAD-MCP-Server.git && cd FreeCAD-MCP-Server && python3 -m venv .venv && source .venv/bin/activate && pip install -e .

What MCP clients work with FreeCAD MCP Server?

FreeCAD MCP Server works with any MCP-compatible client including Claude Desktop, Claude Code, Cursor, and other editors with MCP support.

Turn this server into reusable context

Keep FreeCAD MCP Server docs, env vars, and workflow notes in Conare so your agent carries them across sessions.

Need the old visual installer? Open Conare IDE.
Open Conare