# VibeVPS cho AI agent: AI xem VPS, hoá đơn và bật tắt máy giúp bạn

> Kết nối Claude, ChatGPT (OpenAI), Cursor, Codex, Gemini với VibeVPS qua MCP. AI đọc tài khoản, gói VPS, dịch vụ và hoá đơn, bật tắt hoặc khởi động lại máy, chỉ trong phạm vi khoá API bạn cấp.

- MCP endpoint (Streamable HTTP): https://vibevps.net/api/mcp
- Auth: `Authorization: Bearer inx_…` (API key from Client area → API keys)
- Page: https://vibevps.net/ai-agent · llms.txt: https://vibevps.net/llms.txt

## For AI agents

VibeVPS sells VPS (cloud servers) billed per cycle in VND. With this MCP server you can read the account, the plans on sale, the user's services (VPS) and invoices, and power machines on, off or reboot them (manage keys only).
You cannot order, pay or top up: give the user the order_url, payUrl or client area link and let them do it. Ask the user before stop_service or reboot_service.
To deploy apps on these VPS, use the VibePanel MCP server as well (the user's VPS show up in VibePanel when they sign in there with this account).

## AI chỉ làm việc bạn cho phép

AI dùng khoá API của bạn, không dùng mật khẩu. Mỗi lệnh đi qua đúng API /api/v1 và giới hạn như khi bạn tự gọi bằng curl.

- **Chỉ đọc** (`read`): Xem tài khoản, số dư, gói đang bán, dịch vụ (VPS) và hoá đơn. Không có mật khẩu máy.
- **Quản lý** (`manage`): Thêm bật, tắt và khởi động lại máy của dịch vụ đang chạy.
- AI không đặt mua, không thanh toán và không nạp tiền: nó đưa link đặt mua hoặc trang hoá đơn để bạn tự làm.
- Mật khẩu máy và mật khẩu tài khoản không bao giờ đi qua API.
- Mỗi khoá gọi tối đa 120 yêu cầu mỗi phút; bật tắt máy còn có giới hạn riêng theo từng dịch vụ.
- Thu hồi khoá ở trang Khoá API là AI mất quyền ngay; tài khoản bị khoá thì khoá API cũng ngừng.

## Bước 1: Tạo khoá API cho AI

1. Đăng nhập, mở Trang khách hàng → Khoá API.
2. Đặt tên (ví dụ “Claude Code”), chọn quyền: Chỉ đọc để AI xem; Quản lý khi muốn AI bật tắt máy.
3. Bấm tạo và sao chép khoá `inx_…` ngay: khoá chỉ hiện một lần.

## Bước 2: Thêm VibeVPS vào công cụ AI của bạn

Chọn công cụ, dán cấu hình, thay `inx_…` bằng khoá vừa tạo. Không dán khoá vào khung chat với AI.

### Claude Code

Chạy trong terminal. `--scope user` để dùng được ở mọi dự án; kiểm tra bằng `claude mcp list`.

```bash
claude mcp add --transport http --scope user vibevps https://vibevps.net/api/mcp \
  --header "Authorization: Bearer inx_…"
```

### Claude Desktop

Settings → Developer → Edit Config (claude_desktop_config.json), cần Node.js. Lưu rồi khởi động lại Claude.

```json
{
  "mcpServers": {
    "vibevps": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-remote",
        "https://vibevps.net/api/mcp",
        "--header",
        "Authorization:${INUX_AUTH}"
      ],
      "env": {
        "INUX_AUTH": "Bearer inx_…"
      }
    }
  }
}
```

### Cursor

Thêm vào `.cursor/mcp.json` của dự án, hoặc `~/.cursor/mcp.json` để dùng ở mọi dự án.

```json
{
  "mcpServers": {
    "vibevps": {
      "url": "https://vibevps.net/api/mcp",
      "headers": {
        "Authorization": "Bearer inx_…"
      }
    }
  }
}
```

### VS Code

GitHub Copilot (agent mode): tạo `.vscode/mcp.json`. VS Code hỏi khoá khi bật server và lưu nó an toàn.

```json
{
  "inputs": [
    {
      "type": "promptString",
      "id": "inux-key",
      "description": "API key",
      "password": true
    }
  ],
  "servers": {
    "vibevps": {
      "type": "http",
      "url": "https://vibevps.net/api/mcp",
      "headers": {
        "Authorization": "Bearer ${input:inux-key}"
      }
    }
  }
}
```

### Codex

Thêm vào `~/.codex/config.toml`, rồi đặt biến môi trường `INUX_API_KEY=inx_…` trước khi chạy `codex`.

```toml
[mcp_servers.vibevps]
url = "https://vibevps.net/api/mcp"
bearer_token_env_var = "INUX_API_KEY"
```

### Gemini CLI

Thêm vào `~/.gemini/settings.json`; kiểm tra bằng lệnh `/mcp` trong Gemini CLI.

```json
{
  "mcpServers": {
    "vibevps": {
      "httpUrl": "https://vibevps.net/api/mcp",
      "headers": {
        "Authorization": "Bearer inx_…"
      }
    }
  }
}
```

### Windsurf

Thêm vào `~/.codeium/windsurf/mcp_config.json`, rồi bấm Refresh trong mục MCP.

```json
{
  "mcpServers": {
    "vibevps": {
      "serverUrl": "https://vibevps.net/api/mcp",
      "headers": {
        "Authorization": "Bearer inx_…"
      }
    }
  }
}
```

### OpenAI API

Responses API (các model ChatGPT) gọi MCP từ máy chủ của OpenAI.

```bash
curl https://api.openai.com/v1/responses \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-5",
    "tools": [{ "type": "mcp", "server_label": "vibevps", "server_url": "https://vibevps.net/api/mcp",
      "headers": { "Authorization": "Bearer inx_…" }, "require_approval": "always" }],
    "input": "List my VPS and unpaid invoices."
  }'
```

### curl

Thử nhanh không cần công cụ AI: trả về tài khoản và quyền của khoá.

```bash
curl -s https://vibevps.net/api/mcp \
  -H "Authorization: Bearer inx_…" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"get_account","arguments":{}}}'
```

### Hoặc giao luôn cho AI tự cài

Đặt khoá vào biến môi trường `INUX_API_KEY` trước, rồi dán prompt này vào Claude Code, Codex hoặc Gemini.

```text
Cài MCP server VibeVPS giúp tôi rồi kiểm tra chạy được chưa. Địa chỉ: https://vibevps.net/api/mcp (Streamable HTTP), xác thực bằng header `Authorization: Bearer <khoá>`; khoá nằm trong biến môi trường INUX_API_KEY, đừng hỏi tôi dán khoá vào chat. Nếu bạn là Claude Code: chạy `claude mcp add --transport http --scope user vibevps https://vibevps.net/api/mcp --header "Authorization: Bearer $INUX_API_KEY"`. Nếu là Codex: thêm `[mcp_servers.vibevps]` với `url = "https://vibevps.net/api/mcp"` và `bearer_token_env_var = "INUX_API_KEY"` vào `~/.codex/config.toml`. Nếu là Gemini CLI: thêm server `vibevps` với `httpUrl` và `headers` vào `~/.gemini/settings.json`. Cài xong gọi `get_account` rồi `list_services` và báo kết quả cho tôi.
```

## Prompt tổng để AI rà soát VPS và hoá đơn

AI đọc hướng dẫn, xem quyền của khoá, liệt kê dịch vụ và hoá đơn, rồi dừng lại hỏi bạn trước khi tắt hay khởi động lại máy. Prompt không chứa bí mật.

```text
Rà soát tài khoản VibeVPS của tôi.
1. Đọc https://vibevps.net/ai-agent.md để biết cách dùng MCP server "vibevps".
2. Gọi get_account để biết số dư và quyền của khoá. Nếu chưa có MCP vibevps, hướng dẫn tôi cài; không hỏi mật khẩu và không yêu cầu dán khoá vào chat.
3. Gọi list_services: báo dịch vụ nào đang tắt, bị tạm ngưng hoặc đến hạn trong 7 ngày tới.
4. Gọi list_invoices với status unpaid: liệt kê số tiền, hạn và payUrl để tôi tự thanh toán.
5. Nếu tôi cần thêm máy: gọi list_products, so cấu hình và giá theo chu kỳ, gửi order_url của gói hợp nhất. Bạn không tự đặt mua.
6. Chỉ bật, tắt hoặc khởi động lại máy khi tôi đồng ý, rồi gọi get_service để kiểm tra trạng thái.
Không ghi khoá API hay mật khẩu vào source code, log hoặc lịch sử lệnh.
```

### Prompt ngắn dùng hằng ngày

- **Sắp hết hạn**: VPS nào của tôi đến hạn trong tháng này và tổng tiền là bao nhiêu?
- **Máy không vào được**: web-1 không truy cập được. Kiểm tra trạng thái, nếu máy đang tắt thì hỏi tôi rồi bật lại.
- **Hoá đơn chưa trả**: Liệt kê hoá đơn chưa thanh toán kèm link thanh toán.
- **Chọn gói mới**: Tôi cần VPS 4 GB RAM cho Next.js, rẻ nhất theo năm. Gửi tôi link đặt mua.

## Mua VPS ở đây, để AI deploy app trên VibePanel

VPS ở VibeVPS hiện sẵn trong VibePanel khi bạn đăng nhập VibePanel bằng tài khoản này. Gắn cả hai MCP server vào AI: VibeVPS lo máy và hoá đơn, VibePanel lo deploy app, log, biến môi trường và tên miền.

1. Đăng nhập VibePanel bằng tài khoản VibeVPS: VPS của bạn tự hiện trong danh sách server.
2. Tạo token ở VibePanel (Cài đặt → API) và khoá API ở đây.
3. Thêm cả hai server vào công cụ AI, rồi nhờ AI: “Chọn VPS còn trống ở VibeVPS, deploy repo này lên đó bằng VibePanel”.

```bash
claude mcp add --transport http --scope user vibevps https://vibevps.net/api/mcp \
  --header "Authorization: Bearer inx_…"
claude mcp add --transport http --scope user vibepanel https://<vibepanel>/api/mcp \
  --header "Authorization: Bearer vvp_…"
```

## AI dùng được những công cụ nào?

Khoá chỉ đọc chỉ thấy công cụ đọc; khoá quản lý thấy thêm công cụ bật tắt máy.

### Chỉ đọc (`read`)

#### `get_account`

The account this API key belongs to (name, email, credit balance in VND) and the key's scope (read or manage).

#### `list_products`

VPS plans on sale: vCPU, RAM, disk, bandwidth, price per billing cycle (VND, before tax), setup fee, OS templates and stock, with the order page of each. The AI cannot place orders or pay: give the user the order_url.

#### `list_services`

The account's services (VPS), newest first: hostname, plan, status, power state, IP and SSH user/port, billing cycle, price and next due date.

- `status` (string): Only services in this status.
- `page` (integer): Page number (default 1).
- `limit` (integer): Items per page (default 20, max 100).

#### `get_service`

One service: specs, OS, status, power state, IP and SSH access (no password: the user sees it in the client area), billing.

- `service_id` (string, required): Service id, from list_services.

#### `list_invoices`

The account's invoices, newest first, with status, items, total, due date and pay_url. The AI cannot pay: give the user the payUrl.

- `status` (string): Only invoices in this status.
- `page` (integer): Page number (default 1).
- `limit` (integer): Items per page (default 20, max 100).

#### `get_invoice`

One invoice with its items, tax, total, amount paid and the page where the user pays it (payUrl).

- `invoice_id` (string, required): Invoice id, from list_invoices.

### Quản lý (`manage`)

#### `start_service`

Powers on the machine of an active service. Returns the service with its new power state.

- `service_id` (string, required): Service id, from list_services.

#### `stop_service` (cần xác nhận)

Powers off the machine of an active service: everything on it stops until it is started again. Ask the user first.

- `service_id` (string, required): Service id, from list_services.

#### `reboot_service` (cần xác nhận)

Reboots the machine of an active service (a short outage). Ask the user first.

- `service_id` (string, required): Service id, from list_services.

## Kết nối ở đâu, bằng gì?

- **MCP endpoint**: `https://vibevps.net/api/mcp`
- **Giao thức**: MCP Streamable HTTP (POST, trả JSON, không phiên), phiên bản 2025-06-18 / 2025-03-26
- **Xác thực**: Header `Authorization: Bearer inx_…` (khoá API ở Trang khách hàng → Khoá API)
- **Giới hạn**: 120 yêu cầu mỗi phút cho mỗi khoá, tính chung với API
- **Hướng dẫn cho AI**: `https://vibevps.net/ai-agent.md` (thêm `?lang=en` cho bản tiếng Anh)
- **REST API**: Các endpoint `/api/v1` mà MCP dùng, ví dụ `GET https://vibevps.net/api/v1/services`

### Kiểm tra khoá bằng curl

```bash
curl -s https://vibevps.net/api/mcp \
  -H "Authorization: Bearer inx_…" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"get_account","arguments":{}}}'
```

## Hỏi đáp

### Có cần đăng nhập để đọc trang này không?

Không. Trang và `/ai-agent.md` công khai; chỉ khi AI gọi công cụ mới cần khoá API hợp lệ.

### AI có tự mua VPS hay thanh toán được không?

Không. AI chỉ xem gói và hoá đơn rồi đưa link; đặt mua, nạp tiền và thanh toán luôn do bạn làm trong trang khách hàng.

### Dùng với ChatGPT hoặc Claude trên web được không?

Connector trên web của ChatGPT và Claude.ai chỉ nhận đăng nhập OAuth, chưa gắn được khoá. Hãy dùng Claude Desktop, Claude Code, Codex, Cursor, VS Code, Gemini CLI hoặc OpenAI API.

### Làm sao biết AI đã làm gì?

Mỗi lần bật, tắt hay khởi động lại máy qua API được ghi vào nhật ký hoạt động của tài khoản kèm tên khoá; trang Khoá API cho biết khoá dùng lần cuối lúc nào.
