JD

jorekai/db-timetable-mcp

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

17 stars 7 forks 质量 72 趋势 35MIT

Ein 模型上下文协议(MCP) Server für die Deutsche Bahn Timetable API

概览

官方Deutsche Bahn Timetables API的模型背景协议服务器. 它将紧凑的 DB XML 转换为语义JSON,并将计划的时间表与活的更改合并为一个站板. - 有效持有显示值。 计划并更改了解释偏差。 工具返回结构化的Content,描述性JSON schemas,以及作为MCP资源提供的数据模型. - 官方TypeScript SDK,用于本地客户的stdio,用于远程操作的无国籍流式HTTP. - 说吧 没有 stdout 的日志, 回回绑定, 除非您更改它, 主机许可列表, 超时, 非根容器, 可复制锁文件 。 - 单位、合同和运输测试、保险限额、CI、依赖和秘密检查。 要求:节点.js 22或24 LTS,以及DB API Marketplace中一个订阅的时事表产品. 在stdio模式中,进程等待一个MCP客户端. 状态信息只转到 stderr 。 Stdout保留给JSON -RPC.

概述(AI 翻译)

英语 . .

DB 时表 MCP 服务器

官方Deutsche Bahn Timetables API的模型背景协议服务器. 它将紧凑的 DB XML 转换为语义JSON,并将计划的时间表与活的更改合并为一个站板.

它保证

  • **校正平台和时间。 ** effective 持有显示值。 [[T1] 和 [[T2] 解释偏差。
  • ** 模型产出。 ** 工具返回structuredContent,描述性JSON schemas,以及作为MCP资源提供的数据模型.
  • ** MCP符合规定。 ** 官方TypeScript SDK,为本地客户端的stdio,为远程操作的无国籍流式HTTP.
  • ** 安全默认。 ** 在 [[T4] 上没有日志, 回回绑定, 除非您更改它, 主机许可列表, 超时, 非根容器, 可复制的锁文件 。
  • ** 可核实的行为。 ** 单位、合同和运输测试、覆盖阈值、CI、依赖和秘密检查。

快开始

要求:节点.js 22或24 LTS,以及DB API Marketplace中一个订阅的时事表产品.

填入[[T5]:

然后构建并开始 :

在stdio模式中,进程等待一个MCP客户端. 状态信息只到 stderr .

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

English | Deutsch

DB Timetable MCP Server

A Model Context Protocol server for the official Deutsche Bahn Timetables API. It converts the compact DB XML into semantic JSON and merges the planned schedule with live changes into one station board.

What it guarantees

  • Correct platforms and times. effective holds the value to display. planned and changed explain the deviation.
  • Output built for models. Tools return structuredContent, descriptive JSON schemas, and a data model available as an MCP resource.
  • MCP conformance. Official TypeScript SDK, stdio for local clients, stateless Streamable HTTP for remote operation.
  • Safe defaults. No logs on stdout, loopback binding unless you change it, host allowlist, timeouts, non-root container, reproducible lockfile.
  • Verifiable behaviour. Unit, contract, and transport tests, coverage thresholds, CI, dependency and secret checks.

Quick start

Requirements: Node.js 22 or 24 LTS, and a subscribed Timetables product in the DB API Marketplace.

git clone https://github.com/jorekai/db-timetable-mcp.git
cd db-timetable-mcp
npm ci
cp .env.example .env

Fill in .env:

DB_TIMETABLE_CLIENT_ID=deine-client-id
DB_TIMETABLE_CLIENT_SECRET=dein-api-key

Then build and start:

npm run build
npm start

In stdio mode the process waits for an MCP client. Status messages go to stderr only. stdout stays reserved for JSON-RPC.

Claude Desktop

Run npm ci && npm run build first, then point the configuration at an absolute path in claude_desktop_config.json.

macOS/Linux:

{
  "mcpServers": {
    "db-timetable": {
      "command": "node",
      "args": ["/absolute/path/db-timetable-mcp/dist/index.js"]
    }
  }
}

Windows:

{
  "mcpServers": {
    "db-timetable": {
      "command": "node",
      "args": ["C:\\absolute\\path\\db-timetable-mcp\\dist\\index.js"]
    }
  }
}

The .env file is looked up in the current working directory and next to the project directory, which covers the case where Claude Desktop starts the compiled server from somewhere else. You can also set the two credentials in the env object of the MCP entry instead.

After a configuration change, quit Claude Desktop completely and start it again. More in Troubleshooting.

Tools

Tool Purpose
getStationBoard Recommended. Joins the planned schedule and the full change set into a live station board
getPlannedTimetable Static planned timetable for an EVA number, date, and hour
在 GitHub 查看完整 README

安装

This server does not publish a one-line install command.

Open the repository installation guide 新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "db-timetable": { "command": "node", "args": ["/absolute/path/db-timetable-mcp/dist/index.js"] } } }