Fusion 360 MCP サーバー
Cline と Autodesk Fusion 360 間のインターフェイスとなるモデル コンテキスト プロトコル (MCP) サーバー。このサーバーは、Fusion 360 ツールバー レベルのコマンドを、Fusion の API に直接マップされる呼び出し可能なツールとして公開します。
🧠 概要
このプロジェクトにより、Cline は次のことが可能になります。
自然言語プロンプトを解析する(例:「角の丸いボックスを作成してください」)
これらをFusionツールのアクションに解決します(例:CreateSketch → DrawRectangle → Extrude → Fillet)
これらのツールをこのMCPサーバー経由で呼び出します
Fusion 360で実行できるPythonスクリプトを返す
Related MCP server: MCP Atlassian Server
🛠️ インストール
前提条件
Python 3.9以上
オートデスク Fusion 360
設定
このリポジトリをクローンします:
git clone https://github.com/yourusername/fusion360-mcp-server.git
cd fusion360-mcp-server
依存関係をインストールします:
pip install -r requirements.txt
🚀 使用方法
HTTPサーバーの実行
これにより、 http://127.0.0.1:8000で FastAPI サーバーが起動します。
MCP サーバーとして実行
cd src
python main.py --mcp
これにより、サーバーが MCP モードで起動され、stdin から読み取り、stdout に書き込みます。
APIエンドポイント
GET / : サーバーが稼働しているかどうかを確認する
GET /tools : 利用可能なすべてのツールを一覧表示する
POST /call_tool : 単一のツールを呼び出してスクリプトを生成する
POST /call_tools : 複数のツールを順番に呼び出してスクリプトを生成する
API呼び出しの例
リストツール
curl -X GET http://127.0.0.1:8000/tools
単一のツールを呼び出す
curl -X POST http://127.0.0.1:8000/call_tool \
-H "Content-Type: application/json" \
-d '{
"tool_name": "CreateSketch",
"parameters": {
"plane": "xy"
}
}'
複数のツールを呼び出す
curl -X POST http://127.0.0.1:8000/call_tools \
-H "Content-Type: application/json" \
-d '{
"tool_calls": [
{
"tool_name": "CreateSketch",
"parameters": {
"plane": "xy"
}
},
{
"tool_name": "DrawRectangle",
"parameters": {
"width": 10,
"depth": 10
}
},
{
"tool_name": "Extrude",
"parameters": {
"height": 5
}
}
]
}'
📦 利用可能なツール
サーバーは現在、次の Fusion 360 ツールをサポートしています。
作成する
CreateSketch : 指定された平面上に新しいスケッチを作成します
DrawRectangle : アクティブなスケッチに長方形を描画します
DrawCircle : アクティブなスケッチに円を描きます
押し出し: プロファイルを 3D ボディに押し出します
回転: 軸を中心にプロファイルを回転します
修正する
フィレット: 選択したエッジにフィレットを追加します
面取り: 選択したエッジに面取りを追加します
シェル: 指定された壁厚のソリッドボディをくり抜きます
結合: ブール演算を使用して2つのボディを結合します
輸出
🔌 MCP統合
このサーバーを Cline で使用するには、MCP 設定構成ファイルに追加します。
{
"mcpServers": {
"fusion360": {
"command": "python",
"args": ["/path/to/fusion360-mcp-server/src/main.py", "--mcp"],
"env": {},
"disabled": false,
"autoApprove": []
}
}
}
🧩 ツールレジストリ
ツールはsrc/tool_registry.jsonで定義されます。各ツールには以下のものが含まれます。
ツール定義の例:
{
"name": "Extrude",
"description": "Extrudes a profile into a 3D body.",
"parameters": {
"profile_index": {
"type": "integer",
"description": "Index of the profile to extrude.",
"default": 0
},
"height": {
"type": "number",
"description": "Height of the extrusion in mm."
},
"operation": {
"type": "string",
"description": "The operation type (e.g., 'new', 'join', 'cut', 'intersect').",
"default": "new"
}
},
"docs": "https://help.autodesk.com/view/fusion360/ENU/?guid=GUID-6D381FCD-22AB-4F08-B4BB-5D3A130189AC"
}
📝 スクリプト生成
サーバーはツール呼び出しに基づいてFusion 360 Pythonスクリプトを生成します。これらのスクリプトはFusion 360のスクリプトエディタで実行できます。
生成されたスクリプトの例:
import adsk.core, adsk.fusion, traceback
def run(context):
ui = None
try:
app = adsk.core.Application.get()
ui = app.userInterface
design = app.activeProduct
# Get the active component in the design
component = design.rootComponent
# Create a new sketch on the xy plane
sketches = component.sketches
xyPlane = component.xYConstructionPlane
sketch = sketches.add(xyPlane)
# Draw a rectangle
rectangle = sketch.sketchCurves.sketchLines.addTwoPointRectangle(
adsk.core.Point3D.create(0, 0, 0),
adsk.core.Point3D.create(10, 10, 0)
)
# Extrude the profile
prof = sketch.profiles.item(0)
extrudes = component.features.extrudeFeatures
extInput = extrudes.createInput(prof, adsk.fusion.FeatureOperations.NewBodyFeatureOperation)
distance = adsk.core.ValueInput.createByReal(5)
extInput.setDistanceExtent(False, distance)
extrude = extrudes.add(extInput)
ui.messageBox('Operation completed successfully')
except:
if ui:
ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))
🧪 サーバーの拡張
新しいツールの追加
src/tool_registry.jsonに新しいツール定義を追加します。
src/script_generator.pyのSCRIPT_TEMPLATESにスクリプト テンプレートを追加します。
src/script_generator.pyの_process_parametersにパラメータ処理ロジックを追加します。
📚 ドキュメントリンク
🔄今後の機能強化
コンテキスト認識操作のためのセッション状態追跡
動的ツール登録
ソケットまたはファイルポーリングによる自動化
その他のFusionコマンド
📄 ライセンス
このプロジェクトは MIT ライセンスに基づいてライセンスされています - 詳細については LICENSE ファイルを参照してください。