DC

daobataotie/cad-mcp

API 开发

本页由 AI 翻译,技术细节请以原文为准。 查看原文

741 stars 114 forks 质量 83 趋势 16MIT

CAD MCP 服务器

概览

CAD-MCP是一款创新的CAD控制服务,允许通过自然语言指令控制绘图操作的CAD软件。该项目结合了自然语言处理和CAD自动化技术,使用户无需手动操作CAD界面即可通过简单的文本命令创建和修改CAD图纸。 - : 支持主流CAD软件,包括AutoCAD、GstarCAD(GCAD)和ZWCAD - : - 线绘 - 圆绘 - 弧线绘制 - 矩形绘图 - 多段线绘制 - 文本添加 - 图案填充 - 尺寸标注 - : 创建和切换图层 - : 将当前图纸保存为DWG文件 - :将自然语言指令解析为CAD操作参数 - :从文本中提取颜色信息并应用于绘图对象 - :支持识别各种形状描述词 - :识别各种绘图和编辑操作 - Windows 操作系统 - 安装的 CAD 软件(AutoCAD、GstarCAD 或 ZWCAD) 那个......

概述(AI 翻译)

英文 |中文 |ไทย

项目简介

CAD-MCP是一款创新的CAD控制服务,允许通过自然语言指令控制绘图操作的CAD软件。该项目结合了自然语言处理和CAD自动化技术,使用户无需手动操作CAD界面即可通过简单的文本命令创建和修改CAD图纸。

2.0版本基于最新的MCP规范全面升级(FastMCP、结构化输出、工具注释、进度通知、可流式HTTP),新增35个工具,涵盖查询、编辑、图层、绘图管理、块和命令直通——形成完整的“绘图→检查→正确”反馈循环。

特色

CAD控制功能

  • 多CAD软件支持:支持包括AutoCAD、GstarCAD(GCAD)和ZWCAD在内的主流CAD软件
  • 基本绘图功能:
  • 线条绘制
  • 圆绘
  • 弧线绘图
  • 椭圆绘图
  • 矩形绘图
  • 多线绘图
  • 文本添加
  • 图案填充
  • 维度注释
  • 查询功能(AI可以看到实际绘图内容):
  • 列出所有图层

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

CAD-MCP Server (CAD Model Context Protocol Server)

English | 中文 | ไทย

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.

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.

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
    • Ellipse drawing
    • Rectangle drawing
    • Polyline drawing
    • Text addition
    • Pattern filling
    • Dimension annotation
  • Query Functions (the AI can see the actual drawing content):
    • List all layers
    • List entities in model space (returns editable entity handles)
    • Query detailed entity properties by handle (coordinates/radius/text content, etc.)
    • Screenshot of the CAD window for preview
  • Editing Functions: erase, move, rotate, scale, copy, mirror, offset, array (linear/polar), undo/redo
  • Layer Management: Create and switch layers, query layer states
  • Drawing Management: New / open / close / save drawings (DWG/DXF)
  • Block Operations: Create, insert, and list blocks
  • Command Passthrough: Execute any CAD command via send_command (an escape hatch for everything else)

MCP Protocol Features

  • Structured Output: All tools return structuredContent with an outputSchema that clients can parse directly
  • Tool Annotations: Query tools are marked readOnlyHint; destructive operations are marked destructiveHint for client confirmation policies
  • Progress Notifications: Long-running operations (CAD startup, saving) send message notifications to the client
  • Dual Transport Modes: stdio (local, single client) and streamable-http (remote / multiple clients sharing one CAD instance)
  • Error Semantics: Input validation errors are returned as tool errors, enabling model self-correction

Natural Language Processing Functions (legacy interface)

  • 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

Demo

The following is the demo video.

在 GitHub 查看完整 README

安装

npx -y @modelcontextprotocol/inspector python C:\\cad-mcp\\src\\server.py
新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "CAD": { "command": "python", "args": [ # Your actual path, such as:"C:\\cad-mcp\\src\\server.py" ] } } }