# Messaging Rules

> Messaging Rules is an open-source MCP server for communication. Checks whether a business may message a person now on WhatsApp, Instagram, Messenger. It runs locally on your machine and is started by your AI client.

- **Kind:** MCP server
- **Pricing:** Open source
- **Platforms:** API, CLI, Self-hosted
- **Repository:** https://github.com/pinlyx/messaging-rules
- **MCP Registry name:** com.pinlyx/messaging-rules
- **Categories:** [communication](https://ai-powered.com/categories/communication), [compliance and regulation](https://ai-powered.com/categories/compliance-and-regulation)
- **Listing updated:** 2026-11-27

## About

Messaging platforms restrict when a business can send a message, based on when the person last wrote in and which message type is used. This package turns those timing and size rules into structured data that code, or an AI assistant, can query before a message goes out.

A check takes the channel, the time of the last inbound message and the kind of message planned, then returns whether it is allowed, when the window closes and which alternatives would be accepted instead. A separate validator tests a draft's text, captions, attachments and buttons against documented limits.

Each rule carries the official platform page it came from, a short quote and the date it was verified. It is published as an npm package and a Python port, and it can be run as a stdio MCP server with three tools. Opt-in status and app permissions are not checked and are returned as conditions for the caller to confirm.

## Features

- **Messaging window check:** Determines whether a free-form or tagged message is allowed on a channel at a given moment.
- **Draft validation:** Checks text length, caption, attachment type and size, and button limits against documented values.
- **Source-cited rules:** Every value links to the official platform page it was read from, with a quote and verification date.
- **MCP server:** Exposes window checks, draft validation and channel rules as tools for AI clients over stdio.
- **TypeScript and Python libraries:** Provides the same logic in both languages, with the rule data bundled and no network calls needed.

## Good for

- Blocking free-form WhatsApp replies sent after the 24-hour customer service window
- Choosing a valid Instagram or Messenger tag for a reply sent days after the last message
- Validating media size and text length before a message is queued
- Giving an AI agent a pre-send check for outbound messages

## Install

### Claude Code: Add with the CLI (Terminal)

```sh
claude mcp add messaging-rules -- npx -y messaging-rules
```

Add --scope user to use it in every project, or --scope project to share it in .mcp.json.

### Claude Code: Or share it with your project (.mcp.json)

```json
{
  "mcpServers": {
    "messaging-rules": {
      "command": "npx",
      "args": [
        "-y",
        "messaging-rules"
      ]
    }
  }
}
```

### Claude Desktop (claude_desktop_config.json)

```json
{
  "mcpServers": {
    "messaging-rules": {
      "command": "npx",
      "args": [
        "-y",
        "messaging-rules"
      ]
    }
  }
}
```

Settings → Developer → Edit Config, then quit and reopen Claude Desktop.

### Cursor (~/.cursor/mcp.json)

```json
{
  "mcpServers": {
    "messaging-rules": {
      "command": "npx",
      "args": [
        "-y",
        "messaging-rules"
      ]
    }
  }
}
```

Use .cursor/mcp.json in a project to share it with the project.

### VS Code (~/.copilot/mcp-config.json)

```json
{
  "mcpServers": {
    "messaging-rules": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "messaging-rules"
      ]
    }
  }
}
```

Or put the same entry in .mcp.json at your workspace root to share it.

### Codex: Add with the CLI (Terminal)

```sh
codex mcp add messaging-rules -- npx -y messaging-rules
```

### Codex: Or add to config.toml (~/.codex/config.toml)

```toml
[mcp_servers.messaging-rules]
command = "npx"
args = ["-y", "messaging-rules"]
```

### Gemini CLI and Antigravity: Gemini CLI (~/.gemini/settings.json)

```json
{
  "mcpServers": {
    "messaging-rules": {
      "command": "npx",
      "args": [
        "-y",
        "messaging-rules"
      ]
    }
  }
}
```

Or run: gemini mcp add -s user messaging-rules npx -- -y messaging-rules

### Gemini CLI and Antigravity: Antigravity (~/.gemini/config/mcp_config.json)

```json
{
  "mcpServers": {
    "messaging-rules": {
      "command": "npx",
      "args": [
        "-y",
        "messaging-rules"
      ]
    }
  }
}
```

Use .agents/mcp_config.json to add it to one workspace only.

### Devin Desktop (~/.config/devin/mcp_config.json)

```json
{
  "mcpServers": {
    "messaging-rules": {
      "command": "npx",
      "args": [
        "-y",
        "messaging-rules"
      ]
    }
  }
}
```

On Windows the file is %APPDATA%\\devin\\mcp_config.json. Use .devin/mcp_config.json to share it with a project.

### Cline (cline_mcp_settings.json)

```json
{
  "mcpServers": {
    "messaging-rules": {
      "command": "npx",
      "args": [
        "-y",
        "messaging-rules"
      ]
    }
  }
}
```

Open it from the MCP Servers icon → Configure → Configure MCP Servers.

### Zed (Zed settings.json)

```json
{
  "context_servers": {
    "messaging-rules": {
      "command": "npx",
      "args": [
        "-y",
        "messaging-rules"
      ]
    }
  }
}
```

Open it with zed: open settings file. Merge context_servers into the settings you already have.

### JetBrains AI Assistant and Junie: AI Assistant (Settings → Tools → AI Assistant → Model Context Protocol (MCP) → Add)

```json
{
  "mcpServers": {
    "messaging-rules": {
      "command": "npx",
      "args": [
        "-y",
        "messaging-rules"
      ]
    }
  }
}
```

### JetBrains AI Assistant and Junie: Junie (~/.junie/mcp/mcp.json)

```json
{
  "mcpServers": {
    "messaging-rules": {
      "command": "npx",
      "args": [
        "-y",
        "messaging-rules"
      ]
    }
  }
}
```

Use .junie/mcp/mcp.json to share it with a project.

### Kiro (~/.kiro/settings/mcp.json)

```json
{
  "mcpServers": {
    "messaging-rules": {
      "command": "npx",
      "args": [
        "-y",
        "messaging-rules"
      ]
    }
  }
}
```

Use .kiro/settings/mcp.json to add it to one workspace only.

### Other clients (your client's MCP settings (most use this shape))

```json
{
  "mcpServers": {
    "messaging-rules": {
      "command": "npx",
      "args": [
        "-y",
        "messaging-rules"
      ]
    }
  }
}
```

## Tools

From the tool list in its README, going by the names, all 3 tools only read data. From the server's own tool labels and tool names; not verified by us.

- `check_messaging_window` (name suggests: reads): May this sender send this kind of message on this channel now? Returns allowed, reason, windowEndsAt, conditions, allowedAlternatives, sources.
- `validate_message` (name suggests: reads): Checks a draft's text, caption, attachments, media size and type and button limits.
- `get_channel_rules` (name suggests: reads): Returns the full source-cited rules for a channel, one section, or a summary of all channels.

## FAQ

### Does Messaging Rules send messages?

No. It only answers whether a message is allowed and whether a draft fits documented limits.

### Can Messaging Rules confirm the user opted in?

No. Opt-in, app permissions and recipient settings are returned as conditions for the caller to check.

### How is Messaging Rules used with AI clients?

It runs as a stdio MCP server started with npx, using the messaging-rules-mcp command, and needs no network access or keys.

### Is Messaging Rules free?

Yes. Messaging Rules is open source, so you can use and self-host it for free.

### How do I add Messaging Rules to Claude Code?

Run this command in your terminal: claude mcp add messaging-rules -- npx -y messaging-rules

### What are the best alternatives to Messaging Rules?

The closest alternatives to Messaging Rules are SMS and WhatsApp Messaging, Messaging MCP, WhatsApp MCP, WizMessage and Markdown To Whatsapp.

## Where this comes from

- Description: written from the project's README and its MCP Registry entry.
- Install steps: from the official MCP Registry entry.

## Alternatives

- [SMS and WhatsApp Messaging](https://ai-powered.com/mcp/sms-and-whatsapp-messaging): SMS and WhatsApp Messaging is a freemium MCP server for communication.
- [Messaging MCP](https://ai-powered.com/mcp/messaging-mcp): Messaging MCP is an open-source MCP server for communication.
- [WhatsApp MCP](https://ai-powered.com/mcp/whatsapp-mcp-3): WhatsApp MCP is an MCP server for communication.
- [WizMessage](https://ai-powered.com/mcp/wizmessage): WizMessage is an MCP server for communication.
- [Markdown To Whatsapp](https://ai-powered.com/mcp/markdown-to-whatsapp): Markdown To Whatsapp is an open-source MCP server for files and documents.
- [pingwa](https://ai-powered.com/mcp/pingwa): pingwa is a freemium MCP server for communication.
- [WhaTools — WhatsApp tools](https://ai-powered.com/mcp/whatools-whatsapp-tools): WhaTools — WhatsApp tools is a free MCP server for communication.
- [WhatsApp Web MCP Server](https://ai-powered.com/mcp/whatsapp-web-mcp-server): WhatsApp Web MCP Server is an open-source MCP server for communication.

---
Source: https://ai-powered.com/mcp/messaging-rules
