irail-mcp
This MCP server provides Belgian railway travel information via the iRail API.
Search Belgian railway stations by name or partial name.
View real-time departures or arrivals from a station.
Find routes/connections between two stations, including transfers.
Get detailed information for a specific train, including stops, delays, and platforms.
Check current network disturbances and planned maintenance.
Use optional language selection: en, nl, fr, de, it.
Run over stdio or Streamable HTTP for desktop or web-based MCP clients.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@irail-mcp Show departures from Brussels Central at 5 PM"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
iRail MCP Server
Disclaimer: This project was vibe coded and is not affiliated with or supported by iRail vzw. Train data may be inaccurate or outdated. Always verify with official sources (belgiantrain.be or the NMBS/SNCB app) before making travel decisions.
A Model Context Protocol (MCP) server that provides Belgian railway travel information via the iRail API.
Features
Search Stations - Find Belgian railway stations by name
Live Departures/Arrivals - Real-time departure and arrival boards
Find Connections - Route planning between stations with transfers
Train Information - Detailed stops, delays, and platforms for a specific train
Network Disturbances - Current disruptions and planned maintenance
Related MCP server: mcp-sbb-transport
Installation
Requires Python 3.11+ and uv.
git clone https://github.com/HansF/irail-mcp.git
cd irail-mcp
uv venv && source .venv/bin/activate
uv pip install -e .Usage with Claude Code
Add to your project's .mcp.json:
{
"mcpServers": {
"irail": {
"command": "uvx",
"args": ["irail-mcp"]
}
}
}Then ask Claude things like:
"What trains leave Brussels Central in the next hour?"
"Find a route from Antwerp to Bruges at 2:30 PM tomorrow"
"Are there any disruptions on the Belgian rail network?"
"Show me details for train IC2240"
Usage over Streamable HTTP (Open WebUI, remote clients)
The server can also be exposed over the MCP Streamable HTTP transport, which is what Open WebUI and most web-based MCP clients expect:
uvx irail-mcp --transport http --host 0.0.0.0 --port 8000The MCP endpoint is then available at http://<host>:8000/mcp and a simple health check at http://<host>:8000/health.
Options:
Flag | Default | Description |
|
|
|
|
| Bind address (use |
|
| Listen port |
|
| Path of the MCP endpoint |
| off | No server-side sessions; each request is independent |
| off | Return plain JSON instead of SSE streams |
| unset | Enable DNS-rebinding protection for the given |
|
|
|
Open WebUI
In Open WebUI go to Admin Panel → Settings → External Tools (or Settings → Tools for a user-level connection), add a new connection with:
Type: MCP (Streamable HTTP)
URL:
http://<host>:8000/mcp
Open WebUI running in Docker cannot reach 127.0.0.1 on the host, so start the server with --host 0.0.0.0 and use the host's LAN address, or host.docker.internal where supported. When exposing the server beyond localhost, put it behind a reverse proxy with authentication; the server itself does not authenticate requests.
Docker
A prebuilt multi-arch image (amd64/arm64) is published to GitHub Container Registry on every push to main (latest) and on version tags:
docker run -d --name irail-mcp -p 8000:8000 ghcr.io/cyberdotgent/irail-mcp:latestOr build it yourself from the included multi-stage Dockerfile. The image runs as a non-root user, exposes the HTTP transport on port 8000 and has a built-in health check.
docker build -t irail-mcp .
docker run -d --name irail-mcp -p 8000:8000 irail-mcpOr with Compose:
docker compose up -dThe MCP endpoint is http://localhost:8000/mcp. Extra arguments are passed straight to the server, so the transport can be changed at run time:
# stdio mode (e.g. for a desktop MCP client that launches Docker)
docker run -i --rm irail-mcp --transport stdio
# HTTP on a custom path with DNS-rebinding protection
docker run -p 8000:8000 irail-mcp --transport http --host 0.0.0.0 --path /irail --allowed-host irail.example.comWhen Open WebUI runs in another container, put both on the same Docker network and use http://irail-mcp:8000/mcp as the URL.
Embedding in your own ASGI app
from irail_mcp.server import build_http_app
app = build_http_app(path="/mcp") # a Starlette app; serve with uvicorn/hypercornTools
search_stations
Search for stations by name.
query(required) - Station name or partial namelang(optional) - Language: en, nl, fr, de, it
get_liveboard
Real-time departures or arrivals from a station.
station(required) - Station namedate(optional) - YYYY-MM-DD, "today", "tomorrow", "+2 days"time(optional) - HH:MM (24h)arrival(optional) - Show arrivals instead of departureslang(optional)
find_connections
Find routes between two stations.
from_station(required) - Departure stationto_station(required) - Destination stationdate,time,lang(optional)arrival_time(optional) - If true, time is desired arrival time
get_train_info
Detailed information about a specific train.
train_id(required) - e.g. "IC1234" or "BE.NMBS.IC1234"date,lang(optional)
get_disturbances
Current network disruptions and planned works.
lang(optional)
Running Tests
uv pip install -e ".[dev]"
python -m pytest tests/ -vAPI Compliance
Rate limited to 3 requests/second per iRail guidelines
Proper User-Agent header set
30-second timeout for slow responses
License
MIT
References
Available Tools
5 toolsfind_connectionsB
Find routes between two stations with connection details
Inputs: to_station (required), from_station (required), date, lang, +2 more.
get_disturbancesA
Get current network disruptions and planned maintenance works
Inputs: lang.
get_liveboardB
Get real-time departures or arrivals from a station
Inputs: station (required), date, lang, time, +1 more.
get_train_infoB
Get detailed information about a specific train including all stops and current delays
Inputs: train_id (required), date, lang.
search_stationsA
Search for railway stations in Belgium by name
Inputs: query (required), lang.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 5 tools
Each tool has a clear, distinct purpose: route planning, disruptions, liveboard, train details, and station search. No overlap.
All tool names follow a consistent verb_noun pattern in snake_case (e.g., find_connections, get_liveboard), making them predictable.
With 5 tools, the set is well-scoped for a railway information server, covering essential operations without being excessive.
The tool surface covers core railway info needs: station lookup, liveboard, connections, train details, and disturbances. No obvious gaps for an informational API.
Maintenance
Related MCP Connectors
iRail MCP — Belgian rail (SNCB/NMBS) real-time via the community iRail API (https://api.irail.be…
Belgian trains for AI agents: live journeys, departures, delays, disruptions. Free, no key.
Stations, connections and departures of Swiss public transport, with real-time delays.
Cached UK train departures and qualified platforms, powered by National Rail Enquiries.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceProvides real-time Dutch Railways (NS) data for journey planning, live departures, disruptions, and station search.3-
- FlicenseNot gradedqualityDmaintenanceEnables querying Swiss public transport (trains, buses, trams, boats) for stations, connections, and station boards via the opendata.ch API.-
- FlicenseNot gradedqualityDmaintenanceMCP server for querying Belgian railway data (SNCB/NMBS) via the iRail API, enabling station search, liveboard, and journey planning.-
- AlicenseNot gradedqualityCmaintenanceProvides real-time Belgian rail (SNCB/NMBS) data via the iRail API, enabling AI agents to query train schedules and live information.83 npmMIT