MCP Airline Demo

The companion to the IEEE talk “Connecting Enterprise AI Using MCP.”

One request, “Book me a cheap flight somewhere sunny this weekend and use my miles”, run four ways: the happy path, two ways it goes wrong, and the fix. Everything is synthetic and open-source. Tool-neutral: any MCP-capable client works.

3 purpose-built MCP servers no restarts between beats synthetic data MIT

View the repo on GitHub →

What it is

An assistant composes three separate back-end systems over MCP to book a trip:

ServerWhy it's neededWhat it contains
reservationsFinds the flights and the weather, and records the booking3 tables: flights, airports (weather), bookings
loyaltyConfirms the traveler's miles so they can be applied to the fare1 table: members (miles balance, tier)
policiesThe refund & baggage rules the assistant must quote2 docs: refund-policy.md, baggage-policy.md

Each server reads its data fresh on every call. That is the whole trick: change a file between two questions and the next answer changes. No restart, no redeploy.

The data

All synthetic. Two SQLite databases and a folder of markdown. This is everything the assistant can see. Follow these rows through the simulator below.

reservations · SQLite → flights

flight_idairlineroutedateprice_usdseats_left
AA88AmericanSJC → SAN (San Diego)2026-10-241499
UA210UnitedSJC → SEA (Seattle)2026-10-241184
DL455DeltaSJC → PHX (Phoenix)2026-10-251296
WN360SouthwestSJC → LAS (Las Vegas)2026-10-2417612
AS512AlaskaSJC → PSP (Palm Springs)2026-10-251693

Cheapest overall is Seattle ($118), but it's raining. AA88 → San Diego ($149) is the cheapest that's actually sunny. DL455 → Phoenix ($129) is the trap in Beat B.

reservations · SQLite → airports (weather)

codecityweatherweather_as_of
SJCSan JoseCloudy2026-10-24
SANSan DiegoSunny2026-10-24
SEASeattleRain2026-10-24
PHXPhoenixStorm2026-10-24
LASLas VegasSunny2026-10-24
PSPPalm SpringsSunny2026-10-24

This is the current snapshot: Phoenix is a Storm today. The stale snapshot (Beat B) is the same table frozen 5 days ago. Every weather_as_of reads 2026-10-19 and Phoenix still says Sunny. Same data, older date → wrong answer.

reservations · SQLite → bookings

booking_idflight_idpassengermiles_appliedstatus
BKG-5001WN360Sam Delgado0confirmed
BKG-5002AS512Priya Anand8000confirmed

Two seed bookings. When you click Book it in the simulator, the assistant calls book_flight, which writes a new BKG-60xx row here, a real, scoped write over MCP.

loyalty · SQLite → members

namemiles_balancetier
Jordan Rivera (the traveler)45,000Gold
Sam Delgado2,200Member
Priya Anand132,000Platinum
Marcus Webb6,100Silver

Jordan has plenty of miles, so the happy path applies 12,000. In Beat C this whole table is unreachable (the DB file is swapped for junk), and the query errors.

policies · filesystem → markdown

filecurrentstale (optional variant)
refund-policy.mdv2026.3: non-refundable basic faresv2025.4: “fully refundable any time” (false)
baggage-policy.mdv2026.3v2025.4

The policies server serves whatever is in policy/active/. A toggle swaps current ↔ stale. The RAG version of the stale-source failure.

See it happen

This is a simulation. It plays scripted, canned data in your browser. No real MCP servers or model calls run here. By default it auto-plays. Tick Animate architecture to light up the diagram on the right as each MCP tool call fires and step through with Proceed →. You send the first message and choose whether to book. To run it for real, open the Run it yourself tab.
Press ▶ Run this beat to watch the assistant compose the MCP tools.
Architecture
User
Traveler: Jordan Rivera
↓ natural language
MCP Host + model
any MCP client
chooses which tools to call
↓ MCP · JSON-RPC / stdio · fans out to 3 servers
MCP Server
reservations
purpose-built · Python
search_flights · book_flight
↓ reads / writes
Database · SQLite
reservations.db
flights · airports · bookings
MCP Server
loyalty
purpose-built · Python
check_miles
↓ reads
Database · SQLite
loyalty.db
members · miles · tier
MCP Server
policies
purpose-built · Python
search_policies
↓ reads
File store
policy/active/
refund · baggage (.md)

Each server re-reads its backend on every call, so the toggle scripts (use-stale.sh, break-miles.sh) change behavior with no restart, the point of the demo, and the source of both failures.

Show the tool code (what a tool actually is)

A tool is a decorated Python function. Two from the reservations server: one read, one write. Excerpts; full source in servers/reservations_server.py.

search_flights · the read (joins in the weather)

@mcp.tool()
def search_flights(origin: str = "SJC", date: str | None = None) -> list[dict]:
    """This weekend's flights leaving `origin`, each row carrying the
    destination's current weather and how fresh it is (weather_as_of),
    sorted cheapest first."""
    con = _connect()                      # opens reservations.db FRESH every call
    try:
        rows = con.execute(
            "SELECT f.flight_id, f.airline, f.origin, f.destination, "
            "       a.city, f.date, f.price_usd, f.seats_left, "
            "       a.weather, a.weather_as_of "
            "FROM flights f "
            "LEFT JOIN airports a ON f.destination = a.code "
            "WHERE f.origin = ? ORDER BY f.price_usd ASC",
            [origin],                     # optional date filter elided
        ).fetchall()
        return [dict(r) for r in rows]
    finally:
        con.close()

book_flight · the scoped write (one row, nothing else)

@mcp.tool()
def book_flight(flight_id: str, passenger: str,
                miles_to_apply: int = 12000, seat: str | None = None) -> dict:
    """SCOPED WRITE: insert exactly ONE confirmed booking row and nothing
    else. No arbitrary SQL; cannot read or modify anything but this insert."""
    con = _connect()
    try:
        # refuse to book a flight that does not exist
        if con.execute("SELECT 1 FROM flights WHERE flight_id = ?",
                       (flight_id,)).fetchone() is None:
            raise ValueError(f"no such flight: {flight_id}")

        # ... mint a fresh BKG-60xx booking id (elided) ...
        con.execute(
            "INSERT INTO bookings "
            "(booking_id, flight_id, passenger, miles_applied, status) "
            "VALUES (?, ?, ?, ?, 'confirmed')",
            (booking_id, flight_id, passenger, miles_to_apply),
        )
        con.commit()
        return {"booking_id": booking_id, "flight_id": flight_id,
                "passenger": passenger, "miles_applied": miles_to_apply,
                "status": "confirmed"}
    finally:
        con.close()
The takeaway. MCP composes real systems live (Beat A). The same flexibility means a stale source (B) or an unhandled tool error (C) produces a confident wrong answer. The fix is a rule: quote your source, fail closed (D). A system prompt here; code in production.

Want to run this for real on your machine? → open the Run it yourself tab above.