# mcp-z-api

An MCP server that lets your agent send WhatsApp messages through a Z-API instance: text, media, contacts and groups.

- MCP server · `type=mcp` · Claude Code, Codex, Cursor, GitHub Copilot, Windsurf (Devin Desktop), Cline, Zed, Gemini CLI · ★ 274
- Author: codespar
- License: MIT · policy=link-only · description only; the file stays with the author
- Source: https://github.com/codespar/mcp-dev-latam/tree/HEAD/packages/communication/z-api
- Updated: 2026-09-27
- HTML: https://affpapa.org/en/nevibecode/mcp/mcp-z-api

## What it does

The package sits between the agent and Z-API and exposes 27 tools. An agent can fire off text, an image, a document or audio, pull the contact list, test whether a number is on WhatsApp, and read a contact's avatar and metadata. Another set covers chats and groups: paged chat listing, marking things read, creating a group, adding or removing members, fetching group metadata.

Interactive payloads are there too — a button list, the native option list, and CALL, URL or REPLY action buttons. Labels let you tag a chat and enumerate the tags. Z-API authenticates with an instance ID and a token that travel inside the request URL.

Sign up at the Z-API developer portal and copy your instance ID and token first; without them the server has nothing to talk to. The platform configs shown below only carry `ZAPI_TOKEN`, so check Z-API's docs for how the second value is passed. MIT licensed, shipped as the npm package `@codespar/mcp-z-api`.

## Requirements
- Needs: Node.js (commands run via npx)
- Environment variables: `ZAPI_TOKEN` — keys and tokens: ask the human for the values, never commit them or put them in shared files.

## Install

### Claude Code (native platform)

**Platform CLI**
```bash
claude mcp add mcp-z-api -e ZAPI_TOKEN=<ZAPI_TOKEN> -- npx -y @codespar/mcp-z-api
```
Replace <…> with your own values

### Codex

**Platform CLI**
```bash
codex mcp add z-api --env ZAPI_TOKEN=<ZAPI_TOKEN> -- npx -y @codespar/mcp-z-api
```
Replace <…> with your own values

### Cursor

**Config file**
File `.cursor/mcp.json`:
```json
{
    "mcpServers": {
        "z-api": {
            "command": "npx",
            "args": [
                "-y",
                "@codespar/mcp-z-api"
            ],
            "env": {
                "ZAPI_TOKEN": "<ZAPI_TOKEN>"
            }
        }
    }
}
```
Replace <…> with your own values

### GitHub Copilot

**Config file**
File `.vscode/mcp.json`:
```json
{
    "servers": {
        "z-api": {
            "type": "stdio",
            "command": "npx",
            "args": [
                "-y",
                "@codespar/mcp-z-api"
            ],
            "env": {
                "ZAPI_TOKEN": "<ZAPI_TOKEN>"
            }
        }
    }
}
```
Replace <…> with your own values

### Gemini CLI

**Platform CLI**
```bash
gemini mcp add -e ZAPI_TOKEN=<ZAPI_TOKEN> z-api npx -y @codespar/mcp-z-api
```
Replace <…> with your own values

## When to use it
- send a WhatsApp message or file from inside an agent session
- verify a number is on WhatsApp before you message it
- page through chat and group lists
- spin up a group and add members to it
- mark messages read or delete them

## Example prompts
- Send a WhatsApp text to the number listed in `contacts.json`
- Check whether that number has WhatsApp and fetch its profile picture
- Create a group called Project and add two participants

## Similar
- [Scrapling MCP Server](https://affpapa.org/en/nevibecode/mcp/scrapling-mcp-server.md) — MCP server · ★ 89433
- [browser-use](https://affpapa.org/en/nevibecode/mcp/browser-use.md) — MCP server · ★ 119160
- [AIHawk](https://affpapa.org/en/nevibecode/mcp/aihawk.md) — MCP server · ★ 32221
- [Skyvern](https://affpapa.org/en/nevibecode/mcp/skyvern.md) — MCP server · ★ 23263
- [SeleniumBase MCP](https://affpapa.org/en/nevibecode/mcp/seleniumbase-mcp.md) — MCP server · ★ 13169
- [Inbox Zero](https://affpapa.org/en/nevibecode/mcp/inbox-zero.md) — MCP server · ★ 12791

From the same set: [codespar/mcp-dev-latam](https://affpapa.org/en/nevibecode/by/codespar/mcp-dev-latam.md) — 124 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
