RA

ranvirw18/autocad-mcp-server

Developer tools

Эта страница переведена автоматически. Технические детали смотрите в оригинале. Открыть оригинал

2 stars 7 forks Качество 78 Тренд 12MIT

A production-grade Model Context Protocol (MCP) server for AutoCAD on Windows, enabling AI assistants (Claude Desktop, ChatGPT, Cursor, etc.) to control AutoCAD through natural language.

Обзор

A production-grade Model Context Protocol (MCP) server for AutoCAD on Windows, enabling AI assistants (Claude Desktop, ChatGPT, Cursor, etc.) to control AutoCAD through natural language. - for CAD operations - for native Windows automation - - "Draw a 100x50 rectangle" → creates geometry - with reconnection logic - for safety - for debugging and monitoring - covering all tools and edge cases - using FastMCP framework - Python 3.11+ - FastMCP - MCP framework - pyautocad - AutoCAD COM wrapper - pywin32 - Windows COM support - Pydantic - Data validation - uv - Fast Python package manager 1. - Draw a line between two points - Parameters: x1, y1, x2, y2 - Returns: Object ID of created line 2. - Draw a circle - Parameters: center_x, center_y, radius - Returns: Object ID of created circle 3. - Draw a rectangle - Parameters: x, y, width, height - Returns: List of object IDs (polyline + entities) 4.

README

Показан фрагмент оригинального README. Открыть оригинал.

AutoCAD MCP Server

A production-grade Model Context Protocol (MCP) server for AutoCAD on Windows, enabling AI assistants (Claude Desktop, ChatGPT, Cursor, etc.) to control AutoCAD through natural language.

Features

  • 10 Comprehensive MCP Tools for CAD operations
  • AutoCAD COM API Integration for native Windows automation
  • Natural Language Control - “Draw a 100x50 rectangle” → creates geometry
  • Automatic Connection Management with reconnection logic
  • Full Type Hints & Pydantic Validation for safety
  • Production Logging for debugging and monitoring
  • Unit Tests covering all tools and edge cases
  • Fast & Lightweight using FastMCP framework

Tech Stack

Available Tools

Drawing Tools

  1. create_line - Draw a line between two points

    • Parameters: x1, y1, x2, y2
    • Returns: Object ID of created line
  2. create_circle - Draw a circle

    • Parameters: center_x, center_y, radius
    • Returns: Object ID of created circle
  3. create_rectangle - Draw a rectangle

    • Parameters: x, y, width, height
    • Returns: List of object IDs (polyline + entities)
  4. create_text - Add text annotation

    • Parameters: text, x, y, height
    • Returns: Object ID of created text

Layer Management

  1. create_layer - Create a new layer

    • Parameters: layer_name
    • Returns: Layer name (or error if exists)
  2. list_layers - List all layers in document

    • No parameters
    • Returns: List of layer names

Analysis & Measurement

  1. calculate_area - Calculate area of closed shape
    • Parameters: object_id
    • Returns: Calculated area value

Document Operations

  1. save_drawing - Save active drawing

    • Parameters: file_path (optional, defaults to current)
    • Returns: Success message with file path
  2. export_pdf - Export drawing to PDF

    • Parameters: output_path
    • Returns: Success message with PDF path
  3. get_active_document - Get active document info

    • No parameters
    • Returns: Document name and full path

Installation

Prerequisites

  • Windows 10/11 (AutoCAD COM API is Windows-only)
  • AutoCAD 2020+ installed and running
  • Python 3.11+ with pip
  • uv package manager (recommended)

Step 1: Clone Repository

git clone https://github.com/yourusername/autocad-mcp-server.git
cd autocad-mcp-server

Step 2: Install Dependencies

Using uv (fastest):

uv sync

Or using pip:

python -m venv venv
venv\Scripts\activate
pip install -r requirements.txt

Step 3: Install pywin32 COM Support

Открыть полный README на GitHub

Установка

This server does not publish a one-line install command.

Open the repository installation guide Новичок в MCP? Начните с руководства на mcpskill.org →

Конфигурация

{ "mcpServers": { "autocad": { "command": "python", "args": ["-m", "src.server"], "cwd": "d:/autocad-mcp-server" } } }