MCPInstall
12306-mcp-service logo

12306-mcp-service

by xpfyg 1 stars xpfyg/12306-mcp-service

12306 Ticket Purchase Search Server Based on Model Context Protocol (MCP) This server provides a simple API interface that allows large models to utilize the interface to search for 12306 ticket purchase information.

READMEmain

12306-MCP

基于 Model Context Protocol (MCP) 的12306购票搜索服务器。提供了简单的API接口,允许大模型利用接口搜索12306购票信息。

功能特点

  • 查询12306购票信息

待办事项

  • 完成12306其余接口(中转,过站查询等)

安装

git clone https://github.com/xpfyg/12306-mcp-service.git
cd 12306-mcp
go mod init 12306-mcp
go mod tidy

快速开始

  1. 运行服务器
go run main.go

API 示例

查询车票信息:

{
    "from_station": "杭州",
    "to_station": "武汉",
    "date": "2025-04-30"
}

响应示例:

[
  {
	"车次": "G1442",
	"出发站": "杭州西",
	"到达站": "武汉",
	"出发时间": "2025-04-26 06:07:00",
	"到达时间": "2025-04-26 10:23:00",
	"历时": "04:16",
	"余票信息": [{
			"座位类型": "商务座",
			"余票数量": 3,
			"价格": 1018
		},
		{
			"座位类型": "一等座",
			"余票数量": 10,
			"价格": 528
		},
		{
			"座位类型": "二等座",
			"余票数量": 21,
			"价格": 329
		}
	]
}
]

在Cursor中使用

要在Cursor IDE中使用此MCP服务:

  1. 确保12306-MCP服务已在本地运行
  2. 在Cursor设置中启用MCP功能
  3. 本地mcp.json添加:
    "12306-mcp": {
      "url": "http://127.0.0.1:8080/sse"
    }
  1. 连接后即可通过对话框使用以下查询示例:
    请帮我查询杭州到武汉明天的高铁票
    
  2. Cursor将通过MCP协议调用本服务获取实时车票信息

参考

许可证

MIT License

More API Development MCP servers

Similar servers from the same category.

Integrates with DeepL to provide high-quality text translation and rephrasing between numerous languages with formality controls for supported language pairs.

API Development

Integrates with Kong API Gateway to enable management and analysis of API configurations, traffic patterns, and control plane settings through Kong's cloud APIs for DevOps teams maintaining API infrastructure.

API Development

Maton

maton-ai

Integrate with Maton APIs through function calling. This protocol supports various apps and actions to interact with different Maton services.

API Development

Converts OpenAPI specifications from API.market into tools for accessing over 200 services including image generation, geocoding, and content detection through a unified authentication system

authentication