mcpField
M
mcp-z-api

mcp-z-api

Local
github.com/codesparCommunication275Updated 4w ago

About mcp-z-api

mcp-z-api is an MCP server for Z-API, a WhatsApp messaging platform. It covers sending several message types and managing contacts, chats, groups and labels. It suits AI agents and workflows that communicate with customers over WhatsApp.

Key features

  1. 01Send text, image, document, audio and location messages
  2. 02Manage contacts, chats and read status
  3. 03Create groups and manage participants
  4. 04Assign labels to chats
  5. 05Send button and option list messages

Use cases

  1. 01Automate replies to customer WhatsApp messages from an agent
  2. 02Maintain group membership and labels at scale

MCP support

The server exposes Z-API WhatsApp functions as 27 MCP tools that MCP clients can call.

Configuration

Local server config is the same for every client. Copy it into your client’s MCP config file.

mcp.json · Universal config
{
"mcpServers": {
"codespar-mcp-z-api": {
"command": "npx",
"args": [
"-y",
"@codespar/mcp-z-api"
],
"env": {
"ZAPI_TOKEN": "<ZAPI_TOKEN>"
}
}
}
}
Run commandnpx -y @codespar/mcp-z-api
Environment variables to set
ZAPI_TOKENSecretAPI key for z-api

Local servers need a runtime on your machine (e.g. Node.js 18+). Config file locations differ by client; see your client’s docs.

Packages
npm@codespar/mcp-z-api0.2.2

Tools

27

Saved tool list · updated 2w ago

ParameterTypeRequiredDescription
phonestringYesPhone number with country code (e.g. 5511999999999)
messagestringYesText message content

Details

From the project README

@codespar/mcp-z-api

MCP server for Z-API — WhatsApp messaging platform

npm License: MIT

Quick Start

Claude Desktop

Add to ~/.config/claude/claude_desktop_config.json:

{
  "mcpServers": {
    "z-api": {
      "command": "npx",
      "args": ["-y", "@codespar/mcp-z-api"],
      "env": {
        "ZAPI_INSTANCE_ID": "your-instance-id",
        "ZAPI_TOKEN": "your-token"
      }
    }
  }
}
Claude Code
claude mcp add z-api -- npx @codespar/mcp-z-api
Cursor / VS Code

Add to .cursor/mcp.json or .vscode/mcp.json:

{
  "servers": {
    "z-api": {
      "command": "npx",
      "args": ["-y", "@codespar/mcp-z-api"],
      "env": {
        "ZAPI_INSTANCE_ID": "your-instance-id",
        "ZAPI_TOKEN": "your-token"
      }
    }
  }
}

Tools (27)

ToolPurpose
send_textSend a text message via WhatsApp
send_imageSend an image message via WhatsApp
send_documentSend a document via WhatsApp
send_audioSend an audio message via WhatsApp
get_contactsGet all WhatsApp contacts
check_numberCheck if a phone number has WhatsApp
get_profile_pictureGet profile picture URL for a phone number
get_messagesGet messages for a phone number
send_button_listSend a button list message via WhatsApp
get_statusGet WhatsApp instance connection status
create_groupCreate a WhatsApp group
get_group_metadataGet group metadata and participants
add_group_participantAdd a participant to a WhatsApp group
remove_group_participantRemove a participant from a WhatsApp group
send_locationSend a location message via WhatsApp
send_contactSend a contact card via WhatsApp
add_labelAssign a label/tag to a chat
get_labelsList all available labels/tags
read_messageMark messages as read
delete_messageDelete a message
get_contact_metadataGet metadata (name, WhatsApp display name, profile picture, status) for a single contact
add_contactsAdd one or more contacts to the WhatsApp address book.
list_chatsList all WhatsApp chats with pagination
mark_chat_as_readMark an entire chat as read or unread
list_groupsList all WhatsApp groups with pagination
send_option_listSend an interactive option list (WhatsApp native list).
send_button_actionsSend interactive action buttons (CALL, URL, REPLY).

Authentication

Z-API uses instance ID and token embedded in the request URL.

Sandbox / Testing

Z-API offers a free trial for testing. Create an account to get started.

Get your credentials
  1. Go to Z-API Developer Portal
  2. Create an account and start a free trial
  3. Get your instance ID and token
  4. Set the environment variables

Environment Variables

VariableRequiredDescription
ZAPI_INSTANCE_IDYesZ-API instance ID
ZAPI_TOKENYesZ-API instance token

Roadmap

v0.2 (planned)
  • send_sticker — Send a sticker message via WhatsApp
  • send_reaction — Send a reaction to a message
  • get_chat_history — Get full chat history with a contact
  • update_group_settings — Update group name, description, settings
  • leave_group — Leave a WhatsApp group
v0.3 (planned)
  • bulk_messaging — Send messages to multiple contacts
  • template_management — Create and manage message templates
  • catalog_products — Manage WhatsApp Business catalog products

Want to contribute? Open a PR or request a tool.

Links

Enterprise

Need governance, budget limits, and audit trails for agent payments? CodeSpar Enterprise adds policy engine, payment routing, and compliance templates on top of these MCP servers.

License

MIT

Comments

Markdown supported

New to MCP?

From what the protocol is to installing your first server, these answers cover most first questions.

An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.