Skip to main content
Glama
gfb-47

WhatsApp MCP Server

by gfb-47

check-whatsapp-status

Verify WhatsApp desktop application status on macOS to determine if it's currently running and accessible for automation tasks.

Instructions

Check if WhatsApp is currently running

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • src/index.ts:143-180 (registration)
    Registration of the 'check-whatsapp-status' MCP tool, including its inline handler function that uses AppleScript to check if the WhatsApp process exists.
    server.tool( "check-whatsapp-status", "Check if WhatsApp is currently running", {}, async () => { try { const appleScript = ` tell application "System Events" return (exists process "WhatsApp") end tell `; const result = await runAppleScript(appleScript); const isRunning = result.toLowerCase() === 'true'; return { content: [ { type: "text", text: isRunning ? "WhatsApp is currently running." : "WhatsApp is not currently running. Please start WhatsApp before trying to send messages.", } ] }; } catch (error) { return { content: [ { type: "text", text: `Error checking WhatsApp status: ${error}`, } ], isError: true }; } } );
  • Helper function to execute AppleScript code, which is called by the tool handler to check WhatsApp status.
    async function runAppleScript(script: string) { try { const { stdout } = await execPromise(`osascript -e '${script.replace(/'/g, "'\\''")}'`); return stdout.trim(); } catch (error) { console.error("AppleScript execution error:", error); throw new Error(`Failed to execute AppleScript: ${error}`); } }
  • Promisified exec function used by runAppleScript helper.
    const execPromise = promisify(exec);

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/gfb-47/whatsapp-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server