FreecadMCP connects Freecad to Claude AI and other MCP-ready tools like Cursor through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Freecad. This integration enables prompt assisted CAD 3d Design.
The FreeCAD MCP (Model Control Protocol) provides a simplified interface for interacting with FreeCAD through a server-client architecture. This allows users to execute commands and retrieve information about the current FreeCAD document and scene.
https://github.com/user-attachments/assets/5acafa17-4b5b-4fef-9f6c-617e85357d44
To configure the MCP server, you can use a JSON format to specify the server settings. Below is an example configuration:
{
"mcpServers": {
"freecad": {
"command": "C:\\ProgramData\\anaconda3\\python.exe",
"args": [
"C:\\Users\\USER\\AppData\\Roaming\\FreeCAD\\Mod\\freecad_mcp\\src\\freecad_bridge.py"
]
}
}
}
command: The path to the Python executable that will run the FreeCAD MCP server. This can vary based on your operating system:
C:\\ProgramData\\anaconda3\\python.exe
or C:\\Python39\\python.exe
./usr/bin/python3
or the path to your Python installation./usr/local/bin/python3
or the path to your Python installation.args: An array of arguments to pass to the Python command. The first argument should be the path to the freecad_bridge.py
script, which is responsible for handling the MCP server logic. Make sure to adjust the path according to your installation.
{
"mcpServers": {
"freecad": {
"command": "C:\\ProgramData\\anaconda3\\python.exe",
"args": [
"C:\\Users\\USER\\AppData\\Roaming\\FreeCAD\\Mod\\freecad_mcp\\src\\freecad_bridge.py"
]
}
}
}
{
"mcpServers": {
"freecad": {
"command": "/usr/bin/python3",
"args": [
"/home/USER/.FreeCAD/Mod/freecad_mcp/src/freecad_bridge.py"
]
}
}
}
{
"mcpServers": {
"freecad": {
"command": "/usr/local/bin/python3",
"args": [
"/Users/USER/Library/Preferences/FreeCAD/Mod/freecad_mcp/src/freecad_bridge.py"
]
}
}
}
The FreeCAD MCP currently supports the following functionalities:
get_scene_info
run_script
To use the FreeCAD MCP, you can connect to the server and send commands as follows:
import socket
import json
# Connect to the FreeCAD MCP server
client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
client.connect(('localhost', 9876))
# Example: Get scene information
command = {
"type": "get_scene_info"
}
client.sendall(json.dumps(command).encode('utf-8'))
# Receive the response
response = client.recv(4096)
print(json.loads(response.decode('utf-8')))
# Example: Run a script
script = """
import FreeCAD
doc = FreeCAD.ActiveDocument
box = doc.addObject("Part::Box", "MyBox")
box.Length = 20
box.Width = 20
box.Height = 20
doc.recompute()
"""
command = {
"type": "run_script",
"params": {
"script": script
}
}
client.sendall(json.dumps(command).encode('utf-8'))
# Receive the response
response = client.recv(4096)
print(json.loads(response.decode('utf-8')))
# Close the connection
client.close()
freecad_mcp
directory in your FreeCAD modules directory:
%APPDATA%/FreeCAD/Mod/
~/.FreeCAD/Mod/
~/Library/Preferences/FreeCAD/Mod/
Feel free to contribute by submitting issues or pull requests. Your feedback and contributions are welcome!
This project is licensed under the MIT License. See the LICENSE file for details.
{ "mcpServers": { "freecadmcp": { "command": "C:\\ProgramData\\anaconda3\\python.exe", "args": [ "C:\\Users\\USER\\AppData\\Roaming\\FreeCAD\\Mod\\freecad_mcp\\src\\freecad_bridge.py" ] } } }
Related projects feature coming soon
Will recommend related projects based on sub-categories