TopoSpatial-CAD MCP
Provides semantic and topology-aware CAD intelligence for AutoCAD, enabling analysis of spatial relationships, architectural ontology tagging, drawing and entity management, block/layer operations, file handling, and safe preview/apply transactions directly on DWG drawings.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@TopoSpatial-CAD MCPFind rooms without direct corridor access"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
TopoSpatial-CAD MCP
Spatial Topology Engine, Architectural Ontology & Autonomous CAD Intelligence via Model Context Protocol (MCP)
Executive Overview
Standard CAD automation interfaces treat drawings as collections of disconnected, "dumb" coordinate geometry: lines, polylines, arcs, and blocks. When a Large Language Model (LLM) interacts with raw CAD data, it is forced to guess relationships from coordinate soup (Polyline handle 274, Line handle 281, Block at x=5230, y=3120).
TopoSpatial-CAD MCP transforms AutoCAD, ZWCAD, GstarCAD, and BricsCAD into a semantically structured, topology-aware architectural model for autonomous AI agents and assistants (Claude Desktop, Cursor, VS Code).
Instead of an LLM perceiving:
"Four polylines + one block + two lines"
TopoSpatial-CAD MCP constructs a rich spatial knowledge graph:
Bedroom-01 (20 m² clear interior usable area) contains Door-03 and Window-02.
Bedroom-01 is topologically adjacent to Corridor-01.
Door-03 connects Bedroom-01 directly to Corridor-01.
┌────────────────────────────────────────────────────────┐
│ AI ARCHITECTURE AGENT │
│ (Semantic & Spatial Reasoning) │
└───────────────────────────┬────────────────────────────┘
│
┌───────────────┴───────────────┐
▼ ▼
┌───────────────────┐ ┌───────────────────┐
│ Spatial Topology │ │ Architectural │
│ (TopologicPy) │ │ Ontology (JSON-LD)│
└─────────┬─────────┘ └─────────┬─────────┘
└───────────────┬───────────────┘
▼
┌─────────────────────────┐
│ TopoSpatial Engine Core │
│ (Transaction Validation)│
└────────────┬────────────┘
▼
┌─────────────────────────┐
│ AutoCAD / ZWCAD COM │
│ (DWG + XData Persistence│
└─────────────────────────┘Related MCP server: multiCAD-mcp
Core Architectural Innovations
"TopoSpatial-CAD MCP gives AI hands.
TopologicPy gives it spatial understanding.
The ontology gives it architectural vocabulary.
JSON-LD gives it structured memory.
Preview / Apply gives it safety."1. Topology vs. Ontology: The Dual-Layer Brain
Topology answers: How are objects geometrically related? (Containment, adjacency, connectivity, boundary closure, opening host relationships).
Ontology answers: What are those objects? (
semantic_id = ROOM-BED-004,class = Bedroom,label = Guest Bedroom,host = WALL-019).
This distinction enables high-level architectural reasoning:
"Which bedrooms don't have direct access to a corridor?"
"Which habitable rooms lack exterior window access?"
"Enlarge Bedroom 2 by 600 mm without reducing the corridor width below 1200 mm."
"Find all rooms directly connected to the main entrance lobby."
2. Strict "Do Not Infer Semantic Classes" Rule
To eliminate LLM hallucinations, unannotated enclosed geometric boundaries are treated strictly as candidate rooms (candidate_room_23, area: 13.5m²) until explicitly designated by the architect or an automated design verification workflow.
AutoCAD Drawing Candidate Detection Explicit Classification
┌──────────────┐ ┌─────────────────┐ ┌─────────────────────┐
│ │ ───► │candidate_room_23│ ───► │ semantic_id: BED-01 │
│ │ │area: 13.5 m² │ │ class: Bedroom │
└──────────────┘ └─────────────────┘ └─────────────────────┘3. Persistent DWG XData Storage (TOPOSPATIAL_TOPOLOGY)
Intelligence does not disappear when an LLM chat session ends. Semantic identities, ontology classes, group assignments, and schema versions are embedded directly into CAD entities as native Extended Entity Data (XData).
When you close AutoCAD, restart your computer, and reopen the project tomorrow, Wall-12 is still Wall-12, Door-04 is still Door-04, and Bedroom-02 is still Bedroom-02.
4. Deterministic 5-Stage Transaction Pipeline (analyze → query → preview → apply)
Autonomous agents are never permitted to execute destructive geometry edits directly. All modifications follow a safe, deterministic transaction lifecycle:
LLM Reasoning ──► Analyze DWG ──► Generate Preview & Diff ──► Validate Rules ──► Apply TransactionExample Transaction Preview:
TRANSACTION: TX-72A91
Action: Move Kitchen East Wall +600 mm
Affected Entities: Kitchen-01, Wall-18, Door-07, LivingRoom-01
Dimensional Impact:
- Kitchen clear width: 3600 mm → 4200 mm
- Living Room clear width: 5100 mm → 4500 mm
Warning:
- Door-07 host wall displaced by 600 mm (requires repositioning)
Status: Awaiting Architect Approval5. SHA-256 Drawing Fingerprint & Revision Safety
Every analysis creates a SHA-256 geometric drawing fingerprint (revision = AF84C2...). If an architect manually adjusts a wall in AutoCAD while the AI is reasoning, TopoSpatial-CAD MCP detects the revision mismatch and rejects outdated transactions to prevent geometric corruption.
6. Clear Interior Dimension Contract
In architectural practice, room dimensions always refer to clear interior usable space. TopoSpatial-CAD MCP enforces this contract at the core API level: requesting a 5000 × 4000 mm bedroom automatically calculates wall thickness offsets (e.g. outer footprint 5400 × 4400 mm with 200 mm walls).
7. DWG & JSON-LD as Source of Truth
TopologicPy operates strictly as an on-demand computational layer, ensuring that your underlying project data remains portable and vendor-neutral in standard DWG XData and JSON-LD graphs.
{
"@context": {"top": "http://w3id.org/topologicpy#", "cad": "urn:topospatial:cad#"},
"@id": "room:bedroom-01",
"@type": "arch:Bedroom",
"label": "Master Bedroom",
"clearWidth": 5000,
"clearDepth": 4000,
"containsElement": ["door:01", "window:03"],
"adjacentTo": ["room:corridor-01"]
}Core Capabilities & Tools
TopoSpatial-CAD MCP provides 8 unified tools dispatching 56+ CAD commands:
Tool | Actions / Scope | Description |
|
| 2D room/boundary analysis, door/window detection, topological graph reasoning, and JSON-LD / Turtle ontology generation. |
|
| High-speed parameterized geometric drawing with shorthand parsing support. |
|
| Full block definition, insertion, and dynamic attribute tag read/write. |
|
| Layer state management and filtering. |
|
| Handle-based entity manipulation and property assignments. |
|
| Multi-drawing tab management and export to DWG / DXF / PDF. |
|
| Connection pooling, viewport navigation, and session diagnostics. |
|
| Drawing data extraction with automated Excel multi-sheet reports. |
Installation & Setup
Prerequisites
Windows OS (COM automation)
Python 3.10+
Supported CAD installed: AutoCAD (2018+), ZWCAD (2020+), GstarCAD (2020+), or BricsCAD (21+)
1. Quick Install
# Install uv package manager (if needed)
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
# Clone and setup environment
git clone https://github.com/Nihalmannath/TopoSpatial-CAD-MCP.git
cd TopoSpatial-CAD-MCP
# Sync dependencies
uv sync --dev
uv run python -m pip install --upgrade pywin32To enable the optional TopologicPy spatial topology engine:
uv sync --extra dev --extra topology2. Claude Desktop Integration
Add to %APPDATA%\Claude\claude_desktop_config.json:
{
"mcpServers": {
"topospatial": {
"command": "C:\\path\\to\\TopoSpatial-CAD-MCP\\.venv\\Scripts\\python.exe",
"args": ["C:\\path\\to\\TopoSpatial-CAD-MCP\\src\\server.py"]
}
}
}ReplaceC:\path\to\TopoSpatial-CAD-MCP with your local repository path, ensuring you point directly to .venv\Scripts\python.exe.
Verification & Testing
# Run the test suite (181 tests)
uv run pytest -m "not slow and not integration" tests/unit
# Type checking
uv run mypy --config-file mypy.ini src/server.pyProject Structure
TopoSpatial-CAD-MCP/
├── src/
│ ├── server.py # FastMCP entry point
│ ├── __version__.py # Version & author metadata
│ ├── config.json # Runtime configuration
│ ├── core/ # Interfaces, ConfigManager, Models
│ ├── adapters/ # Mixin-based COM adapter layer
│ ├── mcp_tools/ # Shorthand dispatchers & tool registrations
│ │ └── tools/ # 8 unified MCP tool modules
│ ├── topology_engine/ # Spatial topology, XData schemas, transactions
│ ├── ui/ # UI resources and inspector templates
│ └── web/ # Real-time CAD status dashboard
├── tests/ # 181 unit & integration tests
├── docs/ # Complete architecture & setup documentation
└── mkdocs.yml # Documentation site configurationAuthor & License
Author: Nihal Ahmed Mannath (
nihalmannat@gmail.com)License: Apache License 2.0
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceEnables controlling CAD software (AutoCAD, GstarCAD, ZWCAD) through natural language instructions, allowing users to create and modify drawings without manually operating the CAD interface.497MIT
- AlicenseNot gradedqualityCmaintenanceControls CAD applications (AutoCAD, ZWCAD, etc.) via AI assistants through the Model Context Protocol, enabling drawing, layer management, and automation through natural language or direct tool calls.85Apache 2.0
- AlicenseBqualityBmaintenanceEnables AI agents to automate AutoCAD LT and create DXF files headless, with tools for drawing, entity, layer, block, annotation, PID, and system operations.16MIT
- AlicenseNot gradedqualityBmaintenanceAgent-native 2D drafting and 3D modeling kernel with a JSON op protocol, enabling parametric design, BIM semantics, and MCP server access for geometry generation and verification.1MIT
Related MCP Connectors
DXF and PDF/X-4 for AI agents: structured facts, PNG renders, an interactive in-chat viewer.
Agent-first CAD: editable .kcad.ts source, deterministic review, OpenCASCADE kernel.
AI Agent with Architectural Memory. Impact analysis (free), tests and code from the graph (pro).
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/Nihalmannath/TopoSpatial-CAD-MCP'
If you have feedback or need assistance with the MCP directory API, please join our Discord server