Logo vun Onshape MCP Server

Onshape MCP Server

Communautéit
hedless

mcp server for interacting with onshape

Editeurhedless
Repositoryonshape-mcp
SproochPython
Forks
72
Stären
158
Disponibel Tools
0
Transporttypstdio
Kategorien
Linken
  • Tools mat KI-Workflows verbannen

    Onshape MCP Server stellt MCP-Funktioune bereit, déi vu kompatibele KI-Clienten a KI-Agente kënne benotzt ginn.

  • 0 disponibel Tools

    Kuckt Iech déi opruffbar Aktiounen hei drënner un, mat Nimm a Beschreiwungen, wa se vum Server geliwwert ginn.

  • Konfiguratioun fir ze kopéieren

    Benotzt d'Installatiounsbeispiller, fir dëse Server an Ärem bevorzugte MCP-Client ze konfiguréieren.

  • Indicateure fir Open Source

    158 Stären an 72 Forks aus dem verlinkte Repository.

Onshape MCP Server

Enhanced Model Context Protocol (MCP) server for programmatic CAD modeling with Onshape.

Features

This MCP server provides comprehensive programmatic access to Onshape's REST API, enabling:

Core Capabilities (45 tools)

  • Document Discovery - Search and list projects, find Part Studios, navigate workspaces
  • Parametric Sketches - Rectangles, circles, lines, and arcs on standard planes
  • Feature Management - Extrude, revolve, thicken, fillet, chamfer, boolean, and pattern features
  • Assembly Management - Create assemblies, add instances, position parts, create mates (fastened, slider, revolute, cylindrical)
  • Assembly Analysis - Interference checking, position verification, face coordinate systems, body details
  • Variable Tables - Read and write Onshape variable tables for parametric designs
  • FeatureScript - Evaluate FeatureScript expressions, get bounding boxes
  • Export - Export Part Studios and Assemblies to STL, STEP, PARASOLID, GLTF, OBJ
  • Part Studio Management - Create and manage Part Studios programmatically

Installation

Prerequisites

  • Python 3.10 or higher
  • Onshape account with API access
  • Onshape API keys (access key and secret key)

Setup

  1. Clone the repository:
bash
git clone https://github.com/hedless/onshape-mcp.git
cd onshape-mcp
  1. Create a virtual environment:
bash
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
  1. Install dependencies:
bash
pip install -e .
  1. Set up environment variables:
bash
export ONSHAPE_ACCESS_KEY="your_access_key"
export ONSHAPE_SECRET_KEY="your_secret_key"

Or create a .env file:

ONSHAPE_ACCESS_KEY=your_access_key
ONSHAPE_SECRET_KEY=your_secret_key

Getting Onshape API Keys

  1. Go to Onshape Developer Portal
  2. Sign in with your Onshape account
  3. Create a new API key
  4. Copy the Access Key and Secret Key

Usage

Running the Server

bash
onshape-mcp

Or directly with Python:

bash
python -m onshape_mcp.server

Configuring with Claude Code

Add to your ~/.claude/mcp.json:

json
{
  "mcpServers": {
    "onshape": {
      "command": "/absolute/path/to/onshape-mcp/venv/bin/python",
      "args": ["-m", "onshape_mcp.server"],
      "env": {
        "ONSHAPE_ACCESS_KEY": "your_access_key_here",
        "ONSHAPE_SECRET_KEY": "your_secret_key_here"
      }
    }
  }
}

Important Notes:

  • Use the absolute path to your virtual environment's Python executable
  • Find your path: cd onshape-mcp && pwd to get the directory path
  • On Windows: Use C:/path/to/onshape-mcp/venv/Scripts/python.exe
  • Replace the API keys with your actual keys from Onshape Developer Portal
  • Restart Claude Code after editing mcp.json

Verify it works: Ask Claude Code: "Can you list my Onshape documents?"

For complete setup instructions, see docs/QUICK_START.md.

Available Tools

Document & Navigation Tools

ToolDescription
list_documentsList documents with filtering and sorting
search_documentsSearch documents by name or description
get_documentGet detailed document information
get_document_summaryGet comprehensive summary with workspaces and elements
find_part_studiosFind Part Studios with optional name filtering
get_elementsGet all elements (Part Studios, Assemblies, BOMs) in a workspace
get_partsGet all parts from a Part Studio
create_documentCreate a new Onshape document
create_part_studioCreate a new Part Studio in a document

Assembly Tools

ToolDescription
create_assemblyCreate a new Assembly in a document
add_assembly_instanceAdd a part or sub-assembly instance to an assembly
get_assemblyGet assembly structure with instances and occurrences
transform_instanceApply a relative transform (inches/degrees). Fails on fixed instances.
set_instance_positionSet absolute position (resets rotation). Fails on fixed instances.
align_instance_to_faceAlign one instance flush against a face of another
create_mate_connectorCreate an explicit mate connector on a face with offsets
create_fastened_mateCreate a rigid (fastened) mate between two instances
create_slider_mateCreate a linear motion mate. First instance slides relative to second.
create_revolute_mateCreate a rotational mate. First instance rotates relative to second.
create_cylindrical_mateCreate a slide+rotate mate. First instance moves relative to second.
delete_featureDelete a feature (mate, mate connector, etc.) from an assembly or Part Studio

Assembly Analysis Tools

ToolDescription
get_assembly_positionsGet positions, sizes, and bounds of all instances (in inches)
get_assembly_featuresGet all features with their state (OK/ERROR/SUPPRESSED)
get_body_detailsGet face IDs, surface types, normals, and origins for all parts
get_face_coordinate_systemQuery the outward-facing coordinate system for a specific face
check_assembly_interferenceCheck for overlapping/interfering parts using bounding box detection

Sketch Tools

ToolDescription
create_sketch_rectangleRectangle with optional variable references for width/height
create_sketch_circleCircle with center point and radius
create_sketch_lineLine from start point to end point
create_sketch_arcArc with center, radius, start angle, and end angle

All sketch tools support plane (Front/Top/Right) and name parameters. Dimensions are in inches.

Feature Tools

ToolDescription
create_extrudeExtrude a sketch with depth, optional variable reference, and operation type
create_thickenThicken a sketch into a solid with optional midplane/opposite direction
create_revolveRevolve a sketch around an axis (X/Y/Z) with angle and operation type
create_filletRound edges by edge IDs with radius (supports variable references)
create_chamferBevel edges by edge IDs with distance (supports variable references)
create_linear_patternRepeat features along an axis (X/Y/Z) with distance and count
create_circular_patternRepeat features around an axis with count and angle spread
create_booleanUnion, subtract, or intersect bodies by deterministic IDs

Variable & Feature Tools

ToolDescription
get_variablesGet all variables from a Part Studio variable table
set_variableSet or update a variable (e.g., "0.75 in")
get_featuresGet all features from a Part Studio

FeatureScript Tools

ToolDescription
eval_featurescriptEvaluate a FeatureScript lambda expression (read-only)
get_bounding_boxGet the tight bounding box of all parts in a Part Studio

Export Tools

ToolDescription
export_part_studioExport to STL, STEP, PARASOLID, GLTF, or OBJ (optional partId filter)
export_assemblyExport to STL, STEP, or GLTF

Architecture

onshape_mcp/
├── api/
│   ├── client.py         # HTTP client with HMAC authentication
│   ├── documents.py      # Document discovery & navigation
│   ├── partstudio.py     # Part Studio management
│   ├── variables.py      # Variable table management
│   ├── assemblies.py     # Assembly lifecycle, mates & features
│   ├── export.py         # Part Studio & Assembly export
│   └── featurescript.py  # FeatureScript evaluation
├── builders/
│   ├── sketch.py         # Sketch builder (rectangle, circle, line, arc, polygon)
│   ├── extrude.py        # Extrude feature builder
│   ├── revolve.py        # Revolve feature builder
│   ├── fillet.py         # Fillet feature builder
│   ├── chamfer.py        # Chamfer feature builder
│   ├── boolean.py        # Boolean operations (union, subtract, intersect)
│   ├── pattern.py        # Linear & circular pattern builders
│   ├── mate.py           # Mate connector & mate builders (face-based)
│   └── thicken.py        # Thicken feature builder
├── analysis/
│   ├── interference.py   # Bounding-box interference detection
│   ├── positioning.py    # Instance position queries & alignment
│   └── face_cs.py        # Face coordinate system queries
├── tools/
│   └── __init__.py       # MCP tool definitions
└── server.py             # Main MCP server (45 tools)

Examples

Example 1: Finding and Working on a Project

python
# Search for your project
documents = await search_documents(query="robot arm", limit=5)

# Get the first matching document
doc_id = documents[0].id

# Get comprehensive summary
summary = await get_document_summary(doc_id)

# Find Part Studios in main workspace
workspace_id = summary['workspaces'][0].id
part_studios = await find_part_studios(doc_id, workspace_id, namePattern="base")

# Now work with the Part Studio
elem_id = part_studios[0].id

Example 2: Creating a Parametric Cabinet

python
# Set variables
await set_variable(doc_id, ws_id, elem_id, "width", "39.5 in")
await set_variable(doc_id, ws_id, elem_id, "depth", "16 in")
await set_variable(doc_id, ws_id, elem_id, "height", "67.125 in")
await set_variable(doc_id, ws_id, elem_id, "wall_thickness", "0.75 in")

# Create side panel sketch
await create_sketch_rectangle(
    doc_id, ws_id, elem_id,
    name="Side Panel",
    plane="Front",
    corner1=[0, 0],
    corner2=[16, 67.125],
    variableWidth="depth",
    variableHeight="height"
)

# Extrude to create side
await create_extrude(
    doc_id, ws_id, elem_id,
    name="Side Extrude",
    sketchFeatureId="<sketch_id>",
    depth=0.75,
    variableDepth="wall_thickness"
)

Development

Running Tests

The project has comprehensive test coverage with 471 unit tests.

bash
# Run all tests
pytest

# Run with coverage
pytest --cov

# Run specific module tests
pytest tests/api/test_documents.py -v

# Use make commands
make test
make test-cov
make coverage-html

For detailed testing documentation, see docs/TESTING.md.

Code Formatting

bash
ruff format .
ruff check .

Documentation

Getting Started

Development & Testing

API & Implementation

Project Analysis & Research

Knowledge Base & Examples

Roadmap

Current Status

  • Document discovery and navigation (10 tools)
  • Sketch creation with rectangles, circles, lines, and arcs
  • Feature tools: extrude, revolve, thicken, fillet, chamfer, boolean, patterns
  • Full assembly management: fastened, slider, revolute, and cylindrical mates with face-based mate connectors
  • Assembly analysis: interference checking, position verification, face coordinate systems
  • Variable table management
  • FeatureScript evaluation and bounding box queries
  • Export to STL, STEP, PARASOLID, GLTF, OBJ
  • 471 comprehensive unit tests
  • Live-tested on multi-part assemblies (25-instance cabinet with 66 features)

In Research

  • Geometry-referenced sketch planes - Create sketches on faces from existing features (see docs/SKETCH_PLANE_REFERENCE_GUIDE.md)
  • Query API investigation - How to programmatically reference geometry
  • Entity ID mapping - Understanding Onshape's internal ID system

Near-Term Priorities

  • Implement create_sketch_on_geometry() for carpentry-correct cabinet assembly
  • Sketch constraints (coincident, parallel, tangent, etc.)
  • Pocket cuts and profiles for joinery (dados, rabbets)

Long-Term Goals

  • Drawing creation
  • Bill of Materials (BOM) generation
  • Advanced constraints and relations
  • Configuration parameter support

Woodworking-Specific Features

  • Joinery library (dado, rabbet, mortise & tenon, dovetail)
  • Standard hardware patterns (shelf pins, drawer slides)
  • Cut list generation
  • Material optimization (sheet layout)
  • Assembly instructions generation

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

MIT License

Acknowledgments

Support

For issues and questions:

Installatioun

TypingMind
{
  "mcpServers": {
    "hedless-onshape-mcp": {
      "command": "onshape-mcp",
      "args": [],
      "env": {
        "ONSHAPE_ACCESS_KEY": "<ONSHAPE_ACCESS_KEY>",
        "ONSHAPE_SECRET_KEY": "<ONSHAPE_SECRET_KEY>"
      }
    }
  }
}

Onshape MCP Server MCP mat verschiddene KI-Modeller benotzen

TypingMind verbënnt MCP-Tools um Niveau vum Aarbechtsberäich. Soubal Onshape MCP Server verbonnen ass, kënnt Dir et mat verschiddene KI-Modeller an TypingMind benotzen, amplaz et fir all Modell separat anzeriichten. Dës MCP-Integratioun leeft lokal iwwer den TypingMind-MCP-Connector op Ärem Apparat.

Ariichtungsuleedung fir de lokale Connector ze benotzen

Benotzt dës Optioun, wann den MCP-Server Zougrëff op lokal Fichieren, Appen oder privat Ressourcen op Ärem Computer brauch.

1

D'MCP-Astellungen opmaachen

Gitt an TypingMind op „Astellungen“, „Erweidert Astellungen“, dann op „Model Context Protocol“ a wielt „Connector ariichten“.

  1. Maacht TypingMind an Ärem Browser op.
  2. Klickt op d'Astellungssymbol.
  3. Gitt op „Erweidert Astellungen“.
  4. Maacht d'Sektioun „Model Context Protocol“ op.
  5. Klickt op „Connector ariichten“ a wielt „Dësen Apparat“.
Ariichtungsbildschierm vum TypingMind-MCP-Connector mat „Dësen Apparat“ ausgewielt
2

De Connector-Befeel ausféieren

Wielt „Dësen Apparat“, kopéiert de Befeel aus TypingMind a féiert en am Terminal aus. Loosst de Prozess lafen, wärend Dir MCP benotzt.

  1. Kopéiert den Ariichtungsbefeel, deen TypingMind uweist.
  2. Maacht Terminal op macOS oder Windows Terminal op Windows op.
  3. Pescht de Befeel an a féiert en aus.
  4. Bestätegt d'Installatioun vum Package, wann den Terminal Iech freet, ob Dir weiderfuere wëllt.
  5. Loosst den Terminal an de Prozess doranner lafen, wärend Dir MCP-Tools benotzt.
3

Onshape MCP Server als Server derbäisetzen

Wann de Connector-Status „Prett“ ass, klickt op „Serveren änneren“ a pescht d'MCP-Serverkonfiguratioun an.

  1. Waart, bis de Connector-Status „Prett“ weist.
  2. Klickt op „Serveren änneren“.
  3. Pescht d'MCP-Serverkonfiguratioun vu Onshape MCP Server an.
  4. Späichert d'Serverlëscht.
  5. Aktualiséiert, wann Dir kontrolléiere wëllt, ob de Connector nach ëmmer prett ass.
MCP-Astellunge vun TypingMind mat aktivem Server an dem Knäppchen „Serveren änneren“
{
  "mcpServers": {
    "hedless-onshape-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "onshape-mcp"
      ]
    }
  }
}
4

D'Verbindung mat verschiddene Modeller benotzen

Späichert d'Serverlëscht, maacht „Plugins“ op an aktivéiert d'MCP-Tools vu Onshape MCP Server. Wielt dann e belibegen ënnerstëtzte KI-Modell an TypingMind a benotzt d'Tools am Chat oder weist se engem KI-Agent zou.

  1. Maacht d'Säit „Plugins“ an TypingMind op.
  2. Aktivéiert d'MCP-Tools vu Onshape MCP Server.
  3. Start e Chat a wielt de KI-Modell, deen Dir benotze wëllt.
  4. Benotzt d'MCP-Tools am Chat oder weist se engem KI-Agent zou.
  5. Wiesselt bei Bedarf op en anere KI-Modell, ouni MCP nei ze verbannen.
TypingMind-Chat mat aktivéierte MCP-Tools an engem ausgewielte KI-Modell
Hëlleft Dir mir bei dëser Aufgab mat Onshape MCP Server?
Onshape MCP Server
Jo. Ech hunn et gelies.
Dat hunn ech mat Onshape MCP Server fonnt.

Heefeg gestallte Froen

Fir wat gëtt de MCP-Server Onshape MCP Server benotzt?

Onshape MCP Server ass e MCP-Server, deen et kompatibele KI-Clienten erlaabt, sech mat externen Tools a Kontext ze verbannen. An TypingMind kënnt Dir dëse MCP-Server eemol derbäisetzen a seng Tools an Ärem KI-Aarbechtsberäich zur Verfügung stellen.

Kann ech Onshape MCP Server MCP mat méi KI-Modeller an TypingMind benotzen?

Jo. TypingMind verbënnt MCP-Tools um Niveau vum Aarbechtsberäich. Sou kënnt Dir Onshape MCP Server mat verschiddene KI-Modeller wéi Claude, ChatGPT, Gemini oder anere Modeller benotzen, déi Dir an TypingMind konfiguréiert hutt, ouni de MCP-Server fir all Modell separat anzeriichten.

Firwat Onshape MCP Server MCP mat TypingMind benotzen?

TypingMind ass eng vun de beschte Benotzeruewerfläche fir LLM-Chat, well et méi KI-Modeller, Prompts, Plugins, KI-Agenten, API-Schlësselen a MCP-Tools an engem Aarbechtsberäich zesummebréngt. Wann Onshape MCP Server verbonnen ass, kënnt Dir seng MCP-Tools mat Äre bevorzugte Modeller benotzen a gläichzäiteg Är Chataarbecht an TypingMind organiséieren.

Wéi verbannen ech Onshape MCP Server MCP mat TypingMind?

Onshape MCP Server leeft iwwer de lokale MCP-Connector vun TypingMind. Dat eegent sech am beschten, wann de MCP-Server Zougrëff op lokal Fichieren, Desktop-Apps, Kommandozeilen-Tools oder privat Ressourcen op Ärem Computer brauch.

Wéi eng Tools stellt Onshape MCP Server MCP an TypingMind zur Verfügung?

Onshape MCP Server stellt MCP-Funktiounen zur Verfügung, déi Dir op der Plugins-Säit vun TypingMind aktivéiere kënnt, fir se am Chat ze benotzen oder KI-Agenten zouzeweisen.

Muss ech meng API-Schlëssele mat TypingMind deelen, fir Onshape MCP Server MCP ze benotzen?

Nee. TypingMind setzt op lokal Veraarbechtung a léisst Iech d'Kontroll iwwer Är Modellubidder, API-Schlësselen, Prompts a MCP-Konfiguratioun. Wann Onshape MCP Server eng Authentifizéierung verlaangt, setzt déi néideg Headeren, OAuth-Astellungen oder lokal Konfiguratioun fir dee MCP-Server derbäi, wann Dir d'Verbindung erstallt.

Änlech MCP-Serveren

All weisen

Elo Ären eegene KI-Workspace ariichten

Abonnéiert Iech op eisen Newsletter, fir iwwer nei Funktiounen an zukünfteg Gewënnspiller informéiert ze ginn 👇