WapiSender MCP
WapiSender的官方MCP服务器。从Claude Code、Codex和其他MCP兼容客户端使用它来管理WhatsApp实例、发送消息、管理联系人、配置Webhook和构建流。
这个MCP做什么
WapiSender MCP允许您的MCP客户端通过有状态会话访问WapiSenders平台。
它支持:
- 使用MCP令牌登录您的WapiSender帐户
- 在WhatsApp实例之间列出和切换
- 检查实例状态和二维码
- 发送文本、媒体和位置WhatsApp消息
- 管理联系人
- 创建、更新、激活和停用流
- 管理实例webhooks
- 管理流使用的AI提供者凭据
需求
- Node.js 20+
- WapiSender帐户位于 wapisender.com
- WapiSender MCP令牌来自 wapisender.com/dashboard/settings/mcp-token
安装型号
您不需要全局安装此软件包。
大多数客户端可以直接使用以下命令运行它:
npx wapisender-mcp@latest该套餐包括:
wapisender-mcp:CLI入口点wapisender-mcp-server:通过stdio的MCP服务器入口点
快速开始
1.生成您的MCP令牌
首选
https://wapisender.com/dashboard/settings/mcp-token2.在本地保存您的凭据
npx wapisender-mcp login --token 这将验证令牌并将其存储在:
~/.config/wapisender-mcp/credentials.json3.将MCP服务器添加到您的客户端
法典
将此添加到 ~/.codex/config.toml:
[mcp_servers.wapisender]
command = "npx"
args = ["wapisender-mcp@latest"]显式服务器表单:
[mcp_servers.wapisender]
command = "npx"
args = ["-y", "-p", "wapisender-mcp@latest", "wapisender-mcp-server"]克劳德代码
将此添加到 ~/.claude/settings.json:
{
"mcpServers": {
"wapisender": {
"command": "npx",
"args": ["wapisender-mcp@latest"]
}
}
}显式服务器表单:
{
"mcpServers": {
"wapisender": {
"command": "npx",
"args": ["-y", "-p", "wapisender-mcp@latest", "wapisender-mcp-server"]
}
}
}4.在MCP客户端中使用它
自然语言示例:
login to wapisender
list my instances
switch to instance WABZ3
show me the current instance status
send a WhatsApp message to +5491112345678 saying "Hello from WapiSender MCP"
list my flows
create a support flow that asks whether the user needs sales or billing help同一会话的工具调用示例:
login
{}switch_instance
{
"instanceIdOrName": "WABZ3"
}send_text
{
"to": "5491112345678",
"message": "Hello from WapiSender MCP"
}身份验证的工作原理
CLI仅在本地存储您的MCP令牌。MCP服务器加载该令牌,并在您调用时创建内存会话 login.
会议跟踪:
- 您的WapiSender帐户
- 该帐户可用的实例列表
- 所有实例作用域工具使用的活动实例
如果您的帐户只有一个实例,则会在 login.
如果您的帐户有多个实例,您应该调用:
list_instancesswitch_instance
之后,所有实例范围的工具都使用所选实例。
多个实例
是的,支持多实例帐户。
典型工作流程
- 登录
- 列出您的实例
- 选择要处理的实例
- 切换到它
- 运行您的消息传递、流、webhook或联系人工具
例子:
login to wapisender
list my instances
switch to instance Sales-BR
send a message to 5491112345678 saying "Hello from the Brazil sales number"工具调用示例:
list_instances
{}switch_instance
{
"instanceIdOrName": "Sales-BR"
}预期行为:
login如果帐户只有一个实例,则自动选择该实例switch_instance接受实例名称或实例ID- 所有后续工具调用都使用新的活动实例
CLI命令
npx wapisender-mcp
npx wapisender-mcp serve
npx wapisender-mcp login --token
npx wapisender-mcp logout
npx wapisender-mcp statusCLI示例
保存凭据:
npx wapisender-mcp login --token ws_xxxxxxxxxxxxxxxxx检查凭据是否已保存:
npx wapisender-mcp status删除已保存的凭据:
npx wapisender-mcp logout可用工具
共有25个工具,分为7个区域。
认证
login
加载已保存的凭据并连接到您的WapiSender帐户。
笔记:
- 没有争论
- 如果您的帐户只有一个实例,则自动选择活动实例
例子:
{}logout
清除当前的WapiSender会话。
例子:
{}list_instances
列出您WapiSender帐户上的所有WhatsApp实例。
例子:
{}switch_instance
按ID或按以下方式设置活动实例 instance_name.
例子:
{
"instanceIdOrName": "WABZ3"
}使用实例名称的示例:
{
"instanceIdOrName": "Sales-BR"
}例子
get_instance_status
返回活动实例的连接状态,包括电话号码和电池电量(如果可用)。
例子:
{}get_qr_code
返回在活动实例上连接WhatsApp所需的二维码。
例子:
{}消息传递
send_text
发送WhatsApp短信。
例子:
{
"to": "5491112345678",
"message": "Hello from WapiSender MCP"
}send_media
从公共URL发送图像、视频或文档。
示例图像:
{
"to": "5491112345678",
"type": "image",
"url": "https://example.com/banner.jpg",
"caption": "Campaign preview"
}示例文档:
{
"to": "5491112345678",
"type": "document",
"url": "https://example.com/invoice.pdf",
"caption": "Invoice attached"
}send_location
发送WhatsApp位置密码。
例子:
{
"to": "5491112345678",
"lat": -34.6037,
"lng": -58.3816,
"name": "Buenos Aires Office"
}联系人
list_contacts
列出活动实例上的联系人。您可以选择按搜索字符串和限制进行筛选。
例子:
{
"limit": 20
}搜索示例:
{
"search": "gilad",
"limit": 10
}get_contact
通过电话号码查找单个联系人。
例子:
{
"phone": "5491112345678"
}upsert_contact
在活动实例上创建或更新联系人。
例子:
{
"phone": "5491112345678",
"name": "Gilad",
"email": "gilad@example.com"
}流动
list_flows
列出活动实例上的所有流。
例子:
{}get_flow
返回流的完整定义和运行状况。
例子:
{
"flowId": "a07692d5-a56c-4027-9cb9-19b44c33eb2c"
}create_flow
创建空流壳。
例子:
{
"name": "Support Router",
"description": "Routes inbound messages to sales or support",
"triggerType": "all_messages"
}update_flow_definition
替换现有流的完整节点和边图。
最小示例:
{
"flowId": "a07692d5-a56c-4027-9cb9-19b44c33eb2c",
"nodes": [
{
"id": "trigger-1",
"type": "trigger",
"position": { "x": 250, "y": 100 },
"data": { "triggerType": "all_messages" }
},
{
"id": "message-1",
"type": "send_message",
"position": { "x": 250, "y": 350 },
"data": {
"messageType": "text",
"message": "Hello. Reply with sales or support."
}
},
{
"id": "end-1",
"type": "end",
"position": { "x": 250, "y": 600 },
"data": {}
}
],
"edges": [
{ "id": "e1", "source": "trigger-1", "target": "message-1" },
{ "id": "e2", "source": "message-1", "target": "end-1" }
]
}update_flow_node
仅更新现有流中的一个节点。
例子:
{
"flowId": "a07692d5-a56c-4027-9cb9-19b44c33eb2c",
"nodeId": "message-1",
"data": {
"message": "Hello. Reply with sales, support, or billing."
}
}generate_and_save_flow
根据自然语言描述创建流shell,然后返回完成节点图所需的模式指导。
例子:
{
"name": "Lead Qualification",
"description": "A flow that greets the user, asks for their company size, and routes enterprise leads to sales.",
"triggerType": "all_messages"
}自然语言示例:
Generate and save a WhatsApp flow named "Lead Qualification" that greets the user, asks for company size, and routes enterprise leads to sales.activate_flow
在健康检查后启用流。
例子:
{
"flowId": "a07692d5-a56c-4027-9cb9-19b44c33eb2c"
}deactivate_flow
禁用流。
例子:
{
"flowId": "a07692d5-a56c-4027-9cb9-19b44c33eb2c"
}流节点架构
update_flow_definition 和 generate_and_save_flow 使用以下节点类型:
trigger: { type: "trigger", data: { triggerType: "all_messages"|"keyword", keyword?: string } }
send_message: { type: "send_message", data: { messageType: "text"|"image"|"audio", message: string, url?: string } }
condition: { type: "condition", data: { variable: string, operator: "equals"|"contains"|"starts_with", value: string } }
delay: { type: "delay", data: { delaySeconds: number } }
wait_for_reply:{ type: "wait_for_reply", data: { timeoutSeconds: number, timeoutAction: "continue"|"end" } }
ai_agent: { type: "ai_agent", data: { mode: "reply"|"router"|"extract", credentialId: string, provider: string, model: string, systemPrompt: string, promptTemplate: string } }
end: { type: "end", data: {} }边缘格式:
{ id: "e1", source: "nodeId", target: "nodeId", sourceHandle?: "true"|"false" }推荐定位:
Start near { x: 250, y: 100 } and space nodes vertically by about 250px.网络钩子
get_webhook
返回活动实例的当前webhook配置。
例子:
{}set_webhook
创建或更新webhook URL和事件订阅。
例子:
{
"url": "https://example.com/api/webhooks/wapisender",
"enabled": true,
"events": ["MESSAGES_UPSERT"]
}AI证书
list_ai_credentials
列出活动实例的已保存AI凭据。钥匙被遮住了。
例子:
{}add_ai_credential
将AI提供者凭据添加到活动实例。
支持的提供商:
openaianthropicgeminixaiopenrouter
例子:
{
"provider": "openai",
"apiKey": "sk-...",
"label": "OpenAI Production",
"defaultModel": "gpt-4o-mini"
}test_ai_credential
对已保存的AI凭据运行实时验证。
例子:
{
"credentialId": "cred_12345678"
}端到端使用示例
示例1:发送WhatsApp消息
login to wapisender
list my instances
switch to instance WABZ3
send a WhatsApp message to +5491112345678 saying "Hello from the MCP"示例2:配置webhook
login to wapisender
switch to instance Support-Number
set the webhook to https://example.com/api/webhooks/wapisender and subscribe to MESSAGES_UPSERT等效工具调用:
{
"url": "https://example.com/api/webhooks/wapisender",
"enabled": true,
"events": ["MESSAGES_UPSERT"]
}示例3:创建并激活一个简单的支持流程
login to wapisender
switch to instance Support-Number
create a flow named "Support Router"
update that flow so it greets the user and asks whether they need sales or support
activate the flow示例4:添加和测试AI凭据
login to wapisender
switch to instance Demo-Instance
add an OpenAI credential labeled "OpenAI Production" using model gpt-4o-mini
list my AI credentials
test the credential I just added常见使用模式
模式:干净地开始每个会话
login to wapisender
list my instances
switch to instance
get the instance status模式:安全地使用多个实例
list my instances
switch to instance Sales-AR
send a message to 5491112345678 saying "Sales team checking in"
switch to instance Support-AR
send a message to 5491112345678 saying "Support team following up"模式:逐步构建流
create a flow named "Lead Capture"
get the flow details
update a single node
activate the flow故障排除
Not authenticated 或 Not logged in
先保存凭据:
npx wapisender-mcp login --token 然后打电话 login 再次进入MCP客户端。
No active instance. Call switch_instance() or login() first.
您的帐户可能有多个实例,但尚未选择任何实例。
运行:
list my instances
switch to instance Instance "" not found in your account.
使用 list_instances 首先复制确切的实例名称或ID。
Invalid token or network error
检查:
- 令牌已正确复制
- 令牌在WapiSender中仍然有效
- 客户端机器可以访问
wapisender.com
安全说明
- CLI将您的MCP令牌本地存储在
~/.config/wapisender-mcp/credentials.json - 人工智能提供商API密钥通过
add_ai_credential由WapiSender在服务器端加密 - MCP服务器在运行时将活动会话状态保存在内存中
包元数据
此存储库发布npm包:
wapisender-mcp顶级 README.md 是npm和显示包文档的MCP客户端使用的包README,因此保持此文件最新也会使面向Codex的包文档保持最新。
许可证
麻省理工学院
