Skip to main content
Glama
ahelja

FreeCAD MCP

by ahelja

Server Configuration

Describes the environment variables required to run the server.

NameRequiredDescriptionDefault
FREECAD_MCP_HOSTNoHost the XML-RPC bridge listens on.127.0.0.1
FREECAD_MCP_PORTNoPort the XML-RPC bridge listens on.9875
FREECAD_MCP_TIMEOUTNoTimeout in seconds for the MCP server.300
FREECAD_MCP_AUTOSTARTNoWhether the addon autostarts in FreeCAD.1

Capabilities

Features and capabilities supported by this server

CapabilityDetails
tools
{
  "listChanged": false
}
prompts
{
  "listChanged": false
}
resources
{
  "subscribe": false,
  "listChanged": false
}
experimental
{}

Tools

Functions exposed to the LLM to take actions

NameDescription
freecad_statusA

Check the bridge connection and list open documents.

Call this before anything else. It reports the FreeCAD version, which document is active, and how many objects each open document holds.

list_documentsA

List every open FreeCAD document with its file path and modified state.

create_documentA

Create a new document and make it active.

Args: name: internal name; FreeCAD may append digits to keep it unique. label: optional display name shown in the tree.

open_documentA

Open an existing .FCStd file and make it active.

save_documentA

Save a document.

Args: document: document name; defaults to the active one. path: save to this path instead (required the first time a document is saved).

close_documentB

Close a document, optionally saving it first. Unsaved changes are lost.

recomputeA

Recompute a document and report objects left in an error/invalid state.

Use this after run_python or when geometry looks stale.

list_objectsA

List objects in a document (name, label, TypeId, state).

Args: document: defaults to the active document. type_filter: case-insensitive substring match on TypeId, e.g. "Part::" or "Sketch".

get_objectA

Inspect one object: all properties, plus shape volume/area/bounding box.

Args: name: object Name or Label. include_properties: set False for a lighter response on complex objects. include_shape: set False to skip geometry measurement.

create_objectA

Create an object in a document.

Frequently used TypeIds: Primitives Part::Box (Length,Width,Height) | Part::Cylinder (Radius,Height,Angle) Part::Sphere (Radius) | Part::Cone (Radius1,Radius2,Height) Part::Torus (Radius1,Radius2) | Part::Plane (Length,Width) Part::Wedge | Part::Ellipsoid | Part::Prism (Polygon,Circumradius,Height) Booleans Part::Cut / Part::Fuse / Part::Common (properties: Base, Tool) Part::MultiFuse / Part::MultiCommon (property: Shapes = [names]) Transforms Part::Mirroring (Source,Normal,Base) | Part::Extrusion | Part::Revolution Structure App::Part | App::DocumentObjectGroup | App::Link (LinkedObject) Modelling PartDesign::Body | Sketcher::SketchObject (build these with run_python)

Value formats accepted by properties: numbers/lengths 10 or 10.5 (millimetres) vectors [x, y, z] or {"x":.., "y":.., "z":..} placement {"Base":[x,y,z], "Rotation":{"Axis":[0,0,1], "Angle":45}} rotation 45 (degrees about Z) | {"Axis":[..],"Angle":..} | {"Yaw":..,"Pitch":..,"Roll":..} links "Box" (object Name or Label) link lists: ["Box","Cylinder"] colours "#ff8800" | [1.0, 0.53, 0.0] | [255, 133, 0] view_properties targets the ViewObject: ShapeColor, Transparency (0-100), DisplayMode ("Flat Lines","Shaded","Wireframe"), Visibility.

Example: a 20mm cube offset on X, coloured orange type_id="Part::Box" properties={"Length": 20, "Width": 20, "Height": 20, "Placement": {"Base": [30, 0, 0]}} view_properties={"ShapeColor": "#ff8800"}

Example: cut a cylinder out of a box (both must already exist) type_id="Part::Cut", properties={"Base": "Box", "Tool": "Cylinder"}

edit_objectA

Change properties of an existing object.

Only the properties you pass are touched; everything else is left alone. Call get_object first if you are unsure which properties exist.

Value formats accepted by properties: numbers/lengths 10 or 10.5 (millimetres) vectors [x, y, z] or {"x":.., "y":.., "z":..} placement {"Base":[x,y,z], "Rotation":{"Axis":[0,0,1], "Angle":45}} rotation 45 (degrees about Z) | {"Axis":[..],"Angle":..} | {"Yaw":..,"Pitch":..,"Roll":..} links "Box" (object Name or Label) link lists: ["Box","Cylinder"] colours "#ff8800" | [1.0, 0.53, 0.0] | [255, 133, 0] view_properties targets the ViewObject: ShapeColor, Transparency (0-100), DisplayMode ("Flat Lines","Shaded","Wireframe"), Visibility.

move_objectA

Reposition an object without touching its other properties.

Args: name: object Name or Label. position: absolute [x, y, z] in mm. Omit to keep the current position. rotation: degrees about Z, or {"Axis": [x,y,z], "Angle": deg}, or {"Yaw":.., "Pitch":.., "Roll":..}. Omit to keep the current rotation.

delete_objectA

Delete an object.

Args: recursive: also delete the object's children (e.g. the operands consumed by a boolean). Deleting a boolean without this leaves its operands behind.

get_selectionA

Read what the user currently has selected in the FreeCAD GUI.

Useful when the user says "this part" or "the selected face".

run_pythonA

Execute Python inside FreeCAD. The escape hatch for anything the typed tools cannot do.

Preloaded names: App/FreeCAD, Gui/FreeCADGui, and doc (the active document). Globals persist between calls, so you can build state incrementally. A trailing expression is returned like a REPL; in statement mode, assign to result to return a value. The document is recomputed afterwards.

Returns stdout, stderr, the value, and a full traceback on failure.

Example -- a sketch-based pad: body = doc.addObject("PartDesign::Body", "Body") sketch = body.newObject("Sketcher::SketchObject", "Sketch") import Part sketch.addGeometry(Part.Circle(App.Vector(0,0,0), App.Vector(0,0,1), 10), False) pad = body.newObject("PartDesign::Pad", "Pad") pad.Profile = sketch pad.Length = 25 result = pad.Name

reset_pythonA

Clear variables accumulated by previous run_python calls.

capture_viewA

Screenshot the 3D view and return it as an image.

Always look at the model after building geometry instead of assuming it is correct.

Args: document: defaults to the active document. view: axonometric, isometric, front, rear, left, right, top or bottom. width, height: pixel size of the render. fit: zoom to fit all visible geometry first.

export_objectsB

Export geometry to a file; the format comes from the extension.

Supported: .step/.stp, .iges/.igs, .stl, .obj, .ply, .3mf, .amf, .off, .brep and .fcstd.

Args: path: destination file path. objects: object names to export; omit to export every shaped object.

Prompts

Interactive templates invoked by user choice

NameDescription

No prompts

Resources

Contextual data attached and managed by the client

NameDescription

No resources

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ahelja/FreeCAD-MCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server