MCP — giao diện lập trình
Ngoài REST, GetMyBot còn có giao diện MCP (Model Context Protocol) — được thiết kế cho AI agent và trợ lý, vốn gọi công cụ thay vì tự gọi endpoint thủ công. REST vẫn là giao diện chính; MCP là lựa chọn tiện lợi cho các kịch bản agentic. Tên công cụ, tài nguyên và prompt dưới đây khớp với những gì server công bố.
Địa chỉ và xác thực
MCP khả dụng tại endpoint /mcp (transport Streamable HTTP, phương thức POST). Xác thực — cùng token cá nhân như với REST: header Authorization: Bearer mbp_…. Không cần tạo token riêng — một PAT hoạt động được cho cả REST lẫn MCP. Mỗi công cụ yêu cầu cùng scope với REST endpoint tương ứng; token có scope * có toàn quyền truy cập. Nếu scope không đủ — lệnh gọi bị từ chối (fail-closed), giống như trong REST.
Kết nối với Claude Code / Cursor
Thêm GetMyBot làm remote MCP server. Ví dụ cấu hình (mcpServers) — thay tên miền và token của bạn:
{
"mcpServers": {
"mybot": {
"url": "https://your-domain/mcp",
"headers": {
"Authorization": "Bearer mbp_YOUR_TOKEN"
}
}
}
}
Claude Code: đặt khối này vào .mcp.json của dự án hoặc thêm server bằng lệnh claude mcp add. Cursor: thêm cùng khối vào cài đặt MCP (Settings → MCP → Add server). Sau khi kết nối, client sẽ tự động nhận danh sách công cụ, tài nguyên và prompt.
Công cụ theo lĩnh vực
Server công bố 100 công cụ — bao phủ toàn bộ REST khả dụng với PAT. Dưới đây là công cụ và scope yêu cầu. Tên theo định dạng động từ_danh từ (snake_case).
Bot (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
Kênh và template WhatsApp (bots)
Hỗ trợ đa kênh (Telegram + WhatsApp + VK) cũng khả dụng qua MCP. Kênh và template được kiểm soát bởi scope dùng chung bots:read / bots:write — không có scope kênh riêng.
list_channels—bots:read— liệt kê các kênh của một bot (nền tảngtg/wa/vk, external_id, tên, enabled, callback_url).connect_channel—bots:write— kết nối một kênh WhatsApp hoặc VK (platform+ thông tin xác thực).delete_channel—bots:write— ngắt kết nối một kênh.list_wa_templates—bots:read— danh mục template WhatsApp của kênh (tên, ngôn ngữ, trạng thái, danh mục, body).sync_wa_templates—bots:write— đồng bộ lại danh mục template với Meta.create_wa_template—bots:write— tạo một template WhatsApp và gửi tới Meta để kiểm duyệt.update_wa_template—bots:write— chỉnh sửa một template (ở trạng tháiAPPROVED/REJECTED/PAUSED).delete_wa_template—bots:write— xóa một template.
Kênh Telegram được kết nối qua
connect_bot, không phảiconnect_channel— cái sau chỉ xử lýwavàvk. Danh mục template:MARKETING/UTILITY/AUTHENTICATION.create_wa_templategửi ngay bản nháp tới Meta để kiểm duyệt; trạng thái thay đổi một cách bất đồng bộ — đọc lại qualist_wa_templates(làm mới danh mục bằngsync_wa_templatesnếu cần).
Việc tải lên media header của template (hình ảnh/video/tài liệu) qua MCP hiện chưa được hỗ trợ — hãy dùng giao diện web hoặc REST
POST /api/bots/{botID}/channels/{channelID}/templates/media.
Phản ứng (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 qua
import_reactionstạo phản ứng nhưng bỏ qua media: trong ngữ cảnh MCP không có kiểm tra premium và không có Telegram receiver cho file. Nếu bundle SamBot có ảnh/video/tài liệu — hãy dùng REST import đầy đủ (POST /api/bots/{botID}/reactions/import), công cụ này chuyển cả media.
Phát đi (broadcasts)
start_broadcast—broadcasts:write(tùy chọnpaid, tùy chọn phân đoạn theo nhãn)get_broadcast—broadcasts:writepause_broadcast—broadcasts:writeresume_broadcast—broadcasts:writecancel_broadcast—broadcasts:write
Nhãn (labels)
list_labels—labels:readcreate_label—labels:writedelete_label—labels:writeset_label_favorite—labels:write
Bộ sưu tập và bản ghi (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
Kịch bản (flows)
list_flows—flows:readget_flow—flows:readcreate_flow—flows:writeupdate_flow—flows:writedelete_flow—flows:write
Tích hợp, kết nối, thông tin xác thực (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 (media)
upload_media—media:writeget_media—media:write
Template (templates)
list_templates—templates:readdelete_template—templates:writecreate_template_from_bot—templates:writeapply_template—templates:write
Người đăng ký, cuộc trò chuyện, hội thoại — đọc (subscribers)
list_subscribers—subscribers:read(phân trang offset/limit, lọc theo nhãn)list_chats—subscribers:readlist_dialogs—subscribers:readread_dialog—subscribers:readsend_dialog_message—subscribers:writesend_dialog_reaction—subscribers:writetranscribe_dialog_message—subscribers:write
Thống kê và phân tích (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
Thanh toán — đọc (billing)
get_balance—billing:readlist_tariffs—billing:readget_transactions—billing:read
Gửi tin nhắn
send_message—broadcasts:write— gửi tin nhắn nhân danh bot; số dư được tính tự động theo chủ sở hữu token.
Tài nguyên
Ngoài công cụ, server còn cung cấp tài nguyên — bạn có thể đọc chúng để không cần đoán cấu trúc:
mybot://openapi.yaml— OpenAPI spec đầy đủ (giống với những gì trả về tại/openapi.yaml).mybot://reference— tài liệu tham khảo gọn: danh sách công cụ với scope và quy ước (địa chỉ gốc, phân trang, định dạng lỗi, giới hạn).mybot://schemas/reaction,mybot://schemas/trigger,mybot://schemas/action,mybot://schemas/flow,mybot://schemas/collection— JSON schema của các cấu hình. Hữu ích nhất để tạo phản ứng (trình kích hoạt, điều kiện, cuộc trò chuyện, hành động), kịch bản và bộ sưu tập chính xác.mybot://bots— danh sách bot động của bạn (ngữ cảnh nhanh mà không cần gọi công cụ).
Prompt
Các kịch bản sẵn có (slash-command trong MCP client):
setup_autoresponder— tạo bot tự trả lời (tham số: bot, chủ đề/bộ câu hỏi).segment_broadcast— phát đi theo phân đoạn nhãn (tham số: bot, nhãn, phản ứng/văn bản).diagnose_reaction— tìm hiểu tại sao phản ứng không kích hoạt (đọc phản ứng, reaction-health và thứ tự).import_from_sambot— thực hiện import bundle SamBot và kiểm tra kết quả.weekly_report— tổng hợp thống kê/phân tích bot theo kỳ.
Khi nào chọn MCP, khi nào chọn REST
- Bạn viết tích hợp, đồng bộ, script hoặc bảng điều khiển riêng — dùng REST.
- Bạn kết nối GetMyBot với AI assistant hoặc agent hỗ trợ MCP — dùng
/mcp.
Cả hai giao diện đều hoạt động với cùng một token và tuân theo cùng quyền hạn của chủ sở hữu. Nếu không tìm thấy công cụ phù hợp với tác vụ — REST endpoint tương ứng luôn có trong tài liệu tham khảo tương tác.
Bước tiếp theo
- Skill cho AI agent — các wrapper GetMyBot sẵn có cho Claude Code và các agent khác.
- Xác thực và token — tạo PAT cho MCP.
- Bắt đầu nhanh API — lựa chọn thay thế REST.
- Tài liệu tham khảo tương tác — REST endpoint đầy đủ.