onshape-mcp
onshape-mcp
OnShape CAD を Claude Code から操作する MCP サーバーです。パラメトリックモデリング(スケッチ、押し出し、回転、フィレット、パターン)、FeatureScript クエリ、STL のエクスポート/検証を、OnShape REST API 経由で行います。
初回セットアップ
uv sync --no-editable
uv run --no-editable onshape-mcp setup # writes ~/.config/onshape-mcp/.env (chmod 600); no-op if it exists
uv run --no-editable onshape-mcp doctor # auth smoke test against the live API (4 calls)なぜどこでも
--no-editableを使うのか? macOS は.venv配下のファイルにhiddenフラグを非同期に付けることがあります。Python ≥3.13.8 は隠しファイルの.pthをスキップするため、editable インストールは同期の数分後に静かにインポートされなくなります。非 editable インストールは.pthを使わないため、影響を受けません。
Related MCP server: MCP 3D Printer Server
認証情報
API キーは https://dev-portal.onshape.com/keys から取得します(アクセスキーとシークレットキーのペア)。認証情報が置かれるのは ~/.config/onshape-mcp/.env のみです。これは onshape-mcp setup が権限 600(所有者のみ読み書き可)で作成します。プロジェクトフォルダに置かれることはなく、コミットも画面表示もされません。変数名は .env.example を参照してください。ファイルと環境変数(ONSHAPE_ACCESS_KEY / ONSHAPE_SECRET_KEY)の両方がある場合は、環境変数が優先されます。
プロジェクト単位の登録
サーバーを利用したい CAD プロジェクトフォルダから、次のように実行してください(/path/to/onshape-mcp は、クローンしたリポジトリの場所に置き換えてください)。
/path/to/onshape-mcp/install.shまたは、次と同等の方法でも構いません:
claude mcp add --scope project onshape -- \
uv run --quiet --no-editable --project /path/to/onshape-mcp onshape-mcpあるいは、プロジェクトの .mcp.json に手動で登録します:
{
"mcpServers": {
"onshape": {
"command": "uv",
"args": ["run", "--quiet", "--no-editable", "--project", "/path/to/onshape-mcp", "onshape-mcp"]
}
}
}(--project であり、--directory ではありません。サーバーはこのリポジトリの venv を解決しますが、呼び出し元の cwd は維持されます。したがって、ファイルパスを渡すツールのパラメータは常に絶対パスにしてください。)
プロジェクトスコープのサーバーは、最初の対話セッションで "Pending approval" と表示されます。プロンプトが表示されたら承認してください。
ツールを操作する LLM 向けチートシート
典型的なビルドの流れ
create_document (parentId = folder id) -> documentId, workspaceId, partStudioElementId
import_cad (ABSOLUTE path to .zip/STEP) -> foreign CAD into an existing workspace [async, +quota]
set_variable (optional, e.g. wall_thk) -> use "#wall_thk" in later expressions
create_sketch (plane {"default":"TOP"}) -> featureId [one closed profile per sketch]
extrude (sketchFeatureId, NEW, depth) -> base solid
create_sketch + extrude REMOVE THROUGH_ALL [holes: skip native hole feature]
find_entities (EDGE, radiusBetween) -> transient ids for fillet/chamfer
fillet_or_chamfer (entityIds) -> check featureStatus == OK after EVERY feature
pattern / revolve / boolean_parts as needed
export_stl (ABSOLUTE path) -> compare_stl(candidate, reference) [mesh: 3D-print, verify]
export_step (ABSOLUTE path) -> editable STEP B-rep solid [CAD/prototyping; async, +quota]鉄則
一時 ID は、どのような変更後も無効になります。 ID を消費するツールの直前に、必ず
find_entitiesを呼び出してください。フィーチャー ID(create_sketch/extrudeなどの戻り値)は安定しているので、受け付けられる場所(押し出し領域、パターンのシード、ブーリアン演算のボディ)ではそちらを優先してください。単位: ツールのパラメータと出力はデフォルトでインチです(
unitsパラメータで変更可能)。寸法の文字列はそのまま通ります:"1.53 in"、"25 mm"、"#wall_thk * 2"。角度は度です。eval_featurescriptの生の結果はメートル/ラジアンです。featureStatusは再生成フィードバックループです。OKなら先へ進んでください。ERRORはフィーチャーが追加されたものの失敗したことを意味します。update_featureまたはdelete_featureでパラメータを修正して再試行してください。モデリング呼び出しのたびに確認します。extrudeの REMOVE は、スタジオ内の全てのソリッドから除去されます(defaultScope)。意図しない限り、1つのスタジオには1点だけを置いてください。スケッチごとに閉じたプロファイルを 1 つだけにすると、押し出し領域の選択が明確になります。
ファイルパスは必ず ABSOLUTE(絶対パス)にしてください(サーバーの cwd はプロジェクトの cwd ではありません)。
節約する: API コール数は年間約 2,500 回です。ポーリングや不要な再一覧は避けてください。
analyze_stl/compare_stlはコール数を消費しません。
クォータに関する警告
OnShape の EDU/無料アカウントには年間 API クォータ(ユーザーあたり年間約 2,500 回)があります。使い切ると 402 が返り、バックオフでは解決できません。このサーバーは ~/.config/onshape-mcp/call_log に永続的なコールカウンタを保持し、累計数を stderr に記録します。利用状況は OnShape のマイアカウント → 開発者 で確認できます。
開発
uv run --no-editable pytest # offline tests (no API calls, no credentials needed)
uv run --no-editable onshape-mcp doctorライセンス
MIT — LICENSE
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
- FlicenseAqualityDmaintenanceEnables programmatic CAD modeling with Onshape's REST API, offering 45 tools for parametric sketches, feature management, assemblies, analysis, variables, and exports.45126
- AlicenseNot gradedqualityDmaintenanceEnables users to connect Claude with various 3D printer management systems, allowing tasks like printer status monitoring, file management, print job control, and STL file manipulation.103GPL 2.0
- AlicenseBqualityCmaintenanceEnables Claude to drive Rhino 8 and Grasshopper for geometry creation, manipulation, and analysis via natural language.1003MIT
- AlicenseNot gradedqualityDmaintenanceEnables Claude to create 3D-printable CAD models using build123d, with tools for modeling, modification, analysis, and publishing to platforms like Thingiverse and GitHub.11Creative Commons Attribution Non Commercial No Derivatives 4.0 International
Related MCP Connectors
WHOOP recovery, strain, sleep and workouts in Claude via official WHOOP OAuth. Free, open source.
Read, edit, publish, and preview your pepita websites from Claude.
Connect Claude to Fathom meeting recordings, transcripts, and summaries
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/kyle-nelson-berkeley/onshape-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server