MCP HubMCP Hub
daobataotie

CAD-MCP

by: daobataotie

CAD MCP Server

35created 24/03/2025
Visit
CAD

πŸ“ŒOverview

Purpose: CAD-MCP aims to simplify CAD drawing operations by enabling users to control CAD software through natural language instructions, eliminating the need for manual interactions.

Overview: CAD-MCP is a pioneering CAD control service that integrates natural language processing with CAD automation, allowing for efficient creation and modification of CAD drawings through text commands. It supports various popular CAD platforms, ensuring ease of use and flexibility for users.

Key Features:

  • Multiple CAD Software Support: Compatible with leading CAD software like AutoCAD, GstarCAD, and ZWCAD, facilitating a wide application range.

  • Natural Language Processing: Employs advanced command parsing and shape recognition to convert natural language instructions into actionable CAD commands, enhancing user experience.

  • Comprehensive Drawing Functions: Offers essential drawing capabilities such as lines, circles, and annotations, along with layer management and drawing saving features, streamlining CAD workflows.


CAD-MCP Server (CAD Model Control Protocol Server)

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

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 the following to claude_desktop_config.json (use your own path):

{
    "mcpServers": {
        "CAD": {
            "command": "python",
            "args": [
                "~/server.py"
            ]
        }
    }
}

MCP Inspector

Run with your own 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/
β”œβ”€β”€ 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