Token导航 LogoToken导航TokenDH.com
Simple Rail MCP logo
运维云端未说明官方级别未说明来源级核验

Simple Rail MCP

MCP Server

通过自然语言控制线性导轨的MCP服务器,支持多种控制器和配置选项。

工具数

1

提示词数

0

GitHub Stars

0

资源数

0
自动化控制JavaScriptClaude自然语言处理ClaudeCursor

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

global-mysterysnailrevolution

提供方

global-mysterysnailrevolution

最后核验

2026/5/17 20:23

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

详细介绍

简单铁路MCP服务器

在Cursor中,通过Claude AI使用自然语言控制线性导轨的MCP(模型上下文协议)服务器。

这是做什么用的

用自然语言控制您的直线导轨:

You: "Move the rail to position 500mm"
Claude: ✅ Rail moved to 500mm

You: "Move rail to opentrons station"
Claude: ✅ Rail at opentrons station

支持的控制器

  • UW PICO 5.09 - 支持G代码转发的HTTP API(预配置)
  • 任何接受命令的HTTP API
  • ✅ 串口控制器
  • ✅ Python脚本包装器
  • ✅ G代码发送器

快速入门

1. 安装

npm install

2. 配置

编辑 index.js 第32-37行:

// For UW PICO controller:
this.RAIL_IP = "192.168.1.101";      // Your controller IP
this.RAIL_PORT = "80";
this.RAIL_ENDPOINT = "/command";
this.COMMAND_TEMPLATE = "G0 X{position} F1000";

设定你的位置(第41-47行):

this.POSITIONS = {
  "pickup_station": 0,
  "opentrons": 500,
  "plate_reader": 750,
  "storage": 1000,
  "home": 0
};

3. 添加到光标

编辑 .cursor/mcp.json:

{
  "mcpServers": {
    "rail": {
      "command": "node",
      "args": ["/absolute/path/to/simple-rail-mcp/index.js"],
      "env": {
        "RAIL_IP": "192.168.1.101"
      }
    }
  }
}

4. 重启光标(或:重启光标工具)

5. 使用!

"Move the rail to opentrons"
"Move rail to 500mm"
"Move to home position"

配置选项

对于UW PICO 5.09控制器

您的控制器具有一个HTTP API,可通过UART转发G代码。

使用curl进行测试:

curl -X POST http://192.168.1.101/command \
  -H "Content-Type: application/x-www-form-urlencoded" \
  -d "cmd=G0 X500 F1000"

配置:

this.RAIL_IP = "192.168.1.101";
this.RAIL_PORT = "80";
this.RAIL_ENDPOINT = "/command";
this.COMMAND_TEMPLATE = "G0 X{position} F1000";

对于其他HTTP API

如果您的控制器使用了不同的端点/格式:

this.RAIL_IP = "192.168.1.100";
this.RAIL_ENDPOINT = "/api/move";
this.COMMAND_TEMPLATE = '{"position": {position}}';  // JSON format

位置配置

编辑 POSITIONS 与您的物理设置相匹配的对象:

this.POSITIONS = {
  "station_a": 0,        // First position (mm)
  "station_b": 250,      // Second position (mm)
  "station_c": 500,      // Third position (mm)
  "home": 0              // Home position
};

时序配置

调整移动后的等待时间(第54行):

this.MOVE_WAIT_TIME = 5;  // Wait 5 seconds after sending command

如果你的轨道运行速度更快或更慢,请相应调整。

环境变量

你可以使用环境变量来覆盖配置:

{
  "mcpServers": {
    "rail": {
      "command": "node",
      "args": ["/path/to/index.js"],
      "env": {
        "RAIL_IP": "192.168.1.101",
        "RAIL_PORT": "80"
      }
    }
  }
}

API 参考文档

工具: move_rail_and_wait

将线性导轨移动到指定位置并等待完成。

参数:

  • position (字符串) - 来自命名位置 POSITIONS 配置

- 示例: "opentrons""pickup_station""home"

  • position_number (数字) - 以毫米为单位的数值位置

- 示例: 500750.5

  • wait_seconds (数字) - 覆盖默认等待时间

- 默认: MOVE_WAIT_TIME 来自配置

示例:

// Via Claude in natural language:
"Move rail to opentrons"
"Move rail to 500mm"
"Move to home position"

// Direct tool call (from code):
move_rail_and_wait({ position: "opentrons" })
move_rail_and_wait({ position_number: 500 })
move_rail_and_wait({ position: "storage", wait_seconds: 10 })

G代码参考手册

线性导轨的常用G代码指令:

命令描述
G0 X500 F1000 以1000毫米/分钟的速度(快速)移动到500毫米处
G1 X500 F500 以500毫米/分钟的速度移动到500毫米处(受控)
G28 X主页 X 轴
G90设置绝对定位模式
G91设置相对定位模式
G92 X0将当前位置设置为零
M114查询当前位置
M400等待所有动作完成

故障排除

无法连接到控制器

  1. 检查IP:
   ping 192.168.1.101
  1. 测试终端点:
   curl http://192.168.1.101/command
  1. 检查防火墙 - 允许Node.js/Cursor通过防火墙

轨道不移动

  1. 手动测试G代码:
   curl -X POST http://192.168.1.101/command -d "cmd=G28 X"  # Home first
   curl -X POST http://192.168.1.101/command -d "cmd=G0 X500 F1000"
  1. 检查定位模式:
   curl -X POST http://192.168.1.101/command -d "cmd=G90"  # Absolute mode
  1. 验证位置是否在范围内 - 检查轨道的物理限制

位置错误

  1. 检查单位 - 确保已设置G21(毫米):
   curl -X POST http://192.168.1.101/command -d "cmd=G21"
  1. 校准位置 - 测量实际距离并更新 POSITIONS
  1. 首先将轨道固定在家(或位置)上:
   curl -X POST http://192.168.1.101/command -d "cmd=G28 X"

在Cursor中无法加载MCP服务器

  1. 手动测试:
   node index.js
  1. 检查节点版本:
   node --version  # Should be ≥18.0.0
  1. 检查路径中的(内容/项目) .cursor/mcp.json - 使用绝对路径
  1. 完全重启光标(或:重新初始化光标)

高级:自定义控制器支持

要添加对其他控制器类型的支持,请修改 sendHttpCommand 方法:

async sendHttpCommand(position) {
  const gcode = this.COMMAND_TEMPLATE.replace('{position}', position);
  const url = `http://${this.RAIL_IP}:${this.RAIL_PORT}${this.RAIL_ENDPOINT}`;
  
  // Customize request format here
  const response = await fetch(url, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'  // Change as needed
    },
    body: JSON.stringify({ command: gcode })  // Change format
  });
  
  // Customize response parsing here
  const data = await response.json();
  return data;
}

集成示例

与其他MCP服务器配合使用,实现全面自动化:

// Example: Pick up plate and move to Opentrons
"Move rail to pickup station"  // This MCP server
"Run VLA pickup script"        // VLA MCP server
"Move rail to opentrons"       // This MCP server
"Upload purple_mixing.py"      // Opentrons MCP server
"Start the protocol"           // Opentrons MCP server

Claude AI 自动协调所有系统!

要求

  • Node.js 大于等于18.0.0
  • Cursor 集成开发环境(IDE) 带有MCP支持
  • 直线导轨 通过HTTP/串行/脚本控制

许可证

麻省理工学院(MIT)

做出贡献

欢迎提出问题和拉取请求!

致谢/制作人员名单

  • 模型上下文协议 - 人类中心主义(或“以人为本”)
  • Claude AI - 自然语言编曲(或“自然语言协同”)
  • Cursor 集成开发环境(IDE) - 开发环境

______________________________________________________________________

有问题吗? 打开一个问题或查看 故障排除指南

目录标签

目录标签

自动化控制JavaScriptClaude自然语言处理线性导轨控制本地部署MCP服务器HTTPAPI

支持客户端

ClaudeCursor

接入字段

传输方式(transport,传输协议)

未说明

鉴权方式(authType,认证方式)

none

工具数量(toolCount,工具数)

1

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

未说明none部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

仍需确认:installCommand

来源信息

继续浏览同类 MCP