Skip to main content
Glama
Flight MCP Workbench

Flight MCP Workbench

by SaiManas2106

Flight MCP Workbench

A local, synthetic flight-booking integration that gives an AI assistant useful tools while keeping price, permission and booking decisions explicit.

The useful problem is the gap between a search result and a bookable itinerary. A cheap result may exclude checked bags, involve an unprotected self-transfer, change price or disappear before booking. A conversational interface must preserve those facts and must not turn a plausible answer into an unintended purchase.

This project connects an actual MCP server to a synthetic partner HTTP contract. It does not connect to Etraveli Group, airlines, payment systems or real traveler data. It was developed as a new AI-assisted portfolio project in November 2026. It is not historical employment or a production deployment.

Workflow

  1. search_flights returns two synthetic fare choices with integer EUR-cent totals, baggage allowances, refundable status and self-transfer warnings.

  2. prepare_booking reprices the selected offer, enforces an explicit maximum total and creates a quote that expires after 120 seconds.

  3. The host shows the exact quote to a person. Approval binds its SHA-256 fingerprint. There is no MCP approval tool.

  4. book_confirmed_quote requires the same caller, write entitlement, unexpired unchanged quote and independent approval. The synthetic partner checks price/version again.

  5. Retries use stable booking identity. If a response is lost after the partner commits, a retry returns the original reservation. Concurrent client keys for one quote also map to one partner booking.

No name, passport, card number or actual ticket is needed or stored. Reservation references always start with SIM-.

flowchart LR
  client[MCP client / assistant] -->|JSON-RPC over stdio| mcp[Typed tools + policy resource + prompt]
  mcp --> service[Caller scope + budget + quote policy]
  service --> state[(SQLite host state)]
  human[Independent trusted host / human] -->|approve exact fingerprint| state
  service --> adapter[Partner adapter: HMAC + schemas + bounded retries]
  adapter --> partner[Synthetic HTTP partner]
  partner --> bookings[(Idempotent simulated bookings)]

Related MCP server: Flight Booking MCP Server

Run it

Python 3.11+ is required. The tested SDK is pinned to the official MCP Python SDK 1.30.0, using its v1 maintenance-line FastMCP interface. This is an intentional version pin, not a claim to target the latest protocol or SDK major release.

Windows PowerShell:

python -m venv .venv
.\.venv\Scripts\python.exe -m pip install -e '.[test]'
.\.venv\Scripts\python.exe -m pytest -q
.\.venv\Scripts\python.exe scripts/demo.py

Linux/macOS:

python3 -m venv .venv
.venv/bin/python -m pip install -e '.[test]'
.venv/bin/python -m pytest -q
.venv/bin/python scripts/demo.py

The demo uses a real MCP subprocess and client session. Its partner transport is an in-process httpx.MockTransport, using signed HTTP request/response contracts. It prints fare differences, demonstrates denial before approval, then asks you to type APPROVE. It does not make a real booking. The integration test additionally runs a real loopback HTTP partner server.

MCP integration

The server exposes three tools with input schemas, typed structured outputs and tool annotations, one flight://policy resource and a plan_trip prompt. Tools return a stable result envelope: status, data, code, message, retryable.

Host configuration:

Variable

Purpose

FLIGHT_SIGNING_KEY

Random development JWT signing key, at least 32 characters

FLIGHT_PARTNER_KEY

Separate random development HMAC key, at least 32 characters

FLIGHT_ACCESS_TOKEN

Local caller JWT supplied by the trusted host, never a tool parameter

FLIGHT_STATE_DIR

Local state directory, default .flight-state

FLIGHT_PARTNER_URL

Optional host-only loopback HTTP address for the synthetic partner

Launch python -m flight_mcp.server with those variables in your MCP host configuration. Do not put keys in a repository, prompt or command-line argument. The interactive demo generates temporary keys and cleans up its state automatically.

For a manually configured host, python -m flight_mcp.host token issues a development JWT from FLIGHT_SIGNING_KEY. A separate terminal can inspect a prepared quote using:

python -m flight_mcp.host approve --db .flight-state/host.sqlite --quote-id <returned-quote-id>

See architecture and trust boundaries and test evidence.

Security and failure handling

  • JWT signature, algorithm allowlist, issuer, audience, expiration and required claims are checked for each operation.

  • flights:read and booking:write are separate caller entitlements. Offer and quote state is caller-bound.

  • Partner HMAC covers method, path, body digest, timestamp, nonce and caller. Replayed nonces and stale timestamps are rejected by the synthetic partner.

  • Local rate limits are per caller. Read retries are bounded. Writes are never automatically retried after an uncertain response.

  • Quote approval covers exact content. Changed prices, altered quotes, expiry, sold-out offers and reused keys for a different quote fail explicitly.

  • Logs contain operation, result code and elapsed time, not access tokens, query text or fare contents.

  • DemoAuthorizationCodes models S256 PKCE proof, registered client/redirect matching, consent, expiry and single-use codes. It is an in-memory local exchange model, not a hosted OAuth 2.0 provider or a complete authentication flow.

Tests and CI

The tests exercise domain policy, partner contracts, security negatives, concurrent idempotency and actual MCP initialization/discovery/tool calls. The stdio integration test connects to a real loopback HTTP server and checks structured output schemas, the resource, prompt, rejection before approval and idempotent booking after approval.

GitHub Actions installs the project and runs the same test suite on Ubuntu. CI workflow.

These tests establish deterministic tool and integration behavior. They do not measure an LLM's planning accuracy, prompt-injection robustness, external partner reliability or production throughput.

Limits and deliberate trade-offs

  • Synthetic EUR fares and future travel dates only, no real availability, seat maps, ancillary purchase or ATPCO integration.

  • Local stdio transport only. Remote MCP OAuth discovery, TLS, JWKS rotation and token exchange with a real provider are future work.

  • HS256 keys and rate-limit/replay state are local demo mechanisms. A multi-instance deployment needs managed identity, durable shared rate limits and replay protection.

  • SQLite provides local transactional bookkeeping. It is not a distributed booking engine or an inventory reservation service.

  • The trusted host and its filesystem are part of the trust boundary. This prototype does not isolate a hostile MCP host or code with local file access.

  • No real user/client integration or production deployment is claimed.

Development provenance

Built with Codex assistance. The implementation was reviewed and exercised with automated tests. Review identified the need to bind repricing to the selected itinerary, map multiple client keys to one quote-level partner key, and preserve an unresolved attempt after an uncertain write response. Regression tests cover those decisions. See the verification record for the checks actually run.

Sources

License

MIT. See LICENSE.

Tool Schema Changelog

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

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables AI assistants to search live travel inventory for flights, stays, and car hire through typed tools, with place resolution and price details while deliberately exposing no booking or payment surface.
      MIT
    • F
      license
      Not graded
      quality
      C
      maintenance
      Enables travel agents to manage the full trip-quoting lifecycle, including searching flights and accommodations, building personalized itineraries, checking entry requirements and cancellation policies, creating and monitoring bookings, and getting upsell recommendations.
      -