YHT Bilet MCP Server

YHT Bilet MCP Server

Enables searching Turkish high-speed train (YHT) tickets via TCDD API. Supports real-time availability, station name resolution, date formatting, and passenger count.

Category
访问服务器

README

YHT Bilet MCP Server

A Model Context Protocol (MCP) server for searching Turkish train (YHT/High-Speed Train) tickets via TCDD API.

Built with MCP TypeScript SDK

License: MIT TypeScript MCP

✨ Features

  • 🚄 Real-time ticket availability from TCDD API
  • 🗺️ Station name to ID mapping - automatic station resolution
  • 📅 Smart date formatting - automatically formats dates for API (1 day prior at 21:00)
  • 👥 Passenger count support - search for multiple passengers
  • Wheelchair accessibility filter - option to include/exclude wheelchair-accessible seats
  • Schema validation with Zod
  • 🎯 Future train filtering - only shows trains that haven't departed yet
  • 📦 Object-oriented architecture - clean, maintainable, and testable code

📋 Table of Contents

🚀 Quick Start

# 1. Clone the repository
git clone https://github.com/yourusername/yht-bilet-mcp.git
cd yht-bilet-mcp

# 2. Install dependencies
npm install

# 3. Create environment file
cp .env.example .env

# 4. Add your TCDD authorization token to .env
# (See "Getting Authorization Token" section below)

# 5. Build the project
npm run build

# 6. Add to Claude Desktop config (see Configuration section)

📦 Installation

Prerequisites

  • Node.js 18+
  • npm or yarn
  • Claude Desktop or any MCP-compatible client

Steps

1. Install Dependencies

npm install

2. Set Up Environment Variables

Copy the example environment file:

cp .env.example .env

3. Get Your Authorization Token

  1. Visit TCDD E-Ticket Website
  2. Open your browser's Developer Tools (F12)
  3. Go to the Network tab
  4. Perform a ticket search
  5. Find the train-availability request
  6. Copy the Authorization header value from Request Headers
  7. Paste it into your .env file:
AUTH_TOKEN=eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldU...

Note: Authorization tokens expire after some time. If you get authentication errors, get a fresh token.

4. Build the Project

npm run build

🎮 Usage

Adding to Claude Desktop

Add the server to your MCP client configuration:

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

Windows: %APPDATA%\Claude\claude_desktop_config.json

{
  "mcpServers": {
    "yht-bilet": {
      "command": "node",
      "args": [
        "/absolute/path/to/yht-bilet-mcp/build/index.js"
      ]
    }
  }
}

Important: Use absolute paths, not relative paths!

Available Tools

The server provides one tool: search_train_ticket

Parameters

Parameter Type Required Default Description
from string Yes - Departure station name (e.g., "Ankara")
to string Yes - Arrival station name (e.g., "Eskişehir")
date string Yes - Travel date in YYYY-MM-DD format (e.g., "2025-12-25")
passengerCount number No 1 Number of passengers
includeWheelchairSeats boolean No true Include wheelchair-accessible seats in results

Example Usage

In Claude Desktop, you can ask:

Are there any train tickets from Ankara to Eskişehir on December 25, 2025 for 2 passengers?

MCP client will translate this to:

{
  "from": "Ankara",
  "to": "Eskişehir",
  "date": "2025-12-25",
  "passengerCount": 2,
  "includeWheelchairSeats": true
}

To exclude wheelchair seats:

Find train tickets from Ankara to Eskişehir on December 25, 2025, but don't show wheelchair seats.

Response Format

The server returns a formatted text response with:

  • ✅/✗ Success/failure indicator
  • 🚂 Train commercial name
  • ⏰ Departure and arrival times
  • 💰 Minimum price
  • 📍 Available cabin classes with seat counts

Example Response:

✓ Ankara - Eskişehir arası 27.12.2025 tarihi için 3 adet tren sefer bulundu.

🚂 YHT ESKİŞEHİR - ANKARA (11:30 - 12:54):
   Minimum Fiyat: 390 TL
   
   📍 Müsait Kabinler:
      • BUSİNESS: 39 koltuk
      • EKONOMİ: 86 koltuk
      • TEKERLEKLİ SANDALYE: 2 koltuk
...

📝 License

MIT License - see LICENSE file for details


Made with ❤️ for the Turkish rail community

Need help? Open an issue

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选