<languages/>
<translate>

<!--T:1-->
[[Image:FreecadRobustMCPBridge.svg|thumb|128px|Robust MCP Bridge Workbench icon]]

</translate>
{{TOCright}}
<translate>

==Description== <!--T:2-->

<!--T:3-->
The '''Robust MCP Bridge Workbench''' is the server-side connection point that bridges to the [https://pypi.org/project/freecad-robust-mcp/ Robust MCP Server], which enables external applications to control FreeCAD through the [https://modelcontextprotocol.io/ Model Context Protocol (MCP)]. The workbench runs inside FreeCAD and exposes XML-RPC and JSON-RPC interfaces that external MCP clients can connect to.

<!--T:4-->
This workbench is designed to work with the [https://pypi.org/project/freecad-robust-mcp/ Robust MCP Server] (available on PyPI), which allows AI assistants like [https://claude.ai Claude] to interact with FreeCAD through natural language. The full documentation and source code can be found at [https://github.com/spkane/freecad-addon-robust-mcp-server 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.

<!--T:5-->
'''Key Features:'''
* Toolbar controls for starting/stopping the MCP bridge.
* Status indicator showing connection state (green=running, red=stopped).
* 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.

==Installation== <!--T:6-->

===From a source checkout=== <!--T:7-->

<!--T:8-->
The workbench is not currently listed in the public Addon Manager. From a matching source checkout, run {{incode|just install::mcp-bridge-workbench}} and restart FreeCAD. The installer selects the latest versioned profile when present and installs to {{FileName|Mod/RobustMCPBridge/freecad/RobustMCPBridge/}}. Pair the server and bridge with {{incode|uv run freecad-mcp --pair-bridge}} as the FreeCAD user before starting the bridge. See the [https://spkane.github.io/freecad-addon-robust-mcp-server/latest/getting-started/installation/ installation and pairing guide].

===Manual installation=== <!--T:9-->

<!--T:10-->
Download a pairing-capable workbench archive matching your server from the [https://github.com/spkane/freecad-addon-robust-mcp-server/releases?q=robust-mcp-workbench&expanded=true workbench releases]. Remove older workbench copies from the selected profile's {{FileName|Mod}} directory, including previous {{FileName|freecad-mcp-workbench-*}} archive directories and the source-installed {{FileName|RobustMCPBridge}} directory. Extract the archive's top-level package directory into that {{FileName|Mod}} directory, and restart FreeCAD. The archive contains {{FileName|package.xml}} and {{FileName|freecad/RobustMCPBridge/}}.

==Usage== <!--T:12-->

===GUI mode=== <!--T:13-->

<!--T:14-->
[[Image:Addon_RobustMCPBridge_toolbar.png|Robust MCP Bridge workbench toolbar]]

<!--T:15-->
# Switch to the '''Robust MCP Bridge''' workbench using the workbench selector
# Click {{Button|Start Bridge}} in the toolbar
# The status indicator turns green when running
# External MCP clients can now connect to localhost:9875 (XML-RPC) or localhost:9876 (Socket)

<!--T:16-->
To stop the bridge, click {{Button|Stop Bridge}} in the toolbar.

<!--T:17-->
[[Image:Addon_RobustMCPBridge_statusbar.png|Robust MCP Bridge workbench statusbar]]

===Headless mode=== <!--T:18-->

<!--T:19-->
For automation and CI/CD pipelines, pair the bridge first as described in the [https://spkane.github.io/freecad-addon-robust-mcp-server/latest/getting-started/installation/ installation and pairing guide], then run it without the GUI. These paths are FreeCAD 1.1 source-installation examples; use the active profile and actual archive directory. Run {{incode|App.getUserAppDataDir()}} in the FreeCAD Python console to find its user data directory. On Linux use {{incode|FreeCADCmd}} if that is the installed executable:

<!--T:20-->
'''Linux:'''
</translate>
{{Code|code=
freecadcmd ~/.local/share/FreeCAD/v1-1/Mod/RobustMCPBridge/freecad/RobustMCPBridge/freecad_mcp_bridge/blocking_bridge.py
}}
<translate>

<!--T:19-->
'''macOS:'''

</translate>
{{Code|code=
/Applications/FreeCAD.app/Contents/Resources/bin/freecadcmd \
    ~/Library/Application\ Support/FreeCAD/v1-1/Mod/RobustMCPBridge/freecad/RobustMCPBridge/freecad_mcp_bridge/blocking_bridge.py
}}
<translate>

<!--T:22-->
The bridge will start and keep FreeCAD running until you press Ctrl+C.

==Configuration== <!--T:23-->

<!--T:24-->
Access preferences via {{MenuCommand|Edit → Preferences → Robust MCP Bridge}} or {{MenuCommand|Robust MCP Bridge → MCP Bridge Preferences...}}

<!--T:25-->
{| class="wikitable"
! Setting !! Description !! Default
|-
| Auto-start bridge || Start bridge automatically when FreeCAD launches || 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
|}

<!--T:26-->
[[Image:Addon RobustMCPBridge preferences.png|800px|Robust MCP Bridge workbench preference pane]]

==Features by Mode== <!--T:27-->

<!--T:28-->
{| class="wikitable"
! Feature !! GUI Mode !! Headless Mode
|-
| Object creation || Yes || Yes
|-
| Boolean operations || Yes || Yes
|-
| Export (STEP, STL, 3MF) || Yes || Yes
|-
| Macro execution || Yes || Yes
|-
| Document management || Yes || Yes
|-
| Screenshots || Yes || No
|-
| Object colors/visibility || Yes || No
|-
| Camera/view control || Yes || No
|}

==Connecting MCP clients== <!--T:29-->

<!--T:30-->
The workbench provides the bridge used by the Robust MCP Server. Install compatible server and workbench releases at version 0.7.0 or later, or use the same source checkout for development; see the [https://spkane.github.io/freecad-addon-robust-mcp-server/latest/getting-started/installation/ installation guide]. Run the pairing command as the FreeCAD user:

</translate>
{{Code|code=
freecad-mcp --pair-bridge
}}
<translate>

<!--T:47-->
For a source checkout, run the following from the checkout directory instead:

</translate>
{{Code|code=
uv run freecad-mcp --pair-bridge
}}
<translate>

<!--T:32-->
See the [https://github.com/spkane/freecad-addon-robust-mcp-server GitHub repository] for full documentation on configuring MCP clients.

==Troubleshooting== <!--T:33-->

===Bridge won't start=== <!--T:34-->

<!--T:35-->
# Check the FreeCAD Python console ({{MenuCommand|View → Panels → Python console}}) for error messages.
# Ensure no other process is using ports 9875/9876.
# Try restarting FreeCAD.

===Connection refused=== <!--T:36-->

<!--T:37-->
# Verify the bridge is running (green status indicator in toolbar).
# Check that ports match between the workbench preferences and your MCP client configuration.
# If connecting from Docker, use {{incode|host.docker.internal}} instead of {{incode|localhost}}.

===Headless mode won't start=== <!--T:38-->

<!--T:39-->
# Ensure you're using {{incode|freecadcmd}} (not {{incode|freecad}}).
# Verify the script path is correct for your installation.
# Test FreeCAD first: {{incode|freecadcmd -c "print('test')"}}.

==Links== <!--T:40-->

<!--T:41-->
* [https://github.com/spkane/freecad-addon-robust-mcp-server/releases?q=robust-mcp-workbench&expanded=true Workbench Releases]
* [https://pypi.org/project/freecad-robust-mcp/ Robust MCP Server on PyPI] - The MCP Server that connects to this bridge.
* [https://spkane.github.io/freecad-addon-robust-mcp-server/ Full Documentation] - Complete guides, API reference, and tutorials.
* [https://github.com/spkane/freecad-addon-robust-mcp-server GitHub Repository] - Source code and issue tracker.
* [https://modelcontextprotocol.io/ Model Context Protocol] - The protocol specification.


</translate>
[[Category:Addons{{#translation:}}]]
[[Category:External_Workbenches{{#translation:}}]]
