WG Tickets MCP
航班查询与预定MCP服务,将GDS API桥接到MCP协议,让AI Agent可以直接调用航班查询、价格查询和预定操作。
安装
pip install wgtickets-mcp
# 或
uvx wgtickets-mcp
配置
环境变量(必须配置)
| 变量名 | 说明 | 必填 |
|---|---|---|
| GDS_BASE_URL | API 基础地址 | 是 |
| GDS_DEFAULT_USERID | 默认用户ID | 是 |
| MCP_TRANSPORT | 传输模式: stdio/sse | 否 |
| MCP_HOST | SSE模式监听地址 | 否 |
| MCP_PORT | SSE模式端口 | 否 |
Claude Desktop 配置
{
"mcpServers": {
"wgtickets-mcp": {
"command": "uvx",
"args": ["wgtickets-mcp"],
"env": {
"GDS_BASE_URL": "https://your-api-url",
"GDS_DEFAULT_USERID": "your-user-id"
}
}
}
}
阿里百炼 配置
{
"mcpServers": {
"wgtickets-mcp": {
"command": "uvx",
"args": ["wgtickets-mcp"],
"env": {
"GDS_BASE_URL": "https://your-api-url",
"GDS_DEFAULT_USERID": "your-user-id"
}
}
}
}
Docker 部署
docker build -t wgtickets-mcp .
docker run -d -p 8080:8080 \
-e GDS_BASE_URL=https://your-api-url \
-e GDS_DEFAULT_USERID=your-user-id \
-e MCP_TRANSPORT=sse \
wgtickets-mcp
可用工具
gds_search_flight - 航班搜索
搜索航班并获取航班列表。
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| flights | array | 是 | 航程列表 |
| passengers | array | 是 | 乘客类型 ["ADT"] |
| tripType | int | 否 | 0=单程, 1=往返, 2=多程 |
| transfer | bool | 否 | 是否允许转机 |
| carriers | array | 否 | 指定航司代码 |
gds_search_flight_price - 价格查询
查询航班详细价格。
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| flightKey | string | 是 | 行程Key |
| flightFareKey | string | 是 | 方案报价Key |
| batchCode | string | 否 | 批次号 |
| passengers | array | 是 | 乘客类型 |
gds_create_pnr - 创建预定
创建PNR预定记录。
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| flightKey | string | 是 | 行程Key |
| flightFareKey | string | 是 | 方案报价Key |
| travelers | array | 是 | 乘机人信息 |
gds_query_pnr - 查询预定
查询PNR预定详情。
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| pnr | string | 是 | PNR号 |
| gds | string | 否 | GDS类型 |
gds_cancel_pnr - 取消预定
取消PNR预定(仅限未出票)。
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| pnr | string | 是 | PNR号 |
gds_issue_ticket - 出票
为PNR出票。
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| pnr | string | 是 | PNR号 |
| gds | string | 是 | GDS类型 |
| flightKey | string | 是 | 行程Key |
| flightFareKey | string | 是 | 方案报价Key |
| travelers | array | 是 | 乘机人列表 |
使用流程
1. gds_search_flight → 搜索航班,获取 flightKey/flightFareKey/batchCode
2. gds_search_flight_price → 查询价格详情
3. gds_create_pnr → 创建预定,获取 PNR号
4. gds_query_pnr → 查询预定状态(可选)
5. gds_issue_ticket → 出票
示例
搜索东京到武汉的航班
{
"flights": [
{
"fromAirportCode": "NRT",
"toAirportCode": "WUH",
"deptDate": "2025-04-15"
}
],
"passengers": ["ADT"],
"transfer": true
}
License
MIT
Metadata
Release files for wgtickets-mcp 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| wgtickets_mcp-0.2.0.tar.gz | 4.1 MB | Without provenance | Details for wgtickets_mcp-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| wgtickets_mcp-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for wgtickets_mcp-0.2.0-py3-none-any.whl |
Total release size: 4.1 MB
Release files / wgtickets_mcp-0.2.0.tar.gz
| Download URL | wgtickets_mcp-0.2.0.tar.gz |
|---|---|
| Size | 4.1 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
58d81478988264fac9236e9888c4794426c76e9c9a95826131f6cf5c0ee6c768
|
|
BLAKE2b-256 checksum How to use checksums |
63b4e292f70835b82ec1070d84f6d2b819b4b823a1f59178600956f30495c203
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.2
|
Release files / wgtickets_mcp-0.2.0-py3-none-any.whl
| Download URL | wgtickets_mcp-0.2.0-py3-none-any.whl |
|---|---|
| Size | 10.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6d23e589553bc591d2711ef3c264f1f26faafe287fe52b46b9b47f0a9fe44493
|
|
BLAKE2b-256 checksum How to use checksums |
11497141ec4fe4b3a6264362112207c4cb03afcbf1068abb20ac3debf81366f1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.2
|
Security for wgtickets-mcp 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.