# TfL MCP

> TfL MCP Server gives your AI client real-time access to London transport data. You can track tube and bus arrivals, plan door-to-door journeys across multiple modes (bus, train, bike), check live line status, and monitor road disruptions—all from a single conversation.

## Overview
- **Category:** government-public-data
- **Price:** Free
- **Tags:** public-transport, real-time-data, journey-planning, api-integration, urban-mobility, transit-tracking

## Description

**TfL MCP Server - London Transport Data API**

Man, this thing gives your AI client real-time access to every piece of data running through London's transit system. Forget jumping between half a dozen different apps or staring at physical arrival boards that are always wrong. Your agent acts like a dedicated transport analyst and journey planner, handling everything from complex door-to-door trips to checking if the Overground is even running today.

### Planning Trips Across London

When you need someone to figure out how to get from point A to point B, your client uses **get_journey**, which calculates multiple travel options combining walking, cycling, tube, and bus into one full itinerary. It gives total duration and step-by-step instructions for the whole ride. To make sure it knows what modes are even available, it calls **get_modes**, listing every method of travel in the London network, like tram or underground. If you're trying to get somewhere specific—whether it's a museum or just a weird corner—you can use **get_place_search** to locate Points of Interest across London by category or coordinates.

### Tracking Movement and Stops

For live updates, your agent uses **get_arrivals**, which predicts the next arrival time for any specific Tube, bus, DLR, tram, or river vehicle at a known TfL stop point. If you're starting with just a name or an address, you gotta find the actual station ID first; that's where **search_stop_point** comes in, locating and returning IDs for stops based on common names or street addresses. For bike commuters, it handles two things: **get_bike_points** lists all nearby docking stations across London coverage areas, showing exactly how many bikes are available and how many docks are empty. If you only care about one specific station, **get_bike_point** gives the detailed status and location data for that single Santander Cycles dock.

### Checking System Health and Roads

To know if things are messed up, your agent checks multiple systems. It runs **get_line_status**, which reports the current service status—like Good Service or Minor Delays—for any specified TfL line system-wide. For road travel, it pulls fresh data on closures and disruptions using **get_road_disruptions**, telling you what caused a closure and which roads are affected. If you're just checking if a specific artery like the A40 is open for driving, you use **get_road_status**. For general infrastructure knowledge, **get_stop_point_details** gives full metadata on one stop point, including its fare zone, accessibility features, and station type. Finally, if someone's driving into London, your client can check vehicle compliance by using **get_vehicle_details**, confirming if a specific registration number meets ULEZ or Congestion Charge rules.

This server lets you build complex logic right inside your agent. You don't need to manually query for arrivals, then check the line status, and *then* find the nearest station; all those steps happen automatically from one conversation.

## Tools

### get_arrivals
Predicts the next arrival time for a specific Tube, bus, DLR, tram, or river vehicle at any known TfL stop point.

### get_bike_point
Provides detailed status and location data for one specific Santander Cycles docking station.

### get_bike_points
Lists all nearby bike docking stations, showing available bikes and empty docks across London coverage areas.

### get_journey
Calculates multiple travel options between two points using a mix of tube, bus, walking, cycling, etc., providing full step-by-step instructions.

### get_line_status
Checks the current service status and disruption details for any specific TfL line or transport mode system-wide.

### get_modes
Lists every available method of travel within the London network, like bus, tube, walking, and tram.

### get_place_search
Finds specific places or points of interest in London by category (e.g., museum, park) using location data.

### get_road_disruptions
Retrieves current information on road closures and disruptions, including the cause and affected road segments.

### get_road_status
Checks the operational status of specific London roads or corridors (e.g., A40) for driving purposes.

### get_stop_point_details
Gives full metadata on a single TfL stop point, including accessibility, fare zone, and station type details.

### get_vehicle_details
Checks if a specific vehicle registration number complies with ULEZ or Congestion Charge rules for driving in London.

### search_stop_point
Locates and returns IDs for TfL stops based on a common name, street address, or desired transport mode.

## Prompt Examples

**Prompt:** 
```
When is the next Northern Line train arriving at Bank station?
```

**Response:** 
```
Searching for Bank station (stop ID: 940GZZLUBNK)... Next Northern Line arrivals: High Barnet — 2 minutes, via Charing Cross; Morden — 5 minutes, via Bank; High Barnet — 8 minutes, via Charing Cross; Morden — 12 minutes, via Bank. All services running on time with no disruptions reported. Platform information and carriage details available upon request.
```

**Prompt:** 
```
How many Santander Cycles are available near Hyde Park Corner?
```

**Response:** 
```
Checking Santander Cycles docking stations near Hyde Park Corner... Found 5 nearby docks: Hyde Park Corner Station — 12 bikes available, 6 empty docks; Apsley Way — 8 bikes, 4 empty; Wellington Arch — 15 bikes, 3 empty; Hyde Park North — 6 bikes, 12 empty; Knightsbridge — 10 bikes, 8 empty. All stations operational with real-time data. Would you like directions to the dock with the most bikes?
```

**Prompt:** 
```
What is the status of the Victoria Line and Jubilee Line right now?
```

**Response:** 
```
Checking TfL line status... Victoria Line: Good Service — trains running frequently with no reported delays. Jubilee Line: Minor Delays — signal failure at Westminster causing 5-10 minute delays eastbound. Expected resolution by 18:30. All other Underground lines running normally. Would you like me to suggest alternative routes if you are traveling on the Jubilee Line?
```

## Capabilities

### Plan Multimodal Journeys
The agent generates door-to-door itineraries combining walking, cycling, and all major transport lines, including total duration and transfer points.

### Check Real-Time Arrivals
You get live predicted arrival times for any specific bus stop or Tube station point across the entire London network.

### Monitor Line Status
The agent reports the current service status (Good Service, Minor Delays, Suspended) for any specified TfL line system-wide.

### Search Locations & Stops
You find specific stop points or Points of Interest in London by searching names, categories, or geographical coordinates.

### Check Road Conditions
The agent pulls current data on road closures and disruptions across specified routes in London.

## Use Cases

### The commuter needs a last-minute detour.
A user asks: 'What should I do if the Jubilee Line is delayed?' The agent first calls `get_line_status` to confirm delays. Then, it uses `get_journey` to plan an alternative route via Overground and walking, providing immediate alternatives.

### The tourist needs a bike-to-bus path.
A user asks: 'How do I get from the central park entrance to the main station?' The agent uses `get_bike_points` for nearby docks, combines that with walking distance (via `get_journey`), and finishes by planning a bus leg.

### The developer needs robust location data.
A service requires knowing the exact details of every stop. Instead of just using coordinates, the agent calls `get_stop_point_details` to confirm if the station is step-free and in which fare zone.

### The logistics team plans a delivery route.
A driver needs directions: 'Drive from point A to B, checking for issues.' The agent first calls `get_road_status` to check the main routes and then checks `get_road_disruptions` to warn about unexpected closures.

## Benefits

- **Multimodal Trip Planning:** Forget manual route building. The `get_journey` tool combines walking, cycling, bus, and tube into one itinerary, giving you total time and transfer instructions instantly.
- **Real-Time Service Awareness:** Don't guess if a line is running. Use `get_line_status` to check the current operational status of every Tube or Overground line system-wide before planning anything.
- **Deep Location Context:** Need more than just coordinates? `get_stop_point_details` provides essential metadata like accessibility, fare zone, and station type for accurate app design.
- **Bike & Walk Integration:** The server handles bike share availability. Use `get_bike_points` to show users exactly how many bikes are docked at a specific location near their destination.
- **Driver Compliance Check:** Before displaying routing options, use `get_vehicle_details`. This confirms if the user’s vehicle is ULEZ compliant or exempt from the Congestion Charge.
- **Comprehensive Search:** Need to find an amenity? The `get_place_search` tool lets you search for things like 'Museum' or 'Park' near any given location, making your app richer.

## How It Works

The bottom line is, your AI acts as a dedicated London transit expert that knows exactly which piece of data it needs to pull to answer your question.

1. Subscribe to the server, then input your TfL Application ID and Key from the developer portal.
2. Your AI client connects using these credentials. It establishes a live connection to the transport data stream.
3. You ask for directions or status updates in natural conversation; the agent runs the necessary tools and gives you a clear answer.

## Frequently Asked Questions

**How do I use get_journey to find a cycling route?**
The agent handles this automatically. Just ask for 'a trip from A to B,' and specify or let it know you want to cycle. It will run `get_bike_points` and factor the biking distance into the total time.

**Does get_line_status tell me if a bus is running?**
No, `get_line_status` reports on the overall operational status of the entire line (e.g., 'Good Service'). For specific buses, you must use `get_arrivals` and provide a specific stop ID.

**What's the difference between get_road_disruptions and get_road_status?**
`get_road_status` gives general operational info for a road (is it open?). `get_road_disruptions` is more specific, telling you *why* it's disrupted—like 'Roadworks' or 'Incident'.

**Do I need to run search_stop_point before get_arrivals?**
Yes. The `get_arrivals` tool requires a precise Stop ID (e.g., 940GZZLUSCL). You must first use `search_stop_point` to find that specific ID using the location name.

**How do I authenticate my agent when using the `get_arrivals` tool?**
You must provide your TfL Application ID and Key during setup. The server requires these credentials to make live API calls, ensuring authorized access to real-time data.

**What specific accessibility information does the `get_stop_point_details` tool return?**
The tool returns detailed stop metadata including step-free access availability and lift status. This helps users plan journeys with mobility needs, going beyond just location coordinates.

**How does the `get_vehicle_details` tool help me verify driving compliance in London?**
It checks vehicle registration against ULEZ and Congestion Charge rules. You input a license plate, and it verifies if the car can legally drive in central London zones.

**If I need to query many docking stations, what are the best practices when using `get_bike_points`?**
Check the rate limit documentation. For large areas, process queries in batches rather than single calls. This prevents throttling and keeps your workflow running smoothly.

**Can my AI check when the next Tube train is arriving at my station?**
Yes! First use `search_stop_point` with the station name (e.g., "Oxford Circus", "King's Cross") to find the stop ID. Then use `get_arrivals` with that stop ID to get real-time arrival predictions with line names, destinations, time to station in minutes, and platform information. This covers all TfL modes including Tube, bus, DLR, Overground, Elizabeth line, tram, river, and cable-car.

**How do I plan a journey from Heathrow Airport to central London using public transport?**
Use the `get_journey` tool with "Heathrow Airport" as the origin and your destination (e.g., "Oxford Circus", "Tower Bridge"). The TfL Journey Planner will return multiple route options combining Elizabeth line, Piccadilly line, Heathrow Express, and connecting Tube/bus services. Each option includes total duration, fare estimates, walking distances, number of interchanges, and step-by-step instructions with station sequences. You can also specify preferences for accessibility or cycling options.

**Are there any Tube line closures or major disruptions right now?**
Use `get_line_status` with modes="tube" to check all Tube line statuses, or call it without a mode filter for system-wide status across all transport modes. This returns each line's current status (Good Service, Minor Delays, Severe Delays, Part Suspended, Planned Work) with detailed descriptions and reasons. Always check this before planning any London journey to avoid unexpected disruptions.