FreeCAD MCP
Click on "Install 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., "@FreeCAD MCPCreate a gear model with radius 15"
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.
FreeCAD MCP Plugin
The FreeCAD MCP plugin integrates the Model Control Protocol (MCP) into FreeCAD, enabling automation of model creation, macro execution, and view management through a server-client architecture. It provides a GUI control panel and a command-line client to streamline FreeCAD workflows, supporting tasks like creating/running macros, adjusting views, and integrating with external tools (e.g., Claude, Cursor, Trace, CodeBuddy).
Table of Contents
Related MCP server: mcp-freecad
Features
The FreeCAD MCP plugin (v0.1.0) offers the following features:
MCP Server: Provides a GUI control panel (
FreeCADMCPPanel) and processes commands likecreate_macro,update_macro,run_macro,set_view, andget_report(implemented infreecad_mcp_server.py).MCP Client: Command-line tool to send commands via
stdioor TCP, manage.FCMacrofiles (create, update, run, validate), and control FreeCAD remotely (implemented infreecad_mcp_client.py).Macro Normalization: Automatically adds imports (
FreeCAD,FreeCADGui,Part,math) and post-execution steps (recompute, view adjustment) for macros.GUI Control Panel: Includes buttons to start/stop the server, clear logs, and switch views (front, top, right, axonometric).
Logging System: Records messages and errors to
freecad_mcp_log.txtin the temporary directory (e.g.,%TEMP%\freecad_mcp_log.txt) and a GUI report browser (100-line limit).Workbench Integration: Adds a
FreeCADMCPWorkbenchwith toolbar and menu commands (implemented inInitGui.py).Visual Assets: Includes workbench icon (
icon.svg), example models (gear.png,flange.png,boat.png,table.png), and demo animation (freecad.gif,freecad.mp4).
Watch the demo animation: Download the demo video: FreeCAD MCP Demo MP4
Quick Start
Install the plugin (see Installation).
Launch FreeCAD and switch to the
FreeCAD MCPworkbench.Open the control panel (
FreeCAD_MCP_Show) and click "Start Server."Run an example macro:
python D:\FreeCAD\Mod\FreeCAD-MCP-main\src\freecad_mcp_client.py --run-macro gear.FCMacro --params '{"radius": 15}'View the result: A gear model is generated and displayed in axonometric view.
Installation
Prerequisites
FreeCAD: Version 0.21 or higher, Download FreeCAD. Select the version for your operating system.
Python: Version 3.12+ (included with FreeCAD or installed via Anaconda).
Anaconda (recommended for dependency management): Download Anaconda. Select the version for your operating system.
Python Dependencies:
Required packages:
mcp-server(specified inpyproject.toml).Installation commands:
# use system Python pip install mcp-serverVerify installation:
pip show mcp-serverEnsure
mcp-serverversion .
Installation Steps
Clone the Repository:
git clone https://github.com/ATOI-Ming/FreeCAD-MCP.gitCopy to FreeCAD Mod Directory: Copy the
FreeCAD-MCPfolder to:Windows:
D:\FreeCAD\Mod\FreeCAD-MCPLinux:
~/.local/share/FreeCAD/Mod/FreeCAD-MCPmacOS:
~/Library/Application Support/FreeCAD/Mod/FreeCAD-MCP
# Windows example xcopy FreeCAD-MCP D:\FreeCAD\Mod\FreeCAD-MCP /E /H /C /INote: Adjust
D:\FreeCAD\Modbased on your FreeCAD installation path.Launch FreeCAD:
Open FreeCAD and switch to the
FreeCAD MCPworkbench (icon:assets/icon.svg).Verify that
FreeCAD-MCPis loaded in Edit > Preferences > Add-ons.
Verify Installation:
Click
FreeCAD_MCP_Showto open the control panel.Check the temporary directory (e.g.,
%TEMP%\freecad_mcp_log.txt) for startup messages.
MCP Configuration
Configure the MCP client to communicate with FreeCAD via stdio or TCP.
Create Configuration File: Create
mcp_config.jsoninD:\FreeCAD\Mod\FreeCAD-MCP-main\src\:{ "mcpServers": { "freecad": { "disabled": false, "timeout": 60, "type": "stdio", "command": "D:\\Anaconda3\\python.exe", "args": ["D:\\FreeCAD\\Mod\\FreeCAD-MCP-main\\src\\freecad_mcp_client.py"] } } }Note:
Adjust paths based on your system:
Anaconda Path: e.g.,
C:\Anaconda3\python.exe(Windows),/home/<user>/anaconda3/bin/python(Linux),/Users/<user>/anaconda3/bin/python(macOS).FreeCAD Mod Path: e.g.,
C:\Users\<YourUser>\AppData\Roaming\FreeCAD\Mod\FreeCAD-MCP(Windows),/home/<user>/.local/share/FreeCAD/Mod/FreeCAD-MCP(Linux),/Users/<user>/Library/Application Support/FreeCAD/Mod/FreeCAD-MCP(macOS).
For TCP communication, set
"type": "tcp", add"host": "localhost", and"port": 9876.
Run the Server:
GUI Method: In the
FreeCAD MCPworkbench, clickFreeCAD_MCP_Showand then "Start Server."Command-Line Method:
conda activate freecad_mcp python D:\FreeCAD\Mod\FreeCAD-MCP-main\src\freecad_mcp_server.py
Verify Server:
Check
%TEMP%\freecad_mcp_log.txtfor a "Server started" message.Test a client command:
python D:\FreeCAD\Mod\FreeCAD-MCP-main\src\freecad_mcp_client.py --get-report
Usage
GUI Usage
In FreeCAD, switch to the
FreeCAD MCPworkbench (icon:assets/icon.svg).Click
FreeCAD_MCP_Showto open the control panel (FreeCADMCPPanel).Use the control panel:
Start/Stop Server: Control the MCP server.
Clear Logs: Clear the report browser and
%TEMP%\freecad_mcp_log.txt.View Switching: Select front, top, right, or axonometric views.
Run a macro:
Click
FreeCAD_MCP_RunMacro, select an.FCMacrofile, and execute it with automatic normalization.
Command-Line Usage
Activate the Anaconda environment:
conda activate freecad_mcpRun client commands:
python D:\FreeCAD\Mod\FreeCAD-MCP-main\src\freecad_mcp_client.py <command>Examples:
Create macro:
--create-macro my_macro --template-type partRun macro:
--run-macro my_macro.FCMacro --params '{"radius": 10}'Set view:
--set-view '{"view_type": "7"}'Get report:
--get-report
Tool Functions
The following tool functions are provided by freecad_mcp_client.py, sending commands via stdio or TCP (localhost:9876), processed by freecad_mcp_server.py.
Function | Parameters | Description |
|
| Creates an |
|
| Updates macro content, auto-adds |
|
| Runs a macro, normalizes code, recomputes document, adjusts to axonometric view. |
|
| Validates macro code syntax, returns success or error (with traceback). |
|
| Sets view: |
| None | Retrieves server logs (from |
Examples
Create Macro:
python D:\FreeCAD\Mod\FreeCAD-MCP-main\src\freecad_mcp_client.py --create-macro gear --template-type partOutput:
{"status": "success", "result": "Macro created"}Update Macro:
python D:\FreeCAD\Mod\FreeCAD-MCP-main\src\freecad_mcp_client.py --update-macro gear --code "import FreeCAD, Part\nradius = 10\ngear = Part.makeCylinder(radius, 5)\nPart.show(gear)"Output:
{"status": "success", "result": "Macro updated"}Run Macro:
python D:\FreeCAD\Mod\FreeCAD-MCP-main\src\freecad_mcp_client.py --run-macro gear.FCMacro --params '{"radius": 15}'Output:
{"status": "success", "result": {...}}Validate Code:
python D:\FreeCAD\Mod\FreeCAD-MCP-main\src\freecad_mcp_client.py --validate-macro-code gear --code "import FreeCAD\nApp.newDocument()"Output:
{"status": "success"}Set View:
python D:\FreeCAD\Mod\FreeCAD-MCP-main\src\freecad_mcp_client.py --set-view '{"view_type": "7"}'Output:
{"status": "success", "result": "view set to axonometric"}Get Report:
python D:\FreeCAD\Mod\FreeCAD-MCP-main\src\freecad_mcp_client.py --get-reportOutput:
{"status": "success", "result": {...}}
Use Cases
Automated Gear Model Creation:
Scenario: Generate a parametric gear model for engineering design.
Steps:
Create macro:
--create-macro gear --template-type partUpdate macro:
--update-macro gear --code "import FreeCAD, Part\nradius = 15\ngear = Part.makeCylinder(radius, 5)\nPart.show(gear)"Run macro:
--run-macro gear.FCMacro --params '{"radius": 15}'
Result: Gear model generated, displayed in axonometric view.
Output:

Generating a Flange Model:
Scenario: Automate creation of a flange with holes for mechanical design.
Steps: Run macro:
--run-macro flange.FCMacroResult: Flange model generated with automatic normalization.
Output:

Text-Based Model Generation:
Scenario: Generate a boat model from a text description (e.g., "create a boat with a curved hull").
Steps:
Use Claude to generate
boat.FCMacro.Run macro:
--run-macro boat.FCMacro
Result: Boat model generated with automatic view adjustment.
Output:

CAD Drawing Recognition:
Scenario: Recreate a table model from a CAD drawing.
Steps:
Use Trace to convert drawing to
table.FCMacro.Run macro:
--run-macro table.FCMacro
Result: Table model generated.
Output:

Batch Processing Models:
Scenario: Automate creation of multiple models (e.g., gear and flange).
Steps:
for macro in gear.FCMacro flange.FCMacro; do python D:\FreeCAD\Mod\FreeCAD-MCP-main\src\freecad_mcp_client.py --run-macro $macro doneResult: Models generated sequentially, logged to
%TEMP%\freecad_mcp_log.txt.Output: See
gear.pngandflange.png.
External Tool Integration
FreeCAD MCP supports integration with external tools to enhance model generation:
Claude: AI model for generating
.FCMacrofiles from text descriptions.Example: Input "create a gear with 10mm radius," generates:
import FreeCAD, Part radius = 10 gear = Part.makeCylinder(radius, 5) Part.show(gear)Save as
gear.FCMacro, run:--run-macro gear.FCMacro.
Trace: CAD drawing processing tool to convert drawings to
.FCMacrofiles.Example: Convert a table drawing to
table.FCMacro, run:--run-macro table.FCMacro.
Cursor/CodeBuddy: Code editing tools for writing and debugging macro code.
Example: Edit
flange.FCMacroin Cursor, update:--update-macro flange.FCMacro --code "<code>".
Assets
The assets/ directory contains the following resources:
icon.svg: Icon for
FreeCADMCPWorkbench, used inInitGui.pyandpackage.xml.gear.png: Example gear model.

flange.png: Example flange model.

boat.png: Example boat model.

table.png: Example table model.

freecad.gif: Demo animation showing GUI panel, macro execution, and view switching.

freecad.mp4: Demo video, available for download. Download: FreeCAD MCP Demo MP4
Troubleshooting
Server Fails to Start:
Issue: Port 9876 is in use.
Solution: Check port (
netstat -ano | findstr 9876), change port, or terminate conflicting process.
Client Connection Failure:
Issue: Incorrect paths in
mcp_config.json.Solution: Verify
commandandargspaths, e.g.,D:\Anaconda3\python.exeandD:\FreeCAD\Mod\FreeCAD-MCP-main\src\freecad_mcp_client.py.
Macro Execution Errors:
Issue: Syntax errors or missing imports in macro code.
Solution: Use
--validate-macro-codeto check code, review traceback in%TEMP%\freecad_mcp_log.txt.
Log File Not Generated:
Issue: No write permission in temporary directory.
Solution: Check permissions for
%TEMP%\freecad_mcp_log.txt, or specify another path infreecad_mcp_server.py.
More Help: Submit issues on GitHub (Bug Tracker).
Contributing
Contributions are welcome! Follow these steps:
Fork the repository:
https://github.com/ATOI-Ming/FreeCAD-MCP.Create a branch:
git checkout -b feature/your-feature.Commit changes:
git commit -m "Add your feature".Push and create a Pull Request.
For questions or collaborations, please open an issue or contact [1757772673@qq.com,抖音:huhushuxue95]
License
This project is licensed under the MIT License. See LICENSE for details.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/ATOI-Ming/FreeCAD-MCP'
If you have feedback or need assistance with the MCP directory API, please join our Discord server