让 Claude、Cursor、Windsurf 等 AI 编程助手直接调用 RoboParts 选型引擎,在对话中完成机器人零部件的智能选型与兼容性分析。
Model Context ProtocolMCP (Model Context Protocol) 是 Anthropic 推出的开放协议,用于让 AI 模型与外部工具/数据源进行标准化交互。RoboParts MCP Server 将平台的选型引擎、零部件数据库、兼容性分析等能力封装为 MCP 工具,使 AI 编程助手能够在对话中直接调用这些能力。
接入后,您只需用自然语言描述需求(如"推荐人形机器人的执行器"),AI 助手便会自动调用 component_search 工具,返回匹配的零部件列表。无需手动构造 HTTP 请求,开发效率大幅提升。
当前 RoboParts MCP Server 提供 5 个工具,覆盖零部件搜索、详情查询、兼容性检查、智能推荐和 BOM 导出等核心场景。
以下 5 个 MCP 工具可供 AI 编程助手调用,每个工具包含名称、功能描述和参数说明。
将 RoboParts MCP Server 添加到您的 AI 编程工具中,以下是各平台的配置方法。
{
"mcpServers": {
"roboparts": {
"command": "node",
"args": ["/path/to/roboparts/mcp-server/index.js"],
"env": {
"ROBOPARTS_API_KEY": "gtk_your_api_key_here"
}
}
}
}
配置文件路径:
~/Library/Application Support/Claude/claude_desktop_config.json%APPDATA%\Claude\claude_desktop_config.json{
"mcpServers": {
"roboparts": {
"command": "node",
"args": ["/path/to/roboparts/mcp-server/index.js"],
"env": {
"ROBOPARTS_API_KEY": "gtk_your_api_key_here"
}
}
}
}
在项目根目录下创建 .cursor/mcp.json 文件,Cursor 会自动加载 MCP Server。
{
"mcpServers": {
"roboparts": {
"command": "node",
"args": ["/path/to/roboparts/mcp-server/index.js"],
"env": {
"ROBOPARTS_API_KEY": "gtk_your_api_key_here"
}
}
}
}
在项目根目录下创建 .windsurf/mcp.json 文件,Windsurf 会自动识别并加载。
输入自然语言查询,直接调用选型引擎 API 查看效果。需要有效的 API Key。
如果您更习惯使用 Python,可以通过 HTTP 直接调用选型引擎 API。以下是一个完整的示例。
# RoboParts 智能选型引擎 - Python SDK 示例 import requests API_BASE = "https://roboparts.cc" API_KEY = "gtk_your_api_key_here" # 替换为您的 API Key # 1. 智能选型推荐 response = requests.post( f"{API_BASE}/api/selection/engine", headers={"Content-Type": "application/json"}, json={ "api_key": API_KEY, "application": "humanoid", "requirements": { "torque_min": 10, "weight_max": 500, "voltage": 48, "ros_required": True, }, "categories": ["actuators", "sensors"], "count_per_category": 3, } ) result = response.json() if result.get("success"): for category, items in result.get("recommendations", {}).items(): print(f"\n=== {category} ===") for item in items: print(f" {item['name']} ({item['component_id']})") print(f" 评分: {item.get('score', 'N/A')} | 价格: {item.get('price', 'N/A')}") else: print(f"Error: {result.get('error', 'Unknown')}") # 2. 查询余额 balance_resp = requests.get( f"{API_BASE}/api/credits/balance?key={API_KEY}" ) print(f"\n当前积分: {balance_resp.json().get('credits', 0)}")