mcp-hsl
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., "@mcp-hsl When are the next departures from Kamppi?"
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.
mcp-hsl
MCP server exposing Greater Helsinki (HSL) public-transport data from Digitransit. Covers Helsinki, Espoo, Vantaa, Kauniainen, Kerava, Kirkkonummi, Sipoo, Siuntio, and Tuusula.
Lets an LLM host (Claude Desktop, Claude Code, Cursor, etc.) answer live-transit questions like "next tram from Kamppi to Töölö" or "plan a trip from Otaniemi to Kallio at 5pm".
Prerequisites
Node.js 20.6 or newer (uses native
--env-file).A free Digitransit subscription key (see below).
Related MCP server: gtfs-pro-mcp
Getting a Digitransit API key
Digitransit publishes HSL data through an Azure API Management portal. The key is free and easy to obtain.
Go to https://portal-api.digitransit.fi/ and click Sign up (top rig ht).
Verify your email and sign in.
Open Products → pick Digitransit API (the free tier).
Click Subscribe, give the subscription a name (e.g.
mcp-hsl), and confirm.Under Profile → Subscriptions, reveal the Primary key. That's you r
DIGITRANSIT_SUBSCRIPTION_KEY.
The free tier has generous rate limits (see https://digitransit.fi/en/developers/api-registration/ for current numbers). Keep the key private — treat it like a password.
Install
mcp-hsl is a standard stdio MCP server, so any MCP-compatible host can use it — Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, Zed, and so on.
Option A — CLI (fastest, if your host has one)
# Claude Code
claude mcp add hsl-transit -e DIGITRANSIT_SUBSCRIPTION_KEY=your-key -- npx -y mcp-hslOther hosts (Cursor, VS Code) offer GUI-driven "Add MCP server" flows in their command palettes — same fields as the JSON below.
Option B — Config file
Add this entry to your host's MCP config:
{
"mcpServers": {
"hsl-transit": {
"command": "npx",
"args": ["-y", "mcp-hsl"],
"env": {
"DIGITRANSIT_SUBSCRIPTION_KEY": "your-key-here"
}
}
}
}Where to put it:
Host | Config path | Wrapper key |
Claude Desktop (macOS) |
|
|
Claude Desktop (Windows) |
|
|
Claude Code |
|
|
Cursor |
|
|
VS Code (Copilot) |
|
|
VS Code uses
"servers"instead of"mcpServers"— otherwise the entry is identical.
Restart the host after editing the config. The server should appear as Connected / Ready.
Local development
git clone <this-repo>
cd mcp-hsl
npm install
cp .env.example .env # then fill in DIGITRANSIT_SUBSCRIPTION_KEY
npm run buildRun against your own build:
{
"mcpServers": {
"hsl-transit": {
"command": "node",
"args": [
"--env-file=/absolute/path/to/mcp-hsl/.env",
"/absolute/path/to/mcp-hsl/build/stdio.js"
]
}
}
}The server exits immediately with a clear message if DIGITRANSIT_SUBSCRIPTION_KEY is missing.
Tools
Name | Purpose | Key inputs |
| Place / address → coordinates |
|
| Route between two places |
|
| Next departures from a stop |
|
All three call Digitransit's HSL routing API. plan_journey geocodes both endpoints internally; stop_departures looks up a stop by name if you don't have the HSL ID.
plan_journey modes
Filter transit modes with the modes array: BUS, TRAM, RAIL, SUBWAY, FERRY. Omit to allow any. departureTime is an ISO 8601 timestamp with offset (e.g. 2026-08-13T17:00:00+03:00); defaults to now.
stop_departures name lookup
HSL stop IDs look like HSL:1140447. If you pass stopName and it matches multiple stops (e.g. Kamppi has several platform IDs), the tool returns the candidate list — the LLM then re-calls with the specific stopId.
Example prompts
"Geocode 'Kamppi metro station' in Helsinki."
"When are the next departures from Kamppi?"
"Plan a tram journey from Kamppi to Töölö."
"Get me from Otaniemi to Kallio around 5pm today, no bus."
"Kamppista Töölöön seuraava ratikka?"
Design notes
Transport-agnostic core.
src/server.tsexposes abuildServer()factory that registers tools without touching any transport. To add HTTP later, add a new entry point that callsbuildServer()and wires it toStreamableHTTPServerTransport.Output for LLMs. Tool results are compact plain-text tables/blocks — enough for the model to reason over without wasting tokens on raw GraphQL responses.
Multilingual. Digitransit returns Finnish and Swedish names side by side; the LLM handles user-facing language.
Real-time. Journey legs and departures include real-time state (
SCHEDULED,UPDATED,CANCELED) so the model can distinguish "on time" from "delayed 3 min".
Attribution
Data © Helsinki Region Transport (HSL) and other producers, provided by Digitransit under Creative Commons BY 4.0. This project is not affiliated with HSL or Digitransit.
License
MIT — see LICENSE.
Available Tools
3 toolsgeocodeGeocode a Helsinki placeA
Look up coordinates for an address, place, or landmark in the Greater Helsinki area. Returns up to 10 candidates with Finnish and Swedish names, coordinates, and a confidence score. Use this before plan_journey when you only have a place name.
Inputs: query (required), limit.
plan_journeyPlan a Helsinki transit journeyA
Plan a public-transport journey between two places in Greater Helsinki. Accepts place names or addresses; both endpoints are geocoded internally. Returns up to 5 itineraries, each with legs, modes, line numbers, and real-time status. Departure time defaults to now; provide an ISO 8601 timestamp with offset to plan ahead.
Inputs: origin (required), destination (required), modes, departureTime, +1 more.
stop_departuresNext departures from a stopA
Get the next departures from a Helsinki public-transport stop, including real-time delays. Accepts either a stop name (e.g. 'Kamppi', looked up internally) or an HSL stop ID (e.g. 'HSL:1140447'). If the name matches multiple stops, returns the candidate list so the caller can pick one.
Inputs: stopId, stopName, numberOfDepartures.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 3 tools
Each tool targets a clearly distinct aspect of transit: geocode for place lookup, stop_departures for real-time departures, and plan_journey for routing. The descriptions reinforce these boundaries, making misselection unlikely.
The naming style is lowercase with underscores, but the grammatical patterns vary: 'geocode' is a single verb, 'plan_journey' is verb_noun, and 'stop_departures' is a noun phrase. This mix is readable but not as consistent as a strict verb_noun convention.
Three tools is at the lower end of the typical well-scoped range, but each tool serves a core transit use case. The set feels slightly sparse for a full public-transport domain, but it is not overly thin or bloated.
The tool surface covers the primary journey-planning workflow: geocoding, departures, and route planning. Minor gaps exist such as no tool for disruptions, fares, or stop metadata, but agents can accomplish the main tasks without dead ends.
Related MCP Connectors
Hosted MCP server for live public-data APIs and Skills for AI agents.
The Ferryhopper MCP server is a connector for LLMs and AI Agents in maritime travel that exposes ferry routes, schedules, and booking options. It enables AI assistants to search ports and connections across 33 countries and 190+ ferry operators, provide real-time ferry itineraries with indicative prices, and assist users with planning island-hopping or multi-leg journeys by processing natural language queries about ferry times, passenger counts, and travel durations.
An MCP server that provides an API to LLMs to manage their JumpCloud resources.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceAn MCP server for interacting with the Berlin Public Transport (BVG) API to search for locations and plan journeys. It provides real-time access to departures, arrivals, trip details, and vehicle tracking within Berlin's transit network.MIT
- AlicenseNot gradedqualityDmaintenanceMCP server that provides tools for querying live transit data (stops, departures, routes, vehicles, alerts) from any WP GTFS Pro site, enabling AI assistants to answer rider questions.8 npmGPL 2.0
- FlicenseNot gradedqualityDmaintenanceMCP server providing real-time public transport data for Tomsk, including routes, schedules, stops with lazy OSM enrichment, nearby stop search, and a routing prompt for LLMs.-
- AlicenseAqualityCmaintenanceMCP server for Atlanta MARTA real-time transit data, enabling queries about train arrivals and bus positions via natural language.4MIT