Skip to main content
Glama

✈️ Flight MCP Server — SQLite Demo

A fully functional Model Context Protocol (MCP) demonstration server providing simulated flight search and booking capabilities.

WARNING

SIMULATION ONLY: All flights, inventory, and bookings in this system are purely simulated using fictional/sample data. This project DOES NOT integrate with any real airline APIs and DOES NOT book real flights.

What is the Project?

This project is a clean, modular Python application designed to teach the fundamentals of the Model Context Protocol (MCP). It acts as a local backend server that seamlessly connects to Claude Desktop, granting the AI safe, controlled access to a local SQLite database for exploring and booking demo flights.

Related MCP server: SQLite MCP Server

What is MCP?

The Model Context Protocol (MCP) is an open standard that allows AI models (like Claude) to securely connect to local or remote data sources, tools, and services. Instead of the LLM guessing or hallucinating data, MCP allows it to query a deterministic backend system.

Architecture

The system architecture follows a clean, layered approach:

Claude Desktop (Client)
        ↓ (stdio JSON-RPC)
Python Flight MCP Server
        ↓
Services Layer (Business Logic)
        ↓
SQLite Database (Data Store)

Technology Stack

  • Language: Python 3.11+

  • Package Manager: uv

  • Framework: Official MCP Python SDK (mcp)

  • Database: SQLite (local file)

  • Client: Claude Desktop


Six Available Tools

The server exposes exactly six robust MCP tools to the AI:

  1. search_flights: Find available flights by origin, destination, and date.

  2. get_flight: Retrieve full details and metadata for a specific flight.

  3. check_seats: Query live seat availability for a flight.

  4. book_flight: Create a new simulated booking (requires user confirmation).

  5. get_booking: Retrieve details of an existing booking via a PNR reference.

  6. cancel_booking: Cancel a booking and restore seat inventory.

SQLite Demo Database

The system uses a local SQLite database (data/flightmcp.db) to store flight inventory and booking states. Note: The actual .db file is excluded from version control to prevent stale state issues.

To initialize the database with fresh demo data, run:

uv run python scripts/seed_database.py

Installation & Setup

Ensure you have uv installed, then sync the dependencies:

uv sync

Running the Tests

The project includes a robust pytest suite for backend verification.

uv run pytest

Running the MCP Server

To manually verify the server starts correctly (it will block and wait for stdio communication):

uv run flight-mcp

(Application logs are strictly routed to stderr to maintain clean MCP protocol output on stdout.)

Configuring Claude Desktop

To connect this MCP server to Claude Desktop, edit your Claude Desktop configuration file (typically located at ~/Library/Application Support/Claude/claude_desktop_config.json on macOS).

Claude Desktop Configuration Example:

{
  "mcpServers": {
    "flight-mcp": {
      "command": "/opt/homebrew/bin/uv",
      "args": [
        "run",
        "--directory",
        "/Users/baratharjun/Desktop/medai",
        "flight-mcp"
      ],
      "cwd": "/Users/baratharjun/Desktop/medai"
    }
  }
}

Note: Adjust the absolute paths to match your local project directory and uv installation path.

Example Tool Usage

Once connected in Claude Desktop, you can interact naturally:

User: "Find me a flight from Chennai to Delhi on 2026-09-05." Claude calls search_flights and reads the SQLite database.

User: "How many seats are left on flight 1?" Claude calls check_seats.

User: "I want to book flight 1. My name is Test User, email is test@example.com, phone 9999999999." Claude summarizes the request and explicitly asks for confirmation.

User: "Confirmed." Claude calls book_flight and returns the fictional booking reference (e.g., FLM-XXXXXX).

Available Tools

6 tools
book_flightA

Create a simulated flight booking in the local SQLite database. This does NOT purchase a real airline ticket or process payment. Use this ONLY after receiving explicit user confirmation to book.

Inputs: flight_id (required), passenger_name (required), passenger_email (required), passenger_phone (required), +1 more.

cancel_bookingB

Cancel a simulated booking and restore the seat availability.

Inputs: booking_reference (required).

check_seatsB

Check currently available seats for a demo flight.

Inputs: flight_id (required).

get_bookingA

Retrieve a simulated booking by its reference code (e.g. FLM-XXXXXX).

Inputs: booking_reference (required).

get_flightA

Retrieve complete information for one fictional flight by its ID.

Inputs: flight_id (required).

search_flightsB

Search the local sample flight inventory. This tool returns fictional/demo flight options and is not connected to live airline availability.

Inputs: date (required), origin (required), destination (required), airline, +2 more. Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.7/5.0

    Scored across 6 tools

    Disambiguation5/5

    Each tool addresses a distinct resource and action: flight search, flight detail, seat availability, booking creation, booking retrieval, and booking cancellation. There is no ambiguity between tool purposes.

    Naming Consistency5/5

    All tool names follow a consistent snake_case verb_noun pattern (search_flights, get_flight, check_seats, book_flight, get_booking, cancel_booking). Naming is uniform and predictable.

    Tool Count5/5

    With 6 tools covering search, inspection, seat checking, booking, retrieval, and cancellation, the count is well-scoped for a demo flight booking server. Each tool earns its place without excess.

    Completeness4/5

    The core booking lifecycle is covered (search, read, book, retrieve, cancel). Minor gaps exist, such as no update booking or list bookings, but these are not critical for the demo scope and agents can work around them.

    Maintenance

    ActivitySlowing
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      D
      maintenance
      Provides Claude Desktop with secure access to multiple database connections, allowing users to query MySQL, PostgreSQL, SQLite, and SQL Server databases directly through natural language.
      -
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables natural language interaction with local SQLite databases through Claude Desktop, translating plain English queries into SQL for data analysis and exploration.
      3
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables natural language querying of SAP flight data (airlines, flights, bookings) using Claude Code, with 19 tools for model introspection, SQL queries, and analytics.
      1
      -
    • F
      license
      Not graded
      quality
      D
      maintenance
      Enables querying and managing a CRM database through natural language conversations with Claude Desktop.
      -