# TransportAPI MCP

> TransportAPI connects real-time data streams for all major UK public transit services. Your agent can track bus arrivals, plan multi-modal journeys combining rail, tram, and walking, and check service disruptions across Great Britain instantly.

## Overview
- **Category:** data-analytics
- **Price:** Free
- **Tags:** public-transport, real-time-tracking, journey-planning, bus-schedules, rail-data, transit-api

## Description

**Planning Complex Trips Across Great Britain**

Your agent doesn't need to juggle separate timetables for buses, trains, or underground lines. It generates full **multi-modal itineraries**, mapping the fastest door-to-door route between any two points using a combination of bus, rail, tram, walking, and cycling legs. For detailed railway leg planning, you can calculate specific service options, duration estimates, and required changes between any two UK stations with `get_rail_route`. Furthermore, if your client just needs to know every train that stops at a station—regardless of where it's going or coming from—you run `get_rail_services`.

**Tracking Live Movement: Buses and Trains**

You can pull live data for buses and trains across the entire UK. If you need to know when the next bus is rolling into a specific stop, your agent runs `get_bus_arrivals`, which delivers real-time ETAs and any delay status. To see every scheduled outgoing bus from a location, it uses `get_bus_departures`. Similarly, for trains, tracking is straightforward: you check incoming services at stations with `get_rail_arrivals` to get platform details and ETAs, or list all departing trains using `get_rail_departures`. You'll never have to guess when the next vehicle rolls through; the system delivers live movement data for every major stop and station.

**Identifying Network Issues**

Knowing if things are running late is half the battle. Your agent gathers active alerts and disruption reports across all transport modes—bus, rail, and tram—in Great Britain using `get_updates`. This tool compiles service status information for delays, cancellations, or scheduled engineering works across the network.

**Finding Places and Deep Metadata**

Before you plan anything, you need to find the right spot. You can locate any UK bus stop by name or general area with `search_stops`, which returns the necessary Naptan ID for all other queries. Once you have an ID, your agent pulls deep metadata on that specific bus stop using `get_stop_info`; this data covers served lines and accessibility features. For rail stations, it fetches detailed information about the facility itself, including operating company details, accessibility status, and amenities via `get_station_info`. These tools let you build rich applications around location intelligence.

**Scheduling and Full Line Details**

If you need more than just a few minutes' notice, your agent can pull out the full schedule for any specific UK bus line using `get_timetable`, detailing patterns for weekdays versus weekends. For general rail scheduling details, you can list all scheduled outgoing services at a station (`get_rail_departures`) or fetch deep metadata about the physical location of a train station (`get_station_info`).

## Tools

### get_bus_arrivals
Gets real-time list of incoming bus services, including ETAs and delay status for a specific UK stop.

### get_bus_departures
Retrieves live departures from all bus lines at a given UK stop ID or location.

### get_journey_plan
Plans the fastest door-to-door itinerary using any mix of public transport modes across the UK.

### get_rail_arrivals
Tracks incoming trains at a specific UK rail station, providing ETAs and platform details.

### get_rail_departures
Lists all scheduled outgoing train services from a given UK rail station in real time.

### get_rail_route
Calculates the best service options, duration, and changes between two specific UK rail stations.

### get_rail_services
Lists all train services that call at a station, regardless of their destination or origin.

### search_stops
Finds UK bus stops by name or location to get the necessary Naptan ID for other queries.

### get_station_info
Fetches deep metadata about a rail station, including facilities, accessibility, and operating company details.

### get_stop_info
Retrieves detailed information on a bus stop, covering served lines, accessibility features, and location data.

### get_timetable
Provides the full schedule for a specific UK bus line, detailing patterns for weekdays, weekends, etc.

### get_updates
Gathers active alerts and disruption reports across all modes (bus, rail, tram) in Great Britain.

## Prompt Examples

**Prompt:** 
```
Show me all bus departures from Oxford Circus in the next 30 minutes.
```

**Response:** 
```
Searching for Oxford Circus bus stops... Found stop ID 490007653. Fetching real-time departures: I found 8 buses departing in the next 30 minutes: Route 94 (towards Piccadilly Circus, departing in 2 minutes, on-time), Route 159 (towards Streatham, 5 minutes, delayed 3 minutes), Route 453 (towards Deptford Bridge, 8 minutes, on-time), Route 13 (towards Euston, 12 minutes, on-time), Route 88 (towards Clapham Common, 15 minutes, on-time), Route 113 (towards Edgware, 18 minutes, delayed 5 minutes), Route 94 (towards Acton Green, 22 minutes, on-time), and Route 12 (towards Dulwich Library, 27 minutes, on-time). All services operated by Transport for London. Would you like more details about any specific route?
```

**Prompt:** 
```
What trains are departing from London Paddington to Bristol in the next 2 hours?
```

**Response:** 
```
Fetching rail departures from Paddington (PAD)... I found 6 direct services to Bristol Temple Meads (BRI) in the next 2 hours: GWR 10:15 (arriving 11:52, 1h 37m, Platform 8, on-time), GWR 10:45 (arriving 12:24, 1h 39m, Platform 10, delayed 4 minutes), GWR 11:15 (arriving 12:51, 1h 36m, Platform 8, on-time), GWR 11:32 (arriving 13:14, 1h 42m, Platform 12, on-time), GWR 11:45 (arriving 13:26, 1h 41m, Platform 10, on-time), and GWR 12:02 (arriving 13:41, 1h 39m, Platform 8, on-time). All services operated by Great Western Railway with modern IEP trains. Fastest journey time is 1h 36m. Would you like me to check the calling points for any specific service?
```

**Prompt:** 
```
Plan a journey from Manchester Airport to the city centre using public transport.
```

**Response:** 
```
Planning multimodal journey with TransportAPI... I found 3 options: Option 1 (fastest): Train from Manchester Airport to Manchester Piccadilly — 18 minutes, TransPennine Express or Northern Rail, trains every 10 minutes, fare from £3.50 with contactless, arrive at Piccadilly Gardens in 25 minutes total. Option 2 (direct bus): Metrolink tram from Airport to St Peters Square — 35 minutes, direct service every 12 minutes, fare £3.30 with contactless. Option 3 (budget): Bus 43 from Airport Terminal to Piccadilly Gardens — 55 minutes, Stagecoach service, fare £2.00 with contactless cap. All options show normal service with no disruptions. Would you like real-time departures for any option?
```

## Capabilities

### Plan Multi-Modal Journeys
Generates complete itineraries combining bus, rail, tram, underground, walking, and cycling legs between any two UK points.

### Track Real-Time Arrivals/Departures
Pulls live ETAs and ETDs for buses at stops or trains at stations across Great Britain.

### Identify Network Disruptions
Checks service status across multiple transport modes, providing active alerts on delays, cancellations, or engineering works.

### Search and Detail Locations
Finds specific bus stops or rail stations, returning metadata like accessibility features, served lines, and facilities.

## Use Cases

### The Commuter Needs Morning Status
A user needs to know if their train is delayed. Instead of opening National Rail's website and manually checking, they ask their agent: 'Are there any disruptions on the Northern Line today?' The agent calls `get_updates` first; if clear, it then uses `get_rail_departures` for specific times.

### The Tourist Needs a Multi-Mode Trip
A tourist arrives at Manchester Airport and needs to get downtown. They ask: 'How do I get from the airport to Piccadilly Gardens?' The agent runs `get_journey_plan`, which returns an optimized route combining a tram ride, a walk, and potentially connecting trains.

### The Developer Needs Deep Metadata
Building a public information display for a rail station. The developer uses `get_station_info` to pull facility data (WiFi, ticket machine count) alongside the live service data from `get_rail_services`, making the display comprehensive.

### The Planner Needs Full Schedule Context
A business analyst needs to understand weekend bus frequency. They ask: 'What times does route 73 run on Sunday?' The agent calls `get_timetable` rather than just checking the next departure, giving them the full pattern.

## Benefits

- Real-time accuracy is key. Instead of relying on static timetables, use `get_bus_arrivals` or `get_rail_departures` to get actual ETAs, including delay flags.
- It handles complexity automatically. The `get_journey_plan` tool combines rail, bus, and walking into one itinerary, eliminating the need for multiple API calls.
- Context matters. Use `get_station_info` or `get_stop_info` to provide facility details (e.g., 'Does this station have step-free access?') that enhance the user experience.
- Know what's wrong *before* planning. The `get_updates` tool aggregates disruption alerts across all modes, so your agent can warn users about service changes immediately.
- You don't need to search multiple directories. Start with `search_stops` or `search_stations` to find the required ID, then pass that ID to any of the other tools.

## How It Works

The bottom line is you get a unified API layer that makes multiple separate transit calls feel like one simple conversation.

1. First, subscribe to the server and enter your TransportAPI credentials (App ID and App Key).
2. Your AI client uses natural language commands like 'Plan a trip from A to B' or 'What buses are leaving X?'
3. The agent selects the appropriate tool (`get_journey_plan`, `get_bus_departures`, etc.) and executes it, returning structured data directly to your chat interface.

## Frequently Asked Questions

**How do I find the stop ID needed for `get_bus_departures`?**
First, run `search_stops`. This tool lets you search by name or location and returns the Naptan stop ID. You then pass that exact ID to `get_bus_departures`.

**Is `get_journey_plan` better than calling `get_rail_route` and then adding a bus leg?**
`get_journey_plan` is always better. It's designed for multi-modal trips, calculating the total time from start to finish while combining all necessary steps (train + walk + bus) into one object.

**Can I find out if a train station has WiFi using `get_station_info`?**
Yes. The `get_station_info` tool returns detailed metadata, including facility flags like 'WiFi' and 'step-free access', so you can build features around accessibility.

**What if I only want the full schedule for a bus line without worrying about real-time delays?**
Use `get_timetable`. This tool returns the complete, scheduled pattern (weekday/weekend) for that specific line, giving you historical and planned service data separate from live alerts.

**If I call `get_rail_arrivals` but no trains are scheduled, what kind of error message should I expect?**
The system returns a clean list indicating zero results. You won't get an error code; instead, the API response will show an empty array or a status confirming 'no services found at this time.' This lets your agent handle silence gracefully.

**Does `get_journey_plan` account for transfers that require crossing between different ticketing zones?**
Yes, the plan accounts for necessary zone crossings. It estimates total journey time and includes a note on expected fare costs or required transfer points when combining bus, rail, and underground legs.

**What is the rate limit if I call `get_updates` repeatedly to monitor multiple lines?**
The service enforces standard API rate limits. For high-frequency monitoring, implement backoff logic in your agent code or consider a paid enterprise tier for increased throughput capacity.

**Can I use `get_station_info` to find out about facilities other than WiFi and step-free access?**
The tool covers key operational data points. It provides details on ticket office availability, car park status, cycle storage locations, and general accessibility notes for the specific rail station.

**Can my AI check when the next bus is arriving at a specific UK bus stop?**
Yes! First use `search_stops` to find the bus stop by name or location (e.g., "Oxford Street" or "Piccadilly Circus"). This returns the Naptan stop ID. Then use `get_bus_departures` with that stop ID to see all upcoming departures with expected arrival times, line numbers, destinations, and any delay information. You can also use `get_bus_arrivals` to monitor incoming services. The API provides real-time predictions based on live vehicle tracking across Great Britain.

**How do I plan a complete journey from my hotel to a UK attraction using public transport?**
Use the `get_journey_plan` tool with your hotel address or postcode as the origin and the attraction name or postcode as the destination. The TransportAPI journey planner will return complete multimodal itineraries combining buses, trains, trams, underground (tube), walking, and cycling with departure times, arrival times, total duration, number of changes, detailed legs with line names and operators, walking distances, and real-time disruption alerts. You can also specify a desired departure or arrival time for time-specific planning.

**Can I check if there are any disruptions or engineering works affecting UK rail services?**
Absolutely! Use `get_updates` to fetch current service alerts and disruption notices across the UK transport network. You can filter by mode ("rail" for trains, "bus" for buses) to get targeted alerts. The results include affected lines or stations, disruption descriptions, severity levels, expected duration, and alternative route recommendations. For station-specific information, use `get_rail_departures` or `get_rail_arrivals` which include cancellation and delay indicators for individual services.