Skip to main content
Glama

digitraffic-mcp

An MCP server for live Finnish rail and road traffic. The data comes from Fintraffic Digitraffic, which is open data under CC BY 4.0. You don't need an API key.

All times are Finnish local time (Europe/Helsinki).

Tools

Tool

What it answers

find_station

Finds a station's short code from its name ("Tampere" → TPE)

station_board

Live departures or arrivals at a station, with estimates, delays, tracks and cancellations

train_connections

Direct trains between two stations, with travel time and live delay

train_status

One train's current delay, last station, next stop, GPS position and speed, delay causes, and stop-by-stop times

road_weather

Live readings from road weather stations: air and road temperature, wind, precipitation, visibility, road condition, friction and warnings

traffic_messages

Active incidents, roadworks, weight restrictions and oversize transports. Filter by road number, area or distance from a point

find_weather_cameras

Road weather cameras near a point or matching a name

get_weather_camera_image

The latest camera image, returned as an MCP image so the model can look at the road

Example questions:

  • "Is the next IC from Helsinki to Tampere on time?"

  • "Where is train 9 right now?"

  • "What's the road surface like on vt4 near Jyväskylä? Show me a camera."

  • "Any roadworks on road 22 this week?"

Related MCP server: trafikverket-mcp

Setup

npm install   # also builds dist/ (via the prepare script)

Claude Code

claude mcp add digitraffic -- node /absolute/path/to/digitraffic-mcp/dist/index.js
claude mcp list   # check that it connects

Replace /absolute/path/to/digitraffic-mcp with where you cloned the project. Running pwd in the project folder prints it.

Inside a session, /mcp shows the server status and its tools.

Other MCP clients

Clients that use an mcpServers JSON config (for example Claude Desktop's claude_desktop_config.json):

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

Development

npm test           # unit + MCP-level tests (offline, fetch is stubbed)
npm run lint       # Biome lint
npm run typecheck  # tsc, including the check that output schemas match the result types
npm run smoke      # end-to-end: starts the server and calls every tool against the live API
npx tsx scripts/call.ts station_board '{"station":"HKI","limit":5}'   # ad-hoc tool call

Layout:

  • src/http.ts: the fetch wrapper. It sends the Digitraffic-User header, uses gzip, gives each request a 15 s deadline (retry included), retries once on network errors, 429 and 5xx, refuses images over 5 MB, and keeps an in-memory TTL cache capped at 500 entries.

  • src/rail.ts: the rail API calls and pure functions that shape the responses.

  • src/road.ts: road weather, traffic messages and weather cameras.

  • src/server.ts: the MCP tool definitions.

  • src/schemas.ts: the tools' output schemas. Every tool returns structuredContent matching its schema, and the same JSON as text for clients that don't read structured content.

Configuration: set DIGITRAFFIC_USER to change the client identifier sent in the Digitraffic-User header. The default is digitraffic-mcp/<version>, e.g. digitraffic-mcp/0.1.0.

Notes

  • Station names, traffic message texts and delay-cause names come from the API in Finnish. The server instructions tell the model to translate them.

  • Station search ignores diacritics ("Jyvaskyla" finds Jyväskylä) and knows a few English names ("Helsinki airport" → LEN).

  • Camera images come with their capture time and age, plus a warning when the image is over 30 minutes old.

  • Caching: metadata such as stations and cause codes is kept for 24 hours, station and camera lists for 1 hour, live data for 10–60 seconds.

  • Attribution: data © Fintraffic / digitraffic.fi, licensed CC BY 4.0.

Available Tools

8 tools
find_stationFind railway stationA
Read-only

Search Finnish railway stations by name or short code (e.g. 'Tampere', 'HKI', 'Pasila'). Returns short codes used by other rail tools.

Inputs: query (required), include_non_passenger. Returns: stations

find_weather_camerasFind road weather camerasA
Read-only

Find Finnish road weather cameras near a point or by name text. Returns camera views (preset ids), image URLs and capture times. Use get_weather_camera_image to look at a view.

Inputs: lat, lon, limit, query. Returns: cameras

get_weather_camera_imageGet weather camera imageA
Read-only

Fetch the latest JPEG from a road weather camera view, to visually check road and weather conditions.

Inputs: preset_id (required), thumbnail. Returns: caption, mimeType, presetId, capturedAt

road_weatherRoad weatherA
Read-only

Live readings from Finnish road weather stations: air and road surface temperature, wind, precipitation, visibility, road condition (dry/wet/icy/snowy), friction and warnings. Find stations by coordinates, by name/road text (e.g. 'vt4 Jyväskylä', 'Espoo') or by station id.

Inputs: lat, lon, limit, query, +2 more. Returns: stations

station_boardStation departures/arrivalsA
Read-only

Live departure or arrival board for a Finnish railway station: upcoming trains with scheduled and estimated times, delay, track and cancellations.

Inputs: station (required), kind, limit, include_all_trains. Returns: kind, trains, station, generatedAt

traffic_messagesTraffic messagesA
Read-only

Active Finnish road traffic messages: incidents/announcements (accidents, bad driving conditions, closures), roadworks, weight restrictions, or exempted (oversize) transports. Filter by road number, area text (municipality/region), or distance from a point.

Inputs: lat, lon, area, road, +3 more. Returns: type, shown, matched, messages

train_connectionsDirect trains between stationsB
Read-only

Direct trains from one Finnish station to another, with departure/arrival times, live delays, tracks and travel time.

Inputs: to (required), from (required), date, after, +1 more. Returns: to, date, from, connections

train_statusTrain statusA
Read-only

Current status of a train by number: delay, last reported station, next stop, GPS location and speed, delay causes, and the stop-by-stop timetable with actual/estimated times.

Inputs: train_number (required), date, include_pass_through. Returns: via, stops, train, origin, +12 more

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.9/5.0

    Scored across 8 tools

    Disambiguation5/5

    Each tool targets a distinct resource or action: train-specific status, station search, station boards, connections, road readings, traffic messages, camera discovery, and camera image fetching. The two camera tools are clearly split into find vs. fetch, and rail tools separate station-level, train-level, and route-level queries.

    Naming Consistency3/5

    The set mixes verb_noun names like find_station and get_weather_camera_image with noun_phrase names like train_status and station_board. It remains readable, but there is no single predictable convention across all eight tools.

    Tool Count5/5

    Eight tools is well-scoped for a Finnish transport data server spanning rail and road/weather use cases. Each tool has a clear role and no tools appear redundant or unnecessary.

    Completeness4/5

    The rail side covers station lookup, station boards, train status, and direct connections, while the road side covers weather readings, traffic messages, and camera discovery/image retrieval. Minor gaps exist, such as no dedicated rail disruption message feed or weather forecast capability, but core workflows are covered.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      C
      maintenance
      Provides access to real-time Danish road traffic events, roadworks, and queues via public data from Vejdirektoratet, enabling AI assistants to check road conditions without any API keys.
      3
      MIT
    • A
      license
      A
      quality
      C
      maintenance
      Provides real-time access to Swedish road weather, traffic cameras, road conditions, and traffic flow data from Trafikverket (Swedish Transport Administration). Enables users to query weather stations, cameras, traffic situations, and flow data through natural language.
      10
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Provides real-time Swiss railway information including departures, connections, train composition, occupancy forecasts, disruptions, and pricing, accessible via natural language in over 100 languages.
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      Enables querying Norwegian traffic messages (roadworks, closures, detours) from Statens vegvesen, filtered by route and time window. Supports both current and future travel times, with tools for route-based and general searches.
      3
      MIT