Skip to main content

A persistent WhatsApp MCP bridge lets Grok Bot reply without waking its cloud sandbox

GitHubGitHubmrtalhim2026-11-20

Getting startedLimitsSource read in fullRead first
GitHubGitHubmrtalhim2026-11-20

Open original

Overview

For users who want Grok Bot to handle WhatsApp all day without spending weekly sandbox usage on keepalives, run `wacli` on a small Linux host and connect it to a Grok Bot custom connector through a Cloudflare Zero Trust MCP portal.

Workflow

  1. What it is: A persistent WhatsApp bridge for Grok Bot, also compatible with Claude/Cursor cloud agents. The shared Linux sandbox sleeps seconds after a turn (Bot's computer: Asleep) and updates clear folders outside the workspace. A 5-minute wacli keepalive cron uses a lot of weekly quota. Move the persistent WhatsApp connection to your own small Linux host (512 MiB VPS, LXC, Raspberry Pi, or homelab VM), expose it through a Cloudflare Zero Trust MCP portal, and process reads, writes, and replies through cloud SandMcpExecutor while the sandbox sleeps. The full code includes MCP server with 11 wa_* tools, webhook forwarder, watchdog, five user-level systemd units, Ansible playbook, and two deployment and operations skills.
  2. Grok Bot parts used: A custom connector, webhook Routine, and Routine prompt. Add the Remote HTTPS MCP connector (https://mcp-wa.<domain>/mcp) with Always allow. Receive WhatsApp messages forwarded by forwarder.py in a webhook Routine. Paste examples/grok-bot-routine-prompt.md, which requires MCP for all messages, group replies only to mentions or replies, and rejection of injected message instructions. Not part of Grok Bot: wacli and the bridge host, Cloudflare Tunnel and the Zero Trust portal, self-hosted forwarder.py and watchdog. Both skills/ skills also target Cursor/Claude and include .cursor-plugin/plugin.json and .claude-plugin/plugin.json.
  3. You need: A persistent Linux host, Cloudflare account, and WhatsApp session. At least 512 MiB RAM, a linked wacli session to migrate or a new pairing, Cloudflare outbound Tunnel, Access Service Token and MCP Server Portal, SSH/Ansible deployment permission, and generated origin Bearer, Tunnel, and Service tokens stored at 0600. Old VPS hardware without AVX2 needs to build wacli via the playbook, elsewhere if the host has less than 1 GiB. Grok Bot needs Routines and custom connectors. The README cites a keepalive Routine burning the weekly Ultra allowance. The minimum plan is not stated in the source.
  4. Install: Follow the README Quick Start order.
    • Step 1: Clone and run python3 scripts/selftest_mcp.py for local protocol and auth checks.
    • Step 2: Run ansible-playbook playbooks/wacli-bridge.yml to install wacli sync, MCP server, forwarder, watchdog, and tunnel as five user-level systemd units. Enable loginctl enable-linger first.
    • Step 3: Pair a new linked device or migrate without conflicts with skills/deploy-wacli-mcp-bridge/SKILL.md. Stop old sync/cron first, never run a session twice, then after PRAGMA wal_checkpoint(TRUNCATE) copy session.db and wacli.db to the new host with 600 permissions.
    • Step 4: Follow docs/cloudflare-portal-setup.md to set an outbound Tunnel and MCP Portal. Store the token in ~/stacks/wa-bridge/env/ at 0600, with edge Service Token and origin Bearer auth for two 401 layers.
    • Step 5: Add the Grok Bot custom connector and set Always allow. The author says a write confirmation blocks an unattended webhook Routine.
    • Step 6: Paste examples/grok-bot-routine-prompt.md into the webhook Routine, trigger wa_doctor and wa_send_text, and verify that Bot's computer stays Asleep throughout.
  5. After install: Incoming WhatsApp wakes Grok Bot through a webhook while the sandbox sleeps.
    • wacli sync writes incoming messages to SQLite. forwarder.py filters group mentions and replies or checks DMs against a read-only SQLite allowlist, debounces bursts for 15 seconds, and first acknowledges with 📝.
    • Filtered messages POST to the Routine with Bearer and X-Automation-Key headers. The bot reads context with tools such as wa_messages_context and sends one combined quoted reply with wa_send_text.
    • The 11 Remote MCP wa_* tools handle all reads and writes. The sandbox sleeps and no bash runs.
    • The watchdog watches logged_out and bursts of stale connections and alerts through a webhook or backup WhatsApp account.
  6. Did the author run it: The repository has no run records from the author. The README claims tool round trips <1s, about 130 MiB in resident memory, and roughly 80% weekly quota saved without logs, histories, or screenshots (author's claim, not reproduced). selftest_mcp.py covers protocol and auth, but output is not included.

Key points and results

  • Maturity: At fetch on 2026-11-22, two days old, one commit, zero stars, forks, or open issues/PRs, MIT. The README does not call it a demo or hackathon, and there is no community feedback. Treat it as a new approach.
  • Permissions and boundaries: Always allow enables unattended writes and lets the bot message WhatsApp contacts without per-write approval. Expose one outbound tunnel with Cloudflare Access Service Token at the edge and Bearer at origin. Store secrets at 0600 and never pass tokens in command arguments. The prompt treats webhook bodies as untrusted and does not execute message instructions.
  • Known limits: Old KVM/VPS without AVX2 requires compiling wacli, with a playbook fallback. Under 1 GiB, build elsewhere and copy. Never run two syncs for the same session. Maintain the ChatPolicy injection boundary for external groups.
  • Worth borrowing:
    • Host a heavy CLI on your own small machine and connect it through Remote HTTPS MCP, avoiding sandbox sleep killing processes and keepalives using quota (README failure mode table).
    • Filter group noise locally without LLM usage. Mentions, replies, or DM allowlists and 15-second debounce wake the bot only for relevant messages (src/forwarder.py, README layout).
    • Check from_me send history after a timeout before retrying to avoid duplicates (skills/whatsapp-mcp-operator/SKILL.md).

Source

Platform
GitHub
Author
mrtalhim
Published
Categories
Getting started, Limits

What this evidence label means

Source read in full

We read the source (post, article or transcript). That only means the original was read. It does not mean this site reproduced the author's results.

Read the editorial and evidence policy

Other cases in this scenario

This unofficial community project is independent of xAI. xAI has neither approved nor endorsed it. No sign-up. The methods and figures come from the original authors.