Skip to main content
Glama
README.md
# GOCheap MCP

MCP server cho [GOCheap Open API](https://developer.gocheap.app). Cho phép AI agent (Claude, Cursor, VS Code Copilot và các ứng dụng hỗ trợ MCP) báo giá, đặt, tra cứu và huỷ chuyến tài xế bằng API key của đối tác.

## Công cụ

| Công cụ | Việc làm | Endpoint |
|---|---|---|
| `list_services` | Dịch vụ được mở, loại xe | `GET /services` |
| `search_places` | Tìm địa điểm, lấy `place_id` | `GET /places/search` |
| `get_quote` | Báo giá | `POST /quotes` |
| `create_booking` | Tạo chuyến từ quote đã được người dùng xác nhận | `POST /bookings` |
| `get_booking` | Xem chuyến | `GET /bookings/{booking_id}` |
| `list_bookings` | Danh sách chuyến, đối soát | `GET /bookings` |
| `cancel_booking` | Huỷ chuyến | `POST /bookings/{booking_id}/cancel` |
| `list_webhooks` | Webhook đã đăng ký | `GET /webhooks` |
| `send_webhook_test` | Gửi sự kiện thử | `POST /webhooks/{webhook_id}/test-event` |
| `simulate_booking` | Giả lập trạng thái (chỉ sandbox) | `POST /sandbox/bookings/{booking_id}/simulate` |

## An toàn

- `create_booking` bắt buộc `user_confirmed: true`: AI chỉ được tạo chuyến sau khi người dùng đồng ý giá và thông tin chuyến.
- Gọi lại `create_booking` với cùng `quote_id` không tạo chuyến thứ hai (Idempotency-Key cố định theo quote).
- Key `gc_live_` (production): MCP từ chối tạo và huỷ chuyến trừ khi đặt `GOCHEAP_ALLOW_LIVE_WRITE=true`.
- API key chỉ nằm trong biến môi trường của MCP server, không trả về cho AI và không ghi log.

## Cấu hình

| Biến | Bắt buộc | Ý nghĩa |
|---|---|---|
| `GOCHEAP_API_URL` | Có | Base URL GOCheap gửi kèm API key |
| `GOCHEAP_API_KEY` | Có | `gc_test_...` (sandbox) hoặc `gc_live_...` (production) |
| `GOCHEAP_ALLOW_LIVE_WRITE` | Không | `true` để cho phép tạo/huỷ chuyến bằng key production |
| `GOCHEAP_LANGUAGE` | Không | `vi` (mặc định) hoặc `en`, ngôn ngữ thông báo lỗi |

## Cài đặt

Cần Node.js 20 trở lên. File chạy là [`dist/gocheap-mcp.mjs`](dist/gocheap-mcp.mjs), đã đóng gói sẵn, không cần `npm install`. Base URL và API key do GOCheap gửi riêng cho từng đối tác.

### Claude Code (plugin)

Đặt biến môi trường trước khi mở Claude Code:

```bash
export GOCHEAP_API_URL=<base URL sandbox>
export GOCHEAP_API_KEY=gc_test_...
```

Trong Claude Code:

```
/plugin marketplace add thienanjsc/gocheap-mcp
/plugin install gocheap@gocheap
```

Plugin gồm MCP server và skill `gocheap-dat-chuyen` hướng dẫn AI quy trình báo giá → xác nhận → đặt chuyến.

### Tải file chạy

Các cách cài dưới đây cần file `gocheap-mcp.mjs` trên máy:

```bash
git clone https://github.com/thienanjsc/gocheap-mcp.git
# hoặc chỉ tải một file:
curl -LO https://raw.githubusercontent.com/thienanjsc/gocheap-mcp/main/dist/gocheap-mcp.mjs
```

### Claude Code (chỉ MCP)

```bash
claude mcp add gocheap \
  --env GOCHEAP_API_URL=<base URL sandbox> \
  --env GOCHEAP_API_KEY=gc_test_... \
  -- node /duong/dan/gocheap-mcp/dist/gocheap-mcp.mjs
```

### Claude Desktop, Cursor, VS Code

Thêm vào file cấu hình MCP của ứng dụng (`claude_desktop_config.json`, `.cursor/mcp.json`, ...):

```json
{
  "mcpServers": {
    "gocheap": {
      "command": "node",
      "args": ["/duong/dan/gocheap-mcp/dist/gocheap-mcp.mjs"],
      "env": {
        "GOCHEAP_API_URL": "<base URL sandbox>",
        "GOCHEAP_API_KEY": "gc_test_..."
      }
    }
  }
}
```

## Phát triển

```bash
npm install
npm test        # build + kiểm tra cấu hình, header, xử lý lỗi
npm run build   # tạo dist/gocheap-mcp.mjs
```

Sửa `src/`, chạy `npm run build` và commit cả `dist/gocheap-mcp.mjs` (plugin cài từ git dùng trực tiếp file này).

## Giấy phép

[MIT](LICENSE)

TDQS

A3.9/5.0

Scored across 10 tools

Disambiguation4/5

The core booking lifecycle tools (search_places, get_quote, create_booking, get_booking, list_bookings, cancel_booking) each have a clearly distinct role, and descriptions reinforce the flow ordering. The only real overlap is cancellation, which appears both as cancel_booking and as simulate_booking sub-actions (cancel_by_driver, cancel_by_gocheap); descriptions distinguish them by actor, but an agent could still hesitate there.

Naming Consistency5/5

Every name is snake_case with a leading verb (list_, get_, create_, cancel_, search_, simulate_, send_), producing a predictable verb_noun pattern throughout. send_webhook_test is slightly longer but still follows the verb-first convention and reads clearly.

Tool Count5/5

Ten tools is well-scoped for a ride-hailing booking API: discovery, quoting, booking lifecycle, and webhook diagnostics are each covered by a small number of purpose-built tools. No tool feels redundant or padded.

Completeness4/5

Booking CRUD is fully covered (create, get, list, cancel) plus the quote/place/service prerequisites and sandbox state simulation, so no core workflow dead-ends. Minor gaps remain around webhook management (list and test exist, but no register/update/delete) and no tool for modifying or rescheduling an existing booking.

Maintenance

ActivityMaintained
ResponsivenessNo recent community issues