Natural Language CAD Control via CAD-MCP Server

5月9日 Published inCAD Tools

CAD-MCP (CAD Model Control Protocol Server) allows you to operate CAD software using natural language instructions. By integrating natural language processing with CAD automation, it enables users to generate or modify drawings through simple text commands rather than navigating traditional menus and toolbars.

CAD Control Features

Multi-Platform Support – Compatible with AutoCAD, GstarCAD (GCAD), and ZWCAD.

Core Drawing Tools – Create lines, circles, arcs, rectangles, and polylines. The server also supports adding text, applying hatch patterns, and inserting dimensions.

Layer Management – Generate new layers and switch between them dynamically while working.

File Export – Save and export the current workspace as a standard DWG file.

Natural Language Processing

Instruction Parsing – Translates plain English sentences into specific CAD operational parameters.

Color Recognition – Identifies color references within the text and applies them to the designated drawing objects.

Semantic Mapping – Recognizes various synonyms and phrasing styles for shapes, drawing actions, and editing tasks.

Installation Requirements

  1. Dependencies

pywin32>=228 – Provides Windows COM interface support. mcp>=0.1.0 – The Model Control Protocol library. pydantic>=2.0.0 – Used for data validation. typing>=3.7.4.3 – Support for type annotations.

  1. System Requirements – A Windows environment with AutoCAD, GstarCAD, or ZWCAD installed.

Configuration

The configuration file is located at src/config.json. A typical setup looks like this:

{
  "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: Contains the server name and version metadata.
  • cad: The type field specifies the target CAD software; startup_wait_time (in seconds) defines how long the server waits for the software to initialize; command_delay (in seconds) sets the pause interval between consecutive commands.
  • output: Defines the storage directory and the default name for exported DWG files.

How to Use

  1. Launch the Server – Execute the script by running python src/server.py.

  2. Integration with Claude Desktop & Windsurf – Add the following configuration to your claude_desktop_config.json file (ensure you update the file path to match your local environment):

{
  "mcpServers": {
    "CAD": {
      "command": "python",
      "args": [
        "~/server.py"
      ]
    }
  }
}
  1. Cursor Setup – Navigate to the Cursor MCP settings. In the "Edit MCP Server" section, set the Name to cad, leave the Type field empty, and set the Command to python C:\\CAD-MCP\\src\\server.py (adjust the path as necessary).

  2. Testing with MCP Inspector – To debug or test, run npx -y @modelcontextprotocol/inspector python C:\\cad-mcp\\src\\server.py, replacing the path with your actual file location.

  3. Server API – The server exposes specialized functions such as draw_line, draw_circle, and draw_arc. It also includes process_command for interpreting natural language and save_drawing for file output.