AutoCAD-MCP: Instructions file for Claude Code

CLAUDE.md

AutoCAD-MCP CLAUDE.md is an instructions file for Claude Code from codesknight/AutoCAD-MCP. It costs 796 tokens per session, scanned A, original, MIT.

A Claude Code project guide for an AutoCAD MCP service. It documents the required three-layer structure, logging rules, environment setup, COM automation conventions, and safety precautions.

In plain words
What is it for?
Use it when adding or fixing AutoCAD tools, geometry handling, COM connections, tests, configuration, or development documentation.
Why use it?
It helps an agent change the service without bypassing its architecture or accidentally modifying a user's active engineering drawing. It also records development changes in a dated log.

Instructions file for Claude Code

Written for Claude Code: the file is CLAUDE.md.

This is codesknight/AutoCAD-MCP's own configuration. It tells Claude Code how to work on AutoCAD-MCP itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything AutoCAD-MCP configures →

Reuse

Borrowing it

Nothing to install: this file belongs to codesknight/AutoCAD-MCP. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/codesknight/AutoCAD-MCP/main/CLAUDE.md
Clone the repo
git clone --depth 1 https://github.com/codesknight/AutoCAD-MCP

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for AutoCAD-MCP CLAUDE.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/codesknight/autocad-mcp/claude-md.svg)](https://agentmods.dev/instructions/codesknight/autocad-mcp/claude-md)
Your own site
<a href="https://agentmods.dev/instructions/codesknight/autocad-mcp/claude-md"><img src="https://agentmods.dev/badge/instructions/codesknight/autocad-mcp/claude-md.svg" alt="Measured on agentmods" height="20"></a>
Per session 796 This file is loaded in full into every session.
When invoked 796 The same file — it is already loaded in full.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00796 $0.00796
Opus 5 $0.00398 $0.00398
Sonnet 5 $0.00159 $0.00159
Haiku 4.5 $0.00080 $0.00080

Measured 6d ago against content hash eeb244e67168, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

AutoCAD-MCP CLAUDE.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 6d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

CLAUDE.md · 31 lines

What it actually says

项目约定

毕设项目:AutoCAD MCP 服务,参考并改进自 daobataotie/CAD-MCP(分析见 docs/references/cad-mcp-analysis.md,架构方案见 docs/design/architecture.md)。

日志规则(重要,必须遵守)

每次对本项目做出实质性修改(新增/修改功能、调整架构、修复 bug、更新依赖等)之后,必须在 docs/logs/devlog.md 追加一条记录:

  • 找到今天日期对应的 ## YYYY-MM-DD 分节,没有就新建一个(日期用当天真实日期,不要用相对时间)。
  • 用简短要点写清楚"改了什么、为什么改",而不是逐行代码变更。
  • 不要覆盖或删除历史条目,只追加。

架构原则

  • 三层结构:server.py(MCP 入口)→ tools/(MCP 工具,参数校验)→ cad/(COM 自动化,不依赖 mcp 包)。新增能力时严格按这个分层放代码,不要在 tools/ 里直接写 COM 调用。
  • 不要自己写自然语言解析层(不要重蹈参考项目 nlp_processor.py 的覆辙)。MCP 客户端本身负责自然语言理解,工具函数只接收结构化参数。
  • AutoCAD COM ProgID 从 src/autocad_mcp/config.json 读取(当前为 AutoCAD.Application.25.1),不要硬编码 "AutoCAD.Application"——本机注册表里这个通用 ProgID 并未注册。
  • 坐标传给 COM 方法前必须用 cad/geometry.py 里的 to_variant_point 转成 VARIANT 数组。

环境

  • conda 环境名:autocad-mcp(Python 3.11)。命令行直接调用建议用 "/c/Users/LiuYanhong/.conda/envs/autocad-mcp/python.exe" script.py(Windows 上 conda run 在遇到中文/非 ASCII 输出时会因为控制台 GBK 编码而报 UnicodeEncodeError,用 env 内的 python.exe 直连可绕开)。
  • 集成测试(tests/test_connection.py 等)需要真实打开的 AutoCAD 实例,连不上时应 pytest.skip 而不是报错失败。

⚠️ 安全注意事项

用户的 AutoCAD 里经常开着真实的工程图纸(不是空白测试文件)。GetActiveObject 连接的是当前活动实例的当前活动文档——任何写操作(画线、保存等)都会直接作用在用户正在编辑的真实图纸上。

  • 写操作类的手动验证脚本,跑之前先打印 conn.document.Name 确认(或者要求用户新建一个空白图纸再测试),不要默认往当前活动文档里写测试数据。
  • 如果不小心在真实图纸上执行了测试性质的绘制,立刻用 document.SendCommand("_.undo\n1\n") 撤销,并明确告知用户改了什么、已撤销。
  • 涉及 save_drawing(另存为/覆盖保存)等不可逆操作时,默认写到新文件路径,不要覆盖用户原文件,除非用户明确要求。
Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 6d ago First seen · 31 lines · 796 tokens per session scan A eeb244e67168

Subscribe to this mod's changes

AutoCAD-MCP CLAUDE.md is an instructions file published in the GitHub repository codesknight/AutoCAD-MCP (1 stars, last pushed 1mo ago), licensed MIT. It adds 796 tokens to every session, about $0.0040 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other instructions, from other repositories

codex AGENTS.md

AGENTS.md instructions for openai/codex, covering rust/codex-rs, the codex-core crate, code review rules, crate api surface and model visible context.

openai/codex · 5,182 tokens

vscode buildNext.instructions.md

Working notes and architecture documentation for the new esbuild-based build system in build/next. Use when making changes to the new build pipeline (transpile/bundle commands, NLS plugin, source-map handling, resource copying, or self-hosting watch tasks).

microsoft/vscode · 6,785 tokens

next.js AGENTS.md

AGENTS.md instructions for vercel/next.js, covering next.js development guide, codebase structure, monorepo overview, core package: packages/next and other important packages.

vercel/next.js · 7,296 tokens

langchain AGENTS.md

AGENTS.md instructions for langchain-ai/langchain, covering global development guidelines for the langchain monorepo, corridor security analysis, project architecture and context, monorepo structure and development tools & commands.

langchain-ai/langchain · 4,469 tokens

vscode oss-third-party-notices.instructions.md

Instructions for microsoft/vscode, covering vs code oss third-party-notices pipeline, architecture, pipeline flow in ci, applying the notice (cutover) and fallback chain (never fail the build).

microsoft/vscode · 5,001 tokens

spec-kit AGENTS.md

AGENTS.md instructions for github/spec-kit, covering agents.md, about spec kit and specify, quickstart — add a new integration in 5 steps, integration architecture and integrationmanifest — file tracking.

github/spec-kit · 7,104 tokens