เอกสารนักพัฒนา · Remote MCP (Streamable HTTP)

เพิ่มการตรวจสลิปไทย
ให้กับ AI agent ทุกตัว

CheckSlip คือ remote MCP server เพียงชี้ AI agent ที่รองรับ MCP ตัวใดก็ได้ — Claude, Cursor, VS Code, Gemini CLI, Codex CLI, Cline, Windsurf หรือของคุณเอง — มาที่ endpoint ด้านล่าง เข้าสู่ระบบครั้งเดียวด้วยชื่อร้านค้า + API key แล้วเครื่องมือ check_slip ก็พร้อมเรียกใช้งาน

MCP Endpoint
https://thaibankslip.com/mcp
ไม่ต้องติดตั้ง SDK ใด ๆ การรับส่งข้อมูลใช้ Streamable HTTP ร่วมกับ OAuth 2.1 (PKCE + Dynamic Client Registration) ไคลเอนต์ส่วนใหญ่จึงลงทะเบียนอัตโนมัติ — คุณเพียงวาง URL แล้วเข้าสู่ระบบ
ขั้นตอนที่ 2

เชื่อมต่อจากไคลเอนต์ MCP ใดก็ได้

เลือก agent หรือ editor ของคุณ ทุกตัวเลือกใช้ endpoint เดียวกัน และเข้าสู่ระบบด้วยชื่อร้านค้า + API key ผ่าน OAuth 2.1 เหมือนกัน

  1. เปิด Settings → Connectors ใน Claude.ai
  2. คลิก Add custom connector
  3. วาง URL ของ MCP endpoint แล้วยืนยัน
  4. Claude จะเปิดหน้าเข้าสู่ระบบ — กรอก ชื่อร้านค้า และ API key (csk_…)
https://thaibankslip.com/mcp

Custom connector ต้องใช้แพ็กเกจ Claude Pro, Max, Team หรือ Enterprise

เพิ่มเซิร์ฟเวอร์ด้วย Claude Code CLI แล้วยืนยันตัวตนจากภายในเซสชัน

# add the remote MCP server (HTTP transport)
claude mcp add --transport http checkslip https://thaibankslip.com/mcp

# then, inside a Claude Code session, run:
/mcp
# …and pick “Authenticate” for checkslip to do the OAuth login

ตรวจสอบว่าเชื่อมต่อแล้วด้วย claude mcp list

Claude Desktop เชื่อมต่อกับเซิร์ฟเวอร์ระยะไกลผ่านบริดจ์ mcp-remote เพิ่มค่านี้ลงใน claude_desktop_config.json (Settings → Developer → Edit Config) แล้วรีสตาร์ตแอป

{
  "mcpServers": {
    "checkslip": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-remote",
        "https://thaibankslip.com/mcp"
      ]
    }
  }
}

หน้าต่างเบราว์เซอร์จะเปิดขึ้นครั้งแรกเพื่อเข้าสู่ระบบ OAuth (ชื่อร้านค้า + API key) ต้องติดตั้ง Node.js ในเครื่อง

Cursor รองรับ remote MCP ในตัว เพิ่มค่านี้ลงใน ~/.cursor/mcp.json (ระดับ global) หรือ .cursor/mcp.json (เฉพาะโปรเจกต์) แล้วเปิดใช้งานเซิร์ฟเวอร์ใน Settings → MCP

{
  "mcpServers": {
    "checkslip": {
      "url": "https://thaibankslip.com/mcp"
    }
  }
}

Cursor จะเปิดหน้าเข้าสู่ระบบ OAuth ในเบราว์เซอร์เมื่อใช้งานเครื่องมือครั้งแรก (ชื่อร้านค้า + API key)

VS Code (โหมด agent ของ GitHub Copilot) รองรับเซิร์ฟเวอร์ Streamable HTTP เพิ่มค่านี้ลงใน .vscode/mcp.json ใน workspace ของคุณ แล้วกด Start เหนือรายการเซิร์ฟเวอร์

{
  "servers": {
    "checkslip": {
      "type": "http",
      "url": "https://thaibankslip.com/mcp"
    }
  }
}

VS Code จะถามให้เข้าสู่ระบบ OAuth (ชื่อร้านค้า + API key) เมื่อใช้งานครั้งแรก ต้องใช้ VS Code เวอร์ชันใหม่ที่เปิดรองรับ MCP

Gemini CLI เชื่อมต่อกับ remote MCP server ในตัวผ่าน Streamable HTTP เพิ่มค่านี้ลงใน ~/.gemini/settings.json (หรือ .gemini/settings.json เฉพาะโปรเจกต์) แล้วรัน /mcp ใน Gemini CLI เพื่อยืนยันว่าเชื่อมต่อแล้ว

{
  "mcpServers": {
    "checkslip": {
      "httpUrl": "https://thaibankslip.com/mcp"
    }
  }
}

หน้าต่างเบราว์เซอร์จะเปิดขึ้นครั้งแรกเพื่อเข้าสู่ระบบ OAuth (ชื่อร้านค้า + API key)

Codex CLI อ่าน MCP server จาก ~/.codex/config.toml และรันผ่าน stdio จึงต้องบริดจ์ไปยังเซิร์ฟเวอร์ระยะไกลนี้ด้วย mcp-remote (ต้องมี Node.js) เพิ่มรายการนี้:

[mcp_servers.checkslip]
command = "npx"
args = ["-y", "mcp-remote", "https://thaibankslip.com/mcp"]

หรือเพิ่มด้วยคำสั่งเดียว: codex mcp add checkslip -- npx -y mcp-remote https://thaibankslip.com/mcp เบราว์เซอร์จะเปิดขึ้นครั้งเดียวเพื่อเข้าสู่ระบบ OAuth

กำลังเขียน agent harness ของคุณเอง (ลูปที่ป้อน schema ของเครื่องมือ MCP ให้โมเดล แล้วรันการเรียกเครื่องมือที่โมเดลเลือก) ใช่ไหม? เชื่อมต่อ endpoint นี้โดยตรงด้วย MCP SDK ผ่าน Streamable HTTP แล้วประกาศเครื่องมือ check_slip ให้โมเดลเรียกใช้

TypeScript

ติดตั้ง @modelcontextprotocol/sdk แล้วเชื่อมต่อด้วย transport แบบ Streamable HTTP:

import { Client } from "@modelcontextprotocol/sdk/client/index.js";
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js";

const transport = new StreamableHTTPClientTransport(
  new URL("https://thaibankslip.com/mcp"),
  { requestInit: { headers: { Authorization: `Bearer ${process.env.CHECKSLIP_TOKEN}` } } },
);
const client = new Client({ name: "my-agent-harness", version: "1.0.0" });
await client.connect(transport);

// list the tools, then hand their schemas to your model
const { tools } = await client.listTools();

// call check_slip when your model decides to verify a slip
const result = await client.callTool({
  name: "check_slip",
  arguments: { transaction_ref: "2024XXXXXXXX", expected_amount: 250 },
});
console.log(result.content);

Python

ติดตั้งแพ็กเกจ mcp (Python) แล้วใช้ไคลเอนต์ Streamable HTTP:

import asyncio
import os
from mcp import ClientSession
from mcp.client.streamable_http import streamablehttp_client

TOKEN = os.environ["CHECKSLIP_TOKEN"]

async def main():
    headers = {"Authorization": f"Bearer {TOKEN}"}
    url = "https://thaibankslip.com/mcp"
    async with streamablehttp_client(url, headers=headers) as (read, write, _):
        async with ClientSession(read, write) as session:
            await session.initialize()
            tools = await session.list_tools()
            result = await session.call_tool(
                "check_slip",
                {"transaction_ref": "2024XXXXXXXX", "expected_amount": 250},
            )
            print(result.content)

asyncio.run(main())
การยืนยันตัวตน: /mcp ใช้ OAuth 2.1 สำหรับ harness ที่รันแบบไม่มีหน้าจอ วิธีที่ง่ายที่สุดคือบริดจ์ผ่าน mcp-remote (ดูแท็บ "เอเจนต์อื่น ๆ") ซึ่งทำ OAuth ให้ครั้งเดียวแล้วแคชโทเค็นไว้ หากคุณมี access token จาก OAuth flow อยู่แล้ว ให้ส่งเป็นเฮดเดอร์ Authorization: Bearer ตามตัวอย่างด้านบน

เอเจนต์และไคลเอนต์อื่น ๆ ส่วนใหญ่ (Cline, Windsurf และ MCP host ที่ทำเอง) จะอยู่ในหนึ่งในสองรูปแบบ หากไคลเอนต์รองรับ remote/HTTP URL โดยตรง ก็แค่ใส่ endpoint แล้วให้มันทำการเข้าสู่ระบบ OAuth เอง:

https://thaibankslip.com/mcp

หากไคลเอนต์รองรับเฉพาะเซิร์ฟเวอร์ local stdio ให้บริดจ์ไปยังเซิร์ฟเวอร์ระยะไกลนี้ด้วย mcp-remote (ต้องมี Node.js):

{
  "mcpServers": {
    "checkslip": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-remote",
        "https://thaibankslip.com/mcp"
      ]
    }
  }
}

เอเจนต์ที่เรียกผ่านโปรแกรมสามารถดึง descriptor ที่เครื่องอ่านได้ (endpoint, transport, auth metadata, tools) ที่ /.well-known/mcp.json

ทางเลือก · ไม่ต้องใช้ MCP

เชื่อมต่อผ่าน REST API

ไม่อยากใช้ไคลเอนต์ MCP? เรียก check_slip ได้โดยตรงด้วย HTTPS + JSON ธรรมดา ยืนยันตัวตนด้วย API key อย่างเดียว (ไม่ต้องทำ OAuth) เหมาะกับระบบหลังบ้าน POS, เว็บฮุค หรือสคริปต์ การหักโทเค็น การตรวจซ้ำ และประวัติทำงานเหมือนกับฝั่ง MCP ทุกประการ

REST Endpoint
https://thaibankslip.com/api/v1/check-slip

ตรวจสอบสลิป

ส่ง POST พร้อมส่วนหัว Authorization: Bearer <API key> และ body เป็น JSON โดยระบุ หนึ่ง ใน qr_payload, transaction_ref หรือ slip_image_base64 (ฟิลด์ทั้งหมดเหมือนเครื่องมือ check_slip ด้านล่าง)

curl -X POST https://thaibankslip.com/api/v1/check-slip \
  -H "Authorization: Bearer csk_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{"transaction_ref":"0123456789","expected_amount":100,"order_id":"order-1042","mark_as_used":true}'

สถานะ / ยอดโทเค็น

เรียก GET ด้วยส่วนหัวเดียวกันเพื่อดูสถานะผู้ให้บริการและยอดโทเค็นคงเหลือ — ใช้ทดสอบการเชื่อมต่อได้

curl https://thaibankslip.com/api/v1/status \
  -H "Authorization: Bearer csk_your_api_key"

รหัสสถานะ HTTP: 200 เมื่อได้ผลชัดเจน (verified/failed/duplicate), 400 input ไม่ถูกต้อง, 401 API key ผิด/ถูกยกเลิก, 402 โทเค็นไม่พอ, 502 ผู้ให้บริการมีปัญหา ตัว body เป็น JSON ผลลัพธ์ชุดเดียวกับเครื่องมือ MCP

ไม่บังคับ · Claude

ติดตั้ง Agent Skill

Agent Skill สอน Claude ว่า เมื่อใด และ อย่างไร ในการตรวจสลิป — รับสลิป เรียก check_slip พร้อมจำนวนเงินที่คาดไว้ อ่านผลลัพธ์ verified/failed/duplicate แล้วทำเครื่องหมายว่าใช้สลิปแล้ว ใช้คู่กับการเชื่อมต่อด้านบนเพื่อให้ Claude จัดการสลิปได้ครบวงจร

ข้อกำหนดเดียว: เชื่อมต่อเซิร์ฟเวอร์ CheckSlip MCP ก่อน (ขั้นตอนที่ 2 ด้านบน) สกิลอธิบายขั้นตอนการทำงาน ส่วนเซิร์ฟเวอร์ MCP เป็นผู้ให้เครื่องมือจริง

Claude Code

บันทึกสกิลลงในไดเรกทอรีสกิลของคุณ (เฉพาะโปรเจกต์ .claude/skills/ หรือ global ~/.claude/skills/) แล้วเริ่มเซสชัน — Claude จะโหลดให้อัตโนมัติเมื่อมีสลิปที่ต้องตรวจ

# download the skill into your project
mkdir -p .claude/skills/thai-slip-verification
curl -fsSL https://thaibankslip.com/skill.md -o .claude/skills/thai-slip-verification/SKILL.md

Claude.ai & Claude Desktop

เปิด Settings → Capabilities → Skills เลือก Upload skill แล้วเพิ่มโฟลเดอร์ชื่อ thai-slip-verification ที่มี SKILL.md ด้านล่าง (ดาวน์โหลดได้จาก https://thaibankslip.com/skill.md)

SKILL.md

สกิลถูกสร้างขึ้นสำหรับ endpoint ของคุณ — คัดลอกได้ตามนี้เลย และยังเสิร์ฟแบบดิบ ๆ ที่ /skill.md ด้วย

---
name: thai-slip-verification
description: Verify Thai bank transfer slips by calling the CheckSlip MCP tools — confirm the amount, receiver, and transfer date, and detect duplicate or reused slips. Use whenever a customer sends a payment slip (an image, a QR payload, or a transaction reference number) to confirm a bank transfer before fulfilling an order.
---

# Thai Bank Slip Verification

Verify Thai bank transfer slips with the **CheckSlip** remote MCP server. Use
this skill to confirm that a customer actually paid — checking the amount,
receiver, and transfer date — and to make sure the same slip is not reused for
two orders.

## Prerequisites

This skill calls tools from the CheckSlip MCP server, so that server must be
connected first:

- Endpoint: https://thaibankslip.com/mcp
- Setup guide: https://thaibankslip.com/docs
- Auth: OAuth 2.1 — sign in once with your store name + API key (`csk_…`).

Once connected, two tools are available:

- `check_slip` — verify a slip and (optionally) mark it as used.
- `slip_checker_status` — report provider/config health (no secrets). Useful as
  a connection smoke test before verifying real slips.

If the tools are not available, tell the user to connect the CheckSlip MCP
server (see https://thaibankslip.com/docs) and stop — do not guess whether a slip is valid.

## When to use this skill

Use it when a customer provides proof of a bank transfer and you need to confirm
it before shipping goods, releasing a service, or marking an order paid — for
example "ลูกค้าส่งสลิปมา" / "here is my payment slip" / "I transferred the
money, here's the receipt".

## How to verify a slip

1. **Collect the slip.** Get exactly one of:
   - `slip_image_base64` — the original full-resolution slip image (PNG/JPEG),
     base64-encoded. The QR is decoded server-side.
   - `qr_payload` — the raw QR string read from the slip.
   - `transaction_ref` — the slip's transaction reference number.
2. **Add what you expect (recommended).** If you know the order details, pass
   `expected_amount`, and optionally `expected_receiver_name`,
   `expected_receiver_account_last4`, and `expected_transfer_date`
   (`YYYY-MM-DD`). The tool then confirms the slip matches the order, not just
   that it is a real slip. Pass `order_id` to record the result against your
   order.
3. **Call `check_slip`** with those fields.
4. **Prevent reuse.** Only once you accept the slip and fulfill the order, call
   `check_slip` again (or the same call) with `mark_as_used: true` so any later
   attempt to reuse that slip returns `duplicate`. Do not mark a slip used until
   you are committing to the order.

## Interpreting the result

The result `status` is one of:

- `verified` — the slip is genuine and (if you passed expectations) matches.
  Safe to fulfill the order.
- `failed` — the slip could not be verified or did not match (wrong amount,
  unknown/too-old slip, etc.). Do **not** fulfill. Tell the customer the slip
  could not be verified and ask for a correct one.
- `duplicate` — this slip was already used for a previous order. Do **not**
  fulfill; the customer is reusing an old slip.
- `provider_error` — the verification service is temporarily unreachable. This
  is a system problem, not the customer's fault. Ask them to try again shortly;
  do not tell them their slip is invalid.
- `config_error` — the server is misconfigured. Surface it to the operator; the
  customer cannot fix this.

Always read the human-readable `message` and the `checks` object (e.g.
`amount_match`, `duplicate`) to explain the outcome clearly.

## Examples

Verify by transaction reference and confirm the amount:

```
check_slip({ transaction_ref: "2024XXXXXXXX", expected_amount: 250, order_id: "order-1042" })
```

Verify a slip image and, on success, mark it used so it cannot be reused:

```
check_slip({ slip_image_base64: "<base64>", expected_amount: 250, mark_as_used: true })
```

Smoke-test the connection:

```
slip_checker_status({})
```

## Guardrails

- Never decide a slip is valid on your own — always rely on `check_slip`. The
  image alone is not proof; only the embedded QR / reference is verified.
- A `provider_error` or `config_error` is never the customer's fault — do not
  tell them their payment is invalid in that case.
- Do not set `mark_as_used: true` until you are actually fulfilling the order.
การยืนยันตัวตน

การเข้าสู่ระบบทำงานอย่างไร

การเข้าถึง /mcp ได้รับการป้องกันด้วย OAuth 2.1 ข้อมูลรับรองร้านค้าของคุณคือ ชื่อร้านค้า + API key — สร้างครั้งเดียวแล้วใช้ซ้ำได้กับทุกไคลเอนต์

  1. สร้างร้านค้าและคีย์ได้ที่ /merchant/register (คีย์ csk_… จะแสดงเพียงครั้งเดียว — เก็บไว้ให้ปลอดภัย)
  2. เมื่อไคลเอนต์เชื่อมต่อ มันจะทำ flow มาตรฐาน OAuth Authorization Code + PKCE; ไคลเอนต์จะถูกลงทะเบียนอัตโนมัติผ่าน Dynamic Client Registration
  3. ในหน้าเข้าสู่ระบบ ให้กรอกชื่อร้านค้า + API key โทเค็นการเข้าถึงเป็น JWT อายุสั้นและจะรีเฟรชอัตโนมัติ

Endpoint สำหรับการค้นหา (Discovery)

ไคลเอนต์ MCP จะอ่านค่าเหล่านี้อัตโนมัติ — แสดงไว้ที่นี่เพื่อใช้อ้างอิง

https://thaibankslip.com/.well-known/oauth-protected-resource
https://thaibankslip.com/.well-known/oauth-authorization-server
อ้างอิง

เครื่องมือ

มีเครื่องมือสองตัวให้ใช้ Claude จะเรียกใช้เองเมื่อเชื่อมต่อแล้ว — คุณแทบไม่ต้องเรียกด้วยมือ

check_slip

ตรวจสอบสลิปโอนเงินไทย ระบุ หนึ่ง ใน slip_image_base64, qr_payload หรือ transaction_ref

ฟิลด์ชนิดคำอธิบาย
slip_image_base64 ไม่บังคับstringรูปสลิปแบบ Base64 (PNG/JPEG) ระบบถอดรหัส QR ฝั่งเซิร์ฟเวอร์ ส่งรูปต้นฉบับความละเอียดเต็ม
qr_payload ไม่บังคับstringสตริง QR ดิบที่อ่านจาก QR สำหรับตรวจสอบบนสลิป
transaction_ref ไม่บังคับstringเลขอ้างอิงรายการของสลิป
expected_amount ไม่บังคับnumberหากระบุ จำนวนเงินบนสลิปต้องตรงกัน
expected_receiver_name ไม่บังคับstringหากระบุ ชื่อผู้รับต้องตรงกัน
expected_receiver_account_last4 ไม่บังคับstring4 หลัก; หากระบุ เลขบัญชีผู้รับ 4 ตัวท้ายต้องตรงกัน
expected_transfer_date ไม่บังคับstringYYYY-MM-DD; หากระบุ วันที่โอนต้องตรงกัน
order_id ไม่บังคับstringเลขอ้างอิงออเดอร์ของคุณ บันทึกพร้อมผลลัพธ์
mark_as_used ไม่บังคับbooleanค่าเริ่มต้น false เมื่อเป็น true สลิปจะถูกทำเครื่องหมายว่าใช้แล้ว เพื่อให้การตรวจครั้งถัดไปคืนค่า duplicate

ผลลัพธ์ status เป็นหนึ่งใน verified, failed, duplicate, provider_error หรือ config_error ตัวอย่างผลลัพธ์ที่สำเร็จ:

{
  "ok": true,
  "status": "verified",
  "message": "Slip verified. Transferred 250.00 THB to ABC Shop.",
  "slip": {
    "transaction_ref": "2024XXXXXXXX",
    "amount": 250,
    "currency": "THB",
    "transfer_datetime": "2026-06-17T14:30:00+07:00",
    "receiver_name": "ABC Shop",
    "receiver_account_last4": "1234",
    "bank_name": "Siam Commercial Bank"
  },
  "checks": {
    "provider_verified": true,
    "amount_match": true,
    "duplicate": false
  },
  "order_id": "order-1042"
}

slip_checker_status

ไม่รับอาร์กิวเมนต์ คืนค่าสถานะของผู้ให้บริการ/การตั้งค่า (ไม่มีข้อมูลลับ) — มีประโยชน์สำหรับทดสอบการเชื่อมต่อ