MCP — อินเทอร์เฟซโปรแกรม
นอกจาก REST แล้ว GetMyBot ยังมีอินเทอร์เฟซ MCP (Model Context Protocol) ซึ่งออกแบบมาสำหรับ AI agent และ assistant ที่เรียกใช้เครื่องมือแทนการเรียก endpoint โดยตรง REST ยังคงเป็นอินเทอร์เฟซหลัก ส่วน MCP เป็นทางเลือกที่สะดวกสำหรับสถานการณ์แบบ agentic ชื่อของเครื่องมือ ทรัพยากร และพรอมต์ด้านล่างตรงกับสิ่งที่เซิร์ฟเวอร์เผยแพร่
ที่อยู่และการอนุญาต
MCP เข้าถึงได้ที่ endpoint /mcp (transport Streamable HTTP, method POST) การอนุญาตใช้ personal token เดียวกัน กับ REST: header Authorization: Bearer mbp_… ไม่จำเป็นต้องสร้าง token แยก — PAT หนึ่งชุดใช้ได้ทั้ง REST และ MCP เครื่องมือแต่ละชิ้นต้องการ scope เดียวกับ REST endpoint ที่สอดคล้องกัน; token ที่มี scope * มีสิทธิ์เข้าถึงทุกอย่าง หากขาด scope การเรียกจะถูกปฏิเสธ (fail-closed) เช่นเดียวกับ REST
เชื่อมต่อกับ Claude Code / Cursor
เพิ่ม GetMyBot เป็น remote MCP server ตัวอย่างการตั้งค่า (mcpServers) — แทนที่ด้วยโดเมนและ token ของคุณ:
{
"mcpServers": {
"mybot": {
"url": "https://your-domain/mcp",
"headers": {
"Authorization": "Bearer mbp_YOUR_TOKEN"
}
}
}
}
Claude Code: วางบล็อกนี้ใน .mcp.json ของโปรเจกต์หรือเพิ่มเซิร์ฟเวอร์ด้วยคำสั่ง claude mcp add Cursor: เพิ่มบล็อกเดียวกันในการตั้งค่า MCP (Settings → MCP → Add server) หลังเชื่อมต่อ client จะได้รับรายการเครื่องมือ ทรัพยากร และพรอมต์โดยอัตโนมัติ
เครื่องมือตามโดเมน
เซิร์ฟเวอร์เผยแพร่เครื่องมือ 100 รายการ ครอบคลุม REST ที่เข้าถึงได้ด้วย PAT ทั้งหมด ด้านล่างคือเครื่องมือและ scope ที่จำเป็น ชื่ออยู่ในรูปแบบ verb_noun (snake_case)
บอท (bots)
list_bots—bots:readget_bot—bots:readvalidate_bot_token—bots:writeconnect_bot—bots:writeupdate_bot—bots:writedelete_bot—bots:writesync_bot—bots:writechange_bot_token—bots:writetransfer_bot—bots:writeget_bot_settings—settings:readupdate_bot_settings—settings:write
ช่องทางและเทมเพลต WhatsApp (bots)
การรองรับหลายช่องทาง (Telegram + WhatsApp + VK) ก็ใช้ได้ผ่าน MCP เช่นกัน ช่องทางและเทมเพลตถูกควบคุมด้วย scope ที่ใช้ร่วมกัน bots:read / bots:write — ไม่มี scope ช่องทางแยกต่างหาก
list_channels—bots:read— รายการช่องทางของบอท (แพลตฟอร์มtg/wa/vk, external_id, ชื่อ, enabled, callback_url)connect_channel—bots:write— เชื่อมต่อช่องทาง WhatsApp หรือ VK (platform+ ข้อมูลรับรอง)delete_channel—bots:write— ยกเลิกการเชื่อมต่อช่องทางlist_wa_templates—bots:read— แคตตาล็อกเทมเพลต WhatsApp ของช่องทาง (ชื่อ, ภาษา, สถานะ, หมวดหมู่, body)sync_wa_templates—bots:write— ซิงค์แคตตาล็อกเทมเพลตกับ Meta อีกครั้งcreate_wa_template—bots:write— สร้างเทมเพลต WhatsApp และส่งไปยัง Meta เพื่อตรวจสอบupdate_wa_template—bots:write— แก้ไขเทมเพลต (ในสถานะAPPROVED/REJECTED/PAUSED)delete_wa_template—bots:write— ลบเทมเพลต
ช่องทาง Telegram เชื่อมต่อผ่าน
connect_botไม่ใช่connect_channel— ตัวหลังรองรับเฉพาะwaและvkหมวดหมู่เทมเพลต:MARKETING/UTILITY/AUTHENTICATIONcreate_wa_templateส่งฉบับร่างไปยัง Meta เพื่อตรวจสอบทันที; สถานะเปลี่ยนแบบ อะซิงโครนัส — อ่านกลับผ่านlist_wa_templates(รีเฟรชแคตตาล็อกด้วยsync_wa_templatesหากจำเป็น)
การอัปโหลดมีเดียหัวข้อของเทมเพลต (รูปภาพ/วิดีโอ/เอกสาร) ผ่าน MCP ยังไม่รองรับ — ใช้อินเทอร์เฟซเว็บหรือ REST
POST /api/bots/{botID}/channels/{channelID}/templates/media
รีแอคชัน (reactions)
list_reactions—reactions:readget_reaction—reactions:readcreate_reaction—reactions:writeupdate_reaction—reactions:writedelete_reaction—reactions:writeimport_reactions—reactions:writetest_formula—reactions:writereorder_reaction—reactions:writeget_reaction_links—reactions:readlist_reaction_folders—reactions:readcreate_reaction_folder—reactions:writeupdate_reaction_folder—reactions:writedelete_reaction_folder—reactions:writeadd_reaction_to_folder—reactions:writeremove_reaction_from_folder—reactions:writeadd_reactions_to_folder—reactions:write
การนำเข้าผ่าน
import_reactionsสร้างรีแอคชันแต่ ข้ามสื่อมีเดีย: ในบริบท MCP ไม่มีการตรวจสอบ premium และตัวรับไฟล์ Telegram หากบันเดิล SamBot มีรูปภาพ/วิดีโอ/เอกสาร — ให้ใช้การนำเข้า REST แบบเต็มรูปแบบ (POST /api/bots/{botID}/reactions/import) ซึ่งโอนสื่อมีเดียด้วย
การกระจายข่าว (broadcasts)
start_broadcast—broadcasts:write(ตัวเลือกpaid, ตัวเลือกเซกเมนต์ตามป้ายกำกับ)get_broadcast—broadcasts:writepause_broadcast—broadcasts:writeresume_broadcast—broadcasts:writecancel_broadcast—broadcasts:write
ป้ายกำกับ (labels)
list_labels—labels:readcreate_label—labels:writedelete_label—labels:writeset_label_favorite—labels:write
คอลเลกชันและรายการ (collections)
list_collections—collections:readcreate_collection—collections:writeupdate_collection—collections:writedelete_collection—collections:writelist_records—collections:readcreate_record—collections:writeupdate_record—collections:writedelete_record—collections:write
สถานการณ์ (flows)
list_flows—flows:readget_flow—flows:readcreate_flow—flows:writeupdate_flow—flows:writedelete_flow—flows:write
การเชื่อมต่อและการเข้าถึง (integrations)
list_integrations—integrations:readget_integration_sheets—integrations:readget_integration_status—integrations:readcreate_integration—integrations:writeupdate_integration—integrations:writedelete_integration—integrations:writerotate_integration_token—integrations:writelist_connections—integrations:readcreate_connection—integrations:writetest_connection—integrations:writeupdate_connection—integrations:writedelete_connection—integrations:writelist_credentials—integrations:readcreate_credential—integrations:writeupdate_credential—integrations:writedelete_credential—integrations:write
สื่อมีเดีย (media)
upload_media—media:writeget_media—media:write
เทมเพลต (templates)
list_templates—templates:readdelete_template—templates:writecreate_template_from_bot—templates:writeapply_template—templates:write
ผู้ติดตาม แชท และไดอะล็อก — อ่าน (subscribers)
list_subscribers—subscribers:read(pagination offset/limit, กรองตามป้ายกำกับ)list_chats—subscribers:readlist_dialogs—subscribers:readread_dialog—subscribers:readsend_dialog_message—subscribers:writesend_dialog_reaction—subscribers:writetranscribe_dialog_message—subscribers:write
สถิติและการวิเคราะห์ (stats)
get_stats—stats:readget_stats_summary—stats:readget_stats_recent—stats:readget_stats_log—stats:readget_reaction_health—stats:readget_analytics—stats:readget_analytics_chats—stats:readget_funnel—stats:read
การเรียกเก็บเงิน — อ่าน (billing)
get_balance—billing:readlist_tariffs—billing:readget_transactions—billing:read
การส่งข้อความ
send_message—broadcasts:write— ส่งข้อความในนามของบอท; การหักยอดคงเหลือคำนวณโดยอัตโนมัติตามเจ้าของ token
ทรัพยากร
นอกจากเครื่องมือแล้ว เซิร์ฟเวอร์ยังให้ ทรัพยากร ที่สามารถอ่านได้เพื่อทำความเข้าใจโครงสร้าง:
mybot://openapi.yaml— OpenAPI spec ฉบับเต็ม (เหมือนกับที่เสิร์ฟที่/openapi.yaml)mybot://reference— คู่มืออ้างอิงกะทัดรัด: รายการเครื่องมือพร้อม scope และข้อกำหนด (base address, pagination, รูปแบบ error, limits)mybot://schemas/reaction,mybot://schemas/trigger,mybot://schemas/action,mybot://schemas/flow,mybot://schemas/collection— JSON schema ของ config มีประโยชน์มากสำหรับการสร้างรีแอคชัน (trigger, เงื่อนไข, แชท, action), สถานการณ์ และคอลเลกชันได้อย่างถูกต้องmybot://bots— รายการบอทของคุณแบบไดนามิก (context ด่วนโดยไม่ต้องเรียกเครื่องมือ)
พรอมต์
สถานการณ์พร้อมใช้ (slash command ใน MCP client):
setup_autoresponder— ตั้งค่าบอทตอบอัตโนมัติ (อาร์กิวเมนต์: บอท, หัวข้อ/ชุดคำถาม)segment_broadcast— การกระจายข่าวตามเซกเมนต์ป้ายกำกับ (อาร์กิวเมนต์: บอท, ป้ายกำกับ, รีแอคชัน/ข้อความ)diagnose_reaction— วิเคราะห์ว่าทำไมรีแอคชันไม่ทำงาน (อ่านรีแอคชัน, reaction-health และลำดับ)import_from_sambot— นำเข้าบันเดิล SamBot และตรวจสอบผลลัพธ์weekly_report— สรุปสถิติ/การวิเคราะห์ของบอทตามช่วงเวลา
เมื่อไหร่ควรเลือก MCP และเมื่อไหร่ควรเลือก REST
- หากสร้าง integration, synchronization, script หรือแดชบอร์ดของตัวเอง — ใช้ REST
- หากเชื่อมต่อ GetMyBot กับ AI assistant หรือ agent ที่รองรับ MCP — ใช้
/mcp
ทั้งสองอินเทอร์เฟซทำงานภายใต้ token เดียวกันและอยู่ภายใต้สิทธิ์เจ้าของเดียวกัน หากไม่มีเครื่องมือสำหรับงานที่ต้องการ — REST endpoint ที่สอดคล้องกันมีอยู่เสมอใน คู่มืออ้างอิงแบบโต้ตอบ
ขั้นตอนถัดไป
- Skills สำหรับ AI agent — wrapper พร้อมใช้ของ GetMyBot สำหรับ Claude Code และ agent อื่นๆ
- การอนุญาตและ token — สร้าง PAT สำหรับ MCP
- เริ่มต้นใช้งาน API — ทางเลือก REST
- คู่มืออ้างอิงแบบโต้ตอบ — REST endpoint ทั้งหมด