使用说明
NWO机器人MCP服务器v2.0
用于NWO Robotics API的完整模型上下文协议(MCP)服务器,包含77个集成工具,涵盖SLAM、强化学习、高级传感器和完整的机器人系统控制。
📋 概述
该MCP服务器通过一个统一的接口提供对所有NWO Robotics API端点的全面访问,该接口具有按优先级和功能组织的77个工具。
✨ 主要特点
- 77集成工具 -全面覆盖API
- SLAM和本地化 -持续的机器人地图和导航
- 强化学习 -云强化学习培训(PPO、SAC、DDPG、TD3)
- 高级传感器 -热、毫米波、气体、声学、磁性
- 视觉与接地 -开放词汇对象检测
- 触觉传感 -ORCA Hand 576税务反馈
- 运动规划 -MoveIt2集成防撞功能
- 任务规划 -基于行为树的分层任务执行
- ROS2集成 -用于真实机器人的云桥(UR5e、Panda、Spot)
- 安全监控 -实时安全验证和紧急停止
- MQTT物联网 -1000多个代理支持边缘计算
- 自主代理 -自我注册和基于ETH的支付
🚀 快速开始
1.克隆存储库
git clone https://github.com/RedCiprianPater/mcp-server-robotics.git
cd mcp-server-robotics
2.安装依赖项
npm install
3.设置环境
cp .env.example .env
# Edit .env and add your NWO_API_KEY
nano .env
4.构建和运行
npm run build
npm start
5.实际测试
# The server will start and display available tools
# You can now use any of the 77 tools through Claude
📦 包含什么
文件
- src/index.ts -完成MCP服务器实施(77个工具)
- package.json -依赖关系和构建脚本
- Tsconflict.儿子 -TypeScript配置
- Dockerfile -容器部署
- docker-compose.yml -使用MQTT代理的全栈
- .env.示例 -环境变量模板
- 集成_指南.md -详细的集成说明
- README.md -此文件
工具类别
优先级1-独特功能(5个工具)
✅ nwo_initialize_slam - Persistent robot mapping
✅ nwo_localize - Landmark-based localization
✅ nwo_create_rl_env - Cloud RL training environments
✅ nwo_train_policy - Policy training (SB3)
✅ nwo_detect_objects_grounding - Open-vocabulary detection
优先级2-新型传感器(5种工具)
✅ nwo_query_thermal - Heat detection
✅ nwo_query_mmwave - Millimeter-wave radar
✅ nwo_query_gas - Air quality sensors
✅ nwo_query_acoustic - Sound localization
✅ nwo_query_magnetic - Metal detection
优先级3-高级功能(4个工具)
✅ nwo_read_tactile - ORCA Hand 576 taxels
✅ nwo_identify_material - Material recognition
✅ nwo_plan_motion - MoveIt2 motion planning
✅ nwo_execute_behavior_tree - Hierarchical task execution
标准操作(58个工具)
Inference & Models (6) Robot Control (3)
Task Planning & Learning (4) Agent Management (3)
Voice & Gesture (2) Simulation & Physics (3)
ROS2 & Hardware (3) MQTT & IoT (2)
Safety & Monitoring (3) Embodiment & Calibration (3)
Autonomous Agents (4) Dataset & Export (2)
Demo & Testing (2)
🔧 配置
API密钥
从获取您的免费API密钥https://nwo.capital/webapp/api-key.php
export NWO_API_KEY="sk_live_your_key_here"
API终点
# Standard API (full features)
NWO_API_BASE=https://nwo.capital/webapp/api-key.php
# Edge API (ultra-low latency, 200+ locations)
NWO_EDGE_API=https://nwo-robotics-api-edge.ciprianpater.workers.dev/api
# ROS2 Bridge (for physical robots)
NWO_ROS2_BRIDGE=https://nwo-ros2-bridge.onrender.com
# MQTT Broker (IoT sensors)
MQTT_BROKER=mqtt.nwo.capital
MQTT_PORT=8883
📖 使用示例
示例1:SLAM和导航
// Initialize SLAM mapping
const slam = await client.messages.create({
tools: [{name: "nwo_initialize_slam", input: {
agent_id: "robot_001",
map_name: "warehouse",
slam_type: "hybrid",
loop_closure: true
}}]
});
// Later: Localize in the map
const localize = await client.messages.create({
tools: [{name: "nwo_localize", input: {
agent_id: "robot_001",
map_id: "map_123",
image: "base64_encoded_image"
}}]
});
示例2:基于视觉的任务
// Detect objects with natural language
const detect = await client.messages.create({
tools: [{name: "nwo_detect_objects_grounding", input: {
agent_id: "robot_001",
image: "base64_image",
object_description: "red cylinder on the left",
threshold: 0.85,
return_mask: true
}}]
});
// Execute action based on detection
const execute = await client.messages.create({
tools: [{name: "nwo_inference", input: {
instruction: "Pick up the detected object",
images: ["base64_image"]
}}]
});
示例3:复杂任务规划
// Break down high-level instruction
const plan = await client.messages.create({
tools: [{name: "nwo_task_planner", input: {
instruction: "Clean the warehouse floor",
agent_id: "robot_001",
context: {
location: "warehouse",
known_objects: ["shelves", "boxes"]
}
}}]
});
// Execute subtasks
for (let i = 1; i <= 5; i++) {
await client.messages.create({
tools: [{name: "nwo_execute_subtask", input: {
plan_id: "plan_123",
subtask_order: i,
agent_id: "robot_001"
}}]
});
}
示例4:传感器融合
const fusion = await client.messages.create({
tools: [{name: "nwo_sensor_fusion", input: {
agent_id: "robot_001",
instruction: "Pick up the hot object carefully",
images: ["base64_camera"],
sensors: {
temperature: {value: 85.5, unit: "celsius"},
proximity: {distance: 0.15, unit: "meters"},
force: {grip_pressure: 2.5},
gps: {lat: 51.5074, lng: -0.1278}
}
}}]
});
示例5:RL策略培训
// Create RL environment
const env = await client.messages.create({
tools: [{name: "nwo_create_rl_env", input: {
agent_id: "robot_001",
task_name: "pick_place",
reward_function: "success",
sim_platform: "mujoco"
}}]
});
// Train policy
const train = await client.messages.create({
tools: [{name: "nwo_train_policy", input: {
agent_id: "robot_001",
env_id: "env_456",
algorithm: "PPO",
num_steps: 100000,
learning_rate: 0.0003
}}]
});
📊 性能指标
| 操作 | 延迟 | 注意事项 |
|---|---|---|
| 标准推断 | 100-120ms | 欧盟数据中心 |
| 边缘推断 | 25-50ms | 全球200+个位置 |
| SLAM初始化 | 200-500ms | 取决于图像质量 |
| SLAM定位 | 100-300ms | 在现有地图中 |
| RL训练(每一步) | 50-100ms | MuJoCo模拟 |
| 任务规划 | 500-1000ms | 复杂分解 |
| 传感器融合 | 150-300ms | 多传感器处理 |
| 紧急停止 | <10ms | 保证响应 |
🐳 Docker部署
简单的Docker运行
docker build -t mcp-nwo-robotics .
docker run -e NWO_API_KEY=sk_xxx mcp-nwo-robotics
Docker Compose(推荐)
# Start full stack with MQTT broker
docker-compose up -d
# View logs
docker-compose logs -f mcp-nwo-robotics
# Stop
docker-compose down
生产部署
# Build for production
docker build -t mcp-nwo-robotics:prod .
# Push to registry
docker tag mcp-nwo-robotics:prod myregistry/mcp-nwo-robotics:latest
docker push myregistry/mcp-nwo-robotics:latest
# Deploy on Kubernetes
kubectl apply -f k8s-deployment.yaml
🔐 安全
API密钥管理
# Never commit API keys
echo "NWO_API_KEY=*" >> .gitignore
echo ".env" >> .gitignore
# Use environment variables or .env (in .gitignore)
速率限制
- 免费层:100000个电话/月
- 原型:每月50万次通话(约16666次/天)
- 生产:无限通话
监控使用情况:
const balance = await client.messages.create({
tools: [{name: "nwo_agent_check_balance", input: {
agent_id: "agent_123"
}}]
});
安全特性
- 实时碰撞检测
- 人体接近警告(默认1.5米)
- 紧急停止(响应时间<10ms)
- 力/扭矩限制执行
- 合规性审计日志
🧪 测试
运行测试
npm test
npm run test:watch
测试单个工具
# Test SLAM
npm run dev -- --test nwo_initialize_slam
# Test inference
npm run dev -- --test nwo_inference
# Test sensor fusion
npm run dev -- --test nwo_sensor_fusion
📚 文档
- API 参考: https://nwo.capital/webapp/nwo-robotics.html
- GitHub: https://github.com/RedCiprianPater/mcp-server-robotics
- 白皮书: https://www.researchgate.net/publication/401902987_NWO_Robotics_API_WHITEPAPER
- 演示: https://huggingface.co/spaces/PUBLICAE/nwo-robotics-api-demo
- 文档: https://nworobotics.cloud
🔗 集成指南
与Claude API
import Anthropic from "@anthropic-ai/sdk";
const client = new Anthropic();
const response = await client.messages.create({
model: "claude-3-5-sonnet-20241022",
max_tokens: 4096,
tools: tools, // All 77 NWO tools
messages: [{
role: "user",
content: "Initialize SLAM mapping on robot_001"
}]
});
与LangChain合作
from langchain.chat_models import ChatAnthropic
from langchain.tools import StructuredTool
llm = ChatAnthropic(model_name="claude-3-sonnet-20240229")
tools = load_nwo_tools()
agent = initialize_agent(tools, llm, agent="tool-using-agent")
与CrewAI合作
from crewai import Agent, Task, Crew
from nwo_tools import get_robotics_tools
tools = get_robotics_tools()
robot_agent = Agent(
role="Robot Controller",
goal="Control robots autonomously",
tools=tools
)
🐛 故障排除
问题:“API密钥无效或丢失”
# Solution: Check API key
echo $NWO_API_KEY
# If empty, set it:
export NWO_API_KEY="sk_your_actual_key"
# Or in .env:
NWO_API_KEY=sk_your_actual_key
问题:“API错误504:网关超时”
# Solution: Use edge API for faster response
# Set: NWO_EDGE_API endpoint
# Tool: nwo_edge_inference instead of nwo_inference
问题:“检测到碰撞”
# Solution: Validate trajectory before execution
# Use: nwo_simulate_trajectory to check collision
# Use: nwo_check_collision for detailed analysis
问题:“SLAM映射失败”
# Solution: Ensure good image quality
# - Well-lit environment
# - Distinct visual features
# - Slow movement during initialization
# - Try visual instead of hybrid SLAM
📈 监控和分析
日志
# View real-time logs
npm run dev
# With custom log level
LOG_LEVEL=debug npm start
# Save to file
npm start > logs/server.log 2>&1
指标
# Monitor API usage
nwo_agent_check_balance
# Export dataset for analysis
nwo_export_dataset
# Check system health
GET /health (if enabled)
🎯 下一步
- ✅ 设置:
npm install && npm run build - ✅ 配置:添加
NWO_API_KEY到.env - ✅ 测试:
npm start并验证工具负载 - ✅ 整合:与Claude API或您的框架一起使用
- ✅ 部署:Docker Compose或Kubernetes
- ✅ 监视器:检查日志和使用指标
- ✅ 规模:根据需要升级层
📞 支持
- 问题: https://github.com/RedCiprianPater/mcp-server-robotics/issues
- 讨论: https://github.com/RedCiprianPater/mcp-server-robotics/discussions
- API密钥帮助: https://nwo.capital/webapp/api-key.php
- NWO文件: https://nwo.capital/nwo-robotics.html
📝 版本历史
v2.0.0(当前版本-2026年4月)
- ✅ 共实施77个工具
- ✅ 优先级1:SLAM、RL、接地(5)
- ✅ 优先事项2:先进传感器(5)
- ✅ 优先级3:高级功能(4)
- ✅ 标准操作(58)
- ✅ 完全支持TypeScript
- ✅ Docker和Kubernetes就绪
- ✅ 生产级错误处理
- ✅ 全面测试覆盖
v1.0.0(上一个)
- 基本工具组(20个工具)
- 仅限标准推理
- 手动配置
📄 许可证
MIT许可证-有关详细信息,请参阅许可证文件
🙏 致谢
- NWO机器人 -API和基础设施
- Anthropic -克劳德和MCP协议
- 开源社区 -贡献和反馈
最后更新2026年4月
状态: ✅ 生产就绪
维护者: @RedCiprianPater