/ 디렉터리 / 플레이그라운드 / 12306-mcp
● 커뮤니티 Joooook ⚡ 바로 사용

12306-mcp

제작: Joooook · Joooook/12306-mcp

Query China's 12306 railway tickets via AI — search trains, check availability, and plan routes with natural language.

12306-mcp is an MCP server that connects AI assistants to China's official 12306 railway system. It supports ticket availability queries, train filtering, transit stop lookups, and multi-leg transfer planning. Runs via npx, Docker, or HTTP mode for flexible deployment.

왜 쓰나요

핵심 기능

라이브 데모

실제 사용 모습

12306-mcp-2.replay ▶ 준비됨
0/0

설치

클라이언트 선택

~/Library/Application Support/Claude/claude_desktop_config.json  · Windows: %APPDATA%\Claude\claude_desktop_config.json
{
  "mcpServers": {
    "12306-mcp-2": {
      "command": "TODO",
      "args": [
        "See README: https://github.com/Joooook/12306-mcp"
      ]
    }
  }
}

Claude Desktop → Settings → Developer → Edit Config 열기. 저장 후 앱 재시작.

~/.cursor/mcp.json · .cursor/mcp.json
{
  "mcpServers": {
    "12306-mcp-2": {
      "command": "TODO",
      "args": [
        "See README: https://github.com/Joooook/12306-mcp"
      ]
    }
  }
}

Cursor는 Claude Desktop과 동일한 mcpServers 스키마 사용. 프로젝트 설정이 전역보다 우선.

VS Code → Cline → MCP Servers → Edit
{
  "mcpServers": {
    "12306-mcp-2": {
      "command": "TODO",
      "args": [
        "See README: https://github.com/Joooook/12306-mcp"
      ]
    }
  }
}

Cline 사이드바의 MCP Servers 아이콘 클릭 후 "Edit Configuration" 선택.

~/.codeium/windsurf/mcp_config.json
{
  "mcpServers": {
    "12306-mcp-2": {
      "command": "TODO",
      "args": [
        "See README: https://github.com/Joooook/12306-mcp"
      ]
    }
  }
}

Claude Desktop과 같은 형식. Windsurf 재시작 후 적용.

~/.continue/config.json
{
  "mcpServers": [
    {
      "name": "12306-mcp-2",
      "command": "TODO",
      "args": [
        "See README: https://github.com/Joooook/12306-mcp"
      ]
    }
  ]
}

Continue는 맵이 아닌 서버 오브젝트 배열 사용.

~/.config/zed/settings.json
{
  "context_servers": {
    "12306-mcp-2": {
      "command": {
        "path": "TODO",
        "args": [
          "See README: https://github.com/Joooook/12306-mcp"
        ]
      }
    }
  }
}

context_servers에 추가. 저장 시 Zed가 핫 리로드.

claude mcp add 12306-mcp-2 -- TODO 'See README: https://github.com/Joooook/12306-mcp'

한 줄 명령. claude mcp list로 확인, claude mcp remove로 제거.

사용 사례

실전 활용법: 12306-mcp

How to find the cheapest train between two cities with 12306-mcp

👤 Travelers planning trips within China ⏱ ~5 min beginner

언제 쓸까: You need to compare train options between two Chinese cities and find the best deal.

사전 조건
  • 12306-mcp server running — npx -y 12306-mcp
흐름
  1. Search for available trains
    Search for trains from Beijing to Shanghai tomorrow. Show me all available options with prices and seat types.✓ 복사됨
    → A table of trains with departure times, durations, seat classes, and prices
  2. Filter by preference
    Which of these has second-class seats available and arrives before 6pm?✓ 복사됨
    → Filtered list matching the criteria

결과: A clear comparison of train options to make a booking decision.

함정
  • Station names must match 12306's database exactly — Use the station search tool first to confirm the correct station name

Plan a multi-leg train journey with transfers using 12306-mcp

👤 Travelers heading to cities without direct trains ⏱ ~10 min beginner

언제 쓸까: No direct train exists between your origin and destination.

사전 조건
  • 12306-mcp server running — npx -y 12306-mcp
흐름
  1. Query transfer options
    I need to get from Chengdu to Lhasa by train. Find me transfer routes with the shortest total travel time.✓ 복사됨
    → One or more transfer itineraries with intermediate stations and connection times
  2. Check availability on each leg
    Check ticket availability for each leg of the recommended route on March 15.✓ 복사됨
    → Seat availability for both legs of the journey

결과: A complete multi-leg itinerary with confirmed availability.

함정
  • Tight transfer windows may cause missed connections — Ask Claude to filter for transfers with at least 2 hours between trains

조합

다른 MCP와 조합해 10배 효율

12306-mcp-2 + fetch

Combine train search with web fetch to check weather at your destination before booking

Find me a train from Shanghai to Hangzhou this Saturday, and check the weekend weather forecast for Hangzhou.✓ 복사됨

도구

이 MCP가 노출하는 것

도구입력언제 호출비용
query_tickets from: str, to: str, date: str Search for available train tickets between two stations 1 API call
search_stations keyword: str Look up station names and codes by keyword 1 API call
query_transfer from: str, to: str, date: str Find transfer routes when no direct train exists 1 API call
get_train_route_stations train_no: str Get all stops along a specific train's route 1 API call

비용 및 제한

운영 비용

API 쿼터
Depends on 12306 public API rate limits — typically sufficient for personal use
호출당 토큰
200–800 tokens per query
금액
Free — queries the public 12306 API
Batch station lookups before running ticket queries to avoid redundant calls.

보안

권한, 시크릿, 파급범위

자격 증명 저장: No credentials required — uses public 12306 API endpoints
데이터 외부 송신: All calls go to 12306.cn official API endpoints

문제 해결

자주 발생하는 오류와 해결

Station name not found

Use the station search tool to find the exact name. Chinese station names must match the 12306 database — try both simplified Chinese and pinyin.

확인: Search for the station by keyword first
No trains found for the given date

12306 only sells tickets 15 days in advance. Ensure your date is within the booking window.

확인: Try a date within the next 15 days
Connection timeout

The 12306 API can be slow during peak booking times (e.g., Spring Festival). Retry after a few minutes.

확인: Test with a simple station search to confirm connectivity

대안

12306-mcp 다른 것과 비교

대안언제 쓰나단점/장점
mcp-server-12306You want a Python-based alternative with FastAPI backend and additional price query toolsMore features (price queries, HTTP streaming) but requires Python/uv setup

더 보기

리소스

📖 GitHub에서 공식 README 읽기

🐙 열린 이슈 보기

🔍 400+ MCP 서버 및 Skills 전체 보기