The fastest way to use this server is with Claude Code - an AI assistant that can design CAD models through natural conversation.
git clone https://github.com/hedless/onshape-mcp.git
cd onshape-mcp
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -e ".[dev]"- Go to Onshape Developer Portal
- Sign in with your Onshape account
- Create a new API key
- Copy the Access Key and Secret Key
Add this to your ~/.claude/mcp.json file:
{
"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: Replace /absolute/path/to/onshape-mcp with the actual full path. To find it:
cd onshape-mcp
pwd # Copy this pathOn Windows, the command path would be:
"C:/path/to/onshape-mcp/venv/Scripts/python.exe"
After saving mcp.json, restart Claude Code for the changes to take effect.
In Claude Code, try asking:
"Can you list my Onshape documents?"
If successful, Claude Code will show your Onshape projects!
pytest
# Should show: 93 passed in ~2s ✅Once configured, just talk to Claude Code naturally! Here are examples:
You say:
"Search for my robot arm project"
Claude Code will:
- Use
search_documentsto find projects matching "robot arm" - Show you the results with document IDs
- Ask which one you want to work with
You say:
"Show me what's inside document abc123"
Claude Code will:
- Use
get_document_summaryto get the overview - List all workspaces and Part Studios
- Help you identify which elements to work with
You say:
"Create a 10x5x3 inch parametric box in my project"
Claude Code will:
- Search for your project
- Find the appropriate Part Studio
- Create variables for width, height, depth
- Create a rectangular sketch
- Extrude it to the specified depth
- Link everything to the variables
You say:
"In my cabinet project, change the width variable to 48 inches"
Claude Code will:
- Search for the cabinet project
- Find the Part Studio with the width variable
- Update the variable using
set_variable - Confirm the change
You: "I need to create a simple box in my 'Test Parts' document.
Make it 10 inches wide, 5 inches tall, and 3 inches deep."
Claude: I'll help you create that box. Let me find your Test Parts document...
[Uses search_documents, find_part_studios]
I found your document. Now I'll create the parametric box...
[Creates variables, sketch, and extrude]
Done! Created a 10"x5"x3" parametric box with variables
for easy adjustment.
You: "Find my robot arm project and show me all the variables"
Claude: Let me search for that...
[Uses search_documents]
Found "Robot Arm v2". Here are the current variables:
- base_diameter: 4 in
- arm_length: 12 in
- joint_radius: 0.5 in
- wall_thickness: 0.25 in
You: "Change the arm length to 15 inches"
Claude: Updated arm_length to 15 in. The model will regenerate
with the new dimension.
| Tool | Purpose | Key Parameters |
|---|---|---|
list_documents |
List all documents | filterType, sortBy, limit |
search_documents |
Search by name | query, limit |
get_document |
Get document details | documentId |
get_document_summary |
Full document overview | documentId |
find_part_studios |
Find Part Studios | documentId, workspaceId, namePattern |
| Tool | Purpose | Key Parameters |
|---|---|---|
create_sketch_rectangle |
Create rectangular sketch | corner1, corner2, variables |
create_extrude |
Extrude sketch | sketchFeatureId, depth |
get_variables |
List variables | documentId, workspaceId, elementId |
set_variable |
Set/update variable | name, expression |
get_features |
List all features | documentId, workspaceId, elementId |
You say: "I want to create a new part in my project"
Claude Code does:
- Searches/lists your documents
- Gets workspace and Part Studio info
- Creates variables for your dimensions
- Creates sketches
- Adds extrudes
- Links features to variables
You say: "Show me my cabinet project parameters"
Claude Code does:
- Searches for "cabinet" in your documents
- Gets the document summary
- Finds Part Studios
- Lists all variables and their values
- Shows existing features
You say: "Change the cabinet width to 48 inches"
Claude Code does:
- Finds your cabinet project
- Locates the Part Studio
- Reviews current variable values
- Updates the width variable
- Confirms the change
# Run all tests (93 tests)
pytest
# Run with coverage
pytest --cov
# Run specific module
pytest tests/api/test_documents.py -v
# Quick test (no coverage)
pytest --no-cov- DOCUMENT_DISCOVERY.md - Document discovery feature guide
- TESTING.md - Complete testing guide
- README.md - Full project documentation
- FEATURE_SUMMARY.md - Implementation details
# Install dev dependencies
pip install -e ".[dev]"
# Format code
make format
# Run linter
make lint
# Run all checks
make check-all
# Clean build artifacts
make clean- Be specific - "Find my robot arm project" is better than "find project"
- Use project names - Claude remembers document IDs during the conversation
- Ask to see first - "Show me the variables" before asking to change them
- Natural language - No need to know API details, just describe what you want
- Use async/await - All API calls are async
- Handle errors - Not all documents may be accessible
- Test thoroughly - Run tests after changes
- Follow patterns - Look at existing code for examples
- Create .env file - Keep credentials secure when running standalone
- Test connection - Run
list_documentsto verify API access - Start simple - Try search and summary first
- Use examples - Follow the workflow examples above
- Ask: "List my Onshape documents"
- Ask: "Search for [project name]"
- Ask: "Show me what's in that document"
- Ask: "Create a simple box 10x5x3 inches"
- Ask: "Show me the variables in my project"
- Ask: "Change the width to 12 inches"
- Design complete parametric assemblies through conversation
- Modify multiple parameters at once
- Create complex multi-part designs
- Check
~/.claude/mcp.jsonexists and is valid JSON - Verify the Python path is absolute (use
pwdin the project directory) - Restart Claude Code after editing
mcp.json - Check credentials are in
mcp.json, not.env
- Verify API credentials in
~/.claude/mcp.json - Check your Onshape account has documents
- Ask Claude: "List all my documents" to see everything
- Use partial names: "robot" instead of "robot arm assembly v2"
- Search is case-insensitive
- Try asking: "List my documents" to browse instead
- Don't manually copy IDs - let Claude find them
- Ask Claude to search and navigate for you
- If stuck, ask: "Show me the document summary"
- Make sure you activated the virtual environment
- Run
pip install -e ".[dev]"again - Check Python version:
python --version(needs 3.10+)
- 10 MCP Tools - Full CAD and discovery capabilities
- 93 Unit Tests - Comprehensive test coverage
- ~2 second test execution - Fast feedback
- 5 API modules - Well-organized codebase
Ready to go! Open Claude Code and ask: "Can you list my Onshape documents?" 🚀
If you want to use the server directly without Claude Code:
- Create
.envfile:
ONSHAPE_ACCESS_KEY=your_access_key
ONSHAPE_SECRET_KEY=your_secret_key- Run the server:
onshape-mcpNote: This is for developers integrating the MCP server into their own tools. Most users should use Claude Code instead.