CAD-MCP Server

Control CAD software through natural language instructions

README.md

CAD-MCP Server (CAD Model Context Protocol Server)

English | 中文

Project Introduction

CAD-MCP is an innovative CAD control service that allows controlling CAD software for drawing operations through natural language instructions. This project combines natural language processing and CAD automation technology, enabling users to create and modify CAD drawings through simple text commands without manually operating the CAD interface.

Features

CAD Control Functions

  • Multiple CAD Software Support: Supports mainstream CAD software including AutoCAD, GstarCAD (GCAD) and ZWCAD
  • Basic Drawing Functions:
    • Line drawing
    • Circle drawing
    • Arc drawing
    • Rectangle drawing
    • Polyline drawing
    • Text addition
    • Pattern filling
    • Dimension annotation
  • Layer Management: Create and switch layers
  • Drawing Save: Save the current drawing as a DWG file

Natural Language Processing Functions

  • Command Parsing: Parse natural language instructions into CAD operation parameters
  • Color Recognition: Extract color information from text and apply it to drawing objects
  • Shape Keyword Mapping: Support recognition of various shape description words
  • Action Keyword Mapping: Recognize various drawing and editing actions

Demo

The following is the demo video.

Demo

Installation Requirements

Dependencies

pywin32>=228    # Windows COM interface support
mcp>=0.1.0      # Model Control Protocol library
pydantic>=2.0.0 # Data validation
typing>=3.7.4.3 # Type annotation support

System Requirements

  • Windows operating system
  • Installed CAD software (AutoCAD, GstarCAD, or ZWCAD)

Configuration

The configuration file is located at src/config.json and contains the following main settings:

{
    "server": {
        "name": "CAD MCP Server",
        "version": "1.0.0"
    },
    "cad": {
        "type": "AutoCAD",  
        "startup_wait_time": 20,
        "command_delay": 0.5
    },
    "output": {
        "directory": "./output",
        "default_filename": "cad_drawing.dwg"
    }
}
  • server: Server name and version information
  • cad:
    • type: CAD software type (AutoCAD, GCAD, GstarCAD, or ZWCAD)
    • startup_wait_time: CAD startup waiting time (seconds)
    • command_delay: Command execution delay (seconds)
  • output: Output file settings

Usage

Starting the Service

python src/server.py

Claude Desktop & Windsurf

# add to claude_desktop_config.json. Note: use your path  
{
    "mcpServers": {
        "CAD": {
            "command": "python",
            "args": [
                # your path, e.g.: "C:\\cad-mcp\\src\\server.py"
                "~/server.py"
            ]
        }
    }
}

Cursor

# Add according to the following diagram Cursor MCP. Note: use your path  

Cursor config

Note:The new version of cursor has also been changed to JSON configuration, please refer to the previous section

MCP Inspector

# Note: use your path  
npx -y @modelcontextprotocol/inspector python C:\\cad-mcp\\src\\server.py

Service API

The server provides the following main API functions:

  • draw_line: Draw a line
  • draw_circle: Draw a circle
  • draw_arc: Draw an arc
  • draw_polyline: Draw a polyline
  • draw_rectangle: Draw a rectangle
  • draw_text: Add text
  • draw_hatch: Draw a hatch pattern
  • add_dimension: Add linear dimension
  • save_drawing: Save the drawing
  • process_command: Process natural language commands

Project Structure

CAD-MCP/
├── imgs/                # Images and video resources
│   └── CAD-mcp.mp4     # Demo video
├── requirements.txt     # Project dependencies
└── src/                 # Source code
    ├── __init__.py     # Package initialization
    ├── cad_controller.py # CAD controller
    ├── config.json     # Configuration file
    ├── nlp_processor.py # Natural language processor
    └── server.py       # Server implementation

License

MIT License

Tools 10

draw_lineDraw a line in the CAD software
draw_circleDraw a circle in the CAD software
draw_arcDraw an arc in the CAD software
draw_polylineDraw a polyline in the CAD software
draw_rectangleDraw a rectangle in the CAD software
draw_textAdd text to the CAD drawing
draw_hatchDraw a hatch pattern in the CAD software
add_dimensionAdd a linear dimension to the drawing
save_drawingSave the current drawing as a DWG file
process_commandProcess natural language commands to perform CAD operations

Try it

Draw a rectangle with a width of 10 and height of 5.
Create a new layer named 'Electrical' and draw a circle inside it.
Add a linear dimension to the line I just drew.
Save the current drawing as 'project_v1.dwg'.
Draw a blue line from coordinate 0,0 to 10,10.

Frequently Asked Questions

What are the key features of CAD-MCP?

Supports AutoCAD, GstarCAD, and ZWCAD. Natural language command parsing for CAD operations. Automated drawing of lines, circles, arcs, rectangles, and polylines. Layer management and pattern filling capabilities. Direct saving of drawings to DWG files.

What can I use CAD-MCP for?

Automating repetitive drafting tasks in AutoCAD using natural language. Integrating CAD drawing workflows directly into AI-assisted design environments. Rapidly generating standard geometric shapes and annotations via text prompts. Managing complex layer structures in CAD projects without manual interface navigation.

How do I install CAD-MCP?

Install CAD-MCP by running: python src/server.py

What MCP clients work with CAD-MCP?

CAD-MCP works with any MCP-compatible client including Claude Desktop, Claude Code, Cursor, and other editors with MCP support.

Turn this server into reusable context

Keep CAD-MCP docs, env vars, and workflow notes in Conare so your agent carries them across sessions.

Open Conare