CAD-LLM驱动的三维几何操作MCP服务器
MCP(模型上下文协议)类型服务器的本地首个开源MVP,使用云LLM(通过Groq运行Llama 3.3的免费API)将自然语言用户命令转换为模拟CAD引擎的结构化几何操作。
先决条件
- Python 3.9+
- A. 免费Groq API密钥 --得到一个在 https://console.groq.com/keys
设置
- 安装项目依赖项:
cd mcp-cad-server
pip3 install -r requirements.txt- 使用Groq密钥启动FastAPI后端服务器:
export GROQ_API_KEY='your-groq-api-key-here'
python3 -m uvicorn app.main:app --reload*服务器默认运行在 http://localhost:8000.*
建筑
- 格罗克云API:使用Llama 3.3 70B进行自由LLM推理。
- FastAPI/MCP服务器:编排接收用户提示、为LLM格式化、安全解析JSON输出和委派指令。
- 模拟CAD引擎:基于结构化命令的模拟几何状态处理尺寸和体积输出。
通过CLI进行测试
您可以通过以下方式轻松地与正在运行的CAD Server交互 test_cli.py:
python3 test_cli.py "Increase hole diameter by 5mm"预期JSON响应:
{
"status": "success",
"message": "Successfully modified hole to 5.0mm.",
"data": {
"feature": "hole",
"new_value": 5.0,
"unit": "mm"
}
}更多示例:
python3 test_cli.py "Create a sphere"
python3 test_cli.py "Extrude the top face by 50mm"
python3 test_cli.py "What is the volume?"支持的模拟CAD功能
create_shape(shape_type,尺寸)--生成长方体、球体、圆柱体、圆锥体或圆环体modify_dimension(特征、价值、单位)extrude(面、距离、单位)get_volume(单位)
