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 →An assistant composes three separate back-end systems over MCP to book a trip:
| Server | Why it's needed | What it contains |
|---|---|---|
reservations | Finds the flights and the weather, and records the booking | 3 tables: flights, airports (weather), bookings |
loyalty | Confirms the traveler's miles so they can be applied to the fare | 1 table: members (miles balance, tier) |
policies | The refund & baggage rules the assistant must quote | 2 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.
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_id | airline | route | date | price_usd | seats_left |
|---|---|---|---|---|---|
| AA88 | American | SJC → SAN (San Diego) | 2026-10-24 | 149 | 9 |
| UA210 | United | SJC → SEA (Seattle) | 2026-10-24 | 118 | 4 |
| DL455 | Delta | SJC → PHX (Phoenix) | 2026-10-25 | 129 | 6 |
| WN360 | Southwest | SJC → LAS (Las Vegas) | 2026-10-24 | 176 | 12 |
| AS512 | Alaska | SJC → PSP (Palm Springs) | 2026-10-25 | 169 | 3 |
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)| code | city | weather | weather_as_of |
|---|---|---|---|
| SJC | San Jose | Cloudy | 2026-10-24 |
| SAN | San Diego | Sunny | 2026-10-24 |
| SEA | Seattle | Rain | 2026-10-24 |
| PHX | Phoenix | Storm | 2026-10-24 |
| LAS | Las Vegas | Sunny | 2026-10-24 |
| PSP | Palm Springs | Sunny | 2026-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_id | flight_id | passenger | miles_applied | status |
|---|---|---|---|---|
| BKG-5001 | WN360 | Sam Delgado | 0 | confirmed |
| BKG-5002 | AS512 | Priya Anand | 8000 | confirmed |
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| name | miles_balance | tier |
|---|---|---|
| Jordan Rivera (the traveler) | 45,000 | Gold |
| Sam Delgado | 2,200 | Member |
| Priya Anand | 132,000 | Platinum |
| Marcus Webb | 6,100 | Silver |
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| file | current | stale (optional variant) |
|---|---|---|
refund-policy.md | v2026.3: non-refundable basic fares | v2025.4: “fully refundable any time” (false) |
baggage-policy.md | v2026.3 | v2025.4 |
The policies server serves whatever is in policy/active/. A toggle swaps
current ↔ stale. The RAG version of the stale-source failure.
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.
A tool is a decorated Python function. Two from the reservations server: one read, one write. Excerpts; full source in servers/reservations_server.py.
@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()
@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()
Want to run this for real on your machine? → open the Run it yourself tab above.
2026-08-22 and 2026-08-17 rather than the October weekend in the tables above.
The seed data was re-dated on 2026-10-18; the recording was not. The behaviour it shows is unchanged,
since the trap depends on the snapshot being five days older than "today," not on the specific dates.
Real MCP host session · Claude Sonnet 4.6 · synthetic data · ~2 min · recorded 2026-08-30. reservations · loyalty · policies.
The first half runs the naive assistant, which books the stale-weather flight. The second half runs the guardrailed prompt, which catches the stale snapshot and refuses. Both are in the recording, so watch the prompt in use before reading a beat as a pass or a fail.
mcp SDK on first launch:
curl -LsSf https://astral.sh/uv/install.sh | shnpx)git clone https://github.com/agnitrip/mcp-airline-demo.git
cd mcp-airline-demo
./scripts/setup.sh # seed synthetic DBs + clean baseline
./scripts/status.sh # -> reservations CURRENT, loyalty healthy, policies CURRENT
Add the three purpose-built servers to your client's config. Replace
/ABSOLUTE/PATH/TO/mcp-airline-demo with the real path. The host needs the absolute path
to each server script.
{
"mcpServers": {
"reservations": {
"command": "uv",
"args": ["run", "--with", "mcp[cli]<2",
"/ABSOLUTE/PATH/TO/mcp-airline-demo/servers/reservations_server.py"]
},
"loyalty": {
"command": "uv",
"args": ["run", "--with", "mcp[cli]<2",
"/ABSOLUTE/PATH/TO/mcp-airline-demo/servers/loyalty_server.py"]
},
"policies": {
"command": "uv",
"args": ["run", "--with", "mcp[cli]<2",
"/ABSOLUTE/PATH/TO/mcp-airline-demo/servers/policies_server.py"]
}
}
}
--with "mcp[cli]<2" pin is required. The servers target the 1.x
low-level SDK; the plain mcp SDK now resolves to 2.x and 1.x-era servers crash on it
('Server' object has no attribute 'list_resources'). The pin holds it at 1.x. Each server
also declares the pin inline via PEP 723 metadata, so
uv run provisions it automatically. See
FIX-sqlite-server-pin.md.
Claude Desktop (macOS): put this in
~/Library/Application Support/Claude/claude_desktop_config.json. A ready copy is in
config/claude_desktop_config.json.
Claude Code: save as .mcp.json in the project root (config/mcp.json).
Then fully quit and reopen the host and confirm all three servers connect.
If the host can't find uv, use its absolute path (which uv).
mcp-server-sqlite and @modelcontextprotocol/server-filesystem (generic
read_query / read_file tools) is committed as config/*.generic.json
and prompts/*.generic.md. cp those over the live config and prompt if a
purpose-built server ever misbehaves on stage. The beats behave the same; only the tool names differ.
Set the assistant's instructions to one of these (paste as Project instructions in Claude Desktop, or as the first message in Claude Code):
assistant-base.md
The naive build (Beats A, B, C). No guardrail, so a stale source or a broken tool fools it.assistant-guardrailed.md
The same assistant with a guardrail: quote your source and fail closed on missing,
errored, or stale data (Beat D).Start a new chat for each beat and type the same request every time:
Book me a cheap flight somewhere sunny this weekend and use my miles. I'm Jordan Rivera.
| Beat | Toggle (terminal) | Prompt | Outcome |
|---|---|---|---|
| A · happy path | ./scripts/setup.sh |
base | Books San Diego $149, sunny, 12k miles (correct) |
| B · stale source | ./scripts/use-stale.sh |
base | Books Phoenix $129 on 5-day-old weather (it's really a storm) |
| C · tool error | ./scripts/use-current.sh./scripts/break-miles.sh |
base | Loyalty server errors → books anyway (fail open) |
| D · guardrail | swap to the guardrailed prompt | guardrailed | Catches both: refuses on the error, flags the stale weather |
Reset any time with ./scripts/setup.sh.