A Python CLI tool for controlling FreeCAD from AI Agents via shell. Communicates with FreeCAD over XML-RPC (port 9875).
flowchart TD
A[AI Agent] -->|shell| B[freecad-cli<br/>Python CLI]
B -->|XML-RPC<br/>localhost:9875| C[FreeCAD + Addon<br/>thin eval proxy]
The addon is a minimal XML-RPC server that runs inside FreeCAD. It only exposes ping and execute_code — all business logic lives in the CLI client. Once installed, the addon never needs to be updated. See docs/architecture.md for design rationale and docs/product-direction.md for the command philosophy.
Security note:
execute-coderuns arbitrary Python inside the FreeCAD process. The RPC server binds to127.0.0.1only — it is not accessible over the network. Only connect to a FreeCAD instance you control.
- Install the CLI:
uv tool install -e . - Install the FreeCAD addon:
freecad-cli install-addon - Restart FreeCAD
- Verify:
freecad-cli ping
The core command. Sends Python code to FreeCAD for execution.
# Inline code
freecad-cli execute-code 'print(FreeCAD.ActiveDocument.Name)'
# Read from a file
freecad-cli execute-code --file script.py
# Pipe from stdin
cat script.py | freecad-cli execute-code -
echo 'print(1+1)' | freecad-cli execute-code -Export the active object to STL, STEP, or FCStd.
freecad-cli export stl -o output.stl
freecad-cli export step -o output.step --object MyBody
freecad-cli export fcstd -o model.FCStdfreecad-cli ping
freecad-cli create-document MyDoc
freecad-cli active-document
freecad-cli screenshot --width 800All commands return JSON output:
{"status": "ok", "data": true}Install as a Claude Code plugin:
/plugin marketplace add yoshikouki/freecad-cli
/plugin install freecad-cli@yoshikouki-freecad-cliThe plugin provides the /freecad-cli skill (setup, operation reference, troubleshooting) and a freecad-operator agent for CAD modeling tasks.
Copy and paste this prompt to your AI agent:
Install freecad-cli by following the setup guide at
SETUP_AGENT.mdin the repository: https://github.com/yoshikouki/freecad-cli. If any prerequisites are missing, ask me before installing them.
uv sync
git config core.hooksPath .githooksuv tool install -e .Installed in editable mode — source code changes take effect immediately.
To uninstall:
uv tool uninstall freecad-cliuv run pytest