Skip to main content
Glama

RZD API for Bun

Типизированный асинхронный клиент на Bun/TypeScript и MCP-сервер для неофициального API ticket.rzd.ru. Проект не связан с ОАО «РЖД»; внутренние endpoint и схемы ответов могут меняться без предупреждения.

Возможности

  • поиск прямых поездов в одну сторону и туда-обратно;

  • поиск станций и разрешение названий в коды;

  • календарь поездов и минимальные цены;

  • вагоны, места, схемы, изображения и станции маршрута;

  • MCP через STDIO и Streamable HTTP;

  • retries, таймауты и LRU-кэш станций.

Related MCP server: Koleo MCP Server

Установка

Требуется Bun 1.2 или новее.

bun install

TypeScript API

import { RzdClient } from "rzd-api";

const client = new RzdClient();
try {
  const routes = await client.searchTickets(
    "Москва",
    "Санкт-Петербург",
    "2026-09-01",
    { adults: 1 },
  );
  console.log(routes);
} finally {
  client.close();
}

Основные методы: searchTickets, findStations, resolveStationCode, getCarriages, getTrainAvailability, getMinimalPrices, getCarScheme, getCarImages, getRouteStations.

MCP

Локальный STDIO:

bun run mcp

Streamable HTTP на loopback:

bun run mcp:http
curl http://127.0.0.1:8000/health

При публикации на non-loopback адресе нужен Bearer-токен длиной не менее 32 символов:

MCP_TRANSPORT=streamable-http \
MCP_HOST=0.0.0.0 \
MCP_AUTH_TOKEN="replace-with-a-random-token-at-least-32-characters" \
bun run src/mcp.ts

Endpoint: http://localhost:8000/mcp. Переменные окружения: MCP_PORT, MCP_RATE_LIMIT_PER_MINUTE, MCP_ALLOWED_HOSTS.

Подключение к Codex:

codex mcp add rzd -- bun run /absolute/path/to/rzd-api/src/mcp.ts

Docker

export MCP_AUTH_TOKEN="replace-with-a-random-token-at-least-32-characters"
docker compose up -d

Vercel

Проект содержит Vercel Functions без web-фреймворка:

  • https://<project>.vercel.app/mcp — публичный Streamable HTTP MCP;

  • https://<project>.vercel.app/health — healthcheck.

Vercel entrypoint использует Elysia, официальный mcp-handler и Bun Runtime. Маршруты принадлежат самому приложению; Vercel rewrites не используются.

Endpoint РЖД можно переопределить переменными окружения RZD_BASE_URL и RZD_B2B_BASE_URL. Значения не должны храниться в репозитории.

vercel deploy

Разработка

bun run check

Безопасность

Как и прежняя Python-версия, клиент отключает проверку TLS-сертификата API РЖД для совместимости. Не передавайте ему секреты или учётные данные.

Лицензия

MIT

A
license - permissive license
-
quality - not tested
B
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • A
    license
    A
    quality
    C
    maintenance
    An MCP server that enables AI assistants to interact with the Netherlands Railways (NS) API for route planning, pricing, and real-time departure information. It provides tools for searching stations, planning trips with connections, and viewing real-time departure boards.
    Last updated
    3
    1
    MIT
  • F
    license
    A
    quality
    F
    maintenance
    An MCP server that provides access to the Koleo API for Polish train timetables, including station information, departures, and arrivals. It allows users to search for connections, view train routes, and access real-time timetable data and seat occupancy statistics.
    Last updated
    14
    6
  • F
    license
    -
    quality
    F
    maintenance
    An MCP server to retrieve train schedules from National Rail using the Realtime Trains API, providing tools for live departures and arrivals.
    Last updated
    7
  • A
    license
    -
    quality
    D
    maintenance
    An MCP server for real-time Italian railway data, enabling natural language queries about train schedules, delays, departures, arrivals, and live tracking via the Viaggiatreno API.
    Last updated
    4
    MIT

View all related MCP servers

Related MCP Connectors

  • Geo-based flight search MCP server. Find more flights between any two places on earth

  • This MCP server provides seamless access to Malaysia's government open data, including datasets, w…

  • Hotel booking MCP server. Search, book, and manage reservations across 250K+ properties worldwide.

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/slavb18/rzd-api'

If you have feedback or need assistance with the MCP directory API, please join our Discord server