comboios-mcp
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@comboios-mcp find trains from Lisbon to Porto tomorrow morning with fares"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
comboios-mcp
An unofficial Model Context Protocol server for Portuguese trains run by Comboios de Portugal (CP). It lets an assistant such as Claude or ChatGPT find stations, search journeys with fares, read live departure boards and train positions, report service alerts and, optionally, sell a ticket through CP's own payment system.
Not affiliated with CP – Comboios de Portugal. The server uses the same undocumented back end as the cp.pt website, with the public credentials that website ships to every browser. It can stop working whenever CP changes that back end. Tickets are issued and charged by CP. Use it with respect for CP's services: the server caches aggressively and limits itself to one upstream request per second.
What it can do
Tool | Purpose |
| Find stations by name (fuzzy, accents optional) and return their CP codes ( |
| Line, address, step-free access and facilities of a station. |
| Journeys between two stations on a date: times, legs, changes and fares, with filters for time window, class, passengers, service and direct trains. |
| The same search shown as interactive cards in the chat (MCP Apps), each with a buy button. The assistant uses it only when the user wants to compare trains or buy. |
| Fares for 1st and 2nd class, optionally for one train. |
| Live departures or arrivals for a station, including the first trains after midnight on late requests. |
| Live status of a train: delay, last station passed and every stop. Falls back to Infraestruturas de Portugal if CP fails. |
| Current alerts (strikes, works, disruptions) with a text filter. |
| Travel classes, booking horizon, passenger limits and service codes. |
| With payments enabled: a link to the purchase page for a journey option. It reserves nothing by itself. |
| With payments disabled: a link that opens the same search on cp.pt. |
Station arguments accept a name or a code; an ambiguous name such as "Lisboa" returns the candidates instead
of a guess. Dates are YYYY-MM-DD and times HH:MM, in Europe/Lisbon.
Related MCP server: mcp-swisstransport
Use the public instance
Add the server as a custom connector. No sign-in is needed.
Claude (web, desktop, mobile): Settings → Connectors → Add custom connector →
https://comboios.noodg.com/mcpChatGPT and other MCP clients: add
https://comboios.noodg.com/mcpas a remote MCP server (Streamable HTTP).
The landing page at https://comboios.noodg.com explains the service and what data goes where.
Run your own
Requires Node.js 20 or later.
npm installnpm run buildLocal, over stdio
Claude Code:
claude mcp add comboios -- node /absolute/path/to/comboios-mcp/dist/index.jsClaude Desktop (claude_desktop_config.json); use the full path to node, because the app does not read
your shell's PATH:
{
"mcpServers": {
"comboios": { "command": "/opt/homebrew/bin/node", "args": ["/absolute/path/to/comboios-mcp/dist/index.js"] }
}
}Locally, payments are disabled and buying goes through a cp.pt link.
Local, over HTTP
HTTP mode binds to 127.0.0.1 and requires a bearer token of at least 16 characters.
CP_MCP_TOKEN="$(openssl rand -hex 24)" node dist/index.js --http --port 8787Hosted on Vercel
vercel.json deploys api/mcp.js (the MCP endpoint at /mcp), api/pay.js and public/ (landing and
purchase pages). The "Other" framework preset is required; Vercel's "Node" preset would run the stdio CLI.
Variable | Purpose |
|
|
| 32 random bytes, base64. Encrypts purchase and pre-fill tokens. Required with payments. |
| Public origin, e.g. |
|
|
openssl rand -base64 32 | tr -d '\n' | vercel env add PAY_TOKEN_KEY production --sensitiveBuying tickets
When PAYMENTS_ENABLED=1, horarios gives each option sold online a buy_url, and comprar_bilhete
returns the same link, optionally with the passenger names, email and phone pre-filled. The page then:
Shows the journey and price, and asks for the passenger names, an email for the ticket and consent. Nothing is reserved before the buyer clicks Continue.
Creates the sale at CP. On trains with seat reservation (Alfa Pendular, Intercidades), shows the seat CP assigned, the occupancy of each carriage and a seat map, and lets the buyer change seats.
Opens CP's own Checkout.com payment form (card, MB WAY or PayPal). Card details never reach this server.
Confirms the sale with CP and offers the PDF ticket, which CP also emails.
Safeguards: personal details are forwarded to CP and not stored or logged; the sale's identifiers travel in an AES-256-GCM token, so the server keeps no state; writes to CP are never retried; a sale is released if CP rejects the details; cancelling is refused whenever a payment may exist. Each direction of a return trip is a separate ticket.
If you run a public instance with payments enabled, you are operating an unofficial checkout for CP tickets on your own domain. You are responsible for that service, its users' data and its support. Consider asking CP for permission first, and keep
PAYMENTS_ENABLEDoff if in doubt.
Disclaimer
This software and the public instance are provided "as is", without warranty of any kind. To the extent permitted by applicable law, the authors and operators accept no liability for any loss or damage arising from their use, including wrong, incomplete or outdated information, failed, duplicated or incorrect purchases, missed trains, or changes and outages of CP's services. Tickets, prices, refunds and travel conditions are CP's responsibility; for any problem with a purchase, contact CP with the purchase reference. See also the license.
Privacy
Searching, timetables, live information and alerts need no personal data. The purchase page sends the details the buyer types to CP to issue the ticket and does not keep them. Hosting providers keep standard request logs.
How it works
Credentials are the public values in
https://www.cp.pt/fe-config.json, fetched at runtime, cached for 6 hours and refreshed once on a 401. They are never logged or stored.All upstream calls share one token bucket (1 request per second, burst 3), a 20 s timeout and two retries on network errors and 502/503/504.
Caches: stations and catalog data 24 h, alerts 10 min, journeys 2 min, live boards 15 s.
Journey option ids are self-contained (
2026-11-30_94-30007_94-2006_c2_p1_out521), so any server instance can resolve them.The in-chat view (
ui/horarios.ts) uses MCP Apps. It is bundled into a single HTML resource with no network access; the buy button asks the host to open the purchase page.
docs/findings.md records what was verified against the live back end, docs/deeplink.md and docs/payment-lab.md how the purchase flow was worked out.
Development
Command | Purpose |
| Unit and protocol tests against recorded fixtures (no network). |
| Live contract tests, one call per tool ( |
| One call per upstream endpoint, printing |
| Re-record |
| Open the MCP Inspector on the built server. |
| Purchase page and in-chat view against fixtures, at |
Contributions are welcome; see CONTRIBUTING.md. Report security issues as described in SECURITY.md.
License
Available Tools
10 toolsclasses_e_regrasClasses, rules and service codesBRead-onlyIdempotent
Travel classes, booking horizon (days ahead), passenger limits and the service codes (AP, IC, ...) CP uses.
Inputs: no named parameters.
estado_comboioLive train statusARead-only
Live status of a train by number: delay, last station passed, and every stop with scheduled/expected times and platform. The date is the departure date at the train's origin (default today; just after midnight it also checks yesterday's run).
Inputs: train_number (required), date.
horariosSearch journeys (timetable + fares)ARead-only
Search CP train journeys between two stations on a date, with times, transfers, legs and fares (EUR per passenger). Times are HH:MM local; arrives_next_day marks journeys that cross midnight; duration comes from CP. cp_url opens the same search on cp.pt. Each option has an id to pass to link_compra; copy it exactly.
Inputs: to (required), from (required), date, lang, +7 more.
info_estacaoStation infoARead-onlyIdempotent
Details for one station: line, address, step-free access and facilities (ticket office, WC, parking, metro, ...).
Inputs: station (required).
link_compraLink to buy on cp.ptARead-onlyIdempotent
Returns a cp.pt link that opens the search results for a journey, so the user can pick the train, enter passenger details and pay on cp.pt. Pass option_id from horarios to also say which train to select, or from/to/date. This does not reserve seats, create a sale or take any personal or payment data; the user completes the purchase on cp.pt.
Inputs: to, date, from, lang, +4 more.
mostrar_horariosShow journey options (interactive)ARead-only
Same search as horarios, but also shows the options to the user as interactive cards in the chat, each with a buy button. Use it only when the user wants to see and compare trains to pick one, or wants to buy. Do NOT use it for quick factual questions (next train, a price, a single time), for checks you make for yourself, or when you will answer in one sentence; use horarios for those. Do not call both for the same search.
Inputs: to (required), from (required), date, lang, +7 more.
partidas_chegadasLive departures/arrivals boardARead-only
Live departures or arrivals for a station, with scheduled and expected times, delay in minutes (null = no real-time data yet) and platform. Late-evening requests also include the first trains after midnight; each row carries its own date.
Inputs: station (required), date, view, limit, +1 more.
perturbacoesService alerts and disruptionsARead-onlyIdempotent
Current CP service alerts (strikes, works, disruptions). Expired alerts are dropped unless include_expired. Use include_body for the full text (larger response). query filters title, subtitle and body (accent-insensitive).
Inputs: lang, query, include_body, homepage_only, +1 more.
precosFares by classBRead-onlyIdempotent
Fares only (EUR per passenger) for each journey option, for 1st and 2nd class. Optionally restrict to one train number or one class.
Inputs: to (required), from (required), date, lang, +8 more.
procurar_estacaoSearch stationsARead-onlyIdempotent
Find CP stations by name (accent-insensitive, fuzzy). Returns a ranked list with CP station codes (94-xxxx) to use in other tools.
Inputs: query (required), limit.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 10 tools
Most tools target distinct resources or actions (station lookup vs. station details, live departures vs. train status, alerts, rules, purchase link). The main overlap is horarios and mostrar_horarios, which perform the same search with different presentation, and precos partially overlaps with horarios by returning fares. Descriptions explicitly warn not to call both search tools together, which mitigates but does not eliminate the ambiguity.
All names are consistently snake_case and in Portuguese, which keeps them readable. However, the naming convention is mixed: some tools use verb_noun (procurar_estacao, mostrar_horarios), while many are bare nouns or noun phrases (horarios, precos, perturbacoes, estado_comboio). The pattern is not fully predictable across the set.
Ten tools is well within the appropriate range for a focused train-information server. Each tool covers a meaningful capability: station discovery, journey search, fares, live status, disruptions, travel rules, and a purchase handoff. The horarios/mostrar_horarios pair is a presentation variant, but it still serves a distinct user-facing purpose.
The surface covers the full read-only travel lifecycle: find stations, inspect facilities, search journeys, compare fares, check live departures/arrivals and train status, review disruptions and travel rules, and hand off to cp.pt for purchase. No obvious operational gaps remain for the stated purpose, and the purchase handoff is intentionally scoped to avoid payment/reservation responsibilities.
Maintenance
Related MCP Connectors
Cached UK train departures and qualified platforms, powered by National Rail Enquiries.
Get date-specific quotes and book private UK airport and cruise-port transfers through your AI assistant. Compare vehicle options, validate flights, retrieve bookings, amend details and cancel with customer confirmation. No registration required to start, subject to service limits; optional API-key and OAuth access for registered integrations. Transfer fares are payable separately and cancellation conditions apply. Live demo and connection instructions: https://ai.airport-pickups-london.com/ Technical documentation: https://mcp.airport-pickups-london.com/docs
Omio MCP server for ChatGPT, Claude and any AI agent: search trips, find the cheapest day and start booking in your own Omio account. Cotlet works in the account through your Cloud Browser, a real Chrome where you sign in to Omio yourself; Cotlet does not store your password and you need no Omio API key. About the official Omio API: Omio has no public API for your own account (checked 24 Oct 2026). Its affiliate programme lists a Search API for partners, and its app in ChatGPT searches trips; Your Bookings, saved travelers and checkout work only on omio.com and in the Omio app. Setup and FAQ: https://cotlet.dev/integrations/omio-api-mcp-server
Stations, connections and departures of Swiss public transport, with real-time delays.
Related MCP Servers
- AlicenseAqualityDmaintenanceEnables querying Renfe train schedules, checking prices, and finding stations across Spain using official GTFS data.34MIT
- AlicenseNot gradedqualityCmaintenanceEnables querying Swiss public transport data (stations, departures, connections) from the Transport Open Data API via natural language through an MCP gateway.79 npmMIT
- FlicenseAqualityDmaintenanceConnects AI assistants to Swiss Federal Railways (SBB/CFF/FFS) data: train schedules, station search, ticket prices, and direct ticket purchase links.678 npm-
- AlicenseNot gradedqualityCmaintenanceLets an AI assistant plan public transport journeys across Germany and other countries, with legs, platforms, delays and alerts, plus stop departures, full trip details, place search, and live DB station boards. Tickets and prices are not included.AGPL 3.0