Hafasmcp
FreeNot checkedMCP server for real-time German public transport data (HAFAS/VBN network). Enables querying departures, arrivals, journeys, and nearby stops using natural langu
About
MCP server for real-time German public transport data (HAFAS/VBN network). Enables querying departures, arrivals, journeys, and nearby stops using natural language.
README
[!NOTE] vibe-coded ✨
hafasmcp
MCP server for real-time German public transport data via HAFAS. Lets Claude (or any MCP client) query departures, arrivals, journeys, and nearby stops — currently configured for the VBN network (Lower Saxony / Bremen).
No API key needed. Uses the same public HAFAS API as fahrplaner.vbn.de.
Tools
| Tool | Description |
|---|---|
locations |
Search stops, addresses, or POIs by name |
departures |
Upcoming departures from a stop |
arrivals |
Upcoming arrivals at a stop |
journeys |
Route planning between two locations |
nearby |
Find stops near a coordinate |
Quick Start
With Claude Code (stdio)
Add to your MCP config:
{
"mcpServers": {
"hafas": {
"command": "node",
"args": ["dist/index.js"],
"cwd": "/path/to/hafasmcp"
}
}
}
With Docker (HTTP + OAuth 2.1)
cp .env.example .env
docker compose up -d
This starts the HTTP server on port 3000 with a Cloudflare quick tunnel for remote access.
Local Development
npm install
npm run build
npm start # stdio mode
npm run start:http # HTTP mode with OAuth 2.1
Environment Variables
| Variable | Default | Description |
|---|---|---|
PORT |
3000 |
HTTP server port |
ISSUER_URL |
http://localhost:$PORT |
OAuth 2.1 issuer URL |
How It Works
The server wraps hafas-client with the VBN profile and exposes it as MCP tools. Two transport modes:
- Stdio — for local MCP clients like Claude Code, zero config
- HTTP — for remote access, with full OAuth 2.1 (dynamic client registration, PKCE, auto-approve)
Example
Ask Claude:
"Wann fährt die nächste Straßenbahn vom Hauptbahnhof Bremen?"
Claude will use locations to find the stop ID, then departures to get real-time data — all in under a second.
Stack
TypeScript, Node.js, hafas-client, @modelcontextprotocol/sdk, Express 5
License
ISC
Installing Hafasmcp
This server has no published package — it is built from source. Open the repository and follow its README.
▸ github.com/mchristoffers/hafasmcpFAQ
Is Hafasmcp MCP free?
Yes, Hafasmcp MCP is free — one-click install via Unyly at no cost.
Does Hafasmcp need an API key?
No, Hafasmcp runs without API keys or environment variables.
Is Hafasmcp hosted or self-hosted?
Self-hosted: the server runs locally on your machine via the install command above.
How do I install Hafasmcp in Claude Desktop, Claude Code or Cursor?
Open Hafasmcp on unyly.org, pick your client tab (Claude Desktop, Claude Code, Cursor) and press Install — the config is generated automatically, no JSON editing.
Related MCPs
GitHub
PRs, issues, code search, CI status
by GitHubFilesystem
Secure file operations with configurable access controls.
Memory
Knowledge graph-based persistent memory system.
Template MCP Server
A CLI tool to create a new Model Context Protocol server project with TypeScript support, dual transport options, and an extensible structure
by mcpdotdirectCompare Hafasmcp with
Not sure what to pick?
Find your stack in 60 seconds
Author?
Embed badge for your README
Browse similar
All development MCPs
