Skip to main content
Glama

Fusion 360 MCP 服务器

模型上下文协议 (MCP) 服务器,用于连接 Cline 和 Autodesk Fusion 360。该服务器将 Fusion 360 工具栏级命令公开为可调用工具,可直接映射到 Fusion 的 API。

🧠 概述

该项目允许 Cline:

  • 解析自然语言提示(例如,“制作一个圆角的盒子”)

  • 将它们解析为 Fusion 工具操作(例如,CreateSketch → DrawRectangle → Extrude → Fillet)

  • 通过这个 MCP 服务器调用这些工具

  • 返回可以在 Fusion 360 中执行的 Python 脚本

Related MCP server: MCP Atlassian Server

🛠️ 安装

先决条件

  • Python 3.9 或更高版本

  • Autodesk Fusion 360

设置

  1. 克隆此存储库:

    git clone https://github.com/yourusername/fusion360-mcp-server.git cd fusion360-mcp-server
  2. 安装依赖项:

    pip install -r requirements.txt

🚀 使用方法

运行 HTTP 服务器

cd src python main.py

这将在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 体

  • 旋转:围绕轴旋转轮廓

调整

  • 圆角:向选定的边缘添加圆角

  • 倒角:为选定的边缘添加倒角

  • :挖空具有指定壁厚的实体

  • 合并:使用布尔运算合并两个物体

出口

  • ExportBody :将主体导出到文件

🔌 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 :工具的名称

  • 描述:该工具的作用

  • 参数:该工具接受的参数

  • docs :链接到相关的 Fusion API 文档

工具定义示例:

{ "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()))

🧪 扩展服务器

添加新工具

  1. src/tool_registry.json添加新的工具定义

  2. src/script_generator.py中的SCRIPT_TEMPLATES添加脚本模板

  3. src/script_generator.py中的_process_parameters中添加参数处理逻辑

📚 文档链接

🔄 未来的增强功能

  • 上下文感知操作的会话状态跟踪

  • 动态工具注册

  • 通过套接字或文件轮询实现自动化

  • 更多 Fusion 命令

📄 许可证

该项目根据 MIT 许可证获得许可 - 有关详细信息,请参阅 LICENSE 文件。

-
security - not tested
A
license - permissive license
-
quality - not tested

Latest Blog Posts

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/ArchimedesCrypto/fusion360-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server