AI & agents · Model Context Protocol server
MCP + Sendjade
Give Claude, Cursor and other MCP clients tools to check a number and send messages.
Works with the live APIWhat you can automate
- Ask an assistant "is my number connected?"
- Have an agent send a templated reminder after approval
- Review recent incoming messages from your editor
Before you start
- A Sendjade account with a connected instance (status Authorized). See Getting started.
- Your **idInstance** (shown on the instance page in the console) and **apiTokenInstance** (shown once when you created the instance; press Generate new token if you lost it). Use a spare number while testing.
- Node 20+ and an MCP-compatible client.
Set it up
Create the server
Install the SDK (
npm i @modelcontextprotocol/sdk zod) and expose a few focused tools. The SDK surface changes between versions, so adjust to yours.import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'; import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js'; import { z } from 'zod'; const BASE = 'https://api.sendjade.com/waInstance' + process.env.SENDJADE_ID_INSTANCE; const T = process.env.SENDJADE_TOKEN_INSTANCE; const text = (v) => ({ content: [{ type: 'text', text: typeof v === 'string' ? v : JSON.stringify(v, null, 2) }] }); const server = new McpServer({ name: 'sendjade', version: '0.1.0' }); server.tool('get_state', 'Is the WhatsApp number connected?', {}, async () => { return text(await (await fetch(BASE + '/getStateInstance/' + T)).json()); }); server.tool('recent_incoming', 'Incoming messages from the last N minutes', { minutes: z.number().default(60) }, async ({ minutes }) => { return text(await (await fetch(BASE + '/lastIncomingMessages/' + T + '?minutes=' + minutes)).json()); }); server.tool('send_message', 'Send a WhatsApp text message', { to: z.string(), message: z.string() }, async ({ to, message }) => { const r = await fetch(BASE + '/sendMessage/' + T, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ chatId: to.replace(/\D/g, ''), message }) }); return text('HTTP ' + r.status + ' ' + (await r.text())); }); await server.connect(new StdioServerTransport());Register it in your client
Add the server to your MCP client's configuration with the credentials as environment variables.
{ "mcpServers": { "sendjade": { "command": "node", "args": ["/path/to/server.mjs"], "env": { "SENDJADE_ID_INSTANCE": "YOUR_ID_INSTANCE", "SENDJADE_TOKEN_INSTANCE": "YOUR_API_TOKEN_INSTANCE" } } } }Keep a human in the loop
Configure your client to ask for approval on
send_message. The token can act on its own instance only, and you can rotate it any time.
Test it
Ask your assistant whether your number is connected. It should report the instance state.
Troubleshooting
The client does not list the tools
Check the command path, that Node 20+ is used, and the client's MCP log for startup errors.
I get 401 unauthorized
The idInstance or token in the URL is wrong. Copy both again from the console. Generating a new token makes the old one stop working immediately.
I get 409 instance_not_connected
The instance is not Authorized yet. Open it in the console, press Connect and scan the QR code.
I get 400 invalid_chat_id
Use international format with digits only, e.g. 2348012345678 (or 2348012345678@c.us). Remove spaces, dashes and the leading zero of the local number.
I get 422 recipient_opted_out
That person replied STOP (or was added to the opt-out list). Sendjade refuses to message them. Remove the number from Opt-outs only if they asked to hear from you again.
I get 429 daily_limit_reached or rate_limited
The number reached its 24-hour sending cap (default 500) or you are calling too fast. The cap protects your number from restriction. Slow down, and raise the cap only if your volume is genuine.
Ask AI to help me integrate MCP
Copy this prompt into ChatGPT, Claude or any assistant. It already knows Sendjade’s API, so the answer matches our endpoints.
The prompt is plain text that you copy yourself. Never paste real keys into an assistant; use placeholders.