# MCP: DoneTalk as an AI's tools

DoneTalk is also an **MCP** (Model Context Protocol) server. An AI connected with the company's API key gets the API's own operations as tools: look up and add contacts, read and answer conversations, build and send campaigns, see the schedule.

There is nothing new to learn or to allow: each tool **is** an operation of the [API](https://donetalk.com/developers/), called with the same key. What the key may not do, the AI may not do either.

## The address

```
https://api.donetalk.com/v1/c/YOUR-COMPANY/mcp
```

- `YOUR-COMPANY` is the company's identifier, the same as in the other calls of the API. It shows in **Settings › API**, with the address ready to copy.
- The key goes in the `Authorization: Bearer <key>` header. Create a key for the AI alone, with the scopes of what it should do ([Keys and scopes](/en/developers/keys-and-scopes/)).
- The transport is **Streamable HTTP**: one `POST` per message, a JSON answer, no session.

## Connecting

It is the same everywhere: the address above and the `Authorization` header with the key. Keep the key in an environment variable (`DONETALK_KEY`), not in the file.

**Claude Code**, from the terminal:

```bash
claude mcp add --transport http donetalk https://api.donetalk.com/v1/c/YOUR-COMPANY/mcp \
  --header "Authorization: Bearer $DONETALK_KEY"
```

or in the project's `.mcp.json` file (the `type` field is required):

```json
{
  "mcpServers": {
    "donetalk": {
      "type": "http",
      "url": "https://api.donetalk.com/v1/c/YOUR-COMPANY/mcp",
      "headers": { "Authorization": "Bearer ${DONETALK_KEY}" }
    }
  }
}
```

**Cursor**, in `.cursor/mcp.json` (the project's) or `~/.cursor/mcp.json`:

```json
{
  "mcpServers": {
    "donetalk": {
      "url": "https://api.donetalk.com/v1/c/YOUR-COMPANY/mcp",
      "headers": { "Authorization": "Bearer ${env:DONETALK_KEY}" }
    }
  }
}
```

**Claude (claude.ai and Claude Desktop):** add a custom connector with the address and, in the request headers, `Authorization` with the value `Bearer <key>`. Claude connects from Anthropic's servers, not from your computer: a key limited to IP addresses does not work for it.

**Other clients:** any that takes an HTTP address and headers of your own connects the same way (in VS Code, a server of type `http`).

**In an agent of your own**, with MCP's official library:

```js
import { Client, StreamableHTTPClientTransport } from "@modelcontextprotocol/client";

const transport = new StreamableHTTPClientTransport(
  new URL("https://api.donetalk.com/v1/c/YOUR-COMPANY/mcp"),
  { requestInit: { headers: { Authorization: `Bearer ${process.env.DONETALK_KEY}` } } },
);
const client = new Client({ name: "my-agent", version: "1.0.0" });
await client.connect(transport);
const { tools } = await client.listTools();
const me = await client.callTool({ name: "account_me", arguments: {} });
```

A client that only signs in by OAuth, with no place for a header, does not connect yet.

## Try it now, with no account

The company `demo` takes the public test key, which only simulates ([Test mode](/en/developers/test-mode/)):

```bash
curl https://api.donetalk.com/v1/c/demo/mcp?lang=en \
  -H "Authorization: Bearer dt_test_demo_zRZ6twAhj4u9dZT0hEBrNFzr" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-11-25","capabilities":{},"clientInfo":{"name":"curl","version":"1"}}}'
```

```bash
curl https://api.donetalk.com/v1/c/demo/mcp?lang=en \
  -H "Authorization: Bearer dt_test_demo_zRZ6twAhj4u9dZT0hEBrNFzr" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -d '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"account_me","arguments":{}}}'
```

## The tools

A tool's name is the operation's with `_` in place of the dot: `campaigns.list` becomes `campaigns_list`. The list the AI receives holds **only the tools the key reaches**; for it to see fewer, give the key fewer scopes.

The arguments follow the API's call:

- the path's ids go by name (`id`, `tagId`, `key`);
- the filters and the page go in `query`;
- the request's content goes in `body`.

```json
{ "name": "campaigns_get", "arguments": { "id": "01a3e4f5-…" } }
```

```json
{ "name": "contacts_list", "arguments": { "query": { "q": "Ana", "limit": 20 } } }
```

```json
{
  "name": "contacts_create",
  "arguments": { "body": { "displayName": "Ana Souza", "phone": "+5548999990001" } }
}
```

The answer is the API's, as text (JSON) and as structured data. An error of the API comes back as the tool's error, with the same code and message ([Errors and limits](/en/developers/errors-and-limits/)), for the AI to read and correct.

### Account

| Tool | What it does | Scope |
|---|---|---|
| `account_me` | Who the key is |  |

### Campaigns

| Tool | What it does | Scope |
|---|---|---|
| `campaigns_list` | List campaigns | `campaigns:read` |
| `campaigns_create` | Create a campaign | `campaigns:write` |
| `campaigns_get` | Get a campaign | `campaigns:read` |
| `campaigns_update` | Edit a campaign | `campaigns:write` |
| `campaigns_delete` | Delete a campaign | `campaigns:write` |
| `campaigns_waiting` | Who replied and waits for an answer | `campaigns:read` |
| `campaigns_waiting_apply` | Hand who waits to who answers now | `campaigns:send` |
| `campaigns_archive` | Archive a campaign | `campaigns:write` |
| `campaigns_unarchive` | Unarchive a campaign | `campaigns:write` |
| `campaigns_duplicate` | Duplicate | `campaigns:write` |
| `campaigns_header` | Set the header image or document | `campaigns:write` |
| `campaigns_audiencePreview` | Audience preview | `campaigns:read` |
| `campaigns_messagePreview` | Message preview | `campaigns:read` |
| `campaigns_review` | Review: cost, checks and approval | `campaigns:read` |
| `campaigns_test` | Send a test | `campaigns:write` |
| `campaigns_submit` | Start or schedule | `campaigns:send` |
| `campaigns_pause` | Pause | `campaigns:send` |
| `campaigns_resume` | Resume | `campaigns:send` |
| `campaigns_cancel` | Cancel | `campaigns:send` |
| `campaigns_retry` | Retry the failures | `campaigns:send` |
| `campaigns_recipients` | Recipients, one by one | `campaigns:read` |
| `campaigns_insights` | Failures, buttons and clicks | `campaigns:read` |

### Segments

| Tool | What it does | Scope |
|---|---|---|
| `segments_list` | List segments | `contacts:read`, `campaigns:write` |
| `segments_create` | Create a segment | `contacts:write` |
| `segments_update` | Edit a segment | `contacts:write` |
| `segments_delete` | Delete a segment | `contacts:write` |
| `segments_count` | Count who matches | `contacts:read`, `campaigns:write` |
| `contacts_search` | Search contacts by conditions | `contacts:read` |

### Contacts

| Tool | What it does | Scope |
|---|---|---|
| `contacts_list` | List contacts | `contacts:read` |
| `contacts_create` | Create a contact | `contacts:write` |
| `contacts_import` | Create or update contacts (up to 1,000) | `contacts:write` |
| `contacts_get` | Get a contact | `contacts:read` |
| `contacts_update` | Edit a contact | `contacts:write` |
| `contacts_consent` | Record consent | `contacts:write` |
| `contacts_activeMessages` | Get active messages | `contacts:read` |
| `contacts_setActiveMessages` | Pause or opt out of active messages | `contacts:write` |
| `contacts_tagAdd` | Add a tag | `contacts:write` |
| `contacts_tagRemove` | Remove a tag | `contacts:write` |
| `contacts_cards` | Context cards | `contacts:read` |
| `contacts_cardPut` | Show a card to the attendant | `contacts:write` |
| `contacts_cardDelete` | Remove a card | `contacts:write` |
| `contacts_erase` | Erase the contact's data (LGPD) | `contacts:delete` |

### Contact fields

| Tool | What it does | Scope |
|---|---|---|
| `fields_list` | List the contact fields | `fields:read`, `contacts:read` |
| `fields_create` | Create a field | `fields:write` |
| `fields_update` | Edit a field | `fields:write` |
| `fields_layout` | Order the fields and groups | `fields:write` |
| `fields_duplicates` | Possible duplicates | `fields:write` |
| `fields_merge` | Merge two fields | `fields:write` |
| `fields_undoMerge` | Undo a merge | `fields:write` |
| `fieldGroups_create` | Create a field group | `fields:write` |
| `fieldGroups_update` | Rename or hide a group | `fields:write` |
| `fieldGroups_delete` | Delete a group | `fields:write` |

### Templates

| Tool | What it does | Scope |
|---|---|---|
| `templates_list` | List templates | `templates:read`, `campaigns:write`, `messages:send_template` |
| `templates_create` | Create a template | `templates:write` |
| `templates_get` | Get a template | `templates:read`, `templates:write` |
| `templates_update` | Edit a template | `templates:write` |
| `templates_delete` | Delete a template | `templates:write` |
| `templates_authentication` | Access-code templates: allowed? | `templates:read`, `templates:write` |
| `templates_buttonActions` | What each button does | `templates:write` |
| `templates_submit` | Send to Meta for review | `templates:write` |

### Messages

| Tool | What it does | Scope |
|---|---|---|
| `messages_sendTemplate` | Send a template to a phone | `messages:send_template` |
| `messages_get` | A message's status and reply | `conversations:read`, `messages:send_template`, `messages:send_text` |
| `messages_list` | A phone's messages | `conversations:read` |

### Conversations

| Tool | What it does | Scope |
|---|---|---|
| `conversations_list` | List conversations | `conversations:read` |
| `conversations_start` | Open a conversation with a template | `messages:send_template` |
| `conversations_export` | Export the conversation | `conversations:export` |
| `conversations_get` | Get a conversation | `conversations:read` |
| `conversations_send` | Send a message in the conversation | `messages:send_template`, `messages:send_text` |
| `conversations_close` | Close with an outcome | `conversations:write` |
| `conversations_reopen` | Reopen | `conversations:write` |

### Numbers, teams and tags

| Tool | What it does | Scope |
|---|---|---|
| `channels_list` | WhatsApp numbers | `workspace:read`, `campaigns:write`, `messages:send_template`, `templates:read` |
| `teams_list` | Teams | `workspace:read`, `campaigns:write` |
| `tags_list` | Tags | `workspace:read`, `contacts:read` |
| `outcomes_list` | Outcomes | `workspace:read`, `conversations:read`, `conversations:write` |

### Scheduling

| Tool | What it does | Scope |
|---|---|---|
| `appointments_types` | Appointment types | `appointments:read` |
| `appointments_slots` | Free times | `appointments:read` |
| `appointments_list` | Appointments | `appointments:read` |
| `appointments_book` | Book | `appointments:write` |
| `appointments_get` | Get an appointment | `appointments:read` |
| `appointments_reschedule` | Reschedule | `appointments:write` |
| `appointments_cancel` | Cancel | `appointments:write` |

### Webhooks

| Tool | What it does | Scope |
|---|---|---|
| `webhooks_list` | List webhooks | `webhooks:manage` |
| `webhooks_create` | Create a webhook | `webhooks:manage` |
| `webhooks_update` | Edit a webhook | `webhooks:manage` |
| `webhooks_delete` | Delete a webhook | `webhooks:manage` |
| `webhooks_test` | Send a test event | `webhooks:manage` |
| `webhooks_deliveries` | Recent deliveries | `webhooks:manage` |

Sending a file (`POST /uploads`) stays in the API alone: a file does not fit in a tool's arguments. For the same reason, a conversation's export (`conversations_export`) always answers the text; the PDF and the zip stay in the API.

## Limits and care

- **Rate limit:** the key's, 600 per minute. A tool's call counts once. A request is 1 MB at most.
- **Repeating a creation creates again.** The API's `Idempotency-Key` does not pass through a tool. Each tool says whether repeating it is safe (`idempotentHint`).
- **Test key:** the AI really works against the real rules and nothing is stored or sent. It is the right way to develop and to demonstrate.
- **Live key:** sending a message and starting a campaign reaches real people. Give the AI's key only the scopes it needs; if the company uses campaign approval, it applies to the AI too.
- **Marketing needs consent.** WhatsApp's opt-in rules are the same, whoever asks.
- **Language of the descriptions:** Portuguese. Add `?lang=en` or `?lang=es` to the address for English or Spanish.

## Protocol versions

The server serves both generations of MCP at the same address and keeps nothing between one request and the next:

- revision `2026-07-28`, with no handshake: each request says its version, and `server/discover` describes the server;
- revisions `2025-11-25`, `2025-06-18`, `2025-03-26` and `2024-11-05`, which open with `initialize`.

`GET` and `DELETE` answer `405`: there is no event stream and no session to end.
