FreeCAD MCP

v0.1.31
io.github.neka-nat/freecad-mcp Checked 6 hours ago Published 19 days ago

Control FreeCAD from MCP clients: create and edit models, run Python and FEM analyses.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

create_document

Create a new document in FreeCAD. Args: name: The name of the document to create. Returns: A message indicating the success or failure of the document creation. Examples: If you want to create a document named "MyDocument", you can use the following data. ```json { "name": "MyDocument" } ```

ParameterTypeDescription
name *string

create_object

Create a new object in FreeCAD. ``obj_type`` must name a type registered in FreeCAD's C++ type system, such as "Part::", "PartDesign::" or "Fem::" types. A number of FreeCAD features are implemented in Python rather than C++ and so are not registered types; of those, these are supported here through dedicated factories, and each requires the properties listed beside it: Part::Tube InnerRadius, OuterRadius, Height Draft::Circle Radius Draft::Rectangle Length, Height Draft::Polygon FacesNumber, Radius Draft::Wire Points (list of {x, y, z}), optional Clo…

ParameterTypeDescription
doc_name *string
obj_name *string
obj_type *string
analysis_name
include_screenshotboolean
obj_properties
view_namestring

edit_object

Edit an object in FreeCAD. This tool is used when the `create_object` tool cannot handle the object creation. Args: doc_name: The name of the document to edit the object in. obj_name: The name of the object to edit. obj_properties: The properties of the object to edit. include_screenshot: Whether to return a screenshot of the model (default True). Set to False to save tokens when visual feedback is not needed, e.g. for intermediate steps in a longer sequence of changes. view_name: The view orientation of the returned screenshot (default "Isometric").…

ParameterTypeDescription
doc_name *string
obj_name *string
obj_properties *object
include_screenshotboolean
view_namestring

delete_object

Delete an object in FreeCAD. Args: doc_name: The name of the document to delete the object from. obj_name: The name of the object to delete. include_screenshot: Whether to return a screenshot of the model (default True). Set to False to save tokens when visual feedback is not needed, e.g. for intermediate steps in a longer sequence of changes. view_name: The view orientation of the returned screenshot (default "Isometric"). Pick the view that best shows the change being made. Returns: A message indicating the success or failure of the object deleti…

ParameterTypeDescription
doc_name *string
obj_name *string
include_screenshotboolean
view_namestring

execute_code_async

Execute Python code in FreeCAD without waiting for completion. Use this ONLY for long-running background computations that do NOT touch the FreeCAD GUI or mutate the FreeCAD document tree directly. This tool runs the submitted code in a background thread and returns immediately. Because it does not run on FreeCAD's main GUI thread, the code must NOT directly call FreeCADGui APIs, manipulate the active view or selection, create or edit document objects, change object properties, call doc.recompute(), or save documents. FreeCAD documents and the Coin3D scenegraph are not thread-safe: writing t…

ParameterTypeDescription
code *string

execute_code_headless

Run a FreeCAD Python script in a separate headless `freecadcmd` process. Use this for OCCT work that can crash or block FreeCAD: helical threads (makeHelix + makePipeShell), lofts and sweeps, booleans with many or B-spline tools, long parametric rebuilds. A native OpenCascade crash here only kills the helper process; the GUI and its open documents survive, and the tool reports the crash signal and the script's output. The script runs on the MCP server machine, independently of --host, in a fresh process without GUI: import FreeCAD/Part yourself, open documents from disk (FreeCAD.openDocument…

ParameterTypeDescription
code *string
timeoutnumber

get_async_status

Report the state of background jobs started by execute_code_async. Does not use the FreeCAD GUI thread, so it answers even while a job runs. Args: job_id: The id returned by execute_code_async. Empty lists all running jobs and up to 20 recently completed jobs. Returns: For one job: its state (running/done/failed), the error and traceback when it failed. History is held in memory until FreeCAD exits.

ParameterTypeDescription
job_idstring

execute_code

Execute arbitrary Python code in FreeCAD. Args: code: The Python code to execute. include_screenshot: Whether to return a screenshot of the model (default True). Set to False to save tokens when the code does not change the model's appearance, e.g. analytical or computational scripts whose result is printed output, or intermediate steps in a longer sequence of changes. view_name: The view orientation of the returned screenshot (default "Isometric"). Pick the view that best shows the change being made. timeout: Positive finite seconds for each of…

ParameterTypeDescription
code *string
include_screenshotboolean
timeout
view_namestring

get_view

Get a screenshot of the active view. Args: view_name: The name of the view to get the screenshot of. The following views are available: - "Isometric" - "Front" - "Top" - "Right" - "Back" - "Left" - "Bottom" - "Dimetric" - "Trimetric" width: The width of the screenshot in pixels. If not specified, uses the viewport width. height: The height of the screenshot in pixels. If not specified, uses the viewport height. focus_object: The name of the object to focus on. If not specified, fits all objects in the view. Returns: A screenshot of…

ParameterTypeDescription
view_name *string
focus_object
height
width

insert_part_from_library

Insert a part from the parts library addon. Args: relative_path: The relative path of the part to insert. include_screenshot: Whether to return a screenshot of the model (default True). Set to False to save tokens when visual feedback is not needed, e.g. for intermediate steps in a longer sequence of changes. view_name: The view orientation of the returned screenshot (default "Isometric"). Pick the view that best shows the change being made. Returns: A message indicating the success or failure of the part insertion and a screenshot of the object.

ParameterTypeDescription
relative_path *string
include_screenshotboolean
view_namestring

get_objects

Get all objects in a document. You can use this tool to get the objects in a document to see what you can check or edit. Args: doc_name: The name of the document to get the objects from. include_screenshot: Whether to return a screenshot of the document (default True). Set to False to save tokens when only the object data is needed. view_name: The view orientation of the returned screenshot (default "Isometric"). Returns: A list of objects in the document and a screenshot of the document.

ParameterTypeDescription
doc_name *string
include_screenshotboolean
view_namestring

get_object

Get an object from a document. You can use this tool to get the properties of an object to see what you can check or edit. Args: doc_name: The name of the document to get the object from. obj_name: The name of the object to get. include_screenshot: Whether to return a screenshot of the document (default True). Set to False to save tokens when only the object data is needed. view_name: The view orientation of the returned screenshot (default "Isometric"). Returns: The object and a screenshot of the object.

ParameterTypeDescription
doc_name *string
obj_name *string
include_screenshotboolean
view_namestring

get_parts_list

Get the list of parts in the parts library addon.

reload_document

Close and re-open a document to pick up external file changes. Use this AFTER the document's .FCStd file has been modified by something outside of FreeCAD's GUI process — for example, a headless `freecadcmd` script that edited and saved the file. The open GUI document is otherwise unaware of on-disk changes; this tool closes the stale in-memory copy and reopens the file from disk so the GUI shows current geometry. Args: doc_name: The name of the open document to reload. Must match the name shown by ``list_documents``. Returns: A message confirming the document was reloaded…

ParameterTypeDescription
doc_name *string

list_documents

Get the list of open documents in FreeCAD. Returns: A list of document names.

get_rpc_status

Get RPC and FreeCAD GUI-dispatch health. This tool does not use FreeCAD's GUI thread, so it remains available after a GUI operation times out. A ``stuck`` state identifies the operation that is still running and indicates that FreeCAD may need to be restarted. ``version_check`` is "ok" or says whether the addon or the server needs updating.

run_fem_analysis

Run the CalculiX solver on an existing Fem::FemAnalysis container and return summary results. Prerequisites in the document, all created with `create_object`: - A Part-derived solid (e.g. Part::Box, PartDesign::Body) acting as the geometry. - A Fem::AnalysisPython container. - A material: type "Fem::MaterialCommon" with analysis_name set (built with ObjectsFem.makeMaterialSolid) and its Material given as a dict with units, e.g. {"Name": "Steel", "YoungsModulus": "210 GPa", "PoissonRatio": "0.3", "Density": "7900 kg/m^3"}. A dict read from the material library can come back empty; give…

ParameterTypeDescription
analysis_name *string
doc_name *string
include_screenshotboolean
timeoutinteger
view_namestring