Text2Cad MCP
Text2CAD MCP server. A Python MCP server that is exposing CadQuery to LLMs allowing to generate 3D printable step files
Project Description
Text2CAD: Natural Language Interface for 3D Model Generation
Text2CAD is an MCP (Model Context Protocol) server that enables Large Language Models to generate 3D models from natural language descriptions. It serves as a bridge between conversational AI and parametric CAD, allowing users to create complex 3D printable models through simple text descriptions.
Technical Execution
Functionality
-
MCP Server Implementation: Built using the MCP Python SDK, our server exposes a
generate_cad_modeltool that accepts CADQuery Python scripts and returns 3D models. - Multi-format Output: Supports both STEP file export (for 3D printing/CAD software) and PNG image rendering for preview.
- Robust Error Handling: Implements comprehensive error handling for syntax errors, logical CADQuery errors, and execution timeouts.
- Parametric Modeling: Successfully handles various use cases from simple objects to complex multi-feature models with operations like extrusions, fillets, and boolean operations.
Stability
-
Structured Development: Follows a
srclayout with clear separation of concerns. -
Dependency Management: Uses
uvfor reliable Python environment and package management. - Progressive Implementation: Developed through incremental, well-documented steps with detailed changelogs.
- Error Resilience: Gracefully handles edge cases with informative error messages.
AI Leverage
- LLM-CAD Integration: Enables LLMs to generate executable CADQuery scripts from natural language descriptions.
- Standardized Protocol: Implements the Model Context Protocol to provide a consistent interface for AI tools.
- Feedback Loop: Returns detailed error information that LLMs can use to refine their CAD script generation.
- Visual Feedback: PNG output allows LLMs to verify their generated models visually.
Originality & Impact
- Democratizing CAD: Lowers the barrier to entry for 3D modeling by enabling natural language interfaces.
- Standardized Approach: Provides a reusable component that any MCP-compatible LLM application can leverage.
- Practical Application: Generates industry-standard STEP files ready for 3D printing or further CAD work.
- Proof of Concept: Demonstrates the viability of LLM-driven CAD generation workflows.
Agentic Capabilities
- Autonomous Execution: Independently executes CADQuery scripts in a controlled environment.
- Adaptive Processing: Handles various modeling operations and complexity levels.
- Error Recovery: Provides detailed diagnostic information for script correction.
- Self-contained Operation: Functions as a standalone service that can be integrated into larger AI systems.
Technologies Used
- Python: Core implementation language (≥3.10)
- MCP Python SDK: For Model Context Protocol server implementation
- CADQuery: Parametric 3D CAD library for Python
- CairoSVG: For SVG to PNG conversion
- UV: Modern Python package manager and virtual environment tool
The project demonstrates how standardized protocols like MCP can enable specialized AI capabilities without requiring deep domain expertise in both AI and CAD. By providing this bridge, Text2CAD opens up new possibilities for natural language interfaces to technical domains that traditionally require specialized knowledge.