MCP Server
The Retailer API MCP Server is an MCP Server implementation which wraps the functionalities of the Distribusion’s Retailer API functionalities. The purpose of this MCP Server is for it to be used by AI Agents or Agentic applications which support MCP communication, in a Server-to-Server fashion.
Please note that this is an enterprise API feature. Reach out to your Partnership Manager for more information about unlocking this and other advanced features.
Authentication
In order to connect to the MCP Server, clients must pass a key specific to the MCP Server, not the regular key for the API. Contact your Partnership Manager to get access to your MCP Server API key.
How to Use
The MCP Server is intended to be used in a Server-to-Server fashion, in other words, it is not intended to be used in personal AI applications, such as Claude Desktop, or Cursor. Instead, it is targeted towards Agentic application frameworks, such as LangChain, Google ADK, LlamaIndex, and many more.
For instance, using Langchain MCP Adapters, the connection would be setup like this:
from langchain_mcp_adapters.client import MultiServerMCPClient
from langgraph.prebuilt import create_react_agent
client = MultiServerMCPClient(
{
"weather": {
"transport": "streamable_http",
"url": "https://api.distribusion.com/mcp/",
"headers": {
"api-key": "<RAPI_MCP_API_KEY>"
},
}
}
)
tools = await client.get_tools()
agent = create_react_agent("openai:gpt-4.1", tools)
response = await agent.ainvoke({"messages": "london to paris tonight"})Here's an example of a simple agent using Google ADK:
import os
from google.adk.agents.llm_agent import Agent
from google.adk.tools.mcp_tool.mcp_session_manager import StreamableHTTPConnectionParams
from google.adk.tools.mcp_tool.mcp_toolset import MCPToolset
root_agent = Agent(
name="retailer_agent",
description="An agent that searches for ground transportation trips",
model="gemini-2.5-flash",
instruction="""
Help the user find ground transportation trips.
Follow this flow:
1. Search for locations codes (using search_stations, search_areas, search_cities)
2. Search for trips using those location codes and a certain departure date and time using connections_find
3. Present the results to the user
4. Based on the user's selection:
4.1. Check the availability of the trip using connections_vacancy
4.2. If the trip is available:
4.2.1. Get the seat map (if available) for the trip and ask the user for a seat selection using get_seat_map
4.2.2. Use the get_checkout_link tool to create a checkout link for the trip and present it to the user
You may use the tools available to answer additional questions.""",
tools=[
MCPToolset(
connection_params=StreamableHTTPConnectionParams(
url="https://api.distribusion.com/mcp/",
headers={"api-key": os.getenv("DISTRIBUSION_MCP_API_KEY", "")},
)
),
],
)The above example showcases a simple system prompt that instructs the agent to use the MCP Server accordingly. More detailed instructions or different combinations may be written depending on the use case, but generally, agents should follow this flow (analogous to the standard API flow):
1
Find the necessary departure and arrival locations
Either areas, cities, stations, UIC, IATA or geocoordinates.
2
Search for trips
Using the previously obtained codes and a specific departure date.
Search may be filtered by carrier, and search for return trip may be included.
Multiple passengers of different ages may be included as well.
3
Present the search results
Search results include rich data such as available fares, stations data, etc.
4
Check availability
Verify that the selected trip is available and get the most up-to-date price.
5
Optional — get the seat map
If the selected trip supports seat selection, present it to the user.
6
Generate a checkout link
Get a checkout URL for the selected trip, using all the parameters from throughout the conversation.
7
Optional — answer additional questions
At any point, answer queries regarding carrier policies, cheaper travel dates, and more detailed fare information.
Note that the above setups are not time-aware. You may need to add a tool to the agent so that it knows the current date and time. Otherwise, the user must input exactly the travel dates, like “I want to travel on August 7th 2025” instead of “I want to travel next friday”.
You can use the MCP Inspector to explore the MCP Server.
Features
The MCP Server exposes the following tools:
| Search station codes by name, i.e. “Paddington”. | Search for unique 8-letter station codes required for precise routing. |
| Search city codes by name, i.e. “London”. | Best for general searches; uses 5-letter city codes to cover all stations in a city. |
| Search area codes by name/IATA, i.e. “Berlin Airport". | Supports IATA codes (like |
| Search by carrier name (e.g., "Flixbus"). Used to filter search results to specific companies. | Finds 4-letter carrier codes (like |
| Search for trips from location A to location B on a specified date. | Supports one-way or round-trips in one call. Can mix types (e.g., Fly from an IATA code, arrive at a UIC train station). |
| Verify availability and price of a trip before booking. | Mandatory step before booking to confirm the seat is still available and the price hasn't changed. |
| View and select specific seats for a trip. | Check for window vs. aisle availability. Only works for carriers that support pre-assigned seating. |
| Generate booking URL for a trip. | Generates a secure URL to finish the purchase. Supports seat selection and specific passenger types. |
| Find the cheapest dates to travel. | Shows the cheapest prices across a range of dates. Ideal for users with flexible schedules. |
| Get carrier information (terms and conditions, luggage policy, cancellation policy). | Look up luggage limits, passenger requirements, and general terms for a specific carrier company. |
| Get information about a fare class for a marketing carrier, such as ticket validity rules, post-booking conditions, and fare features. | Explains what a specific fare includes (e.g., Refundability, ticket validity, or "Economy vs. Flex"). |
All other functionalities, like reservations and bookings are not supported by the MCP Server. More features will soon be added. We are constantly working on bringing as many features as we can into the MCP Server.
What made this section helpful for you?
What made this section unhelpful for you?
On this page
- MCP Server