# Guarded WhatsApp [Health: Active]

**Category:** 💬 Communication  
**Repository:** https://github.com/peter-tnc-453/guarded-whatsapp-mcp  
**GitHub Stars:** 0  
**Views:** 1  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/guarded-whatsapp

## Description
Security gate for agent-driven WhatsApp: allowlist, secret scan, rate limit, audit log.

## Tools
Capabilities this server exposes over MCP:

- **wa_list_recipients** — Show the allowlist (numbers masked).
- **wa_preview** — Dry-run a send: run every check, return a verdict + `confirm_token` if needed. Sends nothing.
- **wa_send_message** — Send text to an allowlisted recipient through the full gate.
- **wa_send_file** — Send a file (auto ASCII-safe name, type/size checked, caption scanned).
- **wa_audit_tail** — Recent audit records.

## Claude Desktop Quick Installation
No generated config for this server: it installs through its own setup steps.

The project's own setup steps (from https://github.com/peter-tnc-453/guarded-whatsapp-mcp), copied verbatim. Follow them in order; they are not an mcpServers config.

1. Install:

```sh
git clone https://github.com/peter-tnc-453/guarded-whatsapp-mcp
```

2. Run:

```sh
cd guarded-whatsapp-mcp
```

3. Configure:

```sh
uv venv --python 3.11 && source .venv/bin/activate   # Python 3.10+
```

4. Install:

```sh
uv pip install -e .
```

5. Configure:

```sh
cp config/allowlist.example.yaml config/allowlist.yaml   # edit your allowlist (git-ignored)
```

6. Start the server:

```sh
python -m wa_guard          # run the MCP server (stdio)
```

## Documentation

## What Guarded WhatsApp does

The Guarded WhatsApp MCP server governs outbound WhatsApp messages and files from an AI agent. It does not provide a chat workspace, channels, threads, or an inbound messaging interface. Instead, it adds policy checks between MCP tool calls and an existing WhatsApp transport.

Its default transport is an unofficial whatsmeow-based bridge, such as whatsapp-mcp, which communicates through WhatsApp Web’s private protocol. The project identifies this transport as a terms-of-service risk and recommends using a secondary, non-critical number. It is not positioned for production customer messaging; an official WhatsApp Business Cloud API backend is listed as future work.

The Guarded WhatsApp MCP server fails closed for recipients unless configuration permits unlisted contacts. It can also require a preview and confirmation token before selected sends, including file sends or all sends, depending on policy.

## How it works

An MCP client starts the server through the `wa_guard` Python module using stdio. Each send request passes through the configured checks before the bridge is called. A preview runs those checks without sending anything and returns a verdict. When confirmation is required, the preview returns a `confirm_token`; the subsequent send must provide that token.

Text and file captions are checked for API keys, private keys, cloud, Slack, GitHub, and OpenAI tokens, JWTs, credit-card numbers, and national IDs. Detection can block the request or issue a warning according to configuration. File requests are checked against extension and size rules, and filenames are converted to ASCII-safe names before sending.

Rate limits use per-minute and per-hour sliding windows. Every attempt, including blocked and failed requests, is appended to the audit log. Message bodies are stored as a preview and hash rather than the full body.

## Setup and configuration

Install the project with Python 3.10 or newer, preferably in a virtual environment, then install it in editable mode. Copy the example allowlist configuration to `config/allowlist.yaml` and edit the recipients and policies. The configuration file is ignored by Git in the documented setup.

An authenticated WhatsApp bridge exposing `POST /api/send` must already be running. With the example stdio registration, set `PYTHONPATH` to the repository’s `src` directory and set `WA_GUARD_CONFIG` to the allowlist file, then run `python -m wa_guard`.

Important configuration areas include `allow_unlisted`, `require_confirm_for`, `rate_limit`, `files`, `secrets.on_detect`, and the recipient allowlist. Configuration edits hot-reload on each call. The default audit path is `~/.guarded-whatsapp-mcp/audit.jsonl`.

## Tools and capabilities

The Guarded WhatsApp MCP server exposes these tools:

- `wa_list_recipients` shows the configured allowlist with numbers masked.
- `wa_preview` performs a dry run and returns the result plus a confirmation token when required.
- `wa_send_message` sends text through the complete policy gate.
- `wa_send_file` sends a validated file with an optional scanned caption.
- `wa_audit_tail` returns recent audit records.

A typical controlled flow previews a file send first, then passes the returned token to `wa_send_file`. An unallowlisted recipient or a failed content check produces an explicit blocked result instead of a send.

## Limitations and notes

The current default bridge is unofficial and may violate WhatsApp’s Terms of Service or result in a number ban. The guard reduces operational risks such as wrong recipients, leaked secrets, oversized or disallowed files, and runaway sending; it does not remove the transport’s policy or account risk.

The project is marked alpha. Official Cloud API support, inbound routing, scheduled or templated sends, and per-recipient policies are listed as roadmap items rather than current capabilities.

_Full upstream README: https://allmcps.com/mcp/guarded-whatsapp/readme_

