weixin-grokbot-adapter
Standalone WeChat iLink (ClawBot) adapter that logs in via QR/PIN in the CLI, long-polls inbound WeChat messages, sends text and media (image/video/file), downloads inbound media, and shows or cancels typing indicators through the WeChat iLink API.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@weixin-grokbot-adapter send a WeChat message to my last contact saying I'm running late"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
weixin-grokbot-adapter
Standalone WeChat ClawBot adapter for Grok Bot and Cursor. It exposes a local MCP stdio server and a CLI so you can log in, receive messages, send text or media, and show a typing indicator — without installing OpenClaw.
This is an independent client for the official Weixin iLink HTTPS JSON API (the protocol behind WeChat ClawBot). The protocol matches Tencent/openclaw-weixin 3.0.0-beta-1 (MIT). The official npm package @tencent-weixin/openclaw-weixin-cli only installs an OpenClaw plugin and must not be used as a dependency or installer here.
Requirements: Node.js 20 or newer. A WeChat client with the official ClawBot plugin enabled, used to scan the bind QR code.
Zero runtime dependencies. The optional package qrcode-terminal can be installed if you want the login command to print a scannable QR code in the terminal.
Install
From a local checkout (this project is not published to npm yet):
git clone <your-fork-or-local-path> weixin-grokbot-adapter
cd weixin-grokbot-adapter
node src/cli.js --helpOptional, so the weixin-grokbot command is on your PATH:
npm install --global .
# or, without a global install:
npm linkOptional terminal QR codes:
npm install qrcode-terminalRelated MCP server: weixin-mcp
Login
Login is CLI-only. The MCP server will never request a QR code or start a bind flow, so a bot host cannot pop a login prompt just by connecting the tool.
# Check whether credentials already exist (safe, no QR code)
node src/cli.js status
# In a real terminal, on a machine you control:
node src/cli.js loginScan the printed URL (or QR code) with the WeChat account that has the ClawBot plugin enabled. If the phone shows a PIN, type it into the terminal. On success, credentials are written to credentials.json in the state directory with mode 600.
To unbind this machine only (deletes local credentials and session state; it does not call a remote unbind API):
node src/cli.js logoutAdd as a local stdio MCP (Grok Bot / Cursor)
Complete
loginin a real terminal first.Add a local stdio MCP server. Do not point Grok Bot at a cloud shell that cannot reach your state directory.
Example configuration:
{
"command": "node",
"args": ["/absolute/path/to/weixin-grokbot-adapter/src/cli.js", "mcp"]
}If you installed the CLI globally:
{
"command": "weixin-grokbot",
"args": ["mcp"]
}Use the node executable from your own machine (which node), and the absolute path to this checkout’s src/cli.js. You can also set WEIXIN_GROKBOT_STATE_DIR in the MCP server environment so the tool sees the same credentials you created with login.
MCP tools
Tool | Purpose |
| Whether a bot token is saved locally. Never starts login. |
| One |
| Send a text message. Defaults to the last inbound peer. |
| Upload a local file or |
| Show or cancel the official typing indicator. |
Replies attach the cached context_token from the last inbound message for that user when one is available.
CLI
node src/cli.js status
node src/cli.js poll [--timeout 35000] [--reset-cursor]
node src/cli.js send --text 'Hello' [--to 'id@im.wechat']
node src/cli.js send-media --file ./photo.jpg [--to 'id@im.wechat'] [--caption 'here'] [--type image]
node src/cli.js send-media --url 'https://example.com/file.pdf' --type file
node src/cli.js typing [--to 'id@im.wechat'] [--cancel]
node src/cli.js notify start|stop
node src/cli.js mcpIf no --to is given, the adapter uses the most recently seen inbound WeChat user.
Configuration
All of these are optional except when you run the webhook forwarder. A logged-in credentials.json still supplies the API base URL returned by the server (it may redirect after bind).
Variable | Default | Purpose |
|
| Credentials, cursors, context tokens, inbound media |
|
| iLink API (used for a fresh login) |
|
| Fallback CDN origin |
|
|
|
|
| Client timeout for |
|
| Timeout for ordinary API calls |
|
| Timeout for |
|
| Timeout for CDN upload/download |
|
| Local and remote upload size limit |
See .env.example for a copy-paste template. Never commit a filled-in .env.
Optional webhook forwarder
src/forward-poller.js long-polls inbound messages and POSTs a JSON summary to a webhook you provide. It is optional, not used by the MCP server, and is not tied to any one product’s webhook URL.
export WEIXIN_FORWARD_WEBHOOK_URL="https://example.invalid/hooks/weixin"
export WEIXIN_FORWARD_WEBHOOK_SECRET="your-shared-secret"
node src/cli.js forwardVariable | Default | Purpose |
| (required) | Destination URL |
| (required) | Shared secret |
|
| Header that carries the secret |
|
| Prefix; set to an empty string to send the secret as the raw header value |
|
| Long-poll timeout |
|
| Delay after a poll or POST error |
The JSON body looks like { "source": "weixin-grokbot-adapter", "count": N, "messages": [...] }. Message text and media paths are included; bot tokens are not.
Protocol coverage
Default API host: https://ilinkai.weixin.qq.com. Authenticated requests send AuthorizationType: ilink_bot_token, Authorization: Bearer <bot_token>, iLink-App-Id: bot, plus base_info.channel_version (3.0.0-beta-1/grokbot-adapter-1.1.0) and bot_agent.
Capability | Method / path | Status |
Bind QR code |
| Implemented (CLI login) |
Bind status / PIN |
| Implemented (CLI login) |
Receive messages |
| Implemented |
Send text |
| Implemented |
Send image / video / file |
| Implemented |
Inbound media download | CDN GET + AES-128-ECB | Implemented |
Typing ticket |
| Implemented |
Typing indicator |
| Implemented |
Lifecycle |
| Implemented (CLI |
Outbound media follows the official upload flow: hash the plaintext, generate a 16-byte AES key and file key, call getuploadurl with no_need_thumb: true, encrypt with AES-128-ECB and PKCS#7 padding, POST application/octet-stream to upload_full_url (or a URL built from upload_param + filekey), read x-encrypted-param, and put that download parameter plus the AES key into the media item. HTTP 4xx is not retried; other CDN failures are retried up to three times. An optional caption is sent as a separate text message first.
Out of scope
Installing or depending on OpenClaw, the official OpenClaw plugin SDK, or
@tencent-weixin/openclaw-weixin-cliOutbound voice messages (SILK encoding) and thumbnail (
thumb_media) uploadsOther-owner bind and real-name bind flows documented by the official plugin
Automatic markdown filtering, quote-reply caches, or tool-call item types
Acting as a public hosted WeChat gateway (this is a local client)
Security
credentials.jsoncontainsbot_tokenand account identifiers. It is written with mode600. Never commit, paste, or share that file, the state directory, or.env.publicStatus/weixin_statusreport only whether a token exists, never the token itself.Login must be started by a person in a terminal, not by the MCP server.
The optional forwarder sends inbound message text to whatever URL you configure. Treat that webhook and its secret like credentials.
weixin_send_mediacan read a local path or fetch anhttp(s)URL on the machine running the adapter. Only give that tool to hosts you trust.
Library use
import { pollOnce, sendText, sendMedia } from "weixin-grokbot-adapter";
const inbound = await pollOnce();
await sendText({ text: "hi" });
await sendMedia({ filePath: "./photo.jpg", caption: "look" });Set WEIXIN_GROKBOT_STATE_DIR (or log in first) so the library can find credentials.
Development
node --test test/*.test.js
# or
npm testSee CONTRIBUTING.md and CHANGELOG.md. A Chinese guide is in README.zh-CN.md.
License
MIT. See LICENSE. Portions implement the Weixin iLink HTTP JSON protocol documented and implemented in Tencent/openclaw-weixin, Copyright (c) Tencent, licensed under the MIT License.
Available Tools
5 toolsweixin_pollA
One getUpdates long-poll cycle (default ~35s). Returns new inbound Weixin messages and caches context_token. Empty result is normal when nobody wrote. Requires a prior CLI login.
Inputs: timeoutMs, resetCursor.
weixin_sendA
Send a text message to a Weixin user via ilink/bot/sendmessage. Defaults to the last inbound peer. A cached context_token is attached when available.
Inputs: text (required), to, context_token.
weixin_send_mediaA
Upload a local file (or an http(s) URL) to the Weixin CDN and send it as an image, video, or file attachment. Optional caption is sent as a separate text message first. Requires a prior CLI login.
Inputs: to, url, path, type, +2 more.
weixin_statusA
Show whether this machine has a saved Weixin iLink bot token, and the local state directory. Does not start login or show a QR code.
Inputs: no named parameters.
weixin_typingB
Show or cancel the official typing indicator for a user (ilink/bot/sendtyping).
Inputs: to, cancel.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 5 tools
Each tool targets a distinct operation: status inspection, message polling, text sending, media sending, and typing indicators. The only adjacent pair, weixin_send and weixin_send_media, is clearly separated by text vs. file/URL payloads.
All tools share the same weixin_ prefix and snake_case convention, making the namespace predictable. However, the suffix mixes states/nouns (status, typing) with actions (poll, send), so the verb pattern is not perfectly uniform.
Five tools is a well-scoped surface for a Weixin bot adapter, covering the essential receive, send, media, and presence operations without bloat. Each tool earns its place.
The core messaging lifecycle is covered: status, inbound polling, outbound text, media attachments, and typing indicators. Minor gaps exist around login/QR initiation and richer message or contact operations, but those appear intentionally delegated to the CLI.
Maintenance
Related MCP Connectors
Ask questions across your WhatsApp inbox from Claude, ChatGPT, Cursor or any MCP client.
Talk to your public-facing AI from any MCP client — Claude, ChatGPT, Cursor, Cline, Windsurf.
Hosted X (Twitter) MCP server for Claude, ChatGPT and Cursor, with each action switched per account.
WA MCP (wa-mcp.com) is a hosted WhatsApp MCP server, with nothing to install. It isn't one of the open-source wa-mcp or whatsapp-mcp projects on GitHub. It connects the WhatsApp number you already have, personal or Business, to Claude, ChatGPT, Grok Bot, Cursor or any MCP client, so your AI can read, search and reply to your chats. Free plan with no time limit.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceMCP server for WeChat PC automation, enabling message sending, voice/video calls, and AI-powered listening through Cursor or WorkBuddy.2-
- FlicenseAqualityCmaintenanceEnables AI assistants to send and receive WeChat messages through the official ClawBot API, supporting text, images, files, and videos.720-
- AlicenseNot gradedqualityDmaintenanceA Windows-native WeChat bridge that connects WeChat to multiple MCP clients (Web Chat, Codex, Claude Desktop, etc.) for bidirectional text, image, and file transfer without requiring OpenClaw.2MIT
- AlicenseNot gradedqualityDmaintenanceAn MCP server that lets an LLM read and drive the macOS WeChat client through the Accessibility API, without reverse-engineering or injected code. It supports listing chats, opening conversations, reading messages, sending actions, and saving media locally.2MIT