Skip to main content
Glama
anoopt

TfL Journey Status MCP Server

by anoopt

TfL (Transport for London) Status & Journey Planner MCP Server

This Model Context Protocol (MCP) server provides AI assistants with access to real-time Transport for London data through a set of automated tools.

⚠️ Important Disclaimer: This is not an official Transport for London (TfL) MCP server. This is an independent project that uses the publicly available TfL Unified API to provide transport data. It is not affiliated with, endorsed by, or officially supported by Transport for London.

Demo Video

TfL MCP Server Demo

Related MCP server: mcp-tfl-journey

πŸš‡ What This MCP Server Does

This server enables AI assistants (like Claude Desktop and VS Code GitHub Copilot) to access live TfL data by providing three main capabilities:

πŸ”§ Available Tools

  1. get_line_status - Get the current status of any TfL line (e.g., Central, Victoria, Piccadilly)

  2. get_line_status_detail - Get detailed status information including disruption details for a TfL line

  3. plan_journey - Plan journeys between two locations using the TfL Journey Planner

🎯 Use Cases

With this MCP server connected, AI assistants can help users:

  • Check if their tube line is running normally before commuting

  • Get detailed information about service disruptions

  • Plan optimal routes between London locations

  • Provide real-time transport advice for London travel

Example interactions:

  • "Is the Central line running normally?"

  • "Plan a journey from King's Cross to Heathrow Airport"

  • "What's causing delays on the Northern line today?"

Let's set things up!

🚦 Getting Started

Choose your preferred installation method:

The easiest way to use this MCP server is through npm:

Installation

npm install -g london-transport-mcp

πŸ” Set up your TfL API key

You can get a free API key from the TfL API Portal.

Method 1: Environment Variable (Recommended) Set the environment variable in your system:

# Windows (PowerShell)
$env:TFL_API_KEY="your_actual_tfl_api_key_here"

# macOS/Linux
export TFL_API_KEY="your_actual_tfl_api_key_here"

Method 2: MCP Configuration Include the API key directly in your MCP configuration (see examples below).

AI Assistant Configuration

For Claude Desktop (Settings β†’ Developers β†’ Edit Config):

{
  "mcpServers": {
    "london-transport": {
      "command": "npx",
      "args": ["london-transport-mcp"],
      "env": {
        "TFL_API_KEY": "your_actual_tfl_api_key_here"
      }
    }
  }
}

For VS Code GitHub Copilot (Settings β†’ GitHub Copilot β€Ί MCP: Servers):

{
  "london-transport": {
    "command": "npx",
    "args": ["london-transport-mcp"],
    "env": {
      "TFL_API_KEY": "your_actual_tfl_api_key_here"
    }
  }
}

That's it! No manual installation or path configuration required.


πŸ› οΈ Option 2: Local Development Setup

For developers who want to modify the code or contribute:

βš™οΈ Prerequisites

Before starting, please ensure you have:

Warning: if you run with a lower version of Node, fetch won't be present. Tools use fetch to make HTTP calls. To work around this, you can modify the tools to use node-fetch instead. Make sure that node-fetch is installed as a dependency and then import it as fetch into each tool file.

πŸ“₯ Installation & Setup

1. Clone the repository

git clone https://github.com/anoopt/london-tfl-journey-status-mcp-server.git
cd london-tfl-journey-status-mcp-server

2. Install dependencies

npm install

πŸ” Set up your TfL API key

3. Configure your TfL API key

Create a .env file in the project root with your TfL API key:

TFL_API_KEY=your_actual_tfl_api_key_here

You can get a free API key from the TfL API Portal.

πŸ§ͺ Test the MCP Server with Postman

We strongly recommend testing your MCP server with Postman before connecting it to an AI assistant. The Postman Desktop Application provides the easiest way to run and test MCP servers.

Step 1: Download Postman Desktop

Download the latest Postman Desktop Application from postman.com/downloads.

Step 2: Create an MCP Request

  1. Open Postman Desktop

  2. Create a new MCP Request (see the documentation for detailed steps)

  3. Set the type to STDIO

  4. Set the command to the full path to your node executable followed by the full path to mcpServer.js

To get the required paths, run these commands in your terminal:

# Get the full path to node
which node

# Get the full path to mcpServer.js  
realpath mcpServer.js

# Check your node version (should be 18+)
node --version

Example command format:

/usr/local/bin/node /full/path/to/TfL-Status-MCP-Server/mcpServer.js

Step 3: Test Your Tools

  1. Click Connect in your Postman MCP Request

  2. You should see the three TfL tools listed

  3. Test each tool:

    • Try get_line_status with lineId: "central"

    • Try plan_journey with fromLocation: "King's Cross" and toLocation: "Westminster"

    • Try get_line_status_detail with lineId: "piccadilly"

If all tools work correctly in Postman, you're ready to connect to an AI assistant!

πŸ€– Connect to AI Assistants

Once you've tested with Postman, you can connect your MCP server to AI assistants:

For Local Development Setup (Option 2)

If you're using the local development setup, you'll need to specify full paths:

Claude Desktop

Step 1: Use the same node and mcpServer.js paths from the Postman testing step.

Step 2: Open Claude Desktop β†’ Settings β†’ Developers β†’ Edit Config and add:

{
  "mcpServers": {
    "london-transport": {
      "command": "node",
      "args": ["/full/path/to/mcpServer.js"]
    }
  }
}

Step 3: Restart Claude Desktop and verify the MCP server shows with a green circle.

VS Code GitHub Copilot

Step 1: Install the GitHub Copilot extension in VS Code if you haven't already.

Step 2: Open VS Code β†’ Settings (Ctrl+,) β†’ Search for "MCP" β†’ GitHub Copilot β€Ί MCP: Servers

Step 3: Add your TfL MCP server configuration:

{
  "london-transport": {
    "command": "node",
    "args": ["/full/path/to/mcpServer.js"]
  }
}

Step 4: Restart VS Code and the MCP server will be available to GitHub Copilot.

Now you can ask your AI assistant things like:

  • "Check the status of the Central line"

  • "Plan a journey from London Bridge to Camden Town"

Additional Options

πŸ› οΈ List Available Tools

View all available tools and their parameters:

npm run list-tools

πŸš€ Quick Postman Integration

Open Postman with the correct MCP configuration automatically:

npm run postman

🐳 Docker Deployment (Production)

For production deployments, you can use Docker:

1. Build Docker image

docker build -t <your_server_name> .

2. AI Assistant Integration

Add Docker server configuration to your AI assistant:

For Claude Desktop (Settings β†’ Developers β†’ Edit Config):

{
  "mcpServers": {
    "tfl-status": {
      "command": "docker",
      "args": ["run", "-i", "--rm", "--env-file=.env", "tfl-mcp-server"]
    }
  }
}

For VS Code GitHub Copilot (Settings β†’ GitHub Copilot β€Ί MCP: Servers):

{
  "tfl-status": {
    "command": "docker",
    "args": ["run", "-i", "--rm", "--env-file=.env", "tfl-mcp-server"]
  }
}

Add your environment variables (API keys, etc.) inside the .env file.

The project comes bundled with the following minimal Docker setup:

FROM node:22.12-alpine AS builder

WORKDIR /app
COPY package.json package-lock.json ./
RUN npm install

COPY . .

ENTRYPOINT ["node", "mcpServer.js"]

🌐 Streamable HTTP

To run the server with Streamable HTTP support, use the --streamable-http flag. This launches the server with the /mcp endpoint enabled:

node mcpServer.js --streamable-http

🌐 Server-Sent Events (SSE)

To run the server with Server-Sent Events (SSE) support, use the --sse flag. This launches the server with the /sse and /messages endpoints enabled:

node mcpServer.js --sse

πŸ–₯️ Stdio (Standard Input/Output)

To run the server using standard input/output (stdio), simply run the script without any flags. This mode is ideal for CLI tools or programmatic integration via stdin and stdout.

node mcpServer.js

πŸ› οΈ Extending the Server

To add more TfL API endpoints or other transport APIs:

  1. Create new tool files in the tools/tfl/ directory

  2. Follow the pattern in existing tools like tools/tfl/status.js

  3. Add your new tool file to tools/paths.js

  4. Test with Postman before deploying

πŸ“š API Reference

This server uses the Transport for London Unified API. All tools automatically include your API key from the .env file.

βž• Adding New Tools

Extend your MCP server with more tools easily:

  1. Visit Postman MCP Generator.

  2. Pick new API request(s), generate a new MCP server, and download it.

  3. Copy new generated tool(s) into your existing project's tools/ folder.

  4. Update your tools/paths.js file to include new tool references.

πŸ’¬ Questions & Support

Visit the Postman MCP Generator page for updates and new capabilities.

Join the #mcp-lab channel in the Postman Discord to share what you've built and get help.

Available Tools

3 tools
get_line_statusC

Get the status of a TfL line from the Transport for London Unified API.

ParametersJSON Schema
NameRequiredDescriptionDefault
lineIdYesThe identifier of the line to query (e.g., victoria, central).
app_keyNoOptional application key for the API.

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden but only states it retrieves status without detailing behavioral traits like rate limits, error handling, authentication needs (beyond the optional app_key parameter), or response format. It lacks crucial context for a read operation.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with zero waste, front-loading the core purpose. It's appropriately sized for a simple tool, making it easy to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations and no output schema, the description is incomplete for a tool that likely returns structured status data. It fails to explain what 'status' entails (e.g., disruptions, operational state) or provide context on the API's behavior, leaving significant gaps for agent usage.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents both parameters (lineId and app_key). The description adds no additional meaning beyond what the schema provides, such as examples of line status outputs or API specifics, meeting the baseline for high coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('Get') and resource ('status of a TfL line'), specifying it uses the Transport for London Unified API. However, it doesn't distinguish from sibling 'get_line_status_detail', leaving some ambiguity about scope differences.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives like 'get_line_status_detail' or 'plan_journey'. The description implies a simple status query but offers no explicit context or exclusions for usage.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_line_status_detailC

Get the status and details of a TfL line.

ParametersJSON Schema
NameRequiredDescriptionDefault
lineIdYesThe identifier of the line to query (e.g., victoria, central).
app_keyNoOptional application key for authentication.

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool retrieves status and details but does not mention critical aspects like authentication requirements (implied by the optional 'app_key' parameter), rate limits, error handling, or the format of returned data. This leaves significant gaps in understanding the tool's behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's purpose without unnecessary words. It is front-loaded and wastes no space, making it easy for an agent to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the lack of annotations and output schema, the description is incomplete for effective tool use. It does not explain what 'status and details' entail, how results are structured, or any behavioral traits like authentication needs. For a tool with two parameters and no structured output information, this leaves the agent under-informed.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 100%, with clear descriptions for both parameters in the input schema. The description does not add any additional meaning beyond what the schema provides, such as examples of line IDs beyond 'victoria' or 'central', or details on when 'app_key' is required. This meets the baseline for adequate but not enhanced parameter semantics.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('Get') and resource ('status and details of a TfL line'), making the purpose specific and understandable. However, it does not explicitly differentiate from the sibling tool 'get_line_status', which likely provides similar functionality, leaving room for ambiguity in tool selection.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives, such as the sibling 'get_line_status' or 'plan_journey'. It lacks context about use cases, prerequisites, or exclusions, leaving the agent to infer usage based on tool names alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

plan_journeyB

Plan journeys between two locations using the TfL Journey Planner.

ParametersJSON Schema
NameRequiredDescriptionDefault
fromLocationYesOrigin location (station name, place name, or UK postcode).
toLocationYesDestination location (station name, place name, or UK postcode).
app_keyNoOptional application key for the API.

TDQS

B3.3/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure but only states the basic function without details on rate limits, authentication needs, error handling, or what the response includes. It mentions using the TfL Journey Planner but doesn't explain behavioral traits like real-time data usage or potential costs.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core purpose without any wasted words. It directly communicates the tool's function in a clear and structured manner, making it easy to understand at a glance.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (journey planning with 3 parameters) and no output schema, the description is minimally complete but lacks details on return values, error cases, or integration context. It covers the basic purpose but doesn't fully compensate for the absence of annotations or output schema, leaving gaps in understanding how to use it effectively.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 100%, so the input schema already documents all parameters thoroughly. The description adds no additional meaning beyond what the schema provides, such as examples or constraints, but doesn't contradict it, meeting the baseline for high schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('Plan journeys') and resource ('between two locations using the TfL Journey Planner'), with a precise verb that distinguishes it from sibling tools like get_line_status and get_line_status_detail, which focus on line status rather than journey planning.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives or any context for its application. It lacks information about prerequisites, such as needing an app_key for certain API calls, or when not to use it, leaving usage entirely implicit.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. 1 tool updatev1.0.0
    • Changedplan_journey1 field changed
      • addedInput schema / additionalProperties
        Added value: +true
  2. 3 tool updates
    • First observedget_line_status
    • First observedget_line_status_detail
    • First observedplan_journey

TDQS

C2.9/5.0
Disambiguation2/5

The tools 'get_line_status' and 'get_line_status_detail' have significant overlap in purpose, both retrieving line status information with only a vague distinction in detail level. This creates ambiguity for an agent trying to choose between them, as the descriptions don't clearly differentiate when to use each tool.

Naming Consistency4/5

All three tools follow a consistent verb_noun naming pattern with snake_case. 'get_line_status' and 'get_line_status_detail' share the same verb prefix, while 'plan_journey' uses a different but still clear verb. The naming is mostly consistent with only minor deviation in verb choice.

Tool Count3/5

With only 3 tools, this server feels thin for a transportation domain that typically involves multiple operations. While the core functions are present, the count is borderline low for what could be a more comprehensive TfL API surface covering additional journey planning or status features.

Completeness2/5

For a TfL journey status server, there are significant gaps in coverage. Missing are tools for station information, arrival predictions, service disruptions beyond line status, and journey planning variations (like alternatives or real-time updates). The surface provides only basic line status and journey planning, leaving many common transportation queries unaddressed.

Maintenance

ActivityInactive
ResponsivenessNo issues

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/anoopt/london-tfl-journey-status-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server