Skip to main content
Glama
gfb-47

WhatsApp MCP Server

by gfb-47

Servidor MCP de WhatsApp

Descripción general

El servidor MCP (Protocolo de Contexto de Modelo) de WhatsApp es una aplicación Node.js que permite la interacción programática con la aplicación de escritorio de WhatsApp en macOS. Mediante la automatización de AppleScript, proporciona una interfaz sencilla para enviar mensajes y consultar el estado de WhatsApp sin necesidad de interactuar directamente con la interfaz de usuario de WhatsApp.

Related MCP server: claude-whatsapp-mcp

Características

1. Enviar mensajes a contactos

Envía mensajes de texto a contactos específicos en tu lista de contactos de WhatsApp:

  • Los mensajes se envían a través de su aplicación de escritorio WhatsApp conectada

  • Admite el formato adecuado de los mensajes, incluidos los saltos de línea.

  • Utiliza AppleScript para automatizar la interfaz de escritorio de WhatsApp

2. Verificar el estado de WhatsApp (WIP)

Verificar si la aplicación WhatsApp se encuentra actualmente ejecutándose:

  • Devuelve el estado de ejecución actual de WhatsApp

  • Ayuda a prevenir errores al intentar enviar mensajes.

3. Lista de contactos recientes (WIP)

Debido a las protecciones de privacidad de WhatsApp, esta función ofrece una funcionalidad limitada:

  • Informa a los usuarios sobre las limitaciones de privacidad de WhatsApp

  • Requiere nombres de contacto exactos para enviar mensajes

Implementación técnica

Construido con

  • @modelcontextprotocol/sdk - Servidor MCP y transporte stdio

  • Zod - Validación de esquemas

  • Módulos integrados de Node.js (child_process, util, fs)

  • Automatización de AppleScript para macOS

Arquitectura

  • Utiliza el Protocolo de Contexto de Modelo (MCP) para la comunicación de herramientas estandarizada

  • Utiliza el transporte stdio para la comunicación

  • Ejecuta comandos AppleScript para interactuar con la aplicación de escritorio WhatsApp

  • Implementa un registro de errores completo para la depuración.

Requisitos

  • sistema operativo macOS

  • Aplicación de escritorio WhatsApp instalada

  • Node.js v14.0.0 o superior

  • Conexión a Internet

Instalación

# Clone the repository
git clone https://github.com/yourusername/whatsapp-mcp-server.git

# Navigate to the project directory
cd whatsapp-mcp-server

# Install dependencies
npm install

Uso

Iniciando el servidor

node index.js

Integración con Claude

Para permitir que Claude use el servidor MCP de WhatsApp, siga estos pasos:

  1. Configurar su servidor MCP

    • Instalar y configurar el servidor MCP de WhatsApp como se describe arriba

    • Asegúrese de que el servidor esté funcionando correctamente en su máquina local

  2. Configurar Claude Desktop con sus herramientas MCP

    • Modifique su archivo claude_desktop_config.json para incluir las herramientas MCP de WhatsApp

    • Este archivo normalmente se encuentra en el directorio de configuración de la aplicación Claude Desktop

    • Añade la siguiente configuración para registrar tus herramientas WhatsApp MCP:


{
  "mcpServers": [
    {
      "name": "whatsapp-mcp",
      "transport": {
        "command": "node",
        "args": ["path/to/your/index.js"]
      }
    }
  ]
}
  1. Pruebe la integración

    • Crea una conversación de prueba con Claude

    • Pídele a Claude que envíe un mensaje de WhatsApp a un contacto de prueba

    • Verificar que el mensaje se envió correctamente a través de la aplicación de escritorio de WhatsApp

Herramientas MCP disponibles

1. enviar-mensaje-de-whatsapp

Envía un mensaje a un contacto específico de WhatsApp.

Parámetros:

  • contactName : Nombre completo del contacto tal como aparece en WhatsApp

  • message : Contenido del mensaje a enviar

Ejemplo de uso (a través del cliente MCP):

const response = await client.invoke("send-whatsapp-message", {
  contactName: "John Doe",
  message: "Hello, how are you today?"
});

2. comprobar-estado-de-whatsapp

Comprueba si la aplicación WhatsApp se está ejecutando actualmente.

No se requieren parámetros.

Ejemplo de uso (a través del cliente MCP):

const response = await client.invoke("check-whatsapp-status", {});

3. lista-de-contactos-recientes

Proporciona información sobre las limitaciones de privacidad de WhatsApp para la lista de contactos.

No se requieren parámetros.

Ejemplo de uso (a través del cliente MCP):

const response = await client.invoke("list-recent-contacts", {});

Detalles de implementación

Automatización de AppleScript

El servidor utiliza AppleScript para automatizar la aplicación de escritorio WhatsApp:

  • Activa la aplicación WhatsApp

  • Utiliza atajos de teclado para navegar por la interfaz.

  • Busca contactos por nombre

  • Selecciona contactos usando la navegación con la flecha hacia abajo

  • Escribe y envía mensajes

Manejo de errores

Manejo y registro de errores integral:

  • Salida de error de la consola

  • Registro basado en archivos en ~/Library/Logs/whatsapp-mcp/

  • Manejo elegante de errores de ejecución de AppleScript

  • Manejo de excepciones a nivel de proceso

Uso de las herramientas MCP de WhatsApp con Claude

Una vez que hayas integrado las herramientas de WhatsApp MCP con Claude, puedes usar lenguaje natural para indicarle a Claude que:

Enviar mensajes

Ejemplos de indicaciones:

  • Envíale un mensaje de WhatsApp a John diciéndole que llegaré 10 minutos tarde a nuestra reunión.

  • Envíale un mensaje a Sarah por WhatsApp con el siguiente texto: Aquí está el documento que solicitaste.

  • Envíale un "¡Feliz cumpleaños!" a mamá por WhatsApp.

Comprobar el estado de WhatsApp

Ejemplos de indicaciones:

  • "¿Está funcionando WhatsApp en mi computadora?"

  • "Comprueba si WhatsApp está activo"

  • Verificar el estado de WhatsApp antes de enviar un mensaje

Obtener información de contacto

Ejemplos de indicaciones:

  • "¿Puedes enumerar mis contactos recientes de WhatsApp?"

  • "Muéstrame a quién le he enviado mensajes recientemente en WhatsApp"

Claude utilizará la herramienta MCP adecuada según su solicitud y le proporcionará comentarios sobre el resultado.

Limitaciones

  • Funciona solo en macOS debido a la dependencia de AppleScript

  • Requiere que esté instalada la aplicación de escritorio WhatsApp

  • La selección de contactos puede verse afectada por los cambios en la interfaz de usuario de WhatsApp

  • Acceso limitado a la lista de contactos de WhatsApp debido a protecciones de privacidad

  • Requiere la configuración adecuada de Claude para acceder a las herramientas MCP locales

Consideraciones de seguridad

  • El servidor interactúa con tu cuenta personal de WhatsApp

  • Los mensajes se envían desde su cuenta y aparecen como enviados por usted.

  • Úselo solo en entornos de confianza

Licencia

Instituto Tecnológico de Massachusetts (MIT)

Descargo de responsabilidad

Este proyecto no está afiliado con WhatsApp Inc. o Meta Platforms, Inc. Úselo a su propia discreción y de acuerdo con los términos de servicio de WhatsApp.

Available Tools

3 tools
check-whatsapp-statusB

Check if WhatsApp is currently running

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

B3.2/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It states the tool checks if WhatsApp is 'currently running,' which implies a read-only operation, but doesn't disclose behavioral traits like what 'running' means (e.g., process active, logged in), error handling, or performance characteristics. The description is minimal and lacks context beyond the basic purpose.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, clear sentence that directly states the tool's purpose without any wasted words. It is appropriately sized and front-loaded, making it easy to understand at a glance.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's simplicity (0 parameters, no annotations, no output schema), the description is minimally adequate. It covers the basic purpose but lacks details on behavior, output format, or usage context, which could be helpful for an agent to understand what 'running' entails or how to interpret results.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 0 parameters with 100% coverage, so no parameter documentation is needed. The description doesn't add parameter details, which is appropriate here, and it doesn't contradict the schema. Baseline is 4 for tools with no parameters, as there's nothing to compensate for.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Check if') and resource ('WhatsApp'), specifying what the tool does. It distinguishes from siblings like 'send-whatsapp-message' by focusing on status checking rather than messaging, though it doesn't explicitly mention the sibling 'list-recent-contacts'.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives. The description implies usage for checking WhatsApp's operational status, but it doesn't specify scenarios, prerequisites, or exclusions, such as whether it requires WhatsApp to be installed or configured.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

list-recent-contactsB

List recently contacted people on WhatsApp (simplified)

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

B3.3/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. It states it lists contacts but doesn't explain what 'recently contacted' means (timeframe, criteria), how results are ordered, or any limitations (e.g., pagination, rate limits). The 'simplified' hint is insufficient to convey operational behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with no wasted words. It's front-loaded with the core purpose ('List recently contacted people on WhatsApp') and uses a brief qualifier ('simplified') that, while vague, doesn't detract from clarity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations and no output schema, the description is incomplete. It lacks details on what 'recently contacted' entails, how results are returned, or any behavioral constraints. For a tool that presumably returns data, more context on output format or limitations is needed.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 0 parameters with 100% coverage, so no parameter documentation is needed. The description appropriately doesn't discuss parameters, focusing instead on the tool's purpose. Baseline is 4 for zero-parameter tools when schema coverage is complete.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('List') and target resource ('recently contacted people on WhatsApp'), making the purpose understandable. It distinguishes from siblings by focusing on listing contacts rather than checking status or sending messages. However, the qualifier 'simplified' is vague and doesn't specify what makes it simplified.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage context (WhatsApp contacts) but provides no explicit guidance on when to use this tool versus alternatives. No prerequisites, exclusions, or comparisons to sibling tools are mentioned, leaving the agent to infer usage from the purpose alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

send-whatsapp-messageC

Send a message to a contact on WhatsApp

ParametersJSON Schema
NameRequiredDescriptionDefault
contactNameYesFull name of the contact as it appears in WhatsApp
messageYesMessage content to send

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the action but fails to mention critical traits like authentication needs, rate limits, error handling, or whether the message is sent immediately or queued. This leaves significant gaps in understanding the tool's behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's function without any unnecessary words. It is front-loaded and appropriately sized for a simple tool, making it easy to grasp quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the lack of annotations and output schema, the description is incomplete. It doesn't address behavioral aspects like success/error responses, side effects, or integration with sibling tools. For a messaging tool with potential complexities, more context is needed to ensure proper usage.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 100%, with clear descriptions for both parameters ('contactName' and 'message'). The description adds no additional meaning beyond the schema, such as formatting details or examples, but the schema adequately documents the parameters, meeting the baseline.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Send a message') and target ('to a contact on WhatsApp'), making the purpose immediately understandable. However, it doesn't differentiate from sibling tools like 'check-whatsapp-status' or 'list-recent-contacts' beyond the obvious functional difference, missing explicit distinction.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives or any prerequisites. The description lacks context about usage scenarios, such as when to choose this over other messaging methods or if there are limitations like contact availability.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 2 tool updatesv1.0.0
    • Changedcheck-whatsapp-status1 field changed
      • removedInput schema / additionalProperties
        Removed value: -false
    • Changedlist-recent-contacts1 field changed
      • removedInput schema / additionalProperties
        Removed value: -false
  2. 3 tool updates
    • First observedcheck-whatsapp-status
    • First observedlist-recent-contacts
    • First observedsend-whatsapp-message

TDQS

B3.1/5.0

Scored across 3 tools

Disambiguation5/5

Each tool has a clearly distinct purpose: checking WhatsApp status, listing recent contacts, and sending messages. There is no overlap in functionality, making it easy for an agent to select the correct tool without confusion.

Naming Consistency4/5

The tools follow a consistent verb-noun pattern with hyphens (e.g., check-whatsapp-status, list-recent-contacts, send-whatsapp-message). However, the use of hyphens instead of underscores is a minor deviation from common snake_case conventions, but it remains readable and predictable.

Tool Count3/5

With only 3 tools, the server feels thin for managing WhatsApp interactions, as it lacks operations like reading messages, managing groups, or handling media. While the tools cover basic actions, the scope is limited, making it borderline appropriate for a comprehensive WhatsApp integration.

Completeness2/5

The toolset is significantly incomplete for a WhatsApp server, missing essential CRUD operations such as reading incoming messages, replying to messages, managing contacts or groups, and handling attachments. This will likely cause agent failures when trying to perform common WhatsApp tasks beyond the basic ones provided.

Maintenance

ActivityInactive
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    A Node.js application that connects WhatsApp Web with AI models through the Model Context Protocol, enabling automated messaging, contact management, and group chat functionality through AI-driven workflows.
    34 npm
    46
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables Claude Code to interact with WhatsApp for reading messages, sending replies, and searching contacts through the Model Context Protocol. It uses whatsapp-web.js to facilitate local connection management with QR code authentication and session persistence.
    4
    MIT
  • A
    license
    A
    quality
    D
    maintenance
    Enables sending iMessages or SMS messages via the macOS Messages app using osascript. No Full Disk Access required, and never reads your message history.
    1
    MIT
  • A
    license
    A
    quality
    C
    maintenance
    MCP server that gives AI agents read and write access to WhatsApp on macOS, reading local chat history offline and sending messages via pre-filled drafts with explicit user confirmation.
    8
    MIT