Skip to content
Back to search

CAD-MCP

CAD MCP Server

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today
Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/daobataotie--cad-mcp/badge.svg)](/listings/daobataotie--cad-mcp)

HTML

<a href="/listings/daobataotie--cad-mcp"><img src="/api/listings/daobataotie--cad-mcp/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

Dependencies

pywin32>=306       # Windows COM interface support
mcp>=1.12,<2       # MCP Python SDK (FastMCP, structured output, Streamable HTTP)
pydantic>=2.0.0    # Data validation
Pillow>=10.0.0     # PNG encoding for screenshot previews

System Requirements

- Windows operating system - Installed CAD software (AutoCAD, GstarCAD, or ZWCAD) - Python 3.10+

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

README.md · README · 210 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

This file has changed since it was scanned, so this is not exactly the text that was scanned, and no line is marked. The findings are listed with the safety scan above.

  1. # CAD-MCP Server (CAD Model Context Protocol Server)
  2. [English](/README_en.md) | [中文](/README_zh.md) | [ไทย](/README_th.md)
  3. ## Project Introduction
  4. 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.
  5. Version 2.0 is fully upgraded based on the latest MCP specification (FastMCP, structured output, tool annotations, progress notifications, Streamable HTTP), and adds 35 tools in total covering querying, editing, layers, drawing management, blocks, and command passthrough — forming a complete "draw → inspect → correct" feedback loop.
  6. ## Features
  7. ### CAD Control Functions
  8. - **Multiple CAD Software Support**: Supports mainstream CAD software including AutoCAD, GstarCAD (GCAD) and ZWCAD
  9. - **Basic Drawing Functions**:
  10. - Line drawing
  11. - Circle drawing
  12. - Arc drawing
  13. - Ellipse drawing
  14. - Rectangle drawing
  15. - Polyline drawing
  16. - Text addition
  17. - Pattern filling
  18. - Dimension annotation
  19. - **Query Functions (the AI can see the actual drawing content)**:
  20. - List all layers
  21. - List entities in model space (returns editable entity handles)
  22. - Query detailed entity properties by handle (coordinates/radius/text content, etc.)
  23. - Screenshot of the CAD window for preview
  24. - **Editing Functions**: erase, move, rotate, scale, copy, mirror, offset, array (linear/polar), undo/redo
  25. - **Layer Management**: Create and switch layers, query layer states
  26. - **Drawing Management**: New / open / close / save drawings (DWG/DXF)
  27. - **Block Operations**: Create, insert, and list blocks
  28. - **Command Passthrough**: Execute any CAD command via `send_command` (an escape hatch for everything else)
  29. ### MCP Protocol Features
  30. - **Structured Output**: All tools return `structuredContent` with an `outputSchema` that clients can parse directly
  31. - **Tool Annotations**: Query tools are marked `readOnlyHint`; destructive operations are marked `destructiveHint` for client confirmation policies
  32. - **Progress Notifications**: Long-running operations (CAD startup, saving) send message notifications to the client
  33. - **Dual Transport Modes**: `stdio` (local, single client) and `streamable-http` (remote / multiple clients sharing one CAD instance)
  34. - **Error Semantics**: Input validation errors are returned as tool errors, enabling model self-correction
  35. ### Natural Language Processing Functions (legacy interface)
  36. - **Command Parsing**: Parse natural language instructions into CAD operation parameters
  37. - **Color Recognition**: Extract color information from text and apply it to drawing objects
  38. - **Shape Keyword Mapping**: Support recognition of various shape description words
  39. - **Action Keyword Mapping**: Recognize various drawing and editing actions
  40. ## Demo
  41. The following is the demo video.
  42. ![Demo](imgs/demo.gif)
  43. ## Installation Requirements
  44. ### Dependencies
  45. ```
  46. pywin32>=306 # Windows COM interface support
  47. mcp>=1.12,<2 # MCP Python SDK (FastMCP, structured output, Streamable HTTP)
  48. pydantic>=2.0.0 # Data validation
  49. Pillow>=10.0.0 # PNG encoding for screenshot previews
  50. ```
  51. ### System Requirements
  52. - Windows operating system
  53. - Installed CAD software (AutoCAD, GstarCAD, or ZWCAD)
  54. - Python 3.10+
  55. ## Configuration
  56. The configuration file is located at `src/config.json` and contains the following main settings:
  57. ```json
  58. {
  59. "server": {
  60. "name": "CAD MCP 服务器",
  61. "version": "2.0.0",
  62. "transport": "stdio",
  63. "host": "127.0.0.1",
  64. "port": 8000
  65. },
  66. "cad": {
  67. "type": "AUTOCAD",
  68. "progid": "",
  69. "startup_wait_time": 20,
  70. "command_delay": 0.5
  71. },
  72. "output": {
  73. "directory": "./output",
  74. "default_filename": "cad_drawing.dwg"
  75. }
  76. }
  77. ```
  78. - **server**: Server name, version, and transport settings
  79. - `transport`: Transport mode, `stdio` (default, local single client) or `streamable-http` (remote / multi-client)
  80. - `host` / `port`: Listen address and port for Streamable HTTP mode (can also be overridden via `--host` / `--port` command-line arguments)
  81. - **cad**:
  82. - `type`: CAD software type (AutoCAD, GCAD, GstarCAD, or ZWCAD)
  83. - `progid`: COM ProgID to use, e.g. `AutoCAD.Application.25.1`. Leave empty to auto-detect (versioned ProgIDs are looked up in the registry)
  84. - `startup_wait_time`: CAD startup waiting time (seconds)
  85. - `command_delay`: Command execution delay (seconds)
  86. - **output**: Output file settings
  87. ## Usage
  88. ### Starting the Service
  89. ```bash
  90. # Option 1: Run directly (fully compatible with existing Claude/Cursor configs)
  91. python src/server.py
  92. # Option 2: Install as a CLI tool
  93. pip install -e .
  94. cad-mcp
  95. # Option 3: Run with Streamable HTTP transport (remote / multi-client sharing one CAD instance)
  96. python src/server.py --transport streamable-http --port 8000
  97. # Clients connect to http://127.0.0.1:8000/mcp
  98. ```
  99. ### Connect from an MCP Client
  100. The server uses `stdio` transport by default, so the same JSON config works for any MCP client (Claude Desktop, Cursor, Windsurf, TRAE, etc.). Add it to your client's MCP server config file (e.g. `claude_desktop_config.json`, Cursor's `mcp.json`), replacing the path with your own:
  101. ```json
  102. {
  103. "mcpServers": {
  104. "CAD": {
  105. "command": "python",
  106. "args": [
  107. # Your actual path, such as:"C:\\cad-mcp\\src\\server.py"
  108. ]
  109. }
  110. }
  111. }
  112. ```
  113. For Streamable HTTP mode, point the client to `http://127.0.0.1:8000/mcp` instead.
  114. ### MCP Inspector
  115. ```bash
  116. # Note: use your path
  117. npx -y @modelcontextprotocol/inspector python C:\\cad-mcp\\src\\server.py
  118. ```
  119. ### Service API
  120. The server provides the following tools (35 in total):
  121. **Basic drawing:**
  122. - `draw_line`: Draw a line
  123. - `draw_circle`: Draw a circle
  124. - `draw_arc`: Draw an arc
  125. - `draw_ellipse`: Draw an ellipse
  126. - `draw_polyline`: Draw a polyline
  127. - `draw_rectangle`: Draw a rectangle
  128. - `draw_text`: Add text
  129. - `draw_hatch`: Draw a hatch pattern
  130. - `add_dimension`: Add linear dimension
  131. **Query:**
  132. - `list_layers`: List all layers
  133. - `list_entities`: List entities in model space (returns editable handles)
  134. - `get_entity_properties`: Query detailed entity properties by handle
  135. - `screenshot`: Capture the CAD window to confirm drawing results
  136. **Editing:**
  137. - `erase_entity` / `move_entity` / `rotate_entity` / `scale_entity`: Erase / move / rotate / scale entities
  138. - `copy_entity` / `mirror_entity` / `offset_entity`: Copy / mirror / offset entities
  139. - `array_linear_entity` / `array_polar_entity`: Linear / polar arrays
  140. - `undo` / `redo`: Undo / redo
  141. **Layer & drawing management:**
  142. - `create_layer` / `set_current_layer`: Layer management
  143. - `new_drawing` / `open_drawing` / `close_drawing` / `save_drawing`: Drawing management
  144. - `create_block` / `insert_block` / `list_blocks`: Block operations
  145. - `send_command`: Execute any CAD command via the command line
  146. **Legacy:**
  147. - `process_command`: Process natural language commands
  148. ## Project Structure
  149. ```
  150. CAD-MCP/
  151. ├── imgs/ # Images and video resources
  152. │ └── CAD-mcp.mp4 # Demo video
  153. ├── pyproject.toml # Packaging config (pip install -e .)
  154. ├── requirements.txt # Project dependencies
  155. └── src/ # Source code
  156. ├── __init__.py # Package initialization
  157. ├── cad_controller.py # CAD controller (COM layer: drawing/query/editing/drawings/blocks)
  158. ├── config.py # Config singleton loader
  159. ├── config.json # Configuration file
  160. ├── models.py # Structured output models (outputSchema)
  161. ├── nlp_processor.py # Natural language processor
  162. └── server.py # Server implementation (FastMCP)
  163. ```
  164. ## License
  165. MIT License

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.