Where's My DB?

Where's My DB?

A Claude skill + MCP server that tells you how Deutsche Bahn delays will affect your trip — not just whether your train is late.

Category
访问服务器

README

Where's My DB?

A Claude skill + MCP server that tells you how Deutsche Bahn delays will affect your trip — not just whether your train is late.


What it does

Knowing a train is "5 min late" isn't useful. Knowing that the 12-minute delay three stops up the line will eat your 9-minute transfer in Berlin — that's useful.

Where's My DB? turns "is my train on time?" into a real answer. You ask Claude in plain language and it walks the upstream stops, traces the connection chain, and tells you which delays actually affect your journey:

Likely 15–18 minutes late.

  • ICE 597 was already 18 min late at Solingen Hbf (three stops upstream) at 15:42.
  • No scheduled padding before your boarding station at 16:02.
  • Your Frankfurt connection (ICE 599) is currently on time — you'd lose ~14 min of a 16-min transfer.

Caveat: a single 5-min recovery en route can change this. The official board hasn't updated yet.

demo

See examples/ for three full transcripts.


How it works

┌──────────────────────────────────────────────────────────┐
│  Claude (Code or Desktop)                                │
│  ┌────────────────────────────────────────────────────┐  │
│  │  Skill: db-delay-predictor                         │  │
│  │  Reasoning playbook: which tool, how to combine    │  │
│  │  signals, how to express confidence honestly.      │  │
│  └────────────────────────────────────────────────────┘  │
└──────────────────────────────────────────────────────────┘
                          │  MCP (stdio, JSON-RPC)
                          ▼
┌──────────────────────────────────────────────────────────┐
│  MCP server: db-mcp (TypeScript)                         │
│  Typed data access. No reasoning.                        │
│  ┌─────────────────────┐    ┌─────────────────────┐      │
│  │ marudor (primary)   │ →  │ db-rest (fallback)  │      │
│  │ tRPC + devalue      │    │ plain REST          │      │
│  └─────────────────────┘    └─────────────────────┘      │
│  + 5-min in-memory LRU cache                             │
└──────────────────────────────────────────────────────────┘

Two artifacts. Clean split:

  • The MCP server knows nothing about reasoning. It's typed data access with transparent provider fallback.
  • The skill knows nothing about API endpoints. It's a reasoning playbook in markdown.

Both are independently testable. Both ship in this repo.


What's interesting under the hood

  • The primary data source isn't a public REST API. Marudor (the community DB tracker) runs internal tRPC with custom devalue encoding. The MCP includes a hand-rolled tRPC transport that speaks it, because no public alternative exposes per-stop connection-chain data ("will my Anschluss be held?") — which is the whole point.
  • Transparent fallback to a stable REST API. If marudor fails (it's an unofficial endpoint), the MCP transparently falls back to db-rest, and the skill tells the user the answer is degraded. Belt-and-suspenders engineering, not a hedge.
  • The skill is honest about uncertainty. Delay predictions are rounded to 5-minute buckets ("about 10–15 minutes late") because precision would be theater. The skill explicitly enumerates which signals fired and what could change.
  • 5 atomic MCP tools, no reasoning baked in. resolve_station, find_train, get_train_status, plan_journey, get_disruptions. The skill composes them.
  • 52 tests, mostly with mocked HTTP. Includes failure modes: timeout → fallback, both providers down → clean error, partial failure on a single stop's connection chain doesn't break the whole call.

Quick start

Build it:

git clone https://github.com/<you>/wheres-my-db.git
cd wheres-my-db
npm install
npm run build

Wire into Claude Code (terminal)

claude mcp add db-mcp -s user -- node "$PWD/packages/db-mcp/dist/index.js"
ln -s "$PWD/packages/skill-db-delay" ~/.claude/skills/db-delay-predictor

Open a claude session, run /mcp to confirm db-mcp is connected with 5 tools, then ask:

Is ICE 597 on time today?

Wire into Claude Desktop

Edit ~/Library/Application Support/Claude/claude_desktop_config.json:

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

Then symlink the skill the same way and fully quit + relaunch Claude Desktop.


Repo layout

packages/
├── db-mcp/                  TypeScript MCP server
│   ├── src/
│   │   ├── server.ts        wiring + cache integration
│   │   ├── tools/           one file per MCP tool
│   │   ├── clients/         marudor (tRPC) + db-rest + provider router
│   │   ├── cache.ts         LRU
│   │   └── types.ts         normalized domain types
│   └── tests/               vitest + msw
└── skill-db-delay/
    └── SKILL.md             the reasoning playbook
examples/                    saved demo transcripts

Test it

npm test

52 tests across cache, provider clients, fallback routing, tool wrappers, and server wiring. Network calls are mocked via msw; failure modes (timeout, 5xx, partial collapse) are part of the test surface, not afterthoughts.


Status

v0.1 — usable. Connection-chain prediction works end-to-end against live marudor data.

Known limitations:

  • Marudor's internal tRPC isn't a public contract; if they change it, the MCP will fall back to db-rest automatically with degraded data and the skill will tell you so.
  • bahn.routing (the journey-search procedure inside marudor) occasionally returns 5xx upstream from DB itself; this is reflected as a transparent fallback to db-rest's /journeys.

Stretch goals (not in v0.1)

  • Loop skill for monitoring a specific train at an interval.
  • Hosted HTTP MCP with SSE transport, so it can be added by URL instead of cloned.
  • Historical baseline collector — per-train on-time stats over weeks, used as a fifth prediction signal.

Credits

  • marudor / bahn.expert — the data source that makes the connection-chain feature possible. Without it this project doesn't exist.
  • db-rest by Jannis R — the stable REST fallback.

License

MIT

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选