mcporter-railway-query

Query and book Chinese railway tickets via 12306 using mcporter CLI. Use when user wants to search for G/D/C train tickets, check train schedules, query seat availability, or plan rail travel between Chinese cities. Supports filtering by date, time range, train type, and sorting results.

Safety Notice

This listing is from the official public ClawHub registry. Review SKILL.md and referenced scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "mcporter-railway-query" with this command: npx skills add Lancenas/mcporter-railway-query-repo

mcporter Railway Ticket Query

使用 mcporter 命令行工具查询 12306 中国铁路车票信息。

Prerequisites

  1. 安装 mcporter CLI
  2. 配置 12306 MCP 服务器
  3. 确认 mcporter.json 配置路径(默认 ~/.mcporter/mcporter.json)

Quick Start

1. 使用快捷脚本查询

# 查询下午班次 (12:00-18:00)
./scripts/query-afternoon.sh 2026-02-18 SHH KYH

# 查询全天班次
./scripts/query-tickets.sh 2026-02-18 AOH HZH

# 查询车站代码
./scripts/get-station-code.sh "上海虹桥"

2. 直接 mcporter 命令

# 基础查询
mcporter call 12306.get-tickets \
  date="2026-02-18" \
  fromStation="AOH" \
  toStation="HZH" \
  trainFilterFlags="GD" \
  --config ~/.mcporter/mcporter.json

# 下午班次
mcporter call 12306.get-tickets \
  date="2026-02-18" \
  fromStation="AOH" \
  toStation="HZH" \
  trainFilterFlags="GD" \
  earliestStartTime=12 \
  latestStartTime=18 \
  sortFlag="startTime" \
  --config ~/.mcporter/mcporter.json

Workflow

Step 1: 获取车站代码

不知道车站代码时:

mcporter call 12306.get-station-code-of-citys \
  citys="上海|杭州" \
  --config ~/.mcporter/mcporter.json

或查看参考表 station-codes.md

Step 2: 查询车票

mcporter call 12306.get-tickets \
  date="YYYY-MM-DD" \
  fromStation="出发站代码" \
  toStation="到达站代码" \
  [可选过滤参数] \
  --config ~/.mcporter/mcporter.json

Step 3: 解析结果

  • 有票: "有票" 或显示剩余票数 "剩余X张票"
  • 无票: "无票"
  • *票: 特殊标记票

Parameters Reference

参数类型默认值说明
datestring必填日期格式 YYYY-MM-DD
fromStationstring必填出发站代码 (如 SHH)
toStationstring必填到达站代码 (如 KYH)
trainFilterFlagsstring""G=高铁, D=动车, GD=高铁+动车
earliestStartTimenumber0最早出发时间 (0-24)
latestStartTimenumber24最晚出发时间 (0-24)
sortFlagstring""startTime/arriveTime/duration
sortReversebooleanfalse是否倒序
limitedNumnumber0限制结果数量
formatstringtexttext/json/csv

Common Station Codes

城市代码城市代码
上海SHH上海虹桥AOH
杭州东HZH无锡WXH
江阴KYH南京南NKH

完整列表见 station-codes.md

Troubleshooting

mcporter not found

npm install -g mcporter

12306 MCP 未配置

创建 ~/.mcporter/mcporter.json 配置文件。

查询无结果

  • 确认车站代码正确
  • 确认日期格式为 YYYY-MM-DD
  • 检查 mcporter.json 路径

Examples

更多查询示例见 query-examples.md

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Coding

HTML to Markdown

Convert HTML↔Markdown for web clipping, clean notes, and batch content migration. Use when users ask 网页转Markdown/Markdown转HTML/批量转换. Supports local files, UR...

Registry SourceRecently Updated
Coding

Podfetcher Tools

Search podcasts, browse episodes, and fetch podcast transcripts from Podfetcher using the bundled Node.js CLI, SDK, or MCP server.

Registry SourceRecently Updated
Coding

test

Extract and categorize expenses from receipts or statements, map to GL codes, check compliance with policies, and flag anomalies for review.

Registry SourceRecently Updated
Coding

CEO Master

Transforms the agent into a strategic CEO and orchestrator. Vision, decision-making, resource allocation, team dispatch, scaling playbook from €0 to €1B. Use...

Registry SourceRecently Updated