关于 Fusion 360 MCP Server
这是一个连接 Cline 与 Autodesk Fusion 360 的 MCP 服务,将 Fusion 360 工具栏级命令暴露为可调用工具。适合希望通过自然语言生成三维建模操作脚本的用户。服务会返回可在 Fusion 360 脚本编辑器中执行的 Python 脚本。
主要功能
- 01创建草图、矩形与圆形绘制
- 02拉伸与旋转生成三维实体
- 03圆角、倒角、抽壳与布尔组合
- 04导出实体
- 05生成可在 Fusion 360 中执行的 Python 脚本
适用场景
- 01通过自然语言生成带圆角的简单实体模型
- 02按顺序组合多个建模工具生成脚本
- 03在 Cline 中辅助 Fusion 360 建模
MCP 相关
该项目是一个 MCP 服务,向 Cline 等 MCP 客户端暴露 Fusion 360 建模工具。调用结果为 Python 脚本,需在 Fusion 360 中手动执行。
配置
本地服务的配置在各客户端中通用,复制后粘贴到客户端的 MCP 配置文件即可。
我们还没有获取到这个服务的安装包或远程地址,请按项目 README 中的说明安装。
工具
本地服务需要在你的电脑上运行后才能读取工具,维护者暂未提供工具列表。
详细介绍
Fusion 360 MCP 服务
一个 Model Context Protocol(MCP)服务,用于连接 Cline 和 Autodesk Fusion 360。此服务将 Fusion 360 工具栏级别的命令作为可调用工具公开,这些工具直接映射到 Fusion 的 API。
🧠 概述
此项目允许 Cline:
- 解析自然语言提示词(例如,“创建一个圆角长方体”)
- 将其转换为 Fusion 工具操作(例如,CreateSketch → DrawRectangle → Extrude → Fillet)
- 通过此 MCP 服务调用这些工具
- 返回可在 Fusion 360 中执行的 Python 脚本
🛠️ 安装
前置条件
- Python 3.9 或更高版本
- Autodesk Fusion 360
设置
-
克隆此仓库:
git clone https://github.com/yourusername/fusion360-mcp-server.git cd fusion360-mcp-server -
安装依赖项:
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 模式启动服务,从标准输入读取内容并写入标准输出。
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:在活动草图中绘制圆形
- Extrude:将轮廓拉伸为 3D 实体
- Revolve:围绕轴旋转轮廓
修改
- Fillet:为选定边添加圆角
- Chamfer:为选定边添加倒角
- Shell:以指定壁厚将实体挖空
- Combine:使用布尔运算合并两个实体
导出
- 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:工具名称
- description:工具的功能
- parameters:工具接受的参数
- 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()))
🧪 扩展服务
添加新工具
- 在
src/tool_registry.json中添加新的工具定义 - 在
src/script_generator.py的SCRIPT_TEMPLATES中添加脚本模板 - 在
src/script_generator.py的_process_parameters中添加参数处理逻辑
📚 文档链接
🔄 后续改进
- 支持会话状态跟踪,以执行上下文感知操作
- 动态工具注册
- 通过套接字或文件轮询实现自动化
- 增加更多 Fusion 命令
📄 许可证
此项目根据 MIT 许可证授权,详情请参阅 LICENSE 文件。
评论
一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。
