Civil 3D MCP Server
Enables AI assistants to write and execute C# code directly inside Autodesk Civil 3D, providing full API access through code generation and execution.
README
Civil 3D MCP Server — Code Execution Architecture
An MCP server that enables AI assistants to write and execute C# code directly inside Autodesk Civil 3D. Instead of fixed tools, the AI generates code that runs with full API access.
Architecture
┌─────────────────┐ stdio ┌──────────────────┐ TCP/JSON-RPC ┌──────────────────┐
│ AI Assistant │ ◄────────────► │ MCP Server (TS) │ ◄──────────────────► │ Civil 3D Plugin │
│ (Claude, Cline) │ │ 3 meta-tools │ port 8080 │ Roslyn Engine │
└─────────────────┘ └──────────────────┘ └──────────────────┘
│ │
Skills Library C# Code Execution
(.skill.md files) (full Civil 3D API)
10 Meta-Tools
| Tool | Purpose | Safety |
|---|---|---|
civil3d_health |
Check connection, Civil 3D version, active drawing | ✅ Read-only |
civil3d_status |
Real-time operation progress and queue state | ✅ Read-only |
civil3d_discover |
Inventory drawing objects without writing C# | ✅ Read-only |
civil3d_audit |
Read audit log of past operations | ✅ Read-only |
civil3d_security |
Read sandbox mode, export paths, confirmation policy | ✅ Read-only |
civil3d_query |
Execute C# code read-only | ✅ No side effects |
civil3d_execute |
Execute C# code with write access | ⚠️ Modifies drawing |
civil3d_command |
Execute native Civil 3D command strings | ⚠️ May modify drawing |
civil3d_session |
Multi-step transactions (begin/execute/commit/abort) | ⚠️ May modify drawing |
civil3d_skills |
Browse/search/read code skill templates | ✅ Metadata only |
How It Works
- AI reads a skill → Gets a documented C# code template
- AI adapts the code → Fills in parameters, combines patterns
- AI sends code → Via
civil3d_executeorcivil3d_query - Roslyn compiles + runs → Inside Civil 3D with full API access
- Results return as JSON → Back to the AI
Example Interaction
User: "What surfaces are in my drawing?"
AI: Uses civil3d_query with:
var surfaces = new List<object>();
foreach (ObjectId id in CivilDoc.GetSurfaceIds()) {
var s = Transaction.GetObject(id, OpenMode.ForRead) as TinSurface;
surfaces.Add(new { s.Name, s.Layer });
}
return surfaces;
Result: [{ "Name": "EG", "Layer": "C-TOPO-EG" }, ...]
Skills Library
Skills are documented C# code templates in skills/:
skills/
├── surfaces/ # Surface operations
├── alignments/ # Alignment + station/offset
├── points/ # COGO points
├── geometry/ # Lines, polylines, text
├── corridors/ # Corridor listing and info
├── pipe_networks/ # Pipe network listing and details
├── parcels/ # Sites and parcels
├── profiles/ # Profile listing and elevation queries
├── sections/ # Sample lines and cross-sections
├── labels/ # Label style inventories
├── styles/ # Object style inventories
├── export/ # CSV, LandXML export patterns
├── quantity/ # Volumes and corridor quantities
├── drawing/ # Drawing info
└── workflows/ # Multi-step civil engineering workflows
Script Globals
Code executed via civil3d_execute or civil3d_query has access to:
| Global | Type | Description |
|---|---|---|
Document / Doc |
Document |
Active AutoCAD document |
CivilDoc / Civil |
CivilDocument |
Active Civil 3D document |
Database |
Database |
Document database |
Transaction / Tr |
Transaction |
Active transaction |
Editor |
Editor |
Document editor |
Helper methods: GetSurfaceByName, GetAlignmentByName, GetProfileByName, GetCogoPointByNumber, GetObjectIdByHandle, ListSurfaces, ListAlignments, ListCogoPoints, ToRef, ToPoint
All Civil 3D namespaces are auto-imported. Return values are auto-serialized (ObjectId → handle, Point3d → xyz).
Setup
Quick setup (recommended)
npm run setup
This interactive script will:
- Detect installed Civil 3D versions (scans C:, D:, and other drives)
- Configure plugin DLL references automatically
- Build the MCP server and plugin
- Print MCP config for Cursor
Civil 3D on D: or custom folder? Use one of these:
# Option A — pass the path directly
npm run setup -- -InstallPath "D:\Program Files\Autodesk\AutoCAD 2026"
# Option B — environment variable (picked up automatically during scan)
$env:CIVIL3D_INSTALL_PATH = "D:\Program Files\Autodesk\AutoCAD 2026"
npm run setup
# Option C — interactive: when the menu appears, press C and paste the path
npm run setup
The path must be the AutoCAD 20XX folder that contains C3D\AeccDbMgd.dll.
Manual setup
1. Build MCP Server
npm install && npm run build
2. Build Plugin
# References are in plugin/Civil3dMcpPlugin/Civil3dMcpPlugin.References.props
# Regenerate with: npm run setup
# Custom install path: npm run setup -- -InstallPath "D:\...\AutoCAD 2026"
cd plugin/Civil3dMcpPlugin
dotnet build
3. Load in Civil 3D
NETLOAD → select Civil3dMcpPlugin.dll
C3DMCPSTATUS → verify running
4. Configure AI
{
"mcpServers": {
"civil3d": {
"command": "node",
"args": ["/path/to/civil3d-mcp/build/index.js"]
}
}
}
Environment Variables
| Variable | Default | Description |
|---|---|---|
CIVIL3D_HOST |
localhost |
Plugin host |
CIVIL3D_PORT |
8080 |
Plugin port (set on both MCP server and Civil 3D process) |
CIVIL3D_DEFAULT_TIMEOUT_MS |
120000 |
Default operation timeout (ms) |
CIVIL3D_EXECUTE_TIMEOUT_MS |
120000 |
C# script execution timeout |
CIVIL3D_COMMAND_TIMEOUT_MS |
300000 |
Native command timeout |
CIVIL3D_DISCOVER_TIMEOUT_MS |
60000 |
Discover inventory timeout |
CIVIL3D_AUDIT_LOG |
%LOCALAPPDATA%\Civil3dMcp\audit.jsonl |
Audit log file path |
CIVIL3D_SANDBOX_MODE |
professional |
strict | professional | unlocked |
CIVIL3D_REQUIRE_CONFIRMATION |
true |
Require confirmed: true for destructive ops |
CIVIL3D_ALLOWED_EXPORT_PATHS |
(see below) | Extra export folders, semicolon-separated |
LOG_LEVEL |
info |
Log level |
Development Roadmap
See ROADMAP.md for the phased plan to reach professional full access.
Security
Three sandbox modes via CIVIL3D_SANDBOX_MODE:
| Mode | File IO | Civil 3D API |
|---|---|---|
strict |
Blocked — use WriteExportFile() only via blocked raw File.* |
Full |
professional (default) |
Only under allowed folders | Full |
unlocked |
Unrestricted (delete still needs confirmation) | Full |
Default allowed export paths: %LOCALAPPDATA%\Civil3dMcp\Exports, Desktop, Documents.
Add more with CIVIL3D_ALLOWED_EXPORT_PATHS.
Safe file helpers in scripts: WriteExportFile(path, content), WriteExportLines(path, lines), ReadImportFile(path), AllowedExportPaths.
Destructive operations (erase, purge, delete) require confirmed: true when CIVIL3D_REQUIRE_CONFIRMATION=true (default). The tool returns CIVIL3D.CONFIRMATION_REQUIRED with the list of detected risks.
Always blocked: process execution, network, registry, P/Invoke, dynamic assembly loading.
Call civil3d_security to inspect the active policy before exports or destructive writes.
License
MIT
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。