# TrainTrack MCP setup for agents

Connect to the Streamable HTTP endpoint:

- URL: https://api.traintrack.hu/mcp
- Transport: Streamable HTTP / JSON-RPC
- Documentation: https://api.traintrack.hu/docs
- OpenAPI: https://api.traintrack.hu/openapi.json

Use the server's OAuth protected-resource metadata and dynamic client registration when your MCP client supports them. Never place a user token or API key in a repository, prompt, log, or generated configuration. If the client requires manual headers, ask the user to supply a credential through that client's secret store.

After connecting:

1. Call tools/list; it is authoritative for current tool names and schemas.
2. Use search_trains or get_live_trains to discover current services. Both support class, category, amenity, origin, and destination filtering.
3. Use get_train_details for a selected train.
4. Treat timestamps and stale indicators as part of the answer.
5. Describe results as active-service observations, not ticket availability or a guaranteed itinerary.

Example planning intent: find active first-class trains toward Budapest with Wi-Fi. Use service_class=first_class, destination=Budapest, and amenity=wifi. If no services match, report that live metadata did not prove a match; do not silently relax the filters.

The website also registers browser-local WebMCP tools when supported. Feature-detect document.modelContext; the WebMCP API is a Community Group draft and can change.
