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

mcp-server-12306

제작: drfccv · drfccv/mcp-server-12306

High-performance Python MCP server for 12306 — real-time tickets, prices, station search, train routes, and transfer planning.

mcp-server-12306 is a FastAPI-based MCP server providing real-time data from China's 12306 railway system. It offers 7 tools for ticket queries, price lookups, station search (Chinese/pinyin/abbreviation), train route stops, transfer planning, and time utilities. Supports both stdio (Claude Desktop) and Streamable HTTP modes, with Docker deployment and sub-second response times.

왜 쓰나요

핵심 기능

라이브 데모

실제 사용 모습

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

설치

클라이언트 선택

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

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

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

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

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

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

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

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

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

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

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

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

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

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

사용 사례

실전 활용법: mcp-server-12306

How to compare train ticket prices for a journey with mcp-server-12306

👤 Budget-conscious travelers in China ⏱ ~5 min beginner

언제 쓸까: You want to find the cheapest option for your train journey.

사전 조건
  • mcp-server-12306 running — uvx mcp-server-12306 or Docker: docker run -p 8000:8000 drfccv/mcp-server-12306:latest
흐름
  1. Search tickets with prices
    Query tickets from Beijing to Guangzhou for tomorrow. Show all available trains with prices for each seat class.✓ 복사됨
    → Table of trains with departure times, durations, and prices per seat class
  2. Get detailed pricing
    Show me the detailed pricing for train G79, including all seat types.✓ 복사됨
    → Complete fare breakdown for the specific train

결과: Clear price comparison to choose the best value train.

함정
  • Prices may vary by date and availability — Check availability alongside prices — cheap seats sell out first

Plan a multi-city train trip across China

👤 Tourists planning a scenic route through multiple Chinese cities ⏱ ~15 min beginner

언제 쓸까: You want to visit several cities and need to plan the train connections.

사전 조건
  • mcp-server-12306 running — uvx mcp-server-12306
흐름
  1. Search stations
    Search for the main train stations in Shanghai, Hangzhou, and Suzhou. Show me the station codes.✓ 복사됨
    → Station names and codes for each city
  2. Plan the route
    Find the fastest train connections for: Shanghai → Hangzhou → Suzhou → back to Shanghai, spending one day in each city. Show departure times and durations.✓ 복사됨
    → Complete itinerary with train numbers and times

결과: A multi-city itinerary with all train connections planned.

함정
  • Small cities may only have one station — Use the station search to confirm available stations before planning

조합

다른 MCP와 조합해 10배 효율

mcp-server-12306-2 + fetch

Check weather at your destination alongside train schedules

Find trains from Beijing to Chengdu this weekend and check the weather forecast for Chengdu.✓ 복사됨

도구

이 MCP가 노출하는 것

도구입력언제 호출비용
query_tickets from: str, to: str, date: str Search for available train tickets 1 API call
query_ticket_price train_no: str, from: str, to: str, date: str Get detailed pricing for a specific train 1 API call
search_stations keyword: str Search stations by name, pinyin, or abbreviation 1 API call
get_station_info station_code: str Get detailed station metadata 1 API call
query_transfer from: str, to: str, date: str Find optimal transfer routes 1 API call
get_train_route_stations train_no: str Get all stops along a train route 1 API call
get_current_time none Get current time for relative date calculations 0

비용 및 제한

운영 비용

API 쿼터
Subject to 12306 public API rate limits
호출당 토큰
200–800 tokens per query
금액
Free — uses public 12306 API
Use station search to confirm names before querying tickets to avoid wasted calls.

보안

권한, 시크릿, 파급범위

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

문제 해결

자주 발생하는 오류와 해결

No tickets found

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

확인: Try today's date to confirm connectivity
Station not recognized

Use search_stations first with pinyin or Chinese to find the exact station name.

확인: search_stations with a broader keyword
Timeout during peak hours

12306 API is slow during peak ticket sales (holidays, Spring Festival). Retry after a few minutes.

확인: Test with a simple station search

대안

mcp-server-12306 다른 것과 비교

대안언제 쓰나단점/장점
12306-mcpYou prefer a JavaScript/npx-based server with simpler setupSimpler install but fewer features (no price queries or HTTP streaming)

더 보기

리소스

📖 GitHub에서 공식 README 읽기

🐙 열린 이슈 보기

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