Skip to main content
Glama
flexible-hotels-mcp-server

flexible-hotels-mcp-server

by sholts2026

flexible-hotels-mcp-server

Servidor MCP (Model Context Protocol) que permite a la IA (Claude o cualquier otro cliente MCP) buscar habitaciones de hotel por número de noches en un rango de fechas flexible, en lugar de por una fecha fija de check-in/check-out.

Por ejemplo: "3 noches en Tel Aviv, en algún momento entre el 1.9 y el 20.9" — el servidor escanea todas las fechas de check-in posibles dentro del rango, obtiene precios reales para cada una y devuelve las ofertas más baratas ordenadas por precio.

Modelo de afiliado: es una herramienta de comparación de precios únicamente — no recopila datos de pago ni realiza reservas. Cada resultado incluye un enlace (bookingUrl) que dirige a la fuente (actualmente Booking.com) donde el usuario puede completar la compra por sí mismo, si así lo desea.

Fuente de datos: Amadeus for Developers — la API gratuita líder en el sector turístico, con un entorno de pruebas (test) totalmente gratuito y sin necesidad de tarjeta de crédito.

Qué hay aquí

Cuatro herramientas (tools) expuestas a la IA:

Herramienta

Qué hace

flexible_hotels_resolve_city_code

Convierte un nombre de ciudad libre ("Tel Aviv") en un código IATA ("TLV")

flexible_hotels_list_hotels_in_city

Devuelve una lista de hoteles (y sus identificadores) en una ciudad determinada

flexible_hotels_search_flexible_offers

La herramienta principal — búsqueda flexible por número de noches en un rango de fechas, con enlace de reserva para cada resultado

flexible_hotels_get_offer_details

Detalles completos y precio actualizado de una oferta específica + enlace de reserva

La lógica de "búsqueda flexible" está implementada en src/services/hotelSearch.ts: dado que Amadeus (y cualquier otro proveedor) solo admite un rango de fechas fijo por llamada, el servidor escanea por sí mismo cada fecha de check-in posible dentro de la ventana definida, llama a la API en consecuencia y agrega los resultados. El enlace de cada resultado se construye en src/services/affiliateLink.ts.

Related MCP server: Amadeus Hotel API MCP Server

Instalación

1. Obtén una clave de API gratuita (2 minutos, sin tarjeta de crédito):

  1. Regístrate en https://developers.amadeus.com/register

  2. Después de la verificación, crea una "New App" en My Self-Service Workspace

  3. Recibirás un API Key y un API Secret — estos serán AMADEUS_CLIENT_ID y AMADEUS_CLIENT_SECRET

Este es el entorno de test (sandbox) — totalmente gratuito, con una cuota mensual generosa y un límite de velocidad de unas 10 solicitudes por segundo. Cubre cientos de miles de hoteles en todo el mundo con datos reales (aunque a veces parciales/en caché). Para pasar a datos en vivo completos en el futuro, se puede solicitar acceso de producción a Amadeus (de pago) y cambiar AMADEUS_ENV=production.

2. Instalación local:

npm install
cp .env.example .env
# ערכו את .env והכניסו את המפתחות שקיבלתם
npm run build

3. Comprobar que todo funciona (sin afectar a la cuota — no envía solicitudes reales a Amadeus):

npm test

Ejecución

npm start

Por defecto, el servidor se ejecuta a través de stdio (adecuado para conexión local con clientes como Claude Desktop). Para ejecutarlo como servidor remoto por HTTP (para conectar desde Claude.ai / Cowork como "custom connector", o desde cualquier otro cliente MCP remoto):

TRANSPORT=http PORT=3000 npm start

Conexión como "plugin" a la IA

Claude Desktop (local)

Añade al archivo de configuración claude_desktop_config.json:

{
  "mcpServers": {
    "flexible-hotels": {
      "command": "node",
      "args": ["/נתיב-מלא/ל/flexible-hotels-mcp-server/dist/index.js"],
      "env": {
        "AMADEUS_CLIENT_ID": "המפתח-שלכם",
        "AMADEUS_CLIENT_SECRET": "הסוד-שלכם"
      }
    }
  }
}

Tras reiniciar Claude Desktop, la IA podrá llamar a estas herramientas directamente en la conversación.

Conexión remota (Claude.ai / Cowork / cualquier otro cliente)

Para que el producto esté disponible como "plugin" para varios usuarios sin que cada uno ejecute código localmente, hay que desplegar (deploy) el servidor en modo TRANSPORT=http en algún servidor/host, y luego conectar la dirección https://su-dominio/mcp como conector MCP personalizado en la configuración del cliente.

Railway (recomendado si ya tienes cuenta + CLI instalado):

cd flexible-hotels-mcp-server
railway login          # רק אם עוד לא מחוברים — פותח דפדפן לאישור
railway up --new -y --detach --json   # יוצר פרויקט חדש, מעלה את הקוד ומפעיל build מה-Dockerfile
railway variable set AMADEUS_CLIENT_ID=המפתח-שלכם --skip-deploys
railway variable set AMADEUS_CLIENT_SECRET=הסוד-שלכם --skip-deploys
railway variable set AMADEUS_ENV=test
railway domain          # מפיק כתובת ציבורית כמו https://xxx.up.railway.app

El servidor se levanta (y pasa el health check) incluso antes de configurar las claves de Amadeus — las herramientas de búsqueda simplemente devolverán un error claro hasta que se configuren las claves reales y se haga un nuevo despliegue automático.

Render: el archivo render.yaml en la raíz del proyecto está listo como Blueprint — conecta el repo a Render, "New" -> "Blueprint", y rellena AMADEUS_CLIENT_ID/AMADEUS_CLIENT_SECRET en la interfaz (ver comentarios dentro del archivo).

Ten en cuenta en todas las opciones: AMADEUS_CLIENT_ID/AMADEUS_CLIENT_SECRET deben ser variables de entorno definidas en el servidor de alojamiento, nunca escritas en el código.

Ejemplo de uso (lo que "ve" la IA)

User: תמצא לי 3 לילות בתל אביב, איפשהו בין ה-1 ל-20 בספטמבר, לזוג.

AI calls: flexible_hotels_resolve_city_code(keyword="Tel Aviv")
  -> TLV

AI calls: flexible_hotels_search_flexible_offers(
  city_code="TLV", nights=3,
  earliest_check_in="2026-09-01", latest_check_in="2026-09-20",
  adults=2
)
  -> רשימת עסקאות ממוינת מהזולה ביותר, עם תאריך צ'ק-אין/אאוט מדויק וקישור הזמנה לכל אחת

User: מעולה, תראה לי את הפרטים המלאים של האופציה הכי זולה.

AI calls: flexible_hotels_get_offer_details(offer_id="...")
  -> מחיר מעודכן + קישור לחיצה שמעביר את המשתמש להשלים את ההזמנה באתר המקורי

El modelo de negocio: afiliado

Este servidor no realiza reservas ni toca datos de pago en ninguna fase — es intencional, tanto por simplicidad/seguridad como porque así funcionan las tiendas de aplicaciones (como ChatGPT App Directory) que exigen "external checkout" y prohíben recopilar números de tarjeta de crédito a través de la propia herramienta.

Cómo funciona en la práctica:

  1. El servidor encuentra precios reales a través de Amadeus (gratis).

  2. Para cada resultado se construye un enlace a la página de búsqueda de Booking.com con el nombre del hotel y las fechas ya rellenados (src/services/affiliateLink.ts).

  3. Si te registras en el Booking.com Affiliate Partner Program (gratuito, registro independiente, sin aprobación especial) y obtienes un aid, puedes configurarlo como variable de entorno BOOKING_AFFILIATE_ID — entonces cada enlace incluirá tu identificador de socio y podrás recibir comisiones por las reservas realizadas a través del enlace.

  4. Sin BOOKING_AFFILIATE_ID los enlaces siguen funcionando perfectamente — simplemente no generan comisión.

Esto es exactamente el "solo hay que registrarse" que pediste: el registro único en el programa de socios de Booking.com (no en Amadeus, no en Railway) es todo lo que se necesita para que los enlaces empiecen a generar ingresos.

Limitaciones conocidas

  • Cuota gratuita: el entorno de test de Amadeus está limitado en cuota mensual y en velocidad de solicitudes (~10/segundo). Una búsqueda flexible sobre una ventana de N días envía hasta N solicitudes (con una ligera pausa entre ellas) — ventana grande = búsqueda más lenta. La ventana está limitada a 30 días por búsqueda para proteger la cuota.

  • Número de hoteles: por defecto se comprueban hasta 15 hoteles en la ciudad por fecha (se puede aumentar hasta 30 mediante max_hotels, o reducir a hotelIds específicos).

  • Datos de sandbox: en el entorno de test, la cobertura más fiable está en las grandes ciudades (por ejemplo, NYC, LON, PAR). Las ciudades más pequeñas pueden devolver pocos hoteles o ninguno — esto se resuelve al pasar a production.

  • Los enlaces de reserva construyen una búsqueda en Booking.com por nombre de hotel y fechas — no un enlace profundo (deep link) directo a la habitación específica, porque Amadeus no lo proporciona. En la mayoría de los casos, el hotel relevante aparecerá primero en los resultados.

Estructura del proyecto

src/
├── index.ts              # נקודת כניסה, רישום השרת והכלים
├── constants.ts           # קבועים (URLs, מגבלות)
├── types.ts                # טיפוסי TypeScript משותפים
├── services/
│   ├── amadeusClient.ts   # קליינט HTTP מאומת ל-Amadeus (OAuth2, endpoints)
│   ├── hotelSearch.ts     # הלוגיקה של חיפוש גמיש (הליבה)
│   ├── affiliateLink.ts   # בניית קישור ההזמנה (Booking.com + aid אופציונלי)
│   └── format.ts           # פורמט markdown לתשובות
├── schemas/
│   └── schemas.ts          # סכמות Zod לכל כלי
├── tools/                  # רישום כל כלי MCP
└── test/
    └── hotelSearch.test.ts # בדיקות יחידה ללוגיקת החיפוש (ללא צורך במפתח API)
scripts/
└── smoke-test-tools.mjs    # בדיקת עשן שמפעילה את השרת האמיתי ומוודאת שכל הכלים נחשפים כראוי

Posibles ampliaciones futuras

  • Rango de noches flexible (min/max nights) y no solo un número fijo.

  • Caché de resultados de búsqueda para ahorrar cuota.

  • Incorporación de programas de afiliados adicionales (Expedia, Agoda, etc.) y mostrar varios enlaces a diferentes fuentes por cada resultado, no solo Booking.com.

  • Migración a un proveedor de pago (como StayAPI / RapidAPI) para una cobertura más amplia de proveedores cuando el producto crezca.

  • Registro en la tienda de aplicaciones de ChatGPT (Apps SDK) — proyecto aparte con sus propios requisitos (cuenta de desarrollador en OpenAI, política de privacidad, cuenta demo para pruebas); el modelo de afiliado actual (sin recopilación de tarjetas de crédito) ya cumple con su requisito de "external checkout".

Available Tools

4 tools
flexible_hotels_get_offer_detailsGet Hotel Offer DetailsA
Read-onlyIdempotent

Fetch full, up-to-date details for a single hotel offer previously returned by search_flexible_hotel_offers, including its cancellation policy.

Offer prices can shift between search and booking, so call this before telling the user a final price or sending them to book. Like the rest of this server, it never collects payment details — it only reads offer details and returns a click-through link to the real site.

Args:

  • offer_id (string): the offerId returned by search_flexible_hotel_offers

  • response_format ('markdown' | 'json'): output format (default markdown)

Returns: hotel name, confirmed price, check-in/check-out dates, room description, board type, cancellation deadline, and a booking link to the real site.

Examples:

  • Use when: the user picked one result from search_flexible_hotel_offers and wants to double-check the price before going to book

  • Don't use when: you don't have an offer_id yet — run search_flexible_hotel_offers first

Error Handling:

  • Returns "No details found for this offer id" if the offer expired (Amadeus test-environment offers are short-lived)

Inputs: offer_id (required), response_format.

flexible_hotels_list_hotels_in_cityList Hotels in a CityA
Read-onlyIdempotent

List hotels (with their Amadeus hotelId) located in a given IATA city code, optionally within a radius.

Use this to discover hotelIds you can pass into search_flexible_hotel_offers via hotel_ids, e.g. to restrict a search to a specific neighborhood or a shortlist of hotels the user already mentioned by name. It does NOT return prices or availability — only hotel identity/location. This tool does not modify any data.

Args:

  • city_code (string): 3-letter IATA city code, e.g. "TLV", "PAR" (use resolve_city_code to find it)

  • radius_km (number): search radius around the city center in km, 1-300 (default 20)

  • max_results (number): max hotels to return, 1-30 (default 20)

  • response_format ('markdown' | 'json'): output format (default markdown)

Returns: hotel name, hotelId, chain code, and coordinates for each matching hotel.

Examples:

  • Use when: "only search hotels near the Tel Aviv beachfront" -> narrow radius_km, then pass returned hotelIds to search_flexible_hotel_offers

  • Don't use when: you just want priced offers — use search_flexible_hotel_offers directly, it looks up hotels automatically

Error Handling:

  • Returns "No hotels found for city code ..." if the city_code is invalid or has no coverage in this environment

Inputs: city_code (required), radius_km, max_results, response_format.

flexible_hotels_resolve_city_codeResolve City Name to IATA City CodeA
Read-onlyIdempotent

Look up the 3-letter IATA city code for a free-text city name (e.g. "Tel Aviv" -> "TLV", "Paris" -> "PAR").

Every other tool in this server (list_hotels_in_city, search_flexible_hotel_offers) requires an IATA city_code, so this is normally the first tool to call when the user names a city.

Args:

  • keyword (string): city name or the start of it, e.g. "Tel Aviv", "New York", "Par"

  • max_results (number): max cities to return, 1-20 (default 10)

  • response_format ('markdown' | 'json'): output format (default markdown)

Returns: matching cities with their name, iataCode, and country code.

Examples:

  • Use when: "find flexible hotel deals in Tel Aviv" -> call with keyword="Tel Aviv" first to get city_code="TLV"

  • Don't use when: you already have a 3-letter IATA city code

Error Handling:

  • Returns "No cities found matching ..." if the keyword doesn't match anything

Inputs: keyword (required), max_results, response_format.

flexible_hotels_search_flexible_offersSearch Hotel Offers by Number of Nights (Flexible Dates)A
Read-only

Find the cheapest hotel offers for a fixed NUMBER OF NIGHTS across a WINDOW of possible check-in dates, instead of a single fixed check-in/check-out date pair. This is the core tool of this server.

For example: "3 nights in Tel Aviv, sometime between Sep 1 and Sep 20" is expressed as nights=3, earliest_check_in="2026-09-01", latest_check_in="2026-09-20". The tool scans every possible check-in date in that window (each implying checkout = check-in + nights), fetches real priced offers for each, and returns the cheapest options found, sorted by price — so the caller can see which exact dates are the best deal.

This does NOT search by a single fixed date — for that, just set earliest_check_in = latest_check_in. This is an AFFILIATE search tool: it never collects payment details or creates a booking. Each returned offer includes a bookingUrl — a link to the real hotel/OTA listing where the guest can complete the purchase themselves, if they choose to. Data comes from the Amadeus for Developers hotel API (free test/sandbox environment by default).

Args:

  • city_code (string): 3-letter IATA city code, e.g. "TLV" (use resolve_city_code to find it from a name)

  • nights (number): exact stay length in nights, 1-28

  • earliest_check_in / latest_check_in (YYYY-MM-DD): the flexible window of possible check-in dates, at most 30 days apart

  • hotel_ids (string[], optional): restrict to specific Amadeus hotelIds (from list_hotels_in_city)

  • max_hotels (number): if hotel_ids is omitted, how many hotels in the city to auto-check (default 15)

  • adults (number): guests per room (default 2)

  • room_quantity (number): rooms to book (default 1)

  • currency (string, optional): 3-letter ISO currency code, e.g. "USD"

  • max_results (number): how many offers to return, cheapest first (default 10)

  • response_format ('markdown' | 'json'): output format (default markdown)

Returns: For JSON format: { "cityCode": string, "nights": number, "earliestCheckIn": string, "latestCheckIn": string, "datesScanned": number, "datesWithOffers": number, "datesSkipped": [{ "date": string, "reason": string }], "hotelsConsidered": number, "offers": [{ "offerId", "hotelId", "hotelName", "checkInDate", "checkOutDate", "nights", "currency", "totalPrice", "boardType", "roomDescription", "bookingUrl" }, ...], "cheapest": <same shape as one offer, or null>, "truncated": boolean }

Examples:

  • Use when: "find me the cheapest 3-night stay in Paris sometime in the next month"

  • Use when: "is it cheaper to go for a long weekend early or late September?"

  • Don't use when: the user already has exact fixed dates in mind — a single-date search is faster (set earliest_check_in = latest_check_in), though this tool still works for that case.

Error Handling:

  • Returns an error if the date window exceeds 30 days — narrow it and retry

  • Individual dates that error out (e.g. sandbox has no data) are listed in datesSkipped rather than failing the whole search

Inputs: nights (required), city_code (required), latest_check_in (required), earliest_check_in (required), +7 more.

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A4.6/5.0

    Scored across 4 tools

    Disambiguation5/5

    Each tool has a clearly distinct purpose: resolving city names to codes, listing hotels, searching flexible offers, and getting offer details. There is no overlap or ambiguity between them; the workflow is linear and obvious.

    Naming Consistency5/5

    All tool names follow the same pattern: 'flexible_hotels_' prefix followed by a verb_noun combination (resolve_city_code, list_hotels_in_city, search_flexible_offers, get_offer_details). The verbs are consistent and descriptive, making the API predictable.

    Tool Count4/5

    Four tools is on the lower end but well-scoped for a focused flexible hotel search server. Each tool is necessary and covers a distinct step in the workflow; there is no bloat or redundancy.

    Completeness5/5

    The server covers the complete user journey: resolve city → optionally list hotels → search offers → get details. For an affiliate-focused read-only service, the surface is complete with no obvious missing operations or dead ends.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      Enables AI agents to search, browse, and book hotels from a database of 2 million properties worldwide. Provides comprehensive hotel search capabilities with location lookup, filtering by amenities, detailed property information, and integrated booking functionality.
      6
      1
      ISC
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables AI agents to search, compare, and book hotels with real-time pricing and availability, supporting multiple location types, star ratings, and price filters.
      12
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables AI agents to search and book hotels globally with real-time pricing and inventory from over 2 million properties.
      46
      MIT