Jump to content

Robust MCP Bridge Workbench

From FreeCAD Documentation
Robust MCP Bridge Workbench icon

Description

The Robust MCP Bridge Workbench connects FreeCAD to the Robust MCP Server. Together, they allow compatible applications to control FreeCAD through the Model Context Protocol (MCP). The workbench runs inside FreeCAD; the separately installed MCP server connects to it through an authenticated local XML-RPC or JSON-RPC bridge.

This workbench is designed to work with the Robust MCP Server (available on PyPI), which allows AI assistants like Claude to interact with FreeCAD through natural language. The full documentation and source code can be found at GitHub repository, where you will find the MCP Server, Bridge and some FreeCAD Macros used for various things, not necessarily related to AI or the MCP work.

Key Features:

  • Toolbar controls for starting/stopping the MCP bridge.
  • Status indicator showing the bridge state, with version and listener details in its tooltip.
  • XML-RPC server on configurable port (default: 9875).
  • JSON-RPC socket server on configurable port (default: 9876).
  • Headless mode support for automation and CI/CD pipelines.
  • Thread-safe queue system ensuring safe FreeCAD operations.
  • Configurable auto-start on FreeCAD launch.

The MCP server also provides tools for parametric modeling, sketches, spreadsheets, Draft text, importing and exporting files, and CAM workflows such as creating jobs, generating toolpaths, and producing G-code. Available CAM operations depend on the FreeCAD version and whether the GUI is available. See the tools reference for the complete list and details.

Installation

FreeCAD 1.0.2 or newer is required. FreeCAD 1.1.4 or newer is recommended because it includes security fixes.

Via Addon Manager (recommended)

Availability: The workbench has been submitted to the FreeCAD Addon Index but may not yet be available in the public Addon Manager catalog. Until it is listed, use the manual GitHub Releases installation below.

  1. Open FreeCAD
  2. Go to Tools → Addon Manager
  3. Search for "Robust MCP Bridge"
  4. Click Install
  5. Restart FreeCAD

Manual installation

Download the stable workbench ZIP or .tar.gz archive from the workbench releases.

  1. Quit FreeCAD.
  2. Find the Mod directory in the FreeCAD profile you use. To find the active profile, open FreeCAD's Python console and run App.getUserAppDataDir(), then quit FreeCAD again.
  3. Move any older copy of the Robust MCP Bridge workbench out of that profile's Mod directory.
  4. Extract the archive and copy its top-level package directory into Mod. Do not copy only the inner freecad or RobustMCPBridge directory.
  5. Restart FreeCAD.

The extracted package directory must directly contain package.xml and freecad/RobustMCPBridge/. Repeat the installation for each FreeCAD profile you intend to use.

Usage

GUI mode

Robust MCP Bridge workbench toolbar

  1. Install and pair the MCP server and workbench as described in Connecting MCP clients.
  2. Switch to the Robust MCP Bridge workbench using the workbench selector.
  3. Click Start Bridge in the toolbar.
  4. Check the bridge status in FreeCAD's status bar. Its tooltip includes the bridge version and listener details.
  5. Start your configured MCP client or assistant.

To stop the bridge, click Stop Bridge in the toolbar.

Robust MCP Bridge workbench statusbar

Headless mode

For automation and CI/CD, the bridge can run without the GUI. Pair it first, then follow the connection-mode instructions for your platform.

The startup path depends on the active FreeCAD profile and how the workbench was installed. Use App.getUserAppDataDir() in FreeCAD's Python console to identify the profile; do not assume that its directory is named v1-2.

Configuration

Access preferences via Edit → Preferences → Robust MCP Bridge or Robust MCP Bridge → MCP Bridge Preferences...

Setting Description Default
Auto-start bridge when FreeCAD GUI launches Start the bridge automatically in the FreeCAD GUI Disabled
Auto-start in console FreeCAD Start the bridge automatically in console FreeCAD Disabled
Also auto-start in console batch runs Also start the bridge during console batch runs; requires console auto-start Disabled
Show status indicator Display connection status in FreeCAD's status bar Enabled
XML-RPC Port Port for XML-RPC connections 9875
Socket Port Port for JSON-RPC socket connections 9876

Robust MCP Bridge workbench preference pane

Features by mode

Feature GUI mode Headless mode
Document and object management Yes Yes
3D shapes and Boolean operations Yes Yes
Parametric modeling, sketches, and constraints Yes Yes
Spreadsheets and Draft text Yes Yes
Import and export Yes Yes
Macro and Python execution Yes Yes
CAM jobs, toolpaths, and G-code Yes Supported with limitations
Screenshots Yes No
Object colors and visibility Yes No
Camera and view control Yes No

CAM capabilities vary by FreeCAD version and execution mode. Some operations require the GUI, and some FreeCAD versions have known headless limitations. Use cam_get_capabilities to inspect the available capabilities. For details, see the CAM tools reference.

Connecting MCP clients

The workbench provides the FreeCAD bridge used by the separately installed Robust MCP Server. Your MCP client or AI assistant connects to the MCP server, which connects to the paired bridge. Install the server with:

pip install freecad-robust-mcp

Or using uv:

uv tool install freecad-robust-mcp

After installing both components, run the pairing command as the same operating-system user who runs FreeCAD:

freecad-mcp --pair-bridge

If the account is already paired, retain the existing credential. Start FreeCAD, select the Robust MCP Bridge workbench, and start the bridge.

Configure your assistant to launch freecad-mcp, then verify the connection:

freecad-mcp --check --mode xmlrpc

The installation guide includes instructions for Claude Desktop, Claude Code, Codex Desktop, and the Codex CLI. Setup is similar for other MCP-compatible clients.

The bridge listens on loopback and requires pairing. A paired client can execute Python with the FreeCAD user's permissions. Pairing does not isolate malicious programs running under the same operating-system user account.

Troubleshooting

Bridge won't start

  1. Confirm that pairing completed for the operating-system user running FreeCAD.
  2. Check the FreeCAD Python console (View → Panels → Python console) for error messages.
  3. Ensure no other process is using ports 9875/9876.
  4. Try restarting FreeCAD.

Connection refused

  1. Verify that FreeCAD and the bridge are running. Check the status indicator and its tooltip for listener status and ports.
  2. Confirm that the MCP server and bridge use the same pairing credential.
  3. Check that ports match between the workbench preferences and MCP server configuration.
  4. Run freecad-mcp --check --mode xmlrpc.

Docker Desktop can forward host.docker.internal to a host-loopback listener. Docker Engine on Linux cannot use its host-gateway address to reach a host-loopback-only bridge in the same way; for a Linux GUI setup, run the MCP server directly on the host. See the connection-mode guide for details.

Headless mode won't start

  1. Confirm that the bridge is paired for the operating-system user running FreeCAD.
  2. Verify that you are using the appropriate FreeCAD console executable and startup script for your platform and installation.
  3. Check the console output for errors, including port conflicts and pairing failures.

Links