Green API WhatsApp

com.green-api由 green-api.com 發布官方發布者v0.1.2更新於 Oct 26, 2026

MCP gateway for WhatsApp via Green API: messaging, contacts, groups and instance management.

已驗證Streamable HTTP可網頁執行效率與工作流溝通與協作

概覽

AI 產生的概覽

Green API 的 WhatsApp 閘道,讓助理透過託管端點收發與管理 WhatsApp 訊息、聯絡人、群組和執行個體。

可以做什麼
  • 傳送、轉寄、編輯和刪除 WhatsApp 訊息,以及依連結或上傳傳送檔案、位置、聯絡人和投票
  • 讀取聊天記錄、最近的收發訊息,並將聊天標示為已讀
  • 查詢聯絡人、頭像、聯絡人與群組資訊,並檢查號碼是否開通 WhatsApp
  • 建立群組、取得群組資料、新增或移除成員、管理管理員
  • 管理執行個體:狀態、設定、QR 授權、連線、中斷、重新啟動、登出,以及合作夥伴層級的建立、列出和刪除
  • 從佇列輪詢或確認接收通知
適用情境
適合需要讓助理透過 Green API 操作 WhatsApp 帳號的情境,例如回覆或傳送客戶訊息、管理群組,或在聊天用戶端中監控收到的通知。
執行需求
遠端端點 mcp.green-api.com,使用 streamable HTTP。需要 Green API 執行個體 ID 和 API 權杖,分別透過 X-Instance-Id 和 X-Api-Token 標頭傳送。專案也提供自架的 Go 程式,可用 YAML 或環境變數設定,支援 stdio、SSE 和 HTTP 傳輸。
安裝前請注意
執行個體 ID 和權杖等同真實 WhatsApp 帳號的控制權,兩個標頭都應視為機密。許多工具會傳送、編輯、刪除、轉寄訊息或將訊息標示為已讀,群組和執行個體工具會修改或刪除資料,包括刪除執行個體。訊息內容和聯絡人會經過 Green API 這個第三方。設定類工具可變更 webhook 和代理設定。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Green API WhatsApp,將其新增到工作區。
  2. 連接 Custom headers 憑證。它們會被私密儲存,絕不會在公開頁面上展示。
  3. 為需要使用其工具的對話啟用該服務。

Web executable,透過 Streamable HTTP。 遠端服務在工作區中設定後即可從網頁執行環境執行。

交給代理程式安裝

把這段提示詞貼上到 Claude Code、Codex、Cursor 等代理程式,或 SourceWeft 對話中。代理程式會讀取該伺服器的安裝指南,先向你展示發布者、端點和登入方式,經你同意後再把它新增到你的客戶端。金鑰不會寫進任何命令。

閱讀 https://sourceweft.com/mcp/com.green-api%2Fwhatsapp/install.md,並按其中說明把這個 MCP 伺服器接入我的客戶端。修改任何設定之前,先告訴我它的發布者、端點和登入方式,等我確認。不要把 API 金鑰寫進命令或我會提交的檔案;問我金鑰應從哪裡取得。

檢視代理程式所依據的安裝指南

其他 MCP 客戶端

把它新增到你客戶端的 mcpServers 設定中。

{
  "mcpServers": {
    "green-api-whatsapp": {
      "type": "http",
      "url": "https://mcp.green-api.com/mcp",
      "headers": {
        "X-Instance-Id": "<VALUE>",
        "X-Api-Token": "<VALUE>"
      }
    }
  }
}

README

green-api-mcp-gateway

[License: MIT] [Go Version] [release] [Protocol: MCP] [Go Report Card]

Support Links

[Support] [Support] [Support]

Guides & News

[Guides] [News] [News]


MCP gateway for GREEN-API WhatsApp. Lets AI agents (Claude Desktop, OpenClaw, Cursor, and others) send messages, manage instances, and receive notifications via WhatsApp using the Model Context Protocol.

What it does

Send text messages, files by URL, locations, contacts, polls. Forward and edit messages. Manage groups (create, fetch data, add/remove participants). Check phone numbers for WhatsApp, fetch contacts and their info. Get instance state and settings, QR code for authorization. Receive incoming notifications via polling or an HTTP receiver. Partner API for creating/deleting instances. Multi-instance support in a single gateway. Prompt templates for common scenarios (customer support, broadcasts). Prometheus metrics and OpenTelemetry.

Instructions for connecting the MCP server can be found on our website

Architecture

Clean Architecture (Ports & Adapters):

cmd/server/main.go                    — entry point, DI wiringinternal/  domain/                             — business entities, errors, constants (zero dependencies)  application/                        — ports (interfaces)  infrastructure/    auth.go                           — CredentialManager (in-memory credential store)    config/config.go                  — YAML + env configuration    greenapi/client.go                — WhatsApp client via Go SDK    mcp/      server.go                       — MCP server (stdio/sse)      tools.go                        — MCP tools registration      resources.go                    — MCP resources      prompts.go                      — MCP prompts    webhook/      bridge.go                       — polling bridge      receiver.go                     — HTTP receiver

Build

bash
go build -o green-api-mcp-gateway ./cmd/server

Requires Go 1.25+.

Transports & endpoints

The server supports four transports, selected via server.transport (or the GREEN_API_TRANSPORT env var):

TransportEndpoints (relative to host:port)Use case
stdiostdin/stdoutLocal CLIs (Claude Desktop, Cursor) launching the binary.
sseGET / (stream) + POST /messageLegacy MCP clients (SSE only).
httpPOST/GET /mcpStreamable HTTP (MCP 2025-03-26+) — preferred for new clients.
hybrid/sse + /message and /mcp on one portPublic server: serves both legacy SSE and Streamable HTTP.

All HTTP-based transports also expose:

  • GET /health, GET /healthz — health probes (no auth)
  • GET /favicon.ico, GET /favicon.png — GREEN-API icon

When auth.mode: proxy is enabled, the OAuth 2.0 PKCE endpoints are added too:

  • GET /.well-known/oauth-authorization-server — RFC 8414 metadata
  • GET /.well-known/oauth-protected-resource — RFC 9728 metadata
  • GET /authorize — browser-facing authorization form
  • POST /token — token exchange

Configuration

Via YAML

yaml
server:  transport: stdio   # stdio | sse | http | hybrid  port: 8090
auth:  mode: config       # config | proxy  cache_ttl: 300     # seconds (proxy mode only)
green_api:  instances:    - id: 1101000001      api_token: "YOUR_TOKEN"      api_url: "https://api.green-api.com"
webhook:  mode: polling  polling_timeout: 20
rate_limit:  requests_per_second: 10  burst: 20
logging:  level: info  format: text

Via environment variables

Environment variables take precedence over the YAML config:

The variables below cover both deployment modes. Credentials variables (GREEN_API_INSTANCE_ID, GREEN_API_TOKEN, GREEN_API_URL) apply only to local stdio runs with auth.mode: config. For HTTP transports (sse on /sse + /message, http on /mcp, or hybrid) use auth.mode: proxy instead — credentials arrive in HTTP headers or via the built-in OAuth flow and the env credentials are ignored.

  • GREEN_API_INSTANCE_ID — instance ID
  • GREEN_API_TOKEN — API token
  • GREEN_API_URL — API base URL (defaults to https://api.green-api.com)
  • GREEN_API_TRANSPORT — transport: stdio, sse, http, or hybrid
  • GREEN_API_PORT — HTTP port (defaults to 8090)
  • GREEN_API_BASE_URL — public base URL (used for OAuth issuer/redirects, e.g. https://mcp.example.com)
  • GREEN_API_WIDGET_DOMAIN — unique widget origin for ChatGPT Apps submission metadata (defaults to GREEN_API_BASE_URL, then https://mcp.green-api.com)
  • GREEN_API_AUTH_MODE — config or proxy
  • GREEN_API_AUTH_CACHE_TTL — proxy-auth credential cache TTL (seconds)
  • GREEN_API_WEBHOOK_MODE — polling or receiver
  • LOG_LEVEL — log level
  • LOG_FORMAT — text or json

Run

bash
# With environment variablesexport GREEN_API_INSTANCE_ID=1101000001export GREEN_API_TOKEN=your_token./green-api-mcp-gateway
# With a config file./green-api-mcp-gateway --config config.yaml

Integration

Claude Desktop (local stdio)

Add to claude_desktop_config.json:

json
{  "mcpServers": {    "whatsapp": {      "command": "/path/to/green-api-mcp-gateway",      "args": ["--config", "/path/to/config.yaml"]    }  }}

OpenClaw

yaml
mcp:  servers:    - name: whatsapp      command: /path/to/green-api-mcp-gateway      args: ["--config", "/path/to/config.yaml"]

Docker

bash
docker build -t green-api-mcp-gateway .
docker run --rm -i \  -e GREEN_API_INSTANCE_ID=1101000001 \  -e GREEN_API_TOKEN=your_token \  green-api-mcp-gateway

MCP Tools

Messaging

Link to documentation

  • whatsapp_send_message — text message
  • whatsapp_send_file — file by URL
  • whatsapp_send_location — location
  • whatsapp_send_contact — contact (vCard)
  • whatsapp_send_poll — poll
  • whatsapp_forward_messages — forward
  • whatsapp_edit_message — edit
  • whatsapp_delete_message — delete

Instance

Link to documentation

  • whatsapp_get_state — authorization state
  • whatsapp_get_settings — current settings
  • whatsapp_set_settings — update settings
  • whatsapp_get_qr — authorization QR code
  • whatsapp_connect — connect instance
  • whatsapp_disconnect — disconnect instance

Contacts

Link to documentation

  • whatsapp_get_contacts — contact list
  • whatsapp_get_contact_info — contact information
  • whatsapp_check_whatsapp — phone number check

Groups

Link to documentation

  • whatsapp_create_group — create a group
  • whatsapp_get_group_data — group data
  • whatsapp_add_group_participant — add a participant
  • whatsapp_remove_group_participant — remove a participant
  • whatsapp_leave_group — leave a group

Notifications

Link to documentation

  • whatsapp_receive_notification — receive an incoming notification (long-poll)

Partner API

Link to documentation

  • whatsapp_create_instance — create an instance
  • whatsapp_delete_instance — delete an instance
  • whatsapp_get_instances — list instances

MCP Resources

  • whatsapp://instance/{id}/state — instance state
  • whatsapp://instance/{id}/settings — instance settings

MCP Prompts

  • whatsapp_customer_support — template for customer support
  • whatsapp_broadcast — template for broadcast messaging

Dependencies

Development

bash
go test ./...gofmt -w .GOOS=linux GOARCH=amd64 go build -o green-api-mcp-gateway-linux ./cmd/server

License

MIT — see LICENSE.

來源:README.md,提交 23ceece

工具

41

whatsapp_add_group_participant

Add Group Participant

Add a participant to a WhatsApp group

輸入參數group_id必填instance_id必填participant_chat_id必填

whatsapp_check_whatsapp

Check WhatsApp Number

Check whether a phone number has a WhatsApp account

輸入參數instance_id必填phone_number必填

whatsapp_connect

Connect Instance

Connect a WhatsApp instance. Call this before using other tools. Validates credentials via getStateInstance.

輸入參數api_urlapi_token必填instance_id必填

whatsapp_create_group

Create Group

Create a WhatsApp group

輸入參數chat_ids必填group_name必填instance_id必填

whatsapp_create_instance

Create Partner Instance

Create a new WhatsApp instance via the GREEN-API Partner API

輸入參數partner_token必填

whatsapp_delete_instance

Delete Partner Instance

Delete a WhatsApp instance via the GREEN-API Partner API

輸入參數instance_id必填partner_token必填

whatsapp_delete_message

Delete Message

Delete a message

輸入參數chat_id必填id_message必填instance_id必填

whatsapp_delete_notification

Delete Notification

Delete a notification from the queue (acknowledge receipt)

輸入參數receipt_id必填instance_id必填

whatsapp_disconnect

Disconnect Instance

Disconnect a WhatsApp instance and remove credentials from the session

輸入參數instance_id必填

whatsapp_edit_message

Edit Message

Edit a previously sent message

輸入參數chat_id必填message必填id_message必填instance_id必填

whatsapp_forward_messages

Forward Messages

Forward messages to another chat

輸入參數chat_id必填messages必填instance_id必填chat_id_from必填

whatsapp_get_authorization_code

Get Authorization Code

Get an authorization code for sign-in by phone number

輸入參數instance_id必填phone_number必填

whatsapp_get_chat_history

Get Chat History

Get chat message history. Use a small 'count' (default 50, max 100) to keep responses focused.

輸入參數countchat_id必填instance_id必填

whatsapp_get_contact_avatar

Get Contact Avatar

Get the avatar of a contact or group

輸入參數chat_id必填instance_id必填

whatsapp_get_contact_info

Get Contact Info

Get information about a contact or group

輸入參數chat_id必填instance_id必填

whatsapp_get_contacts

Get Contacts

Get the contact list

輸入參數instance_id必填

whatsapp_get_group_data

Get Group Data

Get group data (members, name, invite link)

輸入參數group_id必填instance_id必填

whatsapp_get_instances

List Partner Instances

List all partner instances via the GREEN-API Partner API

輸入參數partner_token必填

whatsapp_get_message

Get Message

Get a message by ID

輸入參數chat_id必填id_message必填instance_id必填

whatsapp_get_qr

Get QR Code

Get the QR code for instance authorization. The result contains the QR as an image and a qrLink URL to an official GREEN-API page with a full-size auto-refreshing QR code. Always include the qrLink in your response as a clickable markdown link so the user can open it in the browser and scan comfortably.

輸入參數instance_id必填

whatsapp_get_settings

Get Instance Settings

Get instance settings

輸入參數instance_id必填

whatsapp_get_state

Get Instance State

Get instance state (authorized, notAuthorized, blocked, sleepMode)

輸入參數instance_id必填

whatsapp_get_wa_settings

Get WhatsApp Account Settings

Get WhatsApp account settings (name, description, etc.)

輸入參數instance_id必填

whatsapp_last_incoming_messages

Get Recent Incoming Messages

Get recent incoming messages from the last N minutes (default 60, max 1440 = 24 hours).

輸入參數minutesinstance_id必填

whatsapp_last_outgoing_messages

Get Recent Outgoing Messages

Get recent outgoing messages from the last N minutes (default 60, max 1440 = 24 hours).

輸入參數minutesinstance_id必填

whatsapp_leave_group

Leave Group

Leave a WhatsApp group

輸入參數group_id必填instance_id必填

whatsapp_logout

Logout Instance

Log out the WhatsApp instance

輸入參數instance_id必填

whatsapp_read_chat

Mark Chat as Read

Mark chat messages as read

輸入參數chat_id必填id_messageinstance_id必填

whatsapp_reboot

Reboot Instance

Reboot the WhatsApp instance

輸入參數instance_id必填

whatsapp_receive_notification

Receive Notification

Get one notification from the queue (manual polling)

輸入參數instance_id必填

whatsapp_remove_group_admin

Demote Group Admin

Revoke admin rights from a group member

輸入參數group_id必填instance_id必填participant_chat_id必填

whatsapp_remove_group_participant

Remove Group Participant

Remove a participant from a WhatsApp group

輸入參數group_id必填instance_id必填participant_chat_id必填

whatsapp_send_contact

Send Contact

Send a contact card via WhatsApp

輸入參數chat_id必填companylast_namefirst_nameinstance_id必填phone_number必填

whatsapp_send_file

Send File by URL

Send a file by URL

輸入參數url必填captionchat_id必填file_nameinstance_id必填

whatsapp_send_file_by_upload

Send File

Send a file directly to a chat via multipart upload (no separate URL step)

輸入參數captionchat_id必填filename必填file_base64必填instance_id必填

whatsapp_send_location

Send Location

Send a location

輸入參數nameaddresschat_id必填latitude必填longitude必填instance_id必填

whatsapp_send_message

Send Message

Send a text message via WhatsApp

輸入參數chat_id必填message必填instance_id必填link_previewquoted_message_id

whatsapp_send_poll

Send Poll

Send a poll via WhatsApp

輸入參數chat_id必填message必填options必填instance_id必填multiple_answers

whatsapp_set_group_admin

Promote Group Admin

Promote a group member to admin

輸入參數group_id必填instance_id必填participant_chat_id必填

whatsapp_set_settings

Update Instance Settings

Update instance settings (webhooks, proxy, etc.)

輸入參數instance_id必填webhook_urldelay_messagestate_webhookdevice_webhookincoming_webhookoutgoing_webhookwebhook_url_tokenstatus_instance_webhookmark_incoming_messages_readed

whatsapp_upload_file

Upload File

Upload a file to GREEN-API storage and return its URL. Use the returned URL with whatsapp_send_file.

輸入參數filename必填file_base64必填instance_id必填

版本歷史

1
  1. v0.1.2最新Sep 16, 2026

評分

已滿足適用檢查項的 100%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通必需25 分
  • 已宣告認證方式必需10 分
  • 已列出工具必需15 分
  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分