yhh-mcp-server
v2.0.0
Published
御华浩 B2B 机票 — Cursor/Claude Skill + yhh-cli + MCP stdio(OpenClaw)
Downloads
215
Maintainers
Readme
yhh-mcp-server
御华浩(YHH)B2B 机票 单包发布:yhh-cli(Cursor/Claude Skill)+ yhh-mcp(OpenClaw MCP stdio)+ SDK。
Cursor / Claude Code(推荐)
npm install -g yhh-mcp-server
# 一次性配置
yhh-cli config init --api-url http://your-api-host:18080 --client-secret your-secret
# 安装 Skill + 自检
yhh-cli setup --target cursor
yhh-cli doctor
# 验证
yhh-cli auth login --account <账号> --password <密码> --sender-id cursor:default
yhh-cli flight search --depart 上海 --arrive 西安 --date 2026-07-08 --sender-id cursor:default在 Cursor 中 @yhh-flight-booking,Agent 通过 Shell 执行 yhh-cli。
配置也可写入 ~/.config/yhh/config.json,或由环境变量 YHH_API_BASE_URL、YHH_CLIENT_SECRET 注入。
OpenClaw(MCP stdio)
{
"mcp": {
"servers": {
"yhh-travel": {
"command": "npx",
"args": ["-y", "yhh-mcp-server"],
"env": {
"YHH_API_BASE_URL": "http://your-api-host:8080",
"YHH_CLIENT_SECRET": "your-client-secret"
}
}
}
}
}本地开发:
{
"command": "node",
"args": ["/path/to/mcp-server/dist/mcp/index.js"]
}包内结构
mcp-server/
├── src/sdk/ # API 库(import from 'yhh-mcp-server')
├── src/mcp/ # MCP Server(bin: yhh-mcp, yhh-mcp-server)
├── src/cli/ # CLI(bin: yhh-cli)
├── skills/ # yhh-flight-booking Skill
├── data/ # city_airport_mapping.json
└── dist/yhh-cli 命令一览
| 分组 | 命令 |
|------|------|
| 安装 | setup, config init/show, doctor, skills install |
| 认证 | auth check/login/logout |
| 航班 | flight search/detail/offer-detail/return-search/return-offers/note |
| 乘客 | passenger list/detail/save/remove |
| 订单 | order create/pay/detail/list/cancel |
复杂参数用 --stdin 或 --file order.json 传 JSON(字段同 MCP b2b_* 工具,不含 sender_id)。
环境变量
| 变量 | 必填 | 说明 |
|------|------|------|
| YHH_API_BASE_URL | 是 | B2B 网关根地址 |
| YHH_CLIENT_SECRET | 是 | OAuth Client-Secret |
| YHH_TENANT_ID | 否 | 默认 000000 |
| YHH_MCP_AUTH_DIR | 否 | 登录态目录,默认 ~/.openclaw/mcp-auth |
发布
npm run pack:check
npm login --registry=https://registry.npmjs.org/
npm publish开发
cd mcp-server
npm install
npm run build
node dist/cli/index.js --help
node dist/mcp/index.js # MCP stdio