Freecad

by bonninr

199 709 downloads Not rated yet MIT
GitHub

About

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.

Details

License
MIT

Explore

- Retrieve comprehensive scene information (document properties, objects, sketches, camera)
- Execute arbitrary Python code within the FreeCAD context
- Automate complex CAD operations via script
- Modify existing objects and create new ones programmatically
- Access shape properties, geometry, and constraints of sketches

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name Freecad
    Command (node, npx, python, etc.)

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

To configure the MCP server, you can use a JSON format to specify the server settings. Below is an example configuration:

``json
{
"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:
- Windows: Typically, it might look like
C:\\ProgramData\\anaconda3\\python.exe or C:\\Python39\\python.exe.
- Linux: It could be
/usr/bin/python3 or the path to your Python installation.
- macOS: Usually, it would be
/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.

To use the FreeCAD MCP, you can connect to the server and send commands as follows:

python
import socket
import json

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "freecad": {
            "freecad": {
                "command": "/usr/bin/python3",
                "args": [
                    "/home/USER/.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"
        ]
    }
}

Overview

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

Configuration

To configure the MCP server, you can use a JSON format to specify the server settings. Below is an example configuration: ``json { "mcpServers": { "freecad": { "command": "C:\\ProgramData\\anaconda3\\python.exe", "args": [ "C:\\Users\\USER\\AppData\\Roaming\\FreeCAD\\Mod\\freecad_mcp\\src\\freecad_bridge.py" ] } } } `

Configuration Details

- command: The path to the Python executable that will run the FreeCAD MCP server. This can vary based on your operating system: - Windows: Typically, it might look like
C:\\ProgramData\\anaconda3\\python.exe or C:\\Python39\\python.exe. - Linux: It could be /usr/bin/python3 or the path to your Python installation. - macOS: Usually, it would be /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.

Example for Different Operating Systems

Windows
`json { "mcpServers": { "freecad": { "command": "C:\\ProgramData\\anaconda3\\python.exe", "args": [ "C:\\Users\\USER\\AppData\\Roaming\\FreeCAD\\Mod\\freecad_mcp\\src\\freecad_bridge.py" ] } } } `
Linux
`json { "mcpServers": { "freecad": { "command": "/usr/bin/python3", "args": [ "/home/USER/.FreeCAD/Mod/freecad_mcp/src/freecad_bridge.py" ] } } } `
macOS
`json { "mcpServers": { "freecad": { "command": "/usr/local/bin/python3", "args": [ "/Users/USER/Library/Preferences/FreeCAD/Mod/freecad_mcp/src/freecad_bridge.py" ] } } } `

Features

The FreeCAD MCP currently supports the following functionalities:

1. get_scene_info

- Description: Retrieves comprehensive information about the current FreeCAD document, including: - Document properties (name, label, filename, object count) - Detailed object information (type, position, rotation, shape properties) - Sketch data (geometry, constraints) - View information (camera position, direction, etc.)

2. run_script

- Description: Executes arbitrary Python code within the FreeCAD context. This allows users to perform complex operations, create new objects, modify existing ones, and automate tasks using FreeCAD's Python API.

Example Usage

To use the FreeCAD MCP, you can connect to the server and send commands as follows:
``python import socket import json
No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.

Videos about Freecad

Relevant YouTube tutorials, setups, and demos