SuperAPIAI Directory

AnkusDrive

github.com · AI agents

Drive a local FreeCAD from an agent: parametric CAD, TechDraw drawings with GD&T, CalculiX FEM, and CFD, thermal, EM and multiphysics simulation.

Open website Alternatives
PricingOpen source开源项目(可免费自部署)
PlatformsmacOS · Windows · Linux

About this tool

AnkusDrive is a CLI + MCP server that drives FreeCAD through FreeCAD's Python API, enabling LLMs (and terminal users) to design mechanical parts and run FEM simulations without clicking through the graphical interface.

Purpose FreeCAD exposes almost all of its functionality in the Python API—creating documents, building sketches, extruding solids, meshing, running CalculiX/Elmer FEM solves, reading back stress/displacement fields. But that API lives inside FreeCAD's embedded Python (freecadcmd), which is inconvenient to call from the outside. AnkusDrive wraps it behind two interfaces:

  • CLI: one-shot commands (such as ankusdrive run script.py, ankusdrive box --w 10 --d 20 --h 5 -o part.FCStd), suitable for scripts, CI, and rapid iteration.
  • MCP server: 280+ structured tools (new_document, add_primitive, boolean_op, pad, add_gear, fem_new_analysis, fem_run, fem_results), letting LLM agents iteratively model, inspect, and simulate.

Main capabilities Beyond core CAD/FEM, it also covers a broad simulation surface (thermal, CFD/CHT, electromagnetic, acoustics, FSI, injection molding, particle/DEM, optics, multibody) as well as a design-control layer (materials/part numbers, recipes, variant families, lifecycle/revisions, ECO change orders, versioned interfaces). It also provides multi-agent orchestration: a host-side reference layer lets a group of agents split a product into components, build them in parallel, then merge them back into a whole with joints that actually fit (see Multi-agent design).

Target environment and dependencies The target environment is FreeCAD 1.1.x. The freecadcmd binary is auto-discovered by operating system (macOS .app bundle, Linux /usr/bin etc., Windows C:\Program Files\FreeCAD 1.1\bin\freecadcmd.exe, with version globbing); it can be overridden via $ANKUSDRIVE_FREECADCMD, or rely on PATH. Run ankusdrive doctor to see the actual resolution result. A FreeCAD installation already includes Python, ccx (CalculiX), and gmsh (macOS .app, Linux packages, Windows bin), so core CAD + structural FEM on the three major platforms requires no additional installation. Host-side rendering requires Pillow and numpy, both installed by AnkusDrive as regular pip dependencies. One optional exception: drawing PDF/SVG export (export_drawing) renders inside FreeCAD's embedded Python, so reportlab + svglib need to be installed there. DXF export and everything else does not touch FreeCAD's Python. AnkusDrive is a pip-installable package; FreeCAD itself is the only thing that needs to be installed separately. Host-side dependencies (mcp, Pillow, numpy) come with the installation. freecadcmd is launched as a subprocess and uses its own bundled Python, which AnkusDrive does not touch.

Installation and usage macOS: The above FreeCAD plus a pip install is enough to run the native parts. The Linux solver stack (OpenFOAM, Elmer, YADE, openEMS, Bempp, preCICE, openInjMoldSim) has no practical macOS builds and must run in a container, with AnkusDrive staying on the host and accessing the container; the images are multi-architecture and run natively on Apple Silicon rather than under emulation. Windows: Core CAD + CalculiX FEM can run natively against stock FreeCAD 1.1, and the entire core installation is done by a single script (venv, pinned dependencies, doctor, MCP registration line with resolved absolute paths). Optional solvers are installed afterward via scripts\install-solvers.ps1; Linux-only solvers can be run after installing WSL with ankusdrive container setup --install-engine. Ubuntu 24.04+ / containers: FreeCAD has been removed from Ubuntu 24.04's universe repository, snap/flatpak Fails in both container and sandbox agent environments. The usable path is official AppImage unpack-and-install: the script downloads a pinned AppImage version, verifies its SHA-256, unpacks it with --appimage-extract (no FUSE, root, or snapd required), symlinks freecadcmd, freecad, ccx, and gmsh into /usr/local/bin, and performs live validation with ankusdrive ping plus a real CalculiX solve. FreeCAD location discovery order: $ANKUSDRIVE_FREECADCMD, then shutil.which(...) on PATH (trying freecadcmd, FreeCADCmd, freecad.cmd), then an OS-specific list of standard install locations. On all three major platforms, the official installers require no configuration. ankusdrive doctor prints which of the three layers (env / PATH / auto) actually resolved FreeCAD, along with all candidate paths checked. MCP host integration: the MCP server uses stdio; point the host at the ankusdrive binary and run the mcp subcommand. For Claude Desktop, edit claude_desktop_config.json; alternatively, download ankusdrive-<version>.mcpb for one-click install. Claude Desktop uses uv to create a Python environment; the install dialog has an optional field for the FreeCAD command path. Claude Code only needs to be registered once. Other hosts (Cursor, Continue, custom MCP clients) use the same format: stdio transport, command = ankusdrive, args = ["mcp"]. After restarting, you should see 280+ ankusdrive__* tools. If startup hangs, run ankusdrive ping directly to get a clearer error message.

Toolsets and run control Every tool definition consumes client context; all 283 tools amount to about 114k tokens. Tools are divided into toggleable families: core (always on), drawings, fem, components, sheet_metal, assembly, intent, manufacturing, hand_calcs, simulation, plm, rendering. Controlled via the ANKUSDRIVE_TOOLSETS environment variable or toolsets in config.toml; the Claude Desktop extension enables core, drawings, and fem by default (about 31k tokens), with the others enabled in the extension settings. setup_status lists the disabled families and how to enable them. run_script executes agent-written Python with full access to files and processes, controlled by ANKUSDRIVE_ALLOW_RUN_SCRIPT (env or allow_run_script in config.toml); pip/pipx/uvx/clone are allowed by default (unless set to false), and are disabled by default in the Claude Desktop extension.

Simulation solvers and persistent configuration The base install covers geometry, analytical benchmarks, and the MCP interface. The heavy simulation families each invoke external solvers, discovered at runtime by ankusdrive/solvers.py ($ANKUSDRIVE_<SOLVER>PATH → PATH → standard install directories). Families with missing solvers degrade to a clean {ok: false, reason, install} dictionary rather than crashing; use ankusdrive doctor, the solve_capabilities MCP tool, or the install script's list to see the current resolution status. The install scripts scripts/install-solvers.sh (Linux/macOS) and scripts/install-solvers.ps1 (Windows) handle installing pip-wheel solvers and bundled native solvers. Persistent configuration: every ANKUSDRIVE* path can also be placed in ~/.config/ankusdrive/config.toml (on Windows, %APPDATA%\ankusdrive\config.toml; ANKUSDRIVE_CONFIG overrides this). Environment variables still take precedence; the config file can survive in a minimal MCP host startup environment. Solver teFile location: Each built-in solver writes its computation files (.sif plus mesh, OpenFOAM case tree, .inp, sliced .gcode) into its own directory under <system temp directory>/ankusdrive-cases, and reports that directory as case_dir. The files are retained because the results reference them and the second tool uses them (for example, the warpage solver consumes the cooling case written by the filling solver); when the root directory exceeds 64 directories or 4 GB, they are reclaimed oldest-first, but directories written within the last hour are never touched.

Up/Down to navigate · Enter to open · ESC to closeBrowse all tools