freecad-mcp
- Type
- MCP server
- Scanned
- Nov 12, 2026
- Version
- 5014bd9d538b
- Files read
- 85
This project connects AI coding agents to FreeCAD so they can create and edit 3D models, capture viewport screenshots, run FEM structural simulations, and execute Python scripts inside FreeCAD or in headless mode. The biggest risk is that its code-execution tools give a prompt-injected agent full Python access to your machine, and the FreeCAD addon's local XML-RPC server runs without a password by default, allowing other local users or processes on the same computer to run arbitrary code as you.
What it can reach
- Shell commands
- Executes arbitrary Python scripts inside the FreeCAD process (execute_code and execute_code_async) and launches headless freecadcmd subprocesses (execute_code_headless), as well as Gmsh and CalculiX solver binaries during FEM analysis.
- Files
- Reads and modifies FreeCAD documents, reads parts from FreeCAD's parts_library directory, writes temporary scripts under ~/.cache/freecad-mcp/headless/, creates temporary screenshot files and FEM working directories, and reads/writes freecad_mcp_settings.json.
- Network
- Connects over HTTP XML-RPC to localhost:9875 by default (or a user-specified --host), while the FreeCAD addon listens on 127.0.0.1:9875 by default or 0.0.0.0:9875 when Remote Connections is enabled.
- Secrets
- Reads the optional FREECAD_MCP_TOKEN environment variable (or --auth-token flag) and stores the configured RPC authentication token in freecad_mcp_settings.json.
- System
- Controls the active FreeCAD GUI window, modifies open 3D scenes, and takes screenshots of the active 3D viewport to return to the AI client.
Findings
-
LowFreeCAD XML-RPC server disables authentication by default
addon/FreeCADMCP/rpc_server/settings.py:15
When you start the RPC server in FreeCAD following the standard setup instructions, authentication is turned off unless you manually set a token. Although the server blocks requests from web browsers and binds to 127.0.0.1 by default, any other user account on a shared computer (or a sandboxed local app that shares localhost network access) can connect to port 9875 and call execute_code to run arbitrary Python code under your account. In addition, if you enable Remote Connections without setting a token, anyone on an allowed IP or subnet can run code without a password.
Fix: Generate and require a random authentication token by default on first run, and refuse to start with Remote Connections enabled when no token is set.
-
LowRemote FreeCAD connections use unencrypted HTTP
src/freecad_mcp/freecad_client.py:55
When configured to connect to FreeCAD on another machine (--host with Remote Connections enabled in the addon), all XML-RPC traffic travels over plain HTTP without TLS encryption. Anyone able to eavesdrop on or intercept traffic on that network can read the Bearer authentication token in transit and send execute_code requests to run arbitrary Python code on the FreeCAD machine.
Fix: Add TLS (HTTPS) support for remote XML-RPC connections, or require remote access to go through an encrypted tunnel such as SSH.
-
LowRPC authentication token is saved with default file permissions
addon/FreeCADMCP/rpc_server/settings.py:41
When you set an authentication token in the FreeCAD addon, save_settings writes it in plain text to freecad_mcp_settings.json using standard default file permissions (typically world-readable 0644 on Linux and macOS). On a multi-user system where FreeCAD's user data folder is traversable (such as ~/.FreeCAD created with mkdir -p), another local user can read the token from this file and authenticate to the local RPC server to run Python code as you.
Fix: Write freecad_mcp_settings.json with owner-only permissions (0600) or store the token in the operating system keyring.
-
LowHeadless FreeCAD auto-detection searches the current working directory on Windows
src/freecad_mcp/headless.py:30
When execute_code_headless looks for a FreeCAD executable, it calls shutil.which with a bare command name such as freecadcmd or freecad.cmd. On Windows, Python's shutil.which checks the current working directory before PATH unless NoDefaultCurrentDirectoryInExePath is set. If the MCP server is started inside an untrusted project folder containing a malicious freecadcmd.exe or freecad.cmd, calling execute_code_headless even with a harmless script will run that file instead of the installed FreeCAD binary.
Fix: Search only explicit directories from the PATH environment variable (excluding empty and current-directory entries) or set NoDefaultCurrentDirectoryInExePath before calling shutil.which on Windows.
