AutoCAD MCP Server
About
Production-grade MCP server that lets AI assistants control AutoCAD on Windows via natural language — draw lines, circles, rectangles, manage layers, calculate areas, and export PDFs through the AutoCAD COM API.
Details
- Author
- ranvirw18
- Categories
- Design, Other
Jump to
Setup
Install AutoCAD MCP Server in your MCP client (Claude Desktop, Cursor, Windsurf, and others).
Repository: https://github.com/ranvirw18/autocad-mcp-server
Follow the installation instructions in the repository README, then restart your MCP client.
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.
- 10 Comprehensive MCP Toolsfor CAD operations
- AutoCAD COM API Integrationfor native Windows automation
- Natural Language Control- "Draw a 100x50 rectangle" → creates geometry
- Automatic Connection Managementwith reconnection logic
- Full Type Hints & Pydantic Validationfor safety
- Production Loggingfor debugging and monitoring
- Unit Testscovering all tools and edge cases
- Fast & Lightweightusing FastMCP framework
- Python 3.11+
- FastMCP- MCP framework
- pyautocad- AutoCAD COM wrapper
- pywin32- Windows COM support
- Pydantic- Data validation
- uv- Fast Python package manager
- create_line- Draw a line between two points
- Parameters:x1,y1,x2,y2
- Returns: Object ID of created line
- Parameters:center_x,center_y,radius
- Returns: Object ID of created circle
- Parameters:x,y,width,height
- Returns: List of object IDs (polyline + entities)
- Parameters:text,x,y,height
- Returns: Object ID of created text
- create_layer- Create a new layer
- Parameters:layer_name
- Returns: Layer name (or error if exists)
- No parameters
- Returns: List of layer names
- calculate_area- Calculate area of closed shape
- Parameters:object_id
- Returns: Calculated area value
- save_drawing- Save active drawing
- Parameters:file_path(optional, defaults to current)
- Returns: Success message with file path
- Parameters:output_path
- Returns: Success message with PDF path
- No parameters
- Returns: Document name and full path
- Windows 10/11(AutoCAD COM API is Windows-only)
- AutoCAD 2020+installed and running
- Python 3.11+with pip
- uvpackage manager (recommended)
git clone https://github.com/yourusername/autocad-mcp-server.git cd autocad-mcp-server
python -m venv venv venv\Scripts\activate pip install -r requirements.txt
After installing pywin32, register COM components:
python -m pip install --upgrade pywin32 python Scripts/pywin32_postinstall.py -install
uv run python -m pip install --upgrade pywin32 uv run python Scripts/pywin32_postinstall.py -install
# Test that AutoCAD COM is accessible python -c "import win32com.client; acad = win32com.client.GetObject(class='AutoCAD.Application'); print(f'AutoCAD {acad.Version} detected')"
The server connects to a running AutoCAD instance via COM:
# Start AutoCAD before running the MCP server # AutoCAD will be running in the background
2. Enable COM Automation (Usually Default)
AutoCAD COM is enabled by default. To verify:
- Open AutoCAD
- Go toTools→Options→System
- Ensure "OLE Support" isenabled
Create a.envfile (copy from.env.example):
# AutoCAD connection timeout in seconds AUTOCAD_TIMEOUT=10 # Connection retry attempts RETRY_ATTEMPTS=3 # Logging level: DEBUG, INFO, WARNING, ERROR LOG_LEVEL=INFO # Server host and port MCP_HOST=127.0.0.1 MCP_PORT=8000
# Terminal 1: Start AutoCAD (if not already running) # Open AutoCAD manually # Terminal 2: Start MCP server python -m src.server
- Detect running AutoCAD instance
- Register all tools with MCP
- Listen for tool calls
- Reconnect if AutoCAD restarts
When running locally, the server is available at:
Edit~/.config/Claude/claude_desktop_config.json(Windows):
{ "mcpServers": { "autocad": { "command": "python", "args": ["-m", "src.server"], "cwd": "d:/autocad-mcp-server" } } }
C:\Users\[YourUsername]\AppData\Roaming\Claude\claude_desktop_config.json
Close and reopen Claude Desktop. The AutoCAD tools will appear in the Tools section.
Create a custom action in ChatGPT with this schema pointing to your running MCP server.
In Cursor settings, configure the MCP server endpoint:
{ "mcpServers": { "autocad": { "command": "python", "args": ["-m", "src.server"] } } }
Once connected, use natural language to control AutoCAD:
- "Draw a line from (0, 0) to (100, 50)" → Callscreate_linewith coordinates
- "Create a circle at center (50, 50) with radius 25" → Callscreate_circle
- "Draw a 100x50 rectangle at origin" → Callscreate_rectangle
- "Add text 'WALL-A' at coordinates (10, 20) with height 5" → Callscreate_text
- "Create a new layer called 'Fixtures'" → Callscreate_layer
- "Show me all layers in the drawing" → Callslist_layers
- "Calculate the area of object with ID 'ABC123'" → Callscalculate_area
- "Save the drawing" → Callssave_drawing
- "Export the drawing to PDF at C:\output\plan.pdf" → Callsexport_pdf
- "What's the active document name?" → Callsget_active_document
Issue: "AutoCAD not found" or Connection Refused
- Open AutoCAD manually before starting the MCP server - Verify AutoCAD is running: Task Manager → search for "acad" - Check AutoCAD version supports COM (2020+)# Debug: Test COM access python -c "from src.autocad_client import AutoCADClient; c = AutoCADClient(); print(c.get_document_info())"
Issue: "Module not found" errors
# Reinstall dependencies pip install -r requirements.txt # Or with uv uv sync --reinstall
python -m pip install --upgrade pywin32 python Scripts/pywin32_postinstall.py -install # On some systems, run as Administrator
Issue: "Permission denied" when saving files
- Ensure the output directory exists and is writable - Run AutoCAD as Administrator if needed - Check file paths use forward slashes or double backslashes:# Good "C:/output/drawing.pdf" "C:\\output\\drawing.pdf" # Bad "C:\output\drawing.pdf" # Single backslashes interpreted as escape codes
- Check Python version:python --version(should be 3.11+)
- Verify dependencies:pip list | grep -E "fastmcp|pyautocad|pydantic"
- Check logs:
# Run with DEBUG logging LOG_LEVEL=DEBUG python -m src.server
Issue: Tools not appearing in Claude Desktop
- Verify config file exists:C:\Users\[You]\AppData\Roaming\Claude\claude_desktop_config.json
- Check JSON syntax is valid (usejsonlint.com)
- Restart Claude Desktop completely
- Check server logs for startup errors
Issue: AutoCAD crashes or becomes unresponsive
- The server includes timeout and error handling - If AutoCAD freezes, kill the process and restart - Server will automatically reconnect when AutoCAD restarts - Check for unsupported AutoCAD operations (e.g., complex geometry)# Run all tests pytest # Run with coverage pytest --cov=src # Run specific test file pytest tests/test_models.py # Run with verbose output pytest -v
- ✅ Pydantic model validation
- ✅ Tool parameter validation
- ✅ AutoCAD connection logic
- ✅ API endpoint functionality
- ✅ Error handling and edge cases
autocad-mcp-server/ ├── src/ │ ├── __init__.py │ ├── server.py # MCP server entrypoint │ ├── autocad_client.py # AutoCAD COM wrapper │ ├── models.py # Pydantic validation models │ └── tools/ │ ├── __init__.py # Tool registry │ ├── drawing.py # Line, circle, rectangle, text │ ├── layers.py # Layer management │ ├── dimensions.py # Area calculation │ └── export.py # Save and PDF export ├── tests/ │ ├── test_models.py # Model validation tests │ ├── test_server.py # API endpoint tests │ └── test_tools.py # Tool handler tests ├── pyproject.toml # uv/pip dependencies ├── .env.example # Environment template └── README.md # This file
┌─────────────────────────────────────────┐ │ Claude Desktop / ChatGPT / etc │ └──────────────────┬──────────────────────┘ │ │ (MCP Protocol) │ ┌──────────────────▼──────────────────────┐ │ MCP Server (FastMCP) │ │ ├─ Tool Registry │ │ ├─ Request Dispatcher │ │ └─ Pydantic Validators │ └──────────────────┬──────────────────────┘ │ │ (Python API) │ ┌──────────────────▼──────────────────────┐ │ AutoCAD Client (pyautocad) │ │ ├─ Connection Manager │ │ ├─ Retry Logic │ │ └─ Error Handler │ └──────────────────┬──────────────────────┘ │ │ (COM Automation) │ ┌──────────────────▼──────────────────────┐ │ AutoCAD Application (COM) │ │ ├─ Drawing API │ │ ├─ Layer Management │ │ └─ Document Operations │ └─────────────────────────────────────────┘
- Fast- Direct COM calls, no network overhead
- Lightweight- Minimal dependencies
- Reliable- Auto-reconnection on AutoCAD restart
- Safe- Full input validation with Pydantic
- Concurrent- Handles multiple AI assistant requests
- ✅ Runs locally on Windows (no cloud exposure)
- ✅ Input validation on all tool parameters
- ✅ Type-safe with Pydantic models
- ✅ Error handling prevents information leakage
- ⚠️ AutoCAD file access - ensure proper file permissions
- ⚠️ When exposing via network, use authentication/TLS
Pull requests welcome! Areas for enhancement:
- Additional drawing primitives (arc, polyline, spline)
- Block/component support
- Dimension annotations
- Hatch patterns
- Custom properties
- Multi-document support
- macOS/Linux via parallel AutoCAD alternatives
- 📧Issues:GitHub Issues
- 💬Discussions:GitHub Discussions
- 📚Docs:
- 🔗MCP Protocol:Model Context Protocol Spec
- Initial release
- 10 core CAD tools
- Claude Desktop integration
- Full test coverage
- Production-ready code
- AutoCAD Web API support for cloud deployments
- Real-time drawing updates with WebSocket
- Advanced geometry operations (offset, trim, extend)
- Material/property management
- CAM integration
- Version control for drawing changes
Made with ❤️ for AI-powered CAD automation
-
Changeimageto - Free Image Editing tools
16 tools to remove backgrounds, blur or grayscale backgrounds, change colors, convert formats (PNG/JPEG/WebP/…), upscale, denoise/enhance, run OCR, export PDF, edit text in images (Gemini), clean watermarks, inpaint masked regions, and run bulk resize / convert / quality checks.
You're agent can Chain 60+ AI image and video models on one workflow canvas
MCP server for AI-assisted STEP CAD inspection, geometry queries, PMI hints, and revision comparison
Convert raster images (PNG, JPG, WEBP, TIFF) to scalable SVG vector graphics locally, with no API key, via a single convert_image_to_svg tool.
Looks for design.md file in refero styles to make your UI design better.
Build your custom templated images. One at a time or batches. Save them to presets to reuse later. Create templates or images via agent using MCP server.
Convert files (DOCX, XLSX, PPTX, images), HTML, and Markdown to pixel-perfect PDFs — npx stdio or hosted Streamable HTTP, free API key in one click.
Automate Affinity Designer tasks like document manipulation, layer management, and exports using AI.
Provides instant access to Apple's Human Interface Guidelines, with content auto-updated periodically.
MCP server for BulkRender — generate bulk DOCX and PDF documents from Claude, Cursor, Windsurf, and any MCP-compatible AI assistant
Sign in to leave a review
Use Google, GitHub, or an email account so ratings stay tied to real people.
No reviews posted yet.



