AutoCAD LT AutoLISP
STDIONatural language control of AutoCAD LT through AutoLISP code generation and execution.
Natural language control of AutoCAD LT through AutoLISP code generation and execution.
This MCP server enables natural language control of AutoCAD LT 2024/2025 through AutoLISP code generation and execution. It bridges Claude or other LLM clients with AutoCAD LT for creating engineering drawings, P&ID diagrams, and technical documentation through conversational prompts.
git clone https://github.com/hvkshetry/autocad-mcp.git cd autocad-mcp python -m venv venv venv\Scripts\activate pip install -r requirements.txt
For users WITH CTO Library:
{ "mcpServers": { "autocad-mcp": { "command": "path\\to\\autocad-mcp\\venv\\Scripts\\python.exe", "args": ["path\\to\\autocad-mcp\\server_lisp_fast.py"] } } }
For users WITHOUT CTO Library:
{ "mcpServers": { "autocad-mcp": { "command": "path\\to\\autocad-mcp\\venv\\Scripts\\python.exe", "args": ["path\\to\\autocad-mcp\\server_lisp.py"] } } }
If you have the CAD Tools Online P&ID Library:
C:\PIDv4-CTO\
C:\PIDv4-CTO\VALVES\
C:\PIDv4-CTO\EQUIPMENT\
C:\PIDv4-CTO\PUMPS-BLOWERS\
C:\PIDv4-CTO\TANKS\
If you DON'T have the CTO Library:
server_lisp.py
instead of server_lisp_fast.py
Launch AutoCAD LT
Start the Server
# For users with CTO library (recommended) start_fast_server.bat # For users without CTO library start_lisp_server.bat
Test the Connection
test_connection.bat
create_line
: Draw lines between pointscreate_circle
: Create circles with center and radiuscreate_text
: Add text labels with rotation supportcreate_polyline
: Create polylines from point seriescreate_rectangle
: Create rectangles from corner pointsbatch_create_lines
: Create multiple lines efficientlybatch_create_circles
: Create multiple circles efficientlybatch_create_texts
: Create multiple text entities efficientlyinsert_block
: Insert blocks with attributes and positioningset_layer_properties
: Create/modify layers with full propertiesmove_last_entity
: Move recently created entitiesupdate_block_attribute
: Modify block attributes after insertionsetup_pid_layers
: Create standard P&ID drawing layersinsert_pid_symbol
: Insert any symbol from CTO libraryinsert_pid_equipment_with_attribs
: Insert equipment with proper attributesinsert_valve_with_attributes
: Insert valves with CTO attributesinsert_equipment_tag
: Add equipment identification tagsinsert_equipment_description
: Add equipment description blocksinsert_line_number_tag
: Add process line identificationdraw_process_line
: Draw process piping between pointsconnect_equipment
: Connect equipment with orthogonal routingadd_flow_arrow
: Add directional flow indicatorscreate_arc
: Create arcs with center, radius, and anglescreate_ellipse
: Create ellipses with major axis and ratiocreate_mtext
: Add multiline formatted textcreate_linear_dimension
: Add linear dimensionscreate_hatch
: Add hatching to closed areaslist_pid_symbols
: List available symbols by category"Draw a line from (0,0) to (100,100)"
"Create a circle at (50,50) with radius 25"
"Add text 'Equipment Room' at position (75,125)"
"Set up P&ID layers for a new drawing"
"Insert a centrifugal pump at (100,100) with tag P-101"
"Add a gate valve at (150,100) with size 6 inches and tag V-201"
"Connect the pump P-101 to valve V-201 with process piping"
"Add equipment tag P-101 above the pump"
"Create a wastewater treatment process with screening, primary clarifier, aeration basin, and secondary clarifier"
"Insert a clarifier at (200,100) with equipment number CL-301"
"Add line number 8"-WW-001 to the main process line"
"Create 10 circles in a grid pattern with centers every 50 units"
"Draw process lines connecting all equipment in sequence"
"Add equipment tags for all pumps with sequential numbering"
If you don't have the CAD Tools Online library, you can still use this MCP server effectively:
Replace the server command with:
"args": ["path\\to\\autocad-mcp\\server_lisp.py"]
The following tools will not work without CTO library:
insert_pid_symbol
insert_pid_equipment_with_attribs
insert_valve_with_attributes
list_pid_symbols
Instead of CTO symbols, you can:
"Draw a circle to represent a pump at (100,100)"
"Add text 'P-101 Centrifugal Pump' next to it"
"Create a rectangle for a tank at (200,100)"
"Connect them with a line for piping"
The server loads these LISP files for functionality:
File | Purpose | Dependencies |
---|---|---|
error_handling.lsp | Base error handling and validation | None (load first) |
basic_shapes.lsp | Core drawing functions | error_handling.lsp |
batch_operations.lsp | Batch creation tools | basic_shapes.lsp |
drafting_helpers.lsp | Block and layer management | basic_shapes.lsp |
pid_tools.lsp | P&ID specific operations | drafting_helpers.lsp |
attribute_tools.lsp | Block attribute handling | pid_tools.lsp |
advanced_geometry.lsp | Extended geometry creation | basic_shapes.lsp |
advanced_entities.lsp | Complex entity creation | advanced_geometry.lsp |
annotation_helpers.lsp | Text and dimension tools | basic_shapes.lsp |
entity_modification.lsp | Entity manipulation | drafting_helpers.lsp |
# Instead of 10 separate create_line calls (8 seconds) batch_create_lines([ [0, 0, 100, 0], [100, 0, 100, 100], [100, 100, 0, 100], # ... more lines ]) # Single call (0.8 seconds)
Adjust performance based on your system:
# Fast systems set_performance_mode(fast_mode=True, minimal_delay=0.03) # Slower systems (more reliable) set_performance_mode(fast_mode=False, minimal_delay=0.1)
Common issues and solutions:
server_lisp.py
without P&ID functionalityUsers of the original version should:
server_lisp_fast.py
for better performanceMIT License - See LICENSE file for details
Contributions are welcome! Please:
For detailed troubleshooting and advanced configuration, see the additional documentation files in this repository.