Skip to content

Connect your AI agent (MCP)

Neike ships a built-in MCP server. Point Claude Code, claude.ai or any MCP client at it and your agent gets tools to send messages, read conversations and manage WhatsApp templates over your own channels — no glue code, no SDK.

The server lives at:

https://api.neike.dev/mcp

It speaks Streamable HTTP and authenticates with OAuth 2.1 (interactive, per user) or with an API key (headless, for backends).

  1. Terminal window
    claude mcp add --transport http neike https://api.neike.dev/mcp
  2. The first time the agent uses a Neike tool, Claude Code opens your browser to start the OAuth flow. Log in with your Neike console account.

  3. On the consent screen you pick the workspace (if you belong to several) and the channel selection for this connection:

    SelectionMeaning
    All channelsEvery channel, including ones you connect in the future.
    By platformAll current and future channels of the platforms you tick (e.g. only WhatsApp).
    Specific channelsExactly the channels you list — nothing else, ever.

    Approve, and the agent is connected.

On claude.ai, go to Settings → Connectors → Add custom connector and paste https://api.neike.dev/mcp as the URL. The same browser consent flow kicks in.

You can revoke a connection at any time from the console under API Keys → Connections. Revocation is immediate — every token of that connection dies with it.

For backends, CI or MCP clients that cannot run a browser flow, skip OAuth and send your API key on every request instead:

Terminal window
claude mcp add --transport http neike https://api.neike.dev/mcp \
--header "x-neike-api-key: whk_live_…"

An API key connection has access to all channels of the workspace, limited only by the scopes of the key itself.

The server exposes eight tools. All of them respect the channel selection of the connection.

ToolWhat it doesMain inputs
list_channelsLists the channels this connection can use, with channel_id (nk_*), platform, name and status. The agent’s starting point.
send_messageSends a message through a channel. Async: returns a job_id, not Meta’s message id.channel_id, to, type (text|image|video|audio|document|interactive|reaction), content
broadcast_messageSends the same message through several channels at once. Returns a per-channel result.channel_ids (list or "all"), to or recipients (map channel → recipient), type, content
get_messagesReads the latest inbound and outbound messages of a channel from Neike’s event log, optionally filtered by direction or contact.channel_id, direction?, contact?, limit? (max 100, default 30)
open_conversationStarts a conversation with a contact. Outside WhatsApp’s 24-hour window it requires an approved template.channel_id, to, template_name?, language?, components?, text?
send_templateSends an approved WhatsApp template — mandatory to start conversations outside the 24-hour window.channel_id, to, template_name, language, components?
create_templateSubmits a WhatsApp template to Meta for approval (Business Management API format). Approval is asynchronous.channel_id, template_data
list_templatesLists the channel’s WhatsApp templates with their approval status (APPROVED/PENDING/REJECTED), language and components.channel_id

In practice you never call these yourself — you just talk to your agent:

You: Send a WhatsApp message to +54 9 11 1234-5678 saying their order shipped.

Agent: calls list_channels, picks your WhatsApp channel nk_dvzobn7m4h4y, then calls send_message with to: "5491112345678", type: "text" and content: { "text": "Good news — your order shipped! 📦" }.

Agent: Done — the message is queued (job outbound_nk_dvzobn7m4h4y_…).

  • Sends are asynchronous. send_message, broadcast_message, open_conversation and send_template return a job_id when the message is queued, not when it is delivered. Delivery status arrives on your backend’s webhook as usual.
  • The 24-hour window still applies. Outside 24 hours since the customer’s last WhatsApp message, free-form sends fail at Meta — the agent has to use send_template or open_conversation with an approved template. See Sending messages.
  • Scopes. A connection can hold messages:send, messages:read, templates:manage and usage:read. Administrative scopes (keys, team, billing) are never available over MCP.
SymptomCause and fix
401 on every callThe connection’s grant was revoked or its token expired beyond refresh. Re-authorize: remove and re-add the server, or just retry and let the client restart the OAuth flow.
A channel is “not authorized for this connection”The channel exists but is outside the channel selection of this connection. Revoke the connection in API Keys → Connections and connect again with a broader selection.