hafasmcp
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
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.