Labsco
rishigundakaram logo

CAD-Query MCP Server

โ˜… 14

from rishigundakaram

A server for generating and verifying CAD models using the CAD-Query Python library.

๐Ÿ”ฅ๐Ÿ”ฅ๐Ÿ”ฅโœ“ VerifiedFreeNeeds API keys

CAD-Query MCP Server

A Model Context Protocol (MCP) server that provides CAD generation and verification tools for Claude Code. This server enables conversational 3D modeling by exposing CAD-Query functionality through MCP tools.

Features

  • verify_cad_query - Validates CAD-Query generated models against criteria
  • generate_cad_query - (Stub implementation) Generates CAD-Query Python scripts from descriptions
  • CAD-Query Integration - Full CAD-Query support for parametric 3D modeling
  • STL/STEP Export - Direct export to 3D printing and CAD formats
  • Visual Feedback - SVG generation for model inspection

MCP Tools

verify_cad_query

Validates a CAD-Query generated model against specified criteria.

Parameters:

  • file_path (string): Path to the CAD-Query Python file
  • verification_criteria (string): Description of what to verify

Example:

{
  "file_path": "models/coffee_mug.py",
  "verification_criteria": "coffee mug with handle, 10cm height, 8cm diameter"
}

Returns:

{
  "status": "PASS" | "FAIL",
  "message": "Description of result",
  "file_path": "Path to verified file",
  "criteria": "Verification criteria used",
  "details": "Additional verification details"
}

generate_cad_query (Stub Implementation)

Generates CAD-Query Python scripts from natural language descriptions.

NOTE: Currently returns a stub response indicating the feature is not yet implemented.

Parameters:

  • description (string): Natural language description of the desired 3D model
  • parameters (string, optional): Specific dimensions or constraints

Example:

{
  "description": "Create a coffee mug with a handle, 10cm tall and 8cm diameter",
  "parameters": "height=100mm, diameter=80mm, handle_width=15mm"
}

Returns:

{
  "status": "NOT_IMPLEMENTED",
  "message": "CAD code generation is not yet implemented",
  "description": "Input description",
  "parameters": "Input parameters",
  "details": "Additional information"
}

Development

Testing

# Test server functionality
uv run python tests/test_server.py

# Interactive testing with MCP Inspector
uv run mcp dev server.py

# Run evaluations
uv run python evaluations/evaluate_verify.py

Extending the Server

The current verify_cad_query implementation is a basic validator. You can enhance it to:

  • Parse and validate CAD-Query syntax
  • Execute model generation and catch errors
  • Analyze resulting geometry dimensions
  • Check for specific features and constraints
  • Generate detailed validation reports

Dev tools

# formatting
uvx rff format
# running the MCP server
npx @modelcontextprotocol/inspector \
  uv \
  --directory $(pwd) \
  run \
  server.py