FreeCAD MCP
FreeCAD MCP(模型控制协议)
概述
FreeCAD MCP(模型控制协议)提供了一个简化的接口,用于通过服务器-客户端架构与 FreeCAD 进行交互。这允许用户执行命令并检索有关当前 FreeCAD 文档和场景的信息。
https://github.com/user-attachments/assets/5acafa17-4b5b-4fef-9f6c-617e85357d44
Related MCP server: mcp-freecad
配置
要配置 MCP 服务器,您可以使用 JSON 格式指定服务器设置。以下是示例配置:
{
"mcpServers": {
"freecad": {
"command": "C:\\ProgramData\\anaconda3\\python.exe",
"args": [
"C:\\Users\\USER\\AppData\\Roaming\\FreeCAD\\Mod\\freecad_mcp\\src\\freecad_bridge.py"
]
}
}
}配置详细信息
command :运行 FreeCAD MCP 服务器的 Python 可执行文件的路径。这可能会因操作系统而异:
Windows :通常,它可能看起来像
C:\\ProgramData\\anaconda3\\python.exe或C:\\Python39\\python.exe。Linux :它可以是
/usr/bin/python3或 Python 安装的路径。macOS :通常,它是
/usr/local/bin/python3或 Python 安装的路径。
args :传递给 Python 命令的参数数组。第一个参数应为
freecad_bridge.py脚本的路径,该脚本负责处理 MCP 服务器逻辑。请务必根据您的安装情况调整路径。
不同操作系统的示例
视窗
{
"mcpServers": {
"freecad": {
"command": "C:\\ProgramData\\anaconda3\\python.exe",
"args": [
"C:\\Users\\USER\\AppData\\Roaming\\FreeCAD\\Mod\\freecad_mcp\\src\\freecad_bridge.py"
]
}
}
}Linux
{
"mcpServers": {
"freecad": {
"command": "/usr/bin/python3",
"args": [
"/home/USER/.FreeCAD/Mod/freecad_mcp/src/freecad_bridge.py"
]
}
}
}macOS
{
"mcpServers": {
"freecad": {
"command": "/usr/local/bin/python3",
"args": [
"/Users/USER/Library/Preferences/FreeCAD/Mod/freecad_mcp/src/freecad_bridge.py"
]
}
}
}特征
FreeCAD MCP 目前支持以下功能:
1. get_scene_info
描述:检索有关当前 FreeCAD 文档的综合信息,包括:
文档属性(名称、标签、文件名、对象数量)
详细的对象信息(类型、位置、旋转、形状属性)
草图数据(几何形状、约束)
查看信息(摄像机位置、方向等)
2. run_script
描述:在 FreeCAD 环境中执行任意 Python 代码。这允许用户使用 FreeCAD 的 Python API 执行复杂的操作、创建新对象、修改现有对象以及自动执行任务。
示例用法
要使用 FreeCAD MCP,您可以连接到服务器并发送以下命令:
import socket
import json
# Connect to the FreeCAD MCP server
client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
client.connect(('localhost', 9876))
# Example: Get scene information
command = {
"type": "get_scene_info"
}
client.sendall(json.dumps(command).encode('utf-8'))
# Receive the response
response = client.recv(4096)
print(json.loads(response.decode('utf-8')))
# Example: Run a script
script = """
import FreeCAD
doc = FreeCAD.ActiveDocument
box = doc.addObject("Part::Box", "MyBox")
box.Length = 20
box.Width = 20
box.Height = 20
doc.recompute()
"""
command = {
"type": "run_script",
"params": {
"script": script
}
}
client.sendall(json.dumps(command).encode('utf-8'))
# Receive the response
response = client.recv(4096)
print(json.loads(response.decode('utf-8')))
# Close the connection
client.close()安装
克隆存储库或下载文件。
将
freecad_mcp目录放在您的 FreeCAD 模块目录中:Windows:
%APPDATA%/FreeCAD/Mod/Linux:
~/.FreeCAD/Mod/macOS:
~/Library/Preferences/FreeCAD/Mod/
重新启动 FreeCAD 并从工作台选择器中选择“FreeCAD MCP”工作台。
贡献
欢迎通过提交问题或拉取请求来贡献代码。欢迎您的反馈和贡献!
执照
本项目遵循 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
- AlicenseAqualityBmaintenanceThis repository is a FreeCAD MCP that allows you to control FreeCAD from Claude Desktop.101,886MIT
- AlicenseNot gradedqualityFmaintenanceThis project provides a robust integration between AI assistants and FreeCAD CAD software using the Model Context Protocol (MCP). It allows external applications to interact with FreeCAD through a standardized interface, offering multiple connection methods and specialized tools.24MIT
- AlicenseNot gradedqualityCmaintenanceAn MCP server that enables automation of FreeCAD model creation, macro execution, and view management through a server-client architecture, supporting integration with external AI tools like Claude and Cursor.96MIT
- AlicenseCqualityDmaintenanceAllows AI agents like Claude to create, edit, and query 3D models in FreeCAD through natural language.576MIT
Related MCP Connectors
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
Augments MCP Server - A comprehensive framework documentation provider for Claude Code
MCP server for AI dialogue using various LLM models via AceDataCloud
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/bonninr/freecad_mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server