# MCP (Model Context Protocol)

The Model Context Protocol (MCP) is an emerging open standard that lets AI agents securely access tools, APIs, and external data through a unified interface. Instead of writing custom integrations or backend logic, MCP bridges your local or cloud tools directly to the AI model — giving it controlled, structured access to real-world functions.\
When combined with Whapi.Cloud’s WhatsApp API, MCP enables agents to send messages, manage groups, post to channels, or trigger workflows instantly. It transforms WhatsApp automation from code-heavy development into a plug-and-run experience.

In short, MCP brings the missing layer of intelligence between your AI agent and Whapi’s powerful WhatsApp API — letting you build, test, and scale automations faster than ever.

***

### Quick start

Requires Node.js 18+.

Install and run via NPX:

```
npx -y whapi-mcp@latest
```

Or set your Whapi API token and run:

```
# PowerShell
$env:API_TOKEN="YOUR_TOKEN"; npx -y whapi-mcp@latest
```

### Using with MCP clients

* Cursor: add to %USERPROFILE%.cursor\mcp.json

```
{
  "mcpServers": {
    "whapi-mcp": {
      "command": "npx",
      "args": ["-y", "whapi-mcp@latest"],
      "env": { "API_TOKEN": "YOUR_TOKEN" }
    }
  }
}
```

* Claude Desktop: add to %APPDATA%\Claude\claude\_desktop\_config.json (same structure as above).

### Tools

The server exposes tools generated from Whapi OpenAPI. Example:

* sendMessageText (required: to, body)

Example call (pseudo):

```
name: sendMessageText
arguments: { "to": "1234567890@s.whatsapp.net", "body": "Hello" }
```

***

### MCP Optimal (Slim Toolset) for Model Compatibility

Some LLMs struggle with MCP servers that expose a very large number of tools: tool discovery can be slow, the UI may degrade, and some models refuse to load extensive tool lists. To ensure consistent compatibility and faster startup, we provide a streamlined server: whapi-mcp-optimal. It ships a curated set of core tools only, reducing overhead while preserving essential capabilities.

#### Quick Install (minimal)

PowerShell:

`$env:API_TOKEN="YOUR_TOKEN"; npx -y whapi-mcp-optimal@latest`

Using with MCP clients:

```
{
  "mcpServers": {
    "whapi-mcp-optimal": {
      "command": "npx",
      "args": ["-y", "whapi-mcp-optimal@latest"],
      "env": { "API_TOKEN": "YOUR_TOKEN" }
    }
  }
}
```

#### Included Tools

* checkHealth
* updateChannelSettings
* loginUser
* sendMessageText
* sendMediaMessage
* getMessages
* getChats
* checkPhones
* getGroups
* acceptGroupInvite
* addGroupParticipant

#### Notes

* Use the full server if you need the complete feature set; use the optimal server for models that struggle with large tool catalogs.
* Both servers follow the same MCP protocol; switching only changes the exposed tool list.
