Skip to main content

MCP server for Belgian railway data via the iRail API

Project description

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

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"

Tools

search_stations

Search for stations by name.

  • query (required) - Station name or partial name
  • lang (optional) - Language: en, nl, fr, de, it

get_liveboard

Real-time departures or arrivals from a station.

  • station (required) - Station name
  • date (optional) - YYYY-MM-DD, "today", "tomorrow", "+2 days"
  • time (optional) - HH:MM (24h)
  • arrival (optional) - Show arrivals instead of departures
  • lang (optional)

find_connections

Find routes between two stations.

  • from_station (required) - Departure station
  • to_station (required) - Destination station
  • date, 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/ -v

API Compliance

  • Rate limited to 3 requests/second per iRail guidelines
  • Proper User-Agent header set
  • 30-second timeout for slow responses

License

MIT

References

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

irail_mcp-0.2.0.tar.gz (35.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

irail_mcp-0.2.0-py3-none-any.whl (32.5 kB view details)

Uploaded Python 3

File details

Details for the file irail_mcp-0.2.0.tar.gz.

File metadata

  • Download URL: irail_mcp-0.2.0.tar.gz
  • Upload date:
  • Size: 35.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for irail_mcp-0.2.0.tar.gz
Algorithm Hash digest
SHA256 3eb6ed86daf96faf4006bc2d8e2d6e72918d752abe6d24438a79de2e5be6ea4c
MD5 d022224c73f854d42a5d05bc39a5d6ee
BLAKE2b-256 eec8a49e795f21cd0dc8e7df4f44db8656bf7d64dd9471b8df24f1bb2bef926b

See more details on using hashes here.

Provenance

The following attestation bundles were made for irail_mcp-0.2.0.tar.gz:

Publisher: publish.yml on HansF/irail-mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file irail_mcp-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: irail_mcp-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 32.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for irail_mcp-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6a6712a8a7906d1c22b97ff786b12413ccffbb57837ee9c86b0575eca1d59ae4
MD5 3935ac1fa11a517c2dcad39d2c42b5e6
BLAKE2b-256 f86067d8a7312f51f8ea5a6beb85e564e983241f567ff8bde5c5b504cd78d203

See more details on using hashes here.

Provenance

The following attestation bundles were made for irail_mcp-0.2.0-py3-none-any.whl:

Publisher: publish.yml on HansF/irail-mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page