Skip to main content

MCP server for Ireland's NTA public transport — focused, queryable tools with human-readable output. Inspired by ireland-nta-mcp.

Project description

mcp-nta

An MCP server for Ireland's National Transport Authority (NTA) public transport data. Provides focused, queryable tools that return small, human-readable results — not raw feed dumps.

Built with FastMCP. Inspired by ireland-nta-mcp and tfi-gtfs.

Tools

Tool Description
search_transport Find bus stops, train stations, and tram stops by name. Returns IDs, locations, routes served.
search_routes Find routes by number or name.
get_departures Real-time departures from a bus stop, train station, or tram stop, filtered by route/time window.
get_vehicle_positions Live vehicle positions filtered by route or proximity.
get_service_alerts Active service alerts filtered by route or stop.
get_route_transport Ordered list of bus stops, train stations, or tram stops on a route.
nearby_transport Find the nearest bus stops, train stations, and tram stops to a location. Filter by route, radius, or transport type (bus, rail, tram).

Installation

# Using uv
uvx mcp-nta

# Or install with pip
pip install mcp-nta
python -m mcp_nta

Configuration

Environment variables

Variable Required Default Description
NTA_API_KEY Yes API key from the NTA developer portal
NTA_ROUTES No (all routes) Comma-separated whitelist of routes to index (see Route filtering)
NTA_REFRESH_HOURS No 24 How often to re-download GTFS data (in hours)
NTA_TRANSPORT No stdio Transport protocol: stdio, http (streamable HTTP), or sse
NTA_HOST No 0.0.0.0 Bind address (http/sse only)
NTA_PORT No 8000 Port (http/sse only)

Claude Desktop / Claude Code (stdio)

{
  "mcpServers": {
    "nta": {
      "command": "uvx",
      "args": ["mcp-nta"],
      "env": {
        "NTA_API_KEY": "YOUR_KEY",
        "NTA_ROUTES": "37,39a,DART,Green"
      }
    }
  }
}

Remote access (HTTP)

NTA_API_KEY=YOUR_KEY NTA_TRANSPORT=http NTA_PORT=8000 mcp-nta

The server will be available at http://localhost:8000/mcp. Any MCP client that supports streamable HTTP can connect to this URL.

SSE (legacy)

NTA_API_KEY=YOUR_KEY NTA_TRANSPORT=sse NTA_PORT=8000 mcp-nta

Available at http://localhost:8000/sse. Maintained for backward compatibility — prefer http for new deployments.

Route filtering

By default, the server indexes every route in the NTA GTFS feed — over 1,000 routes, ~7 million schedule entries. This works fine but produces a ~400 MB cache and takes a couple of minutes on first start.

Setting NTA_ROUTES restricts the index to only the routes you care about. This dramatically reduces build time, disk usage, and memory:

No filter 37,39a,DART
Cache size ~400 MB ~6 MB
First build ~2 min ~1 min
Memory (build) ~120 MB ~40 MB

Each entry in NTA_ROUTES is matched case-insensitively against either:

  • Route short name — the public-facing route number/name (e.g. 37, 39a, 102, Green, DART)
  • Route typebus, rail, or tram to include all routes of that type

Examples:

# Just a few bus routes
NTA_ROUTES="37,39a,46a"

# All rail + a specific bus
NTA_ROUTES="rail,37"

# All trams (Luas Green and Red lines)
NTA_ROUTES="tram"

# Everything (default when unset)
NTA_ROUTES=""

Only stops served by whitelisted routes are kept. If the filter changes between runs, the database is automatically rebuilt.

Architecture

Static data

On first run, the server downloads two datasets from Transport for Ireland:

  1. GTFS schedule — routes, stops, trips, stop times, and service calendars
  2. NaPTAN stop points — supplementary stop metadata (street names)

These are parsed and stored in a SQLite database at ~/.cache/mcp-nta/gtfs.db. On subsequent starts, the server opens the existing database with no parsing — startup is instant. The database is rebuilt automatically when it expires (controlled by NTA_REFRESH_HOURS) or when the route filter changes.

The SQLite approach means the server never loads the full dataset into memory. Queries read only the specific rows they need via indexed lookups.

Real-time data

Real-time feeds (GTFS-RT) are fetched from the NTA API on demand and cached in memory for 30 seconds:

  • TripUpdates — delays and predicted arrival times
  • VehiclePositions — live GPS positions of vehicles
  • ServiceAlerts — disruption notices

Each tool combines a targeted SQLite query against the static schedule with the relevant real-time feed to produce a concise, human-readable answer.

Example

"What buses are due at Oaktree Green for the 37?"

The LLM calls search_transport(query="Oaktree Green"), gets back stop IDs, then calls get_departures(stop_id="8240DB001682", route="37") and gets:

Upcoming departures from Oaktree Green (stop 8240DB001682) for route 37:

1. 37 -> Wilton Terrace | Due: 14:22 (in 4 min) — scheduled 14:20, +1 min late
2. 37 -> Wilton Terrace | Due: 14:40 (in 22 min) — on time
3. 37 -> Wilton Terrace | Due: 15:03 (in 45 min) — scheduled (no live data)

Two tool calls, two small responses, complete answer.

License

MIT

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

mcp_nta-0.4.0.tar.gz (106.7 kB view details)

Uploaded Source

Built Distribution

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

mcp_nta-0.4.0-py3-none-any.whl (28.7 kB view details)

Uploaded Python 3

File details

Details for the file mcp_nta-0.4.0.tar.gz.

File metadata

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

File hashes

Hashes for mcp_nta-0.4.0.tar.gz
Algorithm Hash digest
SHA256 ca9c8ae7ff888a8457d7c53cb81b64fbad4cfe2898f59d27faf3caab644b8e1b
MD5 8d2d44f60ac3956a85818cdda4b35aa9
BLAKE2b-256 7387d54fe64f5ea9e4d9623aa3252a82fa5633f994d55cdc937cca5962bedb6f

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcp_nta-0.4.0.tar.gz:

Publisher: publish.yml on dmarkey/mcp-nta

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

File details

Details for the file mcp_nta-0.4.0-py3-none-any.whl.

File metadata

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

File hashes

Hashes for mcp_nta-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ac0e7ee0afc76ce56ee43ac0f0be6dfc2bcbb7f13c17c0cdc7958463b6690cc8
MD5 1199dd87f51c22f19890fadf7cab9bc1
BLAKE2b-256 e7400694559f4ef36e2457e4f3c4ea86da505f8a990c41492a74247185348a10

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcp_nta-0.4.0-py3-none-any.whl:

Publisher: publish.yml on dmarkey/mcp-nta

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