用于步骤分析的MCP服务器
🎯 概述
用于分析和比较STEP文件的MCP(模型上下文协议)服务器(ISO 10303)。与Claude Desktop和其他MCP客户端兼容。
优势 :直接分析附加到Claude Desktop的STEP文件,无需路径!
✨ 功能
服务器通过MCP协议公开6种工具:
1. analyze_step_file
STEP文件的完整分析:元数据、结构和几何体
- 设置 :
- file_path (可选):步骤文件的路径 - file_content (可选):附件的二进制内容
- 归来 :元数据、分层BOM、详细组件、几何属性、依赖项、验证
2. compare_step_files
比较两个STEP文件并检测关键差异,包括接口
- 设置 :
- file1_path (可选):第一步文件的路径 - file1_content (可选):第一个文件的二进制内容 - file2_path (可选):第二步文件的路径 - file2_content (可选):第二个文件的二进制内容
- 归来 :影响分析(碰撞、装配、接口)、变化(BOM、几何、拓扑、接口)、统计
3. extract_bom
仅提取物料清单(Bill of Materials)
- 设置 :
- file_path (可选):步骤文件的路径 - file_content (可选):附件的二进制内容
- 归来 :具有位置、级别、数量、名称和类型的组件分层列表
4. extract_geometry
提取详细的几何属性
- 设置 :
- file_path (可选):步骤文件的路径 - file_content (可选):附件的二进制内容 - component_name (可选):特定组件的名称
- 归来 :按组件和总计划分的几何和拓扑属性
5. validate_step_file
验证STEP文件是否符合行业标准
- 设置 :
- file_path (可选):步骤文件的路径 - file_content (可选):附件的二进制内容
- 归来 :总体状态和验证详细信息
6. analyze_interfaces
分析配置管理组件之间的接口和链接
- 设置 :
- file_path (可选):步骤文件的路径 - file_content (可选):附件的二进制内容
- 归来 :检测到的接口(螺钉、触点、接近度)、临界点、装配图、建议
检测到的接口类型 :
- 固定(紧固) :对齐孔→螺钉/螺栓(高临界)
- 联系人(Contact) :接触表面→嵌入(平均临界)
- Proximité(邻近) :接近组件(低临界性)
🚀 安装
选项1:使用Docker(推荐)
先决条件
- Docker和Docker编写安装程序
- Claude桌面配置
配置
要从Claude Desktop访问STEP文件,您需要组合两个MCP服务器:
- 阶跃分析器 :用于分析STEP文件
- 文件系统 :用于从Claude桌面访问文件
创建/修改MCP配置文件:
macOS/Linux (~/.config/Claude/claude_desktop_config.json) :
{
"mcpServers": {
"step-analyzer": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"--mount", "type=bind,src=/Chemin/Vers/Dossier/Step,dst=/step",
"jchabas/mcp_stepanalyzer:0.0.3"
]
},
"filesystem": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"--mount", "type=bind,src=/Chemin/Vers/Dossier/Step,dst=/step",
"mcp/filesystem",
"/step"
]
}
}
}
视窗 (%APPDATA%\Claude\claude_desktop_config.json) :
{
"mcpServers": {
"step-analyzer": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"--mount", "type=bind,src=C:/Chemin/Vers/Dossier/Step,dst=/step",
"jchabas/mcp_stepanalyzer:0.0.3"
]
},
"filesystem": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"--mount", "type=bind,src=C:/Chemin/Vers/Dossier/Step,dst=/step",
"mcp/filesystem",
"/step"
]
}
}
}
重要 替换: /chemin/vers/vos/fichiers/step 通过包含STEP文件的文件夹的实际路径。
与Claude Desktop一起使用
- 放置您的STEP文件 在配置的文件夹中(例如:
/chemin/vers/vos/fichiers/step/) - 问问克劳德 要列出可用文件:
Quels fichiers STEP sont disponibles ?- 请求分析 :
Analyse le fichier /workspace/step/product.stp💡 令人震惊 :文件系统服务器允许Claude查看您的文件,步骤分析器服务器分析它们。两人一起工作!
选项2:安装区域设置
先决条件
# Installer pythonocc-core (via conda recommandé)
conda install -c conda-forge pythonocc-core
# Installer FastMCP
pip install fastmcpClaude桌面的配置
添加此配置:
macOS/Linux :
{
"mcpServers": {
"step-analyzer": {
"command": "python",
"args": ["/chemin/absolu/vers/MCP_STEP.py"],
"description": "Serveur MCP pour l'analyse de fichiers STEP"
}
}
}视窗 :
{
"mcpServers": {
"step-analyzer": {
"command": "python",
"args": ["C:\\chemin\\vers\\MCP_STEP.py"],
"description": "Serveur MCP pour l'analyse de fichiers STEP"
}
}
}将路径替换为文件的绝对路径。
📖 使用
与Claude Desktop
场景1:分析文件
Utilisateur : Quels fichiers STEP sont disponibles ?
Claude : [liste les fichiers via filesystem]
Utilisateur : Analyse le fichier /workspace/step/product.stp et extrais la nomenclature
Claude : [utilise analyze_step_file avec file_path]场景2:比较两个版本
Utilisateur : Compare /workspace/step/product_v1.stp avec /workspace/step/product_v2.stp
Claude : [utilise compare_step_files avec les deux chemins]场景3:智能导航
Utilisateur : Trouve tous les fichiers STEP dans le dossier et analyse le plus récent
Claude : [utilise filesystem pour lister, puis step-analyzer pour analyser]命令行(开发模式)
# Lancer le serveur en mode développement
python MCP_STEP.py dev
# Le serveur affichera une interface interactive使用stdio进行手动测试
# Lancer le serveur
python MCP_STEP.py
# Envoyer une requête JSON-RPC
echo '{"jsonrpc":"2.0","id":1,"method":"tools/list"}' | python MCP_STEP.py🔧 代码结构
服务器使用 FastMCP 这大大简化了实现:
from fastmcp import FastMCP
import base64
mcp = FastMCP("STEP Analyzer", version="2.0.0")
@mcp.tool()
def analyze_step_file(
file_path: str = None,
file_content: str = None
) -> Dict[str, Any]:
"""Analyse complète d'un fichier STEP
Accepte soit un chemin d'accès, soit le contenu du fichier en base64
"""
# Le serveur gère automatiquement l'une ou l'autre approche
...📊 例子
示例1:分析文件
克劳德桌面入口 :
Utilisateur : Liste les fichiers STEP disponibles dans /workspace/step
Claude : [utilise filesystem pour lister]
Utilisateur : Analyse jasper_v14.stp
Claude : [utilise step-analyzer pour analyser /workspace/step/jasper_v14.stp]答复 :具有层次结构的组件的完整列表
示例2:比较两个版本
克劳德桌面入口 :
Utilisateur : Compare /workspace/step/jasper_v09.stp avec /workspace/step/jasper_v14.stp答复 :
{
"total_changes": 3,
"impact": "CRITICAL_INTERFACE",
"clash_risks": 1,
"interface_changes": 2,
"critical_joints": [
{
"component1": "housing",
"component2": "bracket",
"fastener_count": 4,
"fastener_diameter": 5,
"severity": "critical"
}
]
}示例3:分析本地文件
CLI入口 :
python -c "
from config_manager import ConfigurationManager
cm = ConfigurationManager('step/jaspair_v09.stp')
cm.analyze_complete()
"🐳 配置Docker编写(可选)
对于更高级的部署:
# filepath: docker-compose.yml
version: '3.8'
services:
mcp-step-analyzer:
image: docker.io/jchabas/mcp_stepanalyzer:latest
container_name: mcp_step_analyzer
ports:
- "3000:3000" # Si exposé via HTTP
volumes:
- ./step:/app/step:ro # Monter le répertoire des fichiers STEP (optionnel)
environment:
- LOG_LEVEL=info
restart: unless-stopped开始使用:
docker-compose up -d🔍 依赖性
- fastmcp :创建MCP服务器的框架
- 蟒蛇核心 :用于分析STEP文件的库
- 配置管理器 :配置分析模块
- 基线比较器 :基线比较模块
📝 备注
- 体积要求蒙太奇 :步骤文件必须通过卷安装到Docker容器中
- 服务器 文件系统 允许Claude浏览您的文件
- 服务器 阶跃分析器 执行STEP文件分析
- 基线保存有一个唯一的ID,用于可追溯性
- 服务器自动处理错误并返回清晰的消息
- 与MCP协议2024-11-05兼容
- 新v2.0 :接口分析和与文件系统的集成
🐛 故障排除
Claude Desktop看不到服务器
使用Docker :
# Vérifiez que l'image est disponible
docker images | grep mcp_stepanalyzer
# Redémarrez Docker Desktop
# Redémarrez Claude Desktop本地 :
- 检查配置中的绝对路径
- 测试:
python MCP_STEP.py - 重新启动Claude桌面
- 检查中的日志
~/Library/Logs/Claude/(macOS)
附加文件的“未找到文件”错误
Docker MCP服务器无法直接访问附件。解决方案:
- 使用文件系统服务器 (推荐):
- 将文件复制到已安装的文件夹 - 使用文件系统服务器列出文件 - 请Claude通过路径进行分析 /workspace/step/fichier.stp
- 安装临时音量 :
- 在Docker配置中为临时文件夹添加挂载 - 在分析之前复制您的文件
服务器接受附件,但分析不正确
检查pythonocc core是否正确安装:
python -c "from OCC.Core.STEPControl import STEPControl_Reader; print('OK')"📄 许可证
教育项目-数字挑战
