MCP Integration
What is MCP?
The Model Context Protocol (MCP) is an open standard that lets AI assistants (like Claude, Cursor, or Windsurf) call external APIs as "tools." Instead of writing code, you describe what you want in plain English and the AI translates that into an API call for you.
With our MCP server, you can ask:
"Find me hotels near the Eiffel Tower under $200 per night"
...and the AI will call the Direct Travel API, get live results, and present them to you — no code required.
Learn more about MCP at modelcontextprotocol.io.
Prerequisites
- An API key from hub.stay22.com (see Authentication)
- An MCP-compatible client (see setup below)
Setup
To connect an AI assistant to the Direct Travel API, you provide it with the URL to our MCP server. Most MCP clients use a JSON configuration file where you define your connected servers.
The server URL is:
{{API_BASE_URL}}/mcp?key=YOUR_API_KEYReplace YOUR_API_KEY with your actual key (see Authentication).
Configuration Example
Add the server to your MCP client's configuration (often named claude_desktop_config.json, .mcp.json, or configured through the UI in clients like Cursor or Windsurf):
json
{
"mcpServers": {
"stay22": {
"url": "{{API_BASE_URL}}/mcp?key=YOUR_API_KEY",
"transport": "http"
}
}
}Note: Depending on your client, the transport type might need to be set to "sse" or "http" (we use an HTTP streamable transport). Refer to your client's documentation for exact configuration details.
Available Tool
search_accommodations
Searches accommodations across our supported providers (booking, expedia, vrbo, and hotelscom).
This tool uses the exact same parameters and functionality as our standard endpoints. For a full list of available inputs (like location, dates, guests, and filters), please refer to the API Reference.
Example Prompts
Once connected, you can simply interact with your AI assistant in natural language. Here are a few examples of what you can ask:
- "Find hotels in Paris"
- "Find VRBO rentals in NYC for a family, under $300 per night, with an 8+ rating"
- "Show me hotels within 2km of the Eiffel Tower"
- "Compare prices for a 4-star hotel in Tokyo across Booking and Expedia"
Rate Limits
MCP calls use the same API key as REST calls, so standard rate limits apply (5 req/min demo, 100 req/min with API key).
Tips
- Be specific with location — "hotels near the Louvre in central Paris" works better than just "hotels"
- Points of interest work — "Eiffel Tower", "Berliner Dom", "Times Square" are all valid locations
- Include dates when relevant — or let them default to 90 days from today
- Try different providers — each provider has different inventory and pricing
- Ask for comparisons — the AI can call the tool multiple times and compare results
Troubleshooting
The AI doesn't see the tool
- Double-check your config JSON syntax (missing commas, wrong quotes)
- Verify your API key is valid — test it with a cURL request first
- Restart your AI client after changing the config
"Rate limit exceeded" errors
- You've exceeded 100 requests/minute (or 5/minute in demo mode)
- Wait 60 seconds and try again
- Get an API key if you're in demo mode
No results returned
- Try a broader location (city name instead of specific address)
- Remove strict filters (high
minguestrating, lowmaxprice) - Try a different provider — not all providers have inventory everywhere
"Invalid API key" error
- Check that your key is correctly pasted in the config URL
- Make sure there are no extra spaces or line breaks in the key
- Generate a new key by following the Authentication guide