mcpField
M
mcp-national-rail

mcp-national-rail

本地服务
github.com/lucygoodchild地图与出行773 周前更新

关于 mcp-national-rail

mcp-national-rail 是一个面向 AI Agent 的 MCP 服务,可通过 Realtime Trains API 查询 National Rail 列车信息。它提供实时及指定日期的到达和出发查询工具。

主要功能

  1. 01查询实时列车出发信息
  2. 02查询实时列车到达信息
  3. 03按日期查询列车出发
  4. 04按日期查询列车到达

适用场景

  1. 01查看 National Rail 实时出发信息
  2. 02查询实时到站列车
  3. 03查找指定日期的到发班次

MCP 相关

它向 MCP 客户端提供四种列车查询工具,覆盖实时和指定日期的出发与到达信息;查询使用 Realtime Trains API。

配置

本地服务的配置在各客户端中通用,复制后粘贴到客户端的 MCP 配置文件即可。

mcp.json · 通用配置
{
"mcpServers": {
"national-rail": {
"command": "npx",
"args": [
"-y",
"@smithery/cli"
]
}
}
}
启动命令npx -y @smithery/cli

本地服务需要在你的电脑上安装运行环境(如 Node.js 18+)。各客户端的配置文件位置不同,请参考客户端文档。

安装包
npm@smithery/cli

工具

还没有获取到工具列表

本地服务需要在你的电脑上运行后才能读取工具,维护者暂未提供工具列表。

详细介绍

smithery badge

mcp-national-rail

一个用于从 National Rail 检索列车时刻表的模型上下文协议(MCP)服务。

概述

此项目使用模型上下文协议(MCP)实现了一个服务,允许 AI Agent 使用 Realtime Trains API 检索 National Rail 列车信息。

它提供以下工具:

  • get_live_departures
  • get_live_arrivals
  • get_departures_by_date
  • get_arrivals_by_date

安装

可在此处创建 Real Time Trains API 帐户:https://api.rtt.io/

请记下你的 API 身份验证凭据。

通过 Smithery 安装

通过 Smithery 自动为 Claude Desktop 安装 mcp-national-rail:

npx -y @smithery/cli install @lucygoodchild/mcp-national-rail --client claude
手动为 Claude Desktop 安装
前提条件
  • Node.js
设置
  1. 克隆此仓库
  2. 安装依赖项
npm install
  1. 构建并启动项目
npm run build
npm run start
  1. 将以下内容添加到 MCP 客户端配置文件(~/Library/Application Support/Claude/claude_desktop_config.json):
{
  "mcpServers": {
    "mcp-national-rail": {
      "command": "node",
      "args": ["/path/to/mcp-national-rail/dist/index.js"],
      "env": {
        "RTT_API_USERNAME": "your_rtt_api_username",
        "RTT_API_PASSWORD": "your_rtt_api_password"
      }
    }
  }
}

请务必将 "/path/to/mcp-national-rail/dist/index.js" 替换为实际路径,并添加你的 RTT API 用户名和密码。可在此处创建帐户:https://api.rtt.io/

  1. 重启 Claude
开发
  • 根据示例文件创建 .env 文件
RTT_API_USERNAME=your_rtt_api_username
RTT_API_PASSWORD=your_rtt_api_password

使用以下命令运行检查器:

npx @modelcontextprotocol/inspector node dist/index.js

评论

支持 Markdown

第一次接触 MCP?

从协议是什么,到在客户端里装上第一个服务,这几条回答覆盖了大多数入门问题。

一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。