内容
# ABB RobotStudio MCP 服务器 — LiskinLabs 版本
> **v2.0.0** — [eliasbitsch/abb-robotstudio-mcp](https://github.com/eliasbitsch/abb-robotstudio-mcp) 的分支版本,包含 TcpListener 传输、55 个 MCP 工具、自动加载和安全强化。
用于 ABB RobotStudio 和 ABB 机器人控制器的模型上下文协议服务器。
暴露 **55 个工具**,跨越两种传输方式:
- **`rs_*`** (31 个工具)— 通过 TcpListener 插件的 RobotStudio SDK。检查/编辑站点、目标、路径、模块、变量、IO、配置。驱动仿真。捕获截图。
- **`rws_*`** (24 个工具)— 直接连接到控制器的 Robot Web Services REST API。电机、程序控制、IO、文件、主从控制、事件日志。
已测试:ABB RobotStudio 2025 + IRB 4600 虚拟控制器(IRC5)。
---
## ✨ 相较于原始 v1.0.0 的改进
| 功能 | 原始版本 | LiskinLabs v2.0.0 |
|---|---|---|
| HTTP 传输 | `HttpListener` — 需要 `netsh http add urlacl`(管理员) | **`TcpListener`** — 零管理员权限 |
| 工具 | 50 | **55**(+5 个新工具) |
| 插件启动 | 手动 “加载插件” 每个会话 | **自动加载** |
| 截图 | ❌ | ✅ `rs_get_screenshot` |
| 事件日志(SDK) | ❌ | ✅ `rs_get_execution_errors` |
| 变量列表 | ❌ | ✅ `rs_list_variables`(类型/模块过滤) |
| 包围盒 | ❌ | ✅ `rs_get_station_objects?bbox=true` |
| IO 信号(SDK) | 存根 → “未实现” | ✅ 真实 API |
| RAPID 上传 | 原始 UTF-8 | ✅ 无 BOM + CRLF |
| 仿真重置 | 仅停止 | ✅ 停止 + PP 重置 |
| 请求超时 | 无 | ✅ 15-30 秒 AbortController |
| 路径验证 | 不适用 | ✅ 截图沙箱 |
| CORS | 不适用 | ✅ 已移除(非浏览器 API) |
## v2.0.0 中的新 MCP 工具
| 工具 | 描述 |
|---|---|
| `rs_get_screenshot` | 捕获 3D 视图 → base64 PNG(宽度/高度参数) |
| `rs_get_execution_errors` | 通过 SDK 获取控制器事件日志(计数参数) |
| `rs_list_variables` | 具有类型/模块过滤器的 RAPID 变量 |
| `rs_get_station_objects` | 现支持 `bbox=true` 获取位置 + 尺寸 |
---
## 快速入门
### 1. 构建
```bash
git clone https://github.com/LiskinLabs/abb-robotstudio-mcp.git
cd abb-robotstudio-mcp
# TypeScript MCP 服务器
cd src && npm install && npm run build && cd ..
# C# 插件
cd addin && dotnet build ClaudeBridge.csproj && cd ..
```
### 2. 安装插件
```powershell
# 以管理员身份运行(复制到 Program Files)
powershell -ExecutionPolicy Bypass -File install-addin.ps1
# 或指定 RobotStudio 版本:
powershell -ExecutionPolicy Bypass -File install-addin.ps1 -RobotStudioVersion "2024"
```
### 3. 配置 Claude 代码
添加到 `.mcp.json`:
```json
{
"mcpServers": {
"abb-robotstudio": {
"command": "node",
"args": ["C:/path/to/abb-robotstudio-mcp/dist/index.js"],
"env": {
"ABB_BRIDGE_URL": "http://localhost:58080",
"ABB_RWS_URL": "http://localhost:80",
"ABB_RWS_USER": "默认用户",
"ABB_RWS_PASS": "robotics"
}
}
}
}
```
### 4. 启动 RobotStudio
1. 打开带有虚拟控制器的站点
2. 插件自动加载(自动加载)
3. 验证:`curl http://localhost:58080/ping`
**无需管理员权限** — TcpListener 原生绑定到 `127.0.0.1`。
---
## 架构
```
AI 助手 ←→ MCP 标准输入输出 ←→ TypeScript 服务器 ←→ HTTP ←→ C# 插件(TcpListener :58080)
←→ REST → 控制器 RWS (:80)
```
- **C# 插件** (.NET 4.8):`TcpListener(IPAddress.Loopback, 58080)`,手动 HTTP 解析,32+ 端点,UI 线程封送
- **TypeScript** (Node.js 18+):55 个 MCP 工具,AbortController 超时,结构化错误处理
---
## 所有 55 个工具
### SDK(`rs_*`)— 31 个工具
`rs_ping` `rs_get_station` `rs_get_station_objects` `rs_save_station`
`rs_get_tasks` `rs_get_modules` `rs_read_module` `rs_write_module`
`rs_read_variable` `rs_write_variable` `rs_list_variables` `rs_get_execution_errors`
`rs_get_screenshot` `rs_controller_status`
`rs_start_simulation` `rs_stop_simulation` `rs_pause_simulation` `rs_reset_simulation`
`rs_simulation_status` `rs_set_sim_speed`
`rs_get_paths` `rs_get_path_targets` `rs_create_path` `rs_create_target`
`rs_read_config` `rs_write_config` `rs_check_collisions`
`rs_get_position` `rs_get_io_signals`
### RWS(`rws_*`)— 24 个工具
`rws_controller_status` `rws_set_motors` `rws_start_program` `rws_stop_program`
`rws_reset_pp` `rws_execution_state` `rws_get_tasks` `rws_get_modules`
`rws_read_module` `rws_write_module` `rws_read_variable` `rws_write_variable`
`rws_get_position` `rws_get_io_signals` `rws_read_io` `rws_write_io`
`rws_get_speed_override` `rws_set_speed_override` `rws_event_log`
`rws_list_files` `rws_read_file` `rws_write_file`
`rws_request_mastership` `rws_release_mastership`
---
## 环境变量
| 变量 | 默认值 | 目的 |
|---|---|---|
| `ABB_BRIDGE_URL` | `http://localhost:58080` | 插件 TcpListener 端点 |
| `ABB_RWS_URL` | `http://localhost:80` | 控制器 RWS(真实机器人的 IP) |
| `ABB_RWS_USER` | `默认用户` | RWS 认证用户 |
| `ABB_RWS_PASS` | `robotics` | RWS 认证密码 |
---
## 安全
⚠️ 这些工具可以移动真实硬件(`rws_set_motors`、`rws_start_program`、`rws_write_*`)。在开发时使用虚拟控制器。将 `ABB_RWS_URL` 指向物理机器人时,请确保您完全了解风险。
---
## 致谢与归属
- **原始作者:** [Elias Bitsch](https://github.com/eliasbitsch) — [abb-robotstudio-mcp](https://github.com/eliasbitsch/abb-robotstudio-mcp) (MIT 许可证)。50 个工具的基础,SDK/RWS 双传输架构,ClaudeBridge 插件概念。
- **改进:** [LiskinLabs](https://github.com/LiskinLabs) — Silvestr Liskin & Claude Code
- TcpListener 传输(消除管理员权限要求)
- 5 个新 MCP 工具(截图,事件日志,变量列表,包围盒,IO 信号)
- RAPID 上传修复(无 BOM UTF-8,CRLF 规范化,模块清理)
- 自动加载清单,安全强化,请求超时
- **灵感:** [zhou-zhichao/robotstudio-mcp](https://github.com/zhou-zhichao/robotstudio-mcp) — 开创了 TcpListener 方法用于 Windows 权限处理。
---
## 许可证
MIT — 请参阅 [LICENSE](LICENSE)