Skip to main content
Glama
U-C4N
by U-C4N

Server Configuration

Describes the environment variables required to run the server.

NameRequiredDescriptionDefault
LOG_LEVELNoStandard Python logging level.INFO
ALLOWED_PATHSNoComma-separated absolute paths the server may read/write.
MAX_DXF_BYTESNoReject DXF files larger than this on drawing_open. 0 to disable.52428800
MAX_LIST_LIMITNoHard cap for entity_list and analysis_select_* responses.5000
MAX_UNDO_STACKNoMaximum number of in-flight transaction snapshots.5
MCP_AUTH_TOKENNoRequired when ALLOW_REMOTE_HTTP=true. Bearer token for HTTP clients.
COM_CALL_TIMEOUTNoPer-call timeout for COM operations in seconds.60
ALLOW_REMOTE_HTTPNoPermit HTTP transport on non-loopback hosts.false
AUTOCAD_MCP_BACKENDNoBackend selection (auto, com, ezdxf).auto
DANGEROUS_COMMANDS_ENABLEDNoDisable command and AutoLISP sanitization. Loud warning at startup.false

Instructions

Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.

This server publishes no instructions, or was last inspected before Glama recorded them.

Capabilities

Features and capabilities supported by this server

Protocol revision2025-11-25

CapabilityDetails
tools
{
  "listChanged": true
}
logging
{}
prompts
{
  "listChanged": false
}
resources
{
  "subscribe": false,
  "listChanged": false
}
extensions
{
  "io.modelcontextprotocol/ui": {}
}
experimental
{}

Tools

Functions exposed to the LLM to take actions

NameDescription
drawing_infoA

Get comprehensive metadata for the current drawing.

Returns: name, path, entity_count, layer_count, block_count, extents (min/max), units, version, backend name.

drawing_newA

Create a new empty drawing, optionally from a template (.dwt).

When bootstrap=True (default), the drawing is also seeded with the standard engineering linetypes (CENTER/HIDDEN/PHANTOM) and layers (GEOMETRY, DIM, CENTER, HIDDEN, PHANTOM, HATCH, TEXT, TITLEBLOCK).

drawing_openA

Open an existing DXF drawing file (DWG too, on the live COM backend).

T0.2: a .dwg path is refused up front when the active backend has no dwg capability. ezdxf sniffs content rather than extensions, so it would parse a mislabelled DXF-in-a-.dwg and this tool would answer with a document that does not exist in that format.

drawing_saveC

Save the current drawing. Optionally specify a new path.

drawing_save_asA

Save current drawing to a new path/format (DWG, DXF, or DWT template).

The on-disk format is derived from the file extension so the bytes always match the name (N2) — e.g. 'part.dxf' writes DXF, not DWG. format overrides only when the path has no recognised extension.

drawing_export_dxfB

Export the current drawing as a DXF file.

drawing_export_pdfA

Export the current drawing (or a paper-space layout) to PDF.

drawing_purgeA

Purge all unused objects (layers, blocks, linetypes, styles) from the drawing.

drawing_auditA

Audit the drawing: repair every fixable structural problem, and report it.

This mutates the drawing. fixes lists repairs that have ALREADY been applied, so save afterwards to keep them; errors lists problems that could not be repaired. On the live COM backend AutoCAD applies repairs but hands back no counts, so they arrive as null with detail: "unavailable" rather than as zero.

drawing_closeA

Close the current drawing. If save is True (default), the drawing is saved to its current path before closing. After this call, you must call drawing_new or drawing_open before any other tool.

drawing_undoA

Undo the last drawing operation.

On the live COM backend this is AutoCAD's own undo. The headless backend has no journal, so a step is a full DXF snapshot and history is off by default — set EZDXF_UNDO_DEPTH to the number of steps you want. Measured cost of switching it on: 37x on entity creation (0.18 -> 6.65 ms per call). For a single checkpoint around a risky sequence, transaction_begin / transaction_rollback is far cheaper.

Drawing something after an undo discards the redo branch, as in AutoCAD.

drawing_redoA

Reapply the operation you just undid.

Same history as drawing_undo, so the headless backend needs EZDXF_UNDO_DEPTH set. Anything drawn after an undo discards the redo branch — otherwise redo would restore a state that never existed, with geometry you had removed reappearing beside geometry you drew afterwards.

entity_create_lineA

Create a line from (x1,y1) to (x2,y2). Returns entity info with handle.

entity_create_circleB

Create a circle at (cx, cy) with given radius.

entity_create_arcA

Create a circular arc. Angles are in degrees, measured counter-clockwise from the positive X axis.

entity_create_polylineA

Create a lightweight 2D polyline through the given points.

Example: points=[[0,0],[100,0],[100,100],[0,100]], closed=true → rectangle

entity_create_rectangleA

Create a closed rectangular polyline between two corner points.

Convenience wrapper around entity_create_polyline.

entity_create_textB

Create a single-line text entity (DTEXT/TEXT).

entity_create_mtextA

Create a multi-line text entity (MTEXT) with word-wrap at the specified width.

entity_create_tableB

Create a native COM table or an explicitly-labelled ezdxf composite table.

leader_create_mleaderB

Create a native COM MLeader or an explicitly-labelled ezdxf composite.

entity_create_hatchA

Create a hatch fill pattern inside a closed boundary polygon.

entity_create_splineA

Create a NURBS spline curve passing through the specified fit points.

entity_create_ellipseB

Create an ellipse. major_x/major_y define the major axis vector from the center.

entity_create_pointA

Create a point marker entity at (x, y).

entity_create_block_refB

Insert a block reference (instance of an existing block definition).

hatch_set_gradientA

Fill a hatch with a gradient instead of a pattern.

hatch_editA

Edit an existing hatch in place.

Omitted parameters are left alone — a partial edit that resets the rest is data loss. changed reports which attributes actually moved, so re-setting a value to what it already was comes back as an empty list rather than a false positive.

hatch_add_boundaryA

Add one boundary path built from typed edges.

Typed edges exist because a boundary that only accepts vertex lists silently straightens every curve it is given. Every edge is validated before any is written, so a malformed list refuses instead of leaving a half-built path.

entity_create_wipeoutA

Create a WIPEOUT that hides drawing content behind its outline.

Refuses fewer than three points: a zero-area mask hides nothing while reporting success.

entity_create_revcloudA

Draw a revision cloud: a polyline whose every segment carries an arc.

A segment_length longer than the shortest edge is refused — the result would carry no arcs at all and would be a plain polyline reported as a cloud.

dimension_linearA

Create a linear dimension, optionally toleranced (ISO 129 or ISO 286 fit).

dimension_alignedB

Create an aligned dimension that measures the true distance between two points.

dimension_angularA

Create an angular dimension measuring the angle between two lines from a vertex.

dimension_radiusB

Create a radius dimension for a circle or arc, optionally toleranced.

dimension_diameterA

Create a diameter dimension for a circle, optionally toleranced (e.g. ⌀20 H7).

entity_moveA

Move an entity by the specified displacement vector (dx, dy, dz).

entity_copyA

Copy an entity and move the copy by (dx, dy, dz). Returns info of the new copy.

entity_rotateA

Rotate an entity around a base point by the specified angle.

entity_scaleA

Scale an entity uniformly from a base point.

entity_mirrorB

Mirror an entity across a line defined by two points. Returns the mirrored copy.

entity_offsetA

Create a parallel copy of a line, circle, or polyline at the given distance.

entity_trimA

Trim target against cutter, keeping the segment containing (keep_x, keep_y).

V1 supports LINE+LINE only. Cutter is treated as an infinite ray (AutoCAD's default 'implied extend' trim mode). Raises if the lines are parallel.

entity_extendA

Extend target to meet boundary. If end_x/end_y is None, the target endpoint nearest the boundary is auto-selected.

V1 supports LINE+LINE only. Raises if the lines are parallel.

entity_filletA

Round a corner with a tangent arc. Returns info on the new ARC entity (or the first source line for radius=0). V1 supports LINE+LINE only.

entity_chamferA

Bevel a corner with a chamfer line. Returns info on the new chamfer LINE. V1 supports LINE+LINE only.

entity_deleteB

Permanently delete an entity by its handle.

entity_array_rectangularA

Create a rectangular array of copies. Returns info of all created copies.

rows x cols is unbounded, so this is a result-heavy tool despite being a create: a 40x40 grid hands back 1600 full records. fields=["handle"] is usually all a caller needs from it.

entity_array_polarA

Create a polar (circular) array of copies around a center point.

count is unbounded, so the same result-shaping applies as for the rectangular array: fields=["handle"] when the geometry is already known.

entity_set_propertiesA

Change one or more properties of an entity (layer, color, linetype, lineweight, visibility).

entity_edit_textA

Edit an existing text label in place — change its content, height, or rotation.

Use this to rename/relabel without deleting and recreating (which would lose the handle). Works on both TEXT and MTEXT.

text_set_backgroundA

Mask what is behind an MTEXT so it stays readable over hatch or geometry.

MTEXT only: TEXT has no background-fill attribute, so setting one on it would report success and change nothing.

text_find_replaceA

Replace text in TEXT, MTEXT and block attributes (ATTRIB and ATTDEF).

searched_types is on the response because "no matches" and "that type was never searched" are different answers. Block definitions are included, so the next insert does not reintroduce the old text. DIMENSION text is out of scope: its text field holds the <> override placeholder rather than the measurement, so editing it would break the association.

entity_edit_geometryA

Edit the defining geometry of an existing entity in place (no delete/recreate).

CIRCLE: cx/cy/radius · LINE: x1/y1/x2/y2 · ARC: cx/cy/radius/start_angle/end_angle. Any argument left out is unchanged; the handle is preserved.

selection_windowA

AutoCAD's ssget window/crossing selection.

Corners may be given in any order. Selection is by drawn position, so an entity in a mirrored frame is found where entity_get reports it. A zero-area box is refused rather than answered with an empty list.

selection_polygonA

Window or crossing selection against a polygon rather than a rectangle.

selection_filterA

AutoCAD's QSELECT: filter the drawing by properties.

Named parameters rather than a query string, deliberately — a mistyped attribute name in a query language comes back as an empty result, which is indistinguishable from "no matches". filtered_by reports which filters actually ran.

entity_getA

Get all properties of a specific entity by its handle.

entity_listA

List entities in the drawing with optional type and layer filters.

Returns handle, type, layer, color, and type-specific properties. Use handles with entity_get, entity_move, entity_delete, etc.

This is the most expensive result on the server — the full record runs ~250 characters per entity, and properties.bounding_box alone is about a third of it. When all you need is handles, say so::

entity_list(layer_filter="GEOMETRY", fields=["handle", "type"], compact=True)

Paging honesty: a plain list has nowhere to say that more entities followed the page, so compact=True is the only mode that reports total, truncated and next_offset — all measured against the same filters.

entity_delete_manyA

Delete multiple entities in one call. Returns count of deleted entities.

selection_getA

Read the entities the user pre-selected in the AutoCAD viewport (COM backend only).

Returns the implied "pickfirst" selection — the entities highlighted with grips before invoking the AI — so work can be scoped to exactly those entities instead of the whole drawing. Typical use::

sel = selection_get()
dimension_auto(sel["handles"], style="chain")

Result keys: ok — True on the COM backend (even for an empty selection) count — number of selected entities handles — list of entity handles (hex strings) to act on entities — full per-entity info (type, layer, color, ...) pickfirst — state of the PICKFIRST sysvar (None if unknown) message — guidance when nothing is selected

On the ezdxf headless backend there is no viewport, so this returns ok=False with an empty handles list.

fields / compact shape the "entities" collection — this tool already returns an object, so the columnar envelope lands under that key rather than replacing the result. handles is unaffected, so a caller that only wants handles can pass fields=["handle"] and still read handles directly.

layer_listA

List all layers with their properties (color, linetype, frozen, locked, visibility).

Never truncated — a drawing's whole layer table is returned — so a compact envelope here always reports truncated=false.

layer_createC

Create a new layer with specified properties.

layer_deleteA

Delete a layer. The layer must have no entities. Layer '0' cannot be deleted.

layer_set_currentA

Set the active/current layer for new entities.

layer_modifyA

Modify an existing layer's color, linetype, and/or lineweight.

layer_freezeA

Freeze a layer (makes it invisible and unselectable, faster regeneration).

layer_thawB

Thaw a frozen layer, making it visible and selectable again.

layer_lockA

Lock a layer (entities visible but cannot be selected or modified).

layer_unlockA

Unlock a layer to allow entity selection and modification.

layer_hideA

Turn off a layer (entities invisible but still processed in regeneration).

layer_showA

Turn on a layer that was previously turned off.

layer_isolateB

Hide all layers except the specified one (layer isolation).

linetype_listA

Return the names of all linetypes currently loaded in the active drawing.

linetype_loadA

Load a single linetype safely.

Use this instead of system_run_command('_-LINETYPE _LOAD ...') — that raw form can deadlock on the FILEDIA file-picker dialog and on the -LINETYPE option-menu prompt. This tool sets FILEDIA=0 around the call, picks the right .lin file from MEASUREMENT, and verifies the linetype actually loaded.

block_listA

List all block definitions in the drawing (name, origin, attribute count, entity count).

Never truncated — the whole block table is returned — so a compact envelope here always reports truncated=false.

block_insertC

Insert a block and optionally set attribute values.

block_explodeA

Explode a block reference into its individual component entities.

block_get_attributesA

Get all attribute values from a block reference as {TAG: value} dict.

block_set_attributesA

Update attribute values in a block reference.

block_create_from_entitiesA

Create a new block definition from existing entities in the drawing.

Works on both engines. The originals stay in model space — this defines a reusable block from them rather than consuming them the way AutoCAD's BLOCK command does; use block_insert to place copies, and delete the originals yourself if you want the command's behaviour.

Handles that do not resolve are listed in skipped rather than silently dropped, and a call where none resolve fails instead of leaving an empty definition behind.

block_find_referencesA

Find all insert references to a specific block definition.

Bounded by the backend's own default entity_list page (200 INSERTs scanned), which is a pre-existing limit, not a new one: the compact envelope's total counts the references found within that scan.

boundary_traceA

AutoCAD's BOUNDARY/BPOLY: create a closed polyline around a seed point.

Returns the nearest enclosing loop, so a seed inside an island gives the island rather than the outer region. Straight edges are split where they cross, so a line drawn across a shape divides it the way it looks like it should. A seed with no enclosing loop is refused, and the error names the gap when the edges nearly close.

boundary_from_entitiesA

Chain the given entities into one closed polyline.

The handles may arrive in any order — putting them in chain order is the tool's job. A chain that does not close is refused, and the error names the coordinates of the gap.

analysis_list_propertiesA

AutoCAD's LIST: the full DXF attribute set for one handle.

dxf_attributes is the raw attribute set entity_get deliberately does not carry. Coordinates in it are WCS, like everywhere else in this server, and extrusion is reported so the entity's own frame is still visible.

analysis_entity_statsB

Analyze the drawing and return entity counts grouped by type and by layer.

Returns: total_entities, by_type (sorted by count), by_layer (sorted by count). This is unique to AutoCAD MCP Pro – no other MCP server provides this!

analysis_find_in_regionA

Find all entities within a rectangular region (crossing selection).

Uncapped: a window over a busy drawing returns every hit. Project with fields and/or compact before widening the window.

analysis_measure_distanceA

Measure the Euclidean distance between two points.

analysis_measure_areaA

Area and perimeter of a polygon you supply the vertices for.

This measures the numbers in the call, NOT the drawing. To measure something that exists, use analysis_measure_entity(handle) — it reads the real geometry, including curvature this tool can only see if you pass it.

Straight-edged polygons are exact. Pass a third bulge element per vertex for arc edges; omitting it on curved geometry under-reports (28% on a semicircular edge), which is why assumes says what was taken on faith.

analysis_measure_entityA

Measure something already in the drawing, by handle.

Reads the real geometry, so polyline bulges (arc edges) are included — reading vertices back and shoelacing them yourself loses 28% of the area on a semicircular edge, silently.

Measurable: LWPOLYLINE, 2D POLYLINE, CIRCLE, ELLIPSE, SPLINE, HATCH, SOLID, TRACE, 3DFACE. REGION and 3DSOLID need the live COM backend (their area is in ACIS data ezdxf cannot evaluate) and refuse with capability: "measure_area_acis". LINE/TEXT/INSERT bound no area on any engine and are a plain error, not a capability gap.

The payload states its own accuracy: exact is false when the shape had to be flattened (then flatten_tolerance says how finely), assumed_closed is true when an open boundary was closed the way AutoCAD's AREA does, and self_intersecting warns when the shoelace cancelled crossed lobes — a bowtie measures 0.0 and that number is worse than useless unflagged.

analysis_bounding_boxA

Get the bounding box (extents) of all entities in the drawing.

analysis_select_by_layerA

Get all entities on a specific layer. Returns entity list with handles.

Capped at MAX_LIST_LIMIT (default 5000). The plain list cannot say it was capped — the warning goes to the log stream, which most clients never show the model — so use compact=True when the count matters: its total is the layer's real population and truncated states whether the cap fired.

analysis_select_by_typeA

Get all entities of a specific type. Returns entity list with handles.

Capped at MAX_LIST_LIMIT (default 5000); as with analysis_select_by_layer, compact=True is the only shape that reports total and truncated.

analysis_layer_statsA

Return detailed statistics for each layer: entity count, types present.

cad_batchA

Execute an ordered list of tool calls in ONE round trip.

N calls collapse into one request/response pair, and bind lets a later step reference an earlier step's result so handles never have to be echoed back through the model.

steps=[
  {"tool": "entity_create_line",  "args": {...}, "bind": "edge"},
  {"tool": "point_from_snap",     "args": {"handle": "$edge", "snap": "mid"},
                                  "bind": "mid"},
  {"tool": "entity_create_circle","args": {"cx": "$mid.x", "cy": "$mid.y",
                                           "radius": 4}},
]

Successful steps report only their handle; pass verbose=True for the full result. Anything without a handle is returned whole.

VALIDATION runs first, always: an unknown tool, a schema-invalid argument or a reference no earlier step binds refuses the whole batch before anything executes. on_error governs run-time failures only. dry_run=True returns that validation report and executes nothing.

ERRORS are typed, never text: each failed step carries error.kind - one of unsupported (with the backend capability), invalid_args, refused, failed, unknown_tool, unresolved_ref, denied, malformed_step.

ATOMICITY is reported, not assumed. Read the atomicity block: on the headless backend rollback restores a full document snapshot; on live AutoCAD it sends an UNDO whose landing AutoCAD never confirms. The default on_error="stop" claims nothing and is exact on both.

NOT CALLABLE from a batch: the raw command/LISP escape hatches, and cad_batch itself. Call those directly.

For a few hundred entities of the same kind, entity_batch_create is denser still (no per-step tool name) - and it can be one step of a cad_batch.

entity_batch_createA

Create multiple entities in a single call for better performance.

Each entity dict must have a 'type' key and the parameters for that type. Example: [{"type": "line", "x1": 0, "y1": 0, "x2": 100, "y2": 0}, {"type": "circle", "cx": 50, "cy": 50, "radius": 25}]

Denser than cad_batch for many entities of the same kind (no per-step tool name), and usable as one step of a cad_batch. Use cad_batch when the calls differ, must be ordered, or must feed each other.

entity_batch_modifyA

Apply multiple modifications in a single call.

Example: [{"handle": "1A", "action": "move", "dx": 10, "dy": 20}, {"handle": "2B", "action": "delete"}]

Covers move/rotate/scale/delete/set_properties only. For anything else, for ordering, or to feed one step's result into the next, use cad_batch.

template_apply_layersA

Apply a standard layer set from a predefined template.

Available templates: architectural, mechanical, electrical, piping. Creates all layers defined in the template with standard colors and lineweights.

template_listA

List all available layer templates and their contents.

validation_checkA

Run quality checks on the current drawing.

Available checks:

  • empty_layers: Find layers with no entities

  • zero_length: Find zero-length lines

  • duplicate_entities: Find entities at the same position

Prompts

Interactive templates invoked by user choice

NameDescription
prompt_floor_planGenerate a prompt for creating a floor plan drawing.
prompt_pid_diagramGenerate a prompt for creating a P&ID (Piping and Instrumentation Diagram).
prompt_electrical_schematicGenerate a prompt for creating an electrical schematic diagram.
prompt_mechanical_drawingGenerate a prompt for creating a mechanical engineering drawing.
prompt_quick_drawingGenerate step-by-step instructions for creating a drawing from a description.

Resources

Contextual data attached and managed by the client

NameDescription
Current Drawing InfoMetadata for the currently open drawing
Layer ListAll layers in the current drawing with properties
Block LibraryAll block definitions in the current drawing
Entity StatisticsEntity counts by type and layer
Server StatusAutoCAD MCP Pro server and backend status

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/U-C4N/Autocad-MCP'

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