Skip to main content
Glama
chatwithsrini

Airline Flight Delays MCP Server

Airline Flight Delays MCP Server

AI-Powered Customer Service Automation for Weather-Related Flight Disruptions

Python Version FastMCP License

πŸ“‹ Overview

This project presents a Model Context Protocol (MCP) server-based system designed to reduce customer support costs for Indigo airline during weather-related flight delays. The airline operates a major hub in Mumbai with over 5,000 daily flights and faces peak support demand, long wait times, customer dissatisfaction, and high operational costs during delays.

Key Innovations

  • Mood-Aware Communication: Adapts tone based on passenger sentiment (frustrated, concerned, calm, excited)

  • Proactive Engagement: Entertainment activities scaled to delay duration (30min to 3+ hours)

  • Personalized Service: Prioritizes frequent flyer members and provides customized recommendations

  • Seamless Human Handoff: Full conversation context preservation for specialist escalation

  • Real-Time Intelligence: Live flight status, rebooking options, and destination insights

Expected Results

  • 60-70% reduction in routine customer service inquiries through automation

  • Instant response times for common queries

  • Intelligent routing of complex cases to human specialists

  • Enhanced customer satisfaction through personalized, empathetic service


πŸ—οΈ Architecture

The solution uses a microservices architecture with six specialized MCP servers coordinated by a main orchestrator:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                   Main MCP Orchestrator                      β”‚
β”‚                  (FastMCP Server - Python)                   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                              β”‚
        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
        β”‚                     β”‚                     β”‚
        β–Ό                     β–Ό                     β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚Authenticationβ”‚    β”‚   Flight     β”‚    β”‚    Mood      β”‚
β”‚   Server     β”‚    β”‚ Information  β”‚    β”‚  Analysis    β”‚
β”‚              β”‚    β”‚   Server     β”‚    β”‚   Server     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
        β”‚                     β”‚                     β”‚
        β–Ό                     β–Ό                     β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Engagement/  β”‚    β”‚ Itinerary/   β”‚    β”‚    Human     β”‚
β”‚   Games      β”‚    β”‚    Food      β”‚    β”‚    Agent     β”‚
β”‚   Server     β”‚    β”‚   Server     β”‚    β”‚   Transfer   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

1. Authentication Server

  • Secure passenger login and session management

  • PNR/email/frequent flyer number authentication

  • JWT token generation

  • Passenger profile retrieval

2. Flight Information Server

  • Real-time flight status and delay information

  • Gate details and terminal navigation

  • Alternative flight options for rebooking

  • Connection impact analysis

  • Weather delay notifications

3. Mood Analysis Server

  • Sentiment detection using VADER and TextBlob

  • LLM-powered emotional intelligence analysis

  • Communication tone recommendations

  • Escalation trigger detection

  • Sentiment trend tracking

4. Engagement/Games Server

  • Delay-appropriate entertainment activities

  • Interactive games, trivia, and quizzes

  • Destination virtual tours

  • Relaxation and mindfulness exercises

  • Airport exploration suggestions

5. Itinerary/Food Server

  • Airport restaurant recommendations

  • Destination dining guides

  • Attraction and activity planning

  • Personalized itinerary generation

  • Dietary restriction handling

6. Human Agent Transfer Server

  • Context-aware escalation to specialists

  • Complete conversation history preservation

  • Priority queue management

  • Passenger profile and sentiment handoff

  • Intelligent routing based on issue complexity


πŸš€ Quick Start

Prerequisites

  • Python: 3.9 or higher

  • PostgreSQL: 12+ with pgvector extension

  • Redis: 6+ (optional, for caching)

  • LLM API: OpenAI, Azure OpenAI, or Anthropic API key

Installation

  1. Clone the Repository

cd /path/to/your/workspace
git clone <repository-url>
cd airline-delays-mcp-server
  1. Create Virtual Environment

python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
  1. Install Dependencies

pip install -r requirements.txt
  1. Setup Database

-- Connect to PostgreSQL
psql -U postgres

-- Create database
CREATE DATABASE airline_delays_db;

-- Connect to database
\c airline_delays_db

-- Enable pgvector extension (if using vector operations)
CREATE EXTENSION IF NOT EXISTS vector;
  1. Configure Environment

Create a .env file (copy from env.example):

cp env.example .env

Edit .env with your configuration:

# Database
DB_HOST=localhost
DB_PORT=5432
DB_USER=postgres
DB_PASSWORD=your_password
DB_NAME=airline_delays_db

# OpenAI (or use Azure/Anthropic)
OPENAI_API_KEY=your_openai_api_key
OPENAI_MODEL=gpt-4-turbo-preview

# Server
PORT=3003
TRANSPORT=httpStream
ENVIRONMENT=development
  1. Initialize Database Schema

python -c "import asyncio; from src.config.database import init_database; asyncio.run(init_database())"
  1. Run the Server

python run.py

The server will start on http://localhost:3003/mcp


πŸ’» Usage

Available Tools

The MCP server exposes 6 tools that can be called by AI assistants:

1. authenticate_passenger

Authenticate a passenger and create a session.

{
  "pnr": "ABC123",
  "last_name": "Smith",
  "email": "smith@example.com"
}

2. get_flight_information

Get real-time flight status and rebooking options.

{
  "flight_number": "6E-123",
  "passenger_id": "P12345",
  "include_alternatives": true
}

3. analyze_mood

Analyze passenger sentiment and get communication recommendations.

{
  "session_id": "session_abc123",
  "message": "This delay is completely unacceptable!",
  "analyze_trend": true
}

4. suggest_engagement

Suggest entertainment activities for delayed passengers.

{
  "delay_minutes": 120,
  "passenger_mood": "frustrated",
  "destination": "DEL",
  "activity_type": "any"
}

5. recommend_services

Recommend airport/destination dining and activities.

{
  "service_type": "airport_food",
  "airport_code": "BOM",
  "dietary_restrictions": ["vegetarian"],
  "budget": "moderate"
}

6. transfer_to_human

Transfer to human agent with full context.

{
  "session_id": "session_abc123",
  "reason": "high_frustration",
  "urgency": "high",
  "summary": "Passenger frustrated with long delay and missed connection"
}

πŸ“ Project Structure

airline-delays-mcp-server/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ config/
β”‚   β”‚   β”œβ”€β”€ __init__.py
β”‚   β”‚   β”œβ”€β”€ environment.py      # Environment variable management
β”‚   β”‚   β”œβ”€β”€ database.py         # PostgreSQL connection pool
β”‚   β”‚   └── llm.py              # LLM client (OpenAI/Azure/Anthropic)
β”‚   β”œβ”€β”€ tools/
β”‚   β”‚   β”œβ”€β”€ __init__.py
β”‚   β”‚   β”œβ”€β”€ authentication.py   # Authentication Server
β”‚   β”‚   β”œβ”€β”€ flight_information.py  # Flight Information Server
β”‚   β”‚   β”œβ”€β”€ mood_analysis.py    # Mood Analysis Server
β”‚   β”‚   β”œβ”€β”€ engagement_games.py # Engagement/Games Server
β”‚   β”‚   β”œβ”€β”€ itinerary_food.py   # Itinerary/Food Server
β”‚   β”‚   └── human_handoff.py    # Human Agent Transfer Server
β”‚   β”œβ”€β”€ utils/
β”‚   β”‚   β”œβ”€β”€ __init__.py
β”‚   β”‚   β”œβ”€β”€ logger.py           # Structured logging
β”‚   β”‚   └── helpers.py          # Utility functions
β”‚   β”œβ”€β”€ interfaces/
β”‚   β”‚   └── __init__.py         # Type definitions
β”‚   β”œβ”€β”€ __init__.py
β”‚   └── server.py               # Main MCP server orchestrator
β”œβ”€β”€ docs/
β”‚   └── ARCHITECTURE.md         # Detailed architecture documentation
β”œβ”€β”€ tests/
β”‚   └── (test files)
β”œβ”€β”€ .env                        # Environment configuration (create from env.example)
β”œβ”€β”€ env.example                 # Example environment configuration
β”œβ”€β”€ requirements.txt            # Python dependencies
β”œβ”€β”€ run.py                      # Server startup script
β”œβ”€β”€ Dockerfile                  # Docker container definition
β”œβ”€β”€ docker-compose.yml          # Docker Compose configuration
└── README.md                   # This file

πŸ”§ Configuration

Environment Variables

See env.example for all available configuration options.

Key variables:

Variable

Description

Default

PORT

Server port

3003

TRANSPORT

Transport type (stdio/httpStream)

httpStream

DB_HOST

PostgreSQL host

localhost

OPENAI_API_KEY

OpenAI API key

-

MOOD_FRUSTRATION_THRESHOLD

Frustration threshold for escalation

0.6

DELAY_GAME_THRESHOLD_MINUTES

Min delay for games

30

FREQUENT_FLYER_MIN_FLIGHTS

Min flights for FF status

10

Feature Flags

Enable/disable features via environment:

ENABLE_MOOD_ANALYSIS=true
ENABLE_GAMES=true
ENABLE_FOOD_RECOMMENDATIONS=true
ENABLE_HUMAN_HANDOFF=true

🐳 Docker Deployment

Build Docker Image

docker build -t airline-delays-mcp-server .

Run with Docker Compose

docker-compose up -d

This starts:

  • MCP Server (port 3003)

  • PostgreSQL database

  • Redis cache

Stop Services

docker-compose down

πŸ§ͺ Testing

Run tests:

pytest tests/ -v

Run with coverage:

pytest tests/ --cov=src --cov-report=html

πŸ“Š Monitoring & Observability

Logging

The server uses structured JSON logging. Set log level via:

LOG_LEVEL=INFO  # DEBUG, INFO, WARNING, ERROR, CRITICAL
LOG_FORMAT=json # json or text

Metrics

Key metrics tracked:

  • Tool execution times

  • Sentiment scores and trends

  • Escalation rates

  • Response times

  • Database query performance


πŸ” Security

  • JWT Authentication: Secure session management

  • Input Sanitization: XSS and injection prevention

  • Rate Limiting: Prevent abuse (configure via environment)

  • Database SSL: Encrypted connections to database

  • API Key Management: Secure credential storage


🎯 Use Cases

1. Weather Delay Scenario

Passenger: "My flight is delayed. What's happening?"

System Flow:

  1. βœ… Authenticate passenger (Authentication Server)

  2. βœ… Get flight status (Flight Information Server)

  3. βœ… Analyze mood (Mood Analysis Server)

  4. βœ… Provide alternatives and rebooking options

  5. βœ… Suggest activities if long delay (Engagement Server)

  6. βœ… Recommend airport dining (Itinerary/Food Server)

2. Frustrated Passenger Escalation

Passenger: "This is unacceptable! I demand to speak to a manager!"

System Flow:

  1. βœ… Detect high frustration (Mood Analysis Server)

  2. βœ… Attempt to de-escalate with empathetic response

  3. βœ… Offer compensation/alternatives

  4. βœ… If frustration persists β†’ Transfer to human (Human Handoff Server)

  5. βœ… Agent receives full context, no repetition needed

3. Multi-Hour Delay

Delay: 3+ hours

System Actions:

  1. βœ… Proactive engagement with entertainment options

  2. βœ… Destination planning assistance

  3. βœ… Airport restaurant recommendations

  4. βœ… Meal voucher information

  5. βœ… Regular status updates

  6. βœ… Hotel arrangements if needed


🀝 Integration

Claude Desktop Integration

Add to Claude Desktop config (~/Library/Application Support/Claude/claude_desktop_config.json):

{
  "mcpServers": {
    "airline-delays": {
      "command": "python",
      "args": ["/path/to/airline-delays-mcp-server/run.py"],
      "env": {
        "TRANSPORT": "stdio"
      }
    }
  }
}

API Integration

For HTTP integration:

import requests

response = requests.post(
    "http://localhost:3003/mcp",
    json={
        "jsonrpc": "2.0",
        "id": 1,
        "method": "tools/call",
        "params": {
            "name": "get_flight_information",
            "arguments": {
                "flight_number": "6E-123"
            }
        }
    }
)

print(response.json())

πŸ“š Additional Documentation


πŸ›£οΈ Roadmap

  • Multi-language support (Hindi, regional languages)

  • Voice integration for phone-based support

  • Mobile app integration

  • Advanced analytics dashboard

  • ML-powered delay prediction

  • Integration with more airlines

  • Automated compensation processing


πŸ“„ License

MIT License - see LICENSE file for details


πŸ‘₯ Contributors

  • Development Team

  • Airline Operations Team

  • Customer Service Specialists


πŸ“ž Support

For issues and questions:


πŸ™ Acknowledgments

Built with:


Made with ❀️ for better customer experiences during travel disruptions

-
security - not tested
F
license - not found
-
quality - not tested

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

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

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/chatwithsrini/AirlinesMCP'

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