{
  "markdown": "# green-api-mcp-gateway\n\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![Go Version](https://img.shields.io/github/go-mod/go-version/green-api/green-api-mcp-gateway/main)](https://go.dev/)\n[![release](https://img.shields.io/github/v/release/green-api/green-api-mcp-gateway)](https://github.com/green-api/green-api-mcp-gateway/releases)\n[![Protocol: MCP](https://img.shields.io/badge/Protocol-MCP-orange.svg)](https://modelcontextprotocol.io)\n[![Go Report Card](https://goreportcard.com/badge/github.com/green-api/green-api-mcp-gateway)](https://goreportcard.com/report/github.com/green-api/green-api-mcp-gateway)\n\n- [Документация на русском](README_RU.md) \n\n## Support Links\n\n[![Support](https://img.shields.io/badge/support@green--api.com-D14836?style=for-the-badge&logo=gmail&logoColor=white)](mailto:support@green-api.com)\n[![Support](https://img.shields.io/badge/Telegram-2CA5E0?style=for-the-badge&logo=telegram&logoColor=white)](https://t.me/greenapi_support_eng_bot)\n[![Support](https://img.shields.io/badge/WhatsApp-25D366?style=for-the-badge&logo=whatsapp&logoColor=white)](https://wa.me/77780739095)\n\n## Guides & News\n\n[![Guides](https://img.shields.io/badge/YouTube-%23FF0000.svg?style=for-the-badge&logo=YouTube&logoColor=white)](https://www.youtube.com/@greenapi-en)\n[![News](https://img.shields.io/badge/Telegram-2CA5E0?style=for-the-badge&logo=telegram&logoColor=white)](https://t.me/green_api)\n[![News](https://img.shields.io/badge/WhatsApp-25D366?style=for-the-badge&logo=whatsapp&logoColor=white)](https://whatsapp.com/channel/0029VaLj6J4LNSa2B5Jx6s3h)\n\n---\n\nMCP 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](https://modelcontextprotocol.io).\n\n## What it does\n\nSend 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.\n\nInstructions for connecting the MCP server can be found on [our website](https://green-api.com/en/docs/integration/mcp/integration-setup/)\n\n## Architecture\n\nClean Architecture (Ports & Adapters):\n\n```\ncmd/server/main.go                    — entry point, DI wiring\ninternal/\n  domain/                             — business entities, errors, constants (zero dependencies)\n  application/                        — ports (interfaces)\n  infrastructure/\n    auth.go                           — CredentialManager (in-memory credential store)\n    config/config.go                  — YAML + env configuration\n    greenapi/client.go                — WhatsApp client via Go SDK\n    mcp/\n      server.go                       — MCP server (stdio/sse)\n      tools.go                        — MCP tools registration\n      resources.go                    — MCP resources\n      prompts.go                      — MCP prompts\n    webhook/\n      bridge.go                       — polling bridge\n      receiver.go                     — HTTP receiver\n```\n\n## Build\n\n```bash\ngo build -o green-api-mcp-gateway ./cmd/server\n```\n\nRequires Go 1.25+.\n\n## Transports & endpoints\n\nThe server supports four transports, selected via `server.transport` (or the `GREEN_API_TRANSPORT` env var):\n\n| Transport | Endpoints (relative to `host:port`)             | Use case                                                   |\n|-----------|--------------------------------------------------|------------------------------------------------------------|\n| `stdio`   | stdin/stdout                                     | Local CLIs (Claude Desktop, Cursor) launching the binary.  |\n| `sse`     | `GET /` (stream) + `POST /message`               | Legacy MCP clients (SSE only).                             |\n| `http`    | `POST/GET /mcp`                                  | Streamable HTTP (MCP 2025-03-26+) — preferred for new clients. |\n| `hybrid`  | `/sse` + `/message` **and** `/mcp` on one port   | Public server: serves both legacy SSE and Streamable HTTP. |\n\nAll HTTP-based transports also expose:\n\n- `GET /health`, `GET /healthz` — health probes (no auth)\n- `GET /favicon.ico`, `GET /favicon.png` — GREEN-API icon\n\nWhen `auth.mode: proxy` is enabled, the OAuth 2.0 PKCE endpoints are added too:\n\n- `GET /.well-known/oauth-authorization-server` — RFC 8414 metadata\n- `GET /.well-known/oauth-protected-resource` — RFC 9728 metadata\n- `GET /authorize` — browser-facing authorization form\n- `POST /token` — token exchange\n\n## Configuration\n\n### Via YAML\n\n```yaml\nserver:\n  transport: stdio   # stdio | sse | http | hybrid\n  port: 8090\n\nauth:\n  mode: config       # config | proxy\n  cache_ttl: 300     # seconds (proxy mode only)\n\ngreen_api:\n  instances:\n    - id: 1101000001\n      api_token: \"YOUR_TOKEN\"\n      api_url: \"https://api.green-api.com\"\n\nwebhook:\n  mode: polling\n  polling_timeout: 20\n\nrate_limit:\n  requests_per_second: 10\n  burst: 20\n\nlogging:\n  level: info\n  format: text\n```\n\n### Via environment variables\n\nEnvironment variables take precedence over the YAML config:\n\nThe 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.\n\n- `GREEN_API_INSTANCE_ID` — instance ID\n- `GREEN_API_TOKEN` — API token\n- `GREEN_API_URL` — API base URL (defaults to `https://api.green-api.com`)\n- `GREEN_API_TRANSPORT` — transport: `stdio`, `sse`, `http`, or `hybrid`\n- `GREEN_API_PORT` — HTTP port (defaults to `8090`)\n- `GREEN_API_BASE_URL` — public base URL (used for OAuth issuer/redirects, e.g. `https://mcp.example.com`)\n- `GREEN_API_WIDGET_DOMAIN` — unique widget origin for ChatGPT Apps submission metadata (defaults to `GREEN_API_BASE_URL`, then `https://mcp.green-api.com`)\n- `GREEN_API_AUTH_MODE` — `config` or `proxy`\n- `GREEN_API_AUTH_CACHE_TTL` — proxy-auth credential cache TTL (seconds)\n- `GREEN_API_WEBHOOK_MODE` — `polling` or `receiver`\n- `LOG_LEVEL` — log level\n- `LOG_FORMAT` — `text` or `json`\n\n## Run\n\n```bash\n# With environment variables\nexport GREEN_API_INSTANCE_ID=1101000001\nexport GREEN_API_TOKEN=your_token\n./green-api-mcp-gateway\n\n# With a config file\n./green-api-mcp-gateway --config config.yaml\n```\n\n## Integration\n\n### Claude Desktop (local stdio)\n\nAdd to `claude_desktop_config.json`:\n\n```json\n{\n  \"mcpServers\": {\n    \"whatsapp\": {\n      \"command\": \"/path/to/green-api-mcp-gateway\",\n      \"args\": [\"--config\", \"/path/to/config.yaml\"]\n    }\n  }\n}\n```\n\n### OpenClaw\n\n```yaml\nmcp:\n  servers:\n    - name: whatsapp\n      command: /path/to/green-api-mcp-gateway\n      args: [\"--config\", \"/path/to/config.yaml\"]\n```\n\n### Docker\n\n```bash\ndocker build -t green-api-mcp-gateway .\n\ndocker run --rm -i \\\n  -e GREEN_API_INSTANCE_ID=1101000001 \\\n  -e GREEN_API_TOKEN=your_token \\\n  green-api-mcp-gateway\n```\n\n## MCP Tools\n\n### Messaging\n\n[*Link to documentation*](https://green-api.com/en/docs/integration/mcp/tools/#sending-messages)\n\n- `whatsapp_send_message` — text message\n- `whatsapp_send_file` — file by URL\n- `whatsapp_send_location` — location\n- `whatsapp_send_contact` — contact (vCard)\n- `whatsapp_send_poll` — poll\n- `whatsapp_forward_messages` — forward\n- `whatsapp_edit_message` — edit\n- `whatsapp_delete_message` — delete\n\n### Instance\n\n[*Link to documentation*](https://green-api.com/en/docs/integration/mcp/tools/#instance-management)\n\n- `whatsapp_get_state` — authorization state\n- `whatsapp_get_settings` — current settings\n- `whatsapp_set_settings` — update settings\n- `whatsapp_get_qr` — authorization QR code\n- `whatsapp_connect` — connect instance\n- `whatsapp_disconnect` — disconnect instance\n\n### Contacts\n\n[*Link to documentation*](https://green-api.com/en/docs/integration/mcp/tools/#contacts)\n\n- `whatsapp_get_contacts` — contact list\n- `whatsapp_get_contact_info` — contact information\n- `whatsapp_check_whatsapp` — phone number check\n\n### Groups\n\n[*Link to documentation*](https://green-api.com/en/docs/integration/mcp/tools/#groups)\n\n- `whatsapp_create_group` — create a group\n- `whatsapp_get_group_data` — group data\n- `whatsapp_add_group_participant` — add a participant\n- `whatsapp_remove_group_participant` — remove a participant\n- `whatsapp_leave_group` — leave a group\n\n### Notifications\n\n[*Link to documentation*](https://green-api.com/en/docs/integration/mcp/tools/#notification-queue)\n\n- `whatsapp_receive_notification` — receive an incoming notification (long-poll)\n\n### Partner API\n\n[*Link to documentation*](https://green-api.com/en/docs/integration/mcp/tools/#partner-api)\n\n- `whatsapp_create_instance` — create an instance\n- `whatsapp_delete_instance` — delete an instance\n- `whatsapp_get_instances` — list instances\n\n## MCP Resources\n\n- `whatsapp://instance/{id}/state` — instance state\n- `whatsapp://instance/{id}/settings` — instance settings\n\n## MCP Prompts\n\n- `whatsapp_customer_support` — template for customer support\n- `whatsapp_broadcast` — template for broadcast messaging\n\n## Dependencies\n\n- [mcp-go](https://github.com/mark3labs/mcp-go) — MCP SDK\n- [whatsapp-api-client-golang](https://github.com/green-api/whatsapp-api-client-golang) — GREEN-API Go SDK\n\n## Development\n\n```bash\ngo test ./...\ngofmt -w .\nGOOS=linux GOARCH=amd64 go build -o green-api-mcp-gateway-linux ./cmd/server\n```\n\n## License\n\nMIT — see [LICENSE](LICENSE).\n",
  "bytes": 9942,
  "sha": "0c7cba813b9f7430100c065ad899bd7c7591b618aa8d068e0298943b5e947e57",
  "repo_slug": "green-api/green-api-mcp-gateway",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/mcp_com_green_api_whatsapp_4dd81827/readme"
}