Skip to main content
Glama

whatsmcp

ステートレスなMCPサーバーをCloudflare Workers上で動作させ、Z-API WhatsApp REST APIをツールとして公開します。Streamable HTTP経由で https://whatsmcp.unfld.dev/mcp にて提供されます。

ツールはビルド時に postman.json から生成されるため、手動でメンテナンスするのではなく、コレクションに追従したツールサーフェスが保たれます。3つのメタツール(zapi_list_endpoints、zapi_describe_endpoint、zapi_request)は常に登録されるため、ツールセットフィルターで公開範囲を絞っても、どのエンドポイントも到達不能になることはありません。

セットアップ

bun install

リポジトリルートに .dev.vars を作成し(gitignore対象)、Z-APIの認証情報を記述します:

MCP_AUTH_TOKEN=...
ZAPI_INSTANCE_ID=...
ZAPI_INSTANCE_TOKEN=...
ZAPI_CLIENT_TOKEN=...

ZAPI_INSTANCE_ID と ZAPI_INSTANCE_TOKEN はインスタンスのベースURLを構築するために使用し、ZAPI_CLIENT_TOKEN は Client-Token ヘッダーとして送信されます。MCP_AUTH_TOKEN はクライアントが提示する必要がある静的ベアラートークンです。

Related MCP server: WA MCP

ローカル実行

bun run dev

Wrangler は Worker を http://localhost:8787 で提供します。MCPエンドポイントは http://127.0.0.1:8787/mcp です。クライアントは以下のいずれかを送信する必要があります:

Authorization: Bearer <MCP_AUTH_TOKEN>
Authorization: <MCP_AUTH_TOKEN>

GET /health は公開されており、{ "ok": true, "name": "whatsmcp" } を返します。

スクリプト

スクリプト

説明

bun run generate

Postmanコレクションから src/generated/endpoints.ts を再生成

bun run dev

wrangler dev でWorkerをローカル実行

bun run deploy

Cloudflareにデプロイ

bun run typecheck

tsc --noEmit

bun test

テストスイートを実行

bun run cf-typegen

wrangler.jsonc + .dev.vars から worker-configuration.d.ts を再生成

wrangler.jsonc のバインディングや変数を変更した後は、bun run cf-typegen を再実行してください。

設定

ZAPI_TOOLSETS(wrangler.jsonc 内のプレーン変数、デフォルトは *)は、ツールとして登録するZ-APIカテゴリを選択します(例:instance,messages,groups)。メタツールはこのフィルターを無視します。

デプロイ

シークレットは wrangler.jsonc に保存されません。環境ごとに一度設定します:

wrangler secret put MCP_AUTH_TOKEN
wrangler secret put ZAPI_INSTANCE_ID
wrangler secret put ZAPI_INSTANCE_TOKEN
wrangler secret put ZAPI_CLIENT_TOKEN
wrangler deploy

カスタムドメイン whatsmcp.unfld.dev は wrangler.jsonc で宣言されており、初回デプロイ時にCloudflareによってプロビジョニングされます。

クライアントの接続

{
  "mcpServers": {
    "whatsmcp": {
      "url": "https://whatsmcp.unfld.dev/mcp",
      "headers": { "Authorization": "Bearer <MCP_AUTH_TOKEN>" }
    }
  }
}

Authorization: Bearer <MCP_AUTH_TOKEN> とベアの Authorization: <MCP_AUTH_TOKEN> の両方の形式が受け入れられます。GET /health は公開されており、アップタイムチェックのために認証不要です。

Related MCP Connectors

  • Hosted MCP server connecting AI assistants to 9,000+ apps and 40,000+ actions via Zapier.

  • WhatsMCP connects Claude and other MCP-compatible AI agents directly to WhatsApp. Send and receive text, images, documents, and voice notes; manage groups (create, add/remove members, promote admins); look up contacts and profiles; follow channels; and read call and message history — all through a standard MCP interface. For voice use cases, WhatsMCP offers SIP-based calling plans (inbound-only, or full inbound/outbound) so AI voice agents can answer and place WhatsApp calls, plus low-latency WebSocket integrations with voice agent providers like ElevenLabs. Multiple WhatsApp accounts can be paired and managed per workspace, with webhook support for real-time inbound message delivery to your own infrastructure.

  • Hosted MCP server for your own WhatsApp accounts: messages, contacts, groups, channels, calls.

  • Your own WhatsApp as an MCP server: read, search and send from any MCP client.

Related MCP Servers

  • F
    license
    Not graded
    quality
    Not graded
    maintenance
    A self-hosted MCP server that connects AI clients to WhatsApp via the WAHA HTTP API. It enables users to manage sessions, search contacts, and send or receive messages and media directly through natural language interfaces.
    12 npm
    -
  • F
    license
    Not graded
    quality
    B
    maintenance
    WhatsApp MCP server that exposes messaging, groups, contacts, and profile management as tools and resources for AI agents, supporting Baileys and Meta Cloud API.
    23
    -
  • A
    license
    Not graded
    quality
    C
    maintenance
    MCP server that connects AI agents to WhatsApp using the multi-device API, enabling messaging, group management, and more as a regular user.
    11 npm
    MIT