Provider REST API
CommunicationConnect Claude to Mailgun
Send transactional email, and read Mailgun domains, events, stats, suppressions, mailing lists and templates. Toolspoke puts 18 of its actions behind one MCP endpoint that Claude, Cursor, and Codex all speak.
- Connection
- Provider REST API
- Authentication
- API key
- Actions exposed
- 18
- What a call bills
- Nothing
- Adapter
- Maintained by Toolspoke
Connected in three steps
- 1
Install Mailgun
Open the marketplace in your workspace, add Mailgun to the project your agents work in, and it appears on the gateway immediately.
- 2
Connect the credential
Authenticate with api key. Where to get one, and what it has to be able to reach, is the next section.
- 3
Point your agent at the gateway
Give your client one address, https://toolspoke.com/mcp. Claude Code takes it as a command, Claude and Claude Desktop add it as a custom connector, and Cursor, Codex and VS Code each read it from a config file of their own.
.mcp.json{
"mcpServers": {
"toolspoke": {
"type": "http",
"url": "https://toolspoke.com/mcp"
}
}
}One block covers every tool you have installed. Mailgun shows up in the client as soon as your policy allows it, and so does everything else you install later.
Where the address goes, per client
- Claude Code
Run it in your project, then /mcp to sign in
claude mcp add --transport http toolspoke https://toolspoke.com/mcp- Claude and Claude Desktop
Settings, then Connectors, then Add custom connector
https://toolspoke.com/mcp- Cursor
~/.cursor/mcp.json, or .cursor/mcp.json for one project
{ "mcpServers": { "toolspoke": { "url": "https://toolspoke.com/mcp" } } }- Codex
~/.codex/config.toml
[mcp_servers.toolspoke] url = "https://toolspoke.com/mcp"- VS Code
.vscode/mcp.json, or the MCP: Add Server command
{ "servers": { "toolspoke": { "type": "http", "url": "https://toolspoke.com/mcp" } } }
What Mailgun asks for
API key. You provide it once, when you install the connector. Toolspoke encrypts it at rest and decrypts it only for the length of a single call, and the gateway attaches it to the outbound request itself, so it is never part of the arguments an agent sends.
- API key, with the username api in front of itRequired
- Paste it in exactly that form: the word api, a colon, then your key. Mailgun reads this as HTTP Basic with the username api. Create the key in Mailgun → your name (top right) → API Security → Add new key. Use an account API key, not a domain sending key: a sending key can only send, so every read here would fail with it.
- api:0123456789abcdef0123456789abcdef-12345678-12345678
- API region URLRequired
- Leave blank for a US account. For an EU account use https://api.eu.mailgun.net. The region is shown next to each domain under Send → Sending → Domains. A key sent to the wrong region is rejected as if it were invalid.
- https://api.mailgun.net
What Claude can do in Mailgun
18 actions, each one declared and named by the connector rather than discovered at runtime. A workspace policy grants a person all of them, a hand-picked selection, everything on the read side, everything on the write side, or none.
- Reads
- 13Reads
- Writes
- 2Writes
- Destructive
- 3Destructive
Reads
13Fetches data and changes nothing.
list_domainsList the sending domains on this account, with their state (active, unverified, disabled) and type. The domain names here are what every other action takes. Takes no required arguments, which is why an install tests itself with it.
get_domainFetch one domain with its settings and the DNS records Mailgun expects (SPF, DKIM, MX, tracking CNAME), each with its verification state. This is the answer to most "why is mail from this domain failing" questions.
list_eventsSearch the event log for a domain - accepted, delivered, failed, opened, clicked, unsubscribed, complained. Each event carries the recipient, the message headers and, for failures, the reason. Use it to trace what happened to one message or one recipient.
get_stored_messageRetrieve a stored message - its headers and body - by the storage key found in an event's storage.key. Mailgun keeps messages for a few days only.
get_domain_statsCounts of one event type for a domain over time - accepted, delivered, failed, opened, clicked, unsubscribed, complained or stored - bucketed by hour, day or month. Use it for delivery and engagement rates.
list_bouncesList addresses on a domain's bounce suppression list, with the error code and message for each. Mailgun will not send to these addresses until they are removed.
list_unsubscribesList addresses that have unsubscribed from a domain, with the tags they unsubscribed from (* means everything).
list_complaintsList addresses that marked a domain's mail as spam. Mailgun will not send to them.
list_mailing_listsList the account's mailing lists, with each list's address, name, access level and member count. The list address is what the member actions take.
list_list_membersList the members of one mailing list, with name, subscription state and custom variables.
list_templatesList the stored templates on a domain, by name, description and creation date. A template name is what send_message's template input takes.
get_templateFetch one stored template with its active version's content, so you can see which variables it expects before sending with it.
validate_addressCheck whether one email address is deliverable - syntax, domain, mailbox and risk - before sending to it. Mailgun bills each validation, and the plan must include the Validate product.
Writes
2Creates or updates something on the other side.
add_unsubscribeAdd an address to a domain's unsubscribe list, so Mailgun stops sending to it - for every message, or only for one tag. Use it to honour an opt-out that arrived outside Mailgun.
add_list_memberAdd one member to a mailing list, or update them if upsert is yes. This adds a contact; it sends nothing.
Destructive
3Deletes or permanently alters something. Worth granting on purpose.
send_messageSend one email from a verified Mailgun domain. Classified destructive: it delivers to real inboxes, it cannot be recalled once accepted, and Mailgun bills per message. Supply text, html, or a stored template. Returns the message id and a queued status.
delete_bounceRemove one address from a domain's bounce list, so Mailgun will send to it again. Destructive because the bounce record is lost and the next send goes out to an address that already failed, which can hurt the domain's reputation.
delete_unsubscribeRemove an address from a domain's unsubscribe list, so Mailgun will send to it again. Destructive because it overrides a person's opt-out; do it only when they have asked to be subscribed again.
What it will not do
Enforced by the gateway rather than left to convention, which is why each of these can be stated flatly.
- It cannot call anything else
- The 18 actions above are the whole of it. A call to any other name is refused before it reaches Mailgun rather than forwarded on, and connecting your account does not add to the list: it is fixed by the connector, not discovered at run time.
- It reaches no further than your credential
- Toolspoke holds no access to Mailgun of its own. Every call carries the credential you stored and nothing besides, so whatever that credential cannot reach, this connector cannot reach either.
- It never hears from Mailgun
- Nothing is pushed to it. There is no webhook, no subscription and no polling, so this connector cannot notice by itself that something changed in Mailgun. An agent has to ask.
- It does not smooth over provider limits
- Toolspoke does not retry, queue or back off around Mailgun's own rate limits. A call that Mailgun refuses comes back to the agent as a failed call.
Before you connect it
What can Claude do in Mailgun?
18 named actions: 13 that only read, 2 that write and 3 that delete or permanently alter something. They include send_message, list_domains and get_domain. Nothing outside that list is reachable: the connector declares each operation by name rather than proxying whatever an agent asks for.
What credentials does the Mailgun connector need?
API key. The connector asks for api key, with the username api in front of it and api region url. Values are encrypted at rest and attached to the outbound request by the gateway, so they are never part of the arguments an agent sends and never reach the audit log.
Does the Mailgun connector work with Cursor and Codex, or only Claude?
Any client that speaks MCP, and every one of them gets the same 18 actions. There is a single address, https://toolspoke.com/mcp. Claude Code adds it with claude mcp add --transport http, Claude and Claude Desktop take it as a custom connector in settings, Cursor reads it from .cursor/mcp.json, Codex from ~/.codex/config.toml, and VS Code from .vscode/mcp.json. Each of them signs in to the gateway itself, so there is no key to paste.
What does the Mailgun connector not do?
The 18 actions above are the whole of it. A call to any other name is refused before it reaches Mailgun rather than forwarded on, and connecting your account does not add to the list: it is fixed by the connector, not discovered at run time. Toolspoke holds no access to Mailgun of its own. Every call carries the credential you stored and nothing besides, so whatever that credential cannot reach, this connector cannot reach either. Nothing is pushed to it. There is no webhook, no subscription and no polling, so this connector cannot notice by itself that something changed in Mailgun. An agent has to ask. Toolspoke does not retry, queue or back off around Mailgun's own rate limits. A call that Mailgun refuses comes back to the agent as a failed call.
Can I limit which actions an agent can call?
Yes, in two places. The project switches Mailgun's actions on and off one at a time, for everyone in the project at once, and the screen groups them by read, write and destructive so turning off everything that deletes is one click. An individual agent key can then be narrowed further, to particular toolkits in a project and to particular actions in a toolkit. Whatever it was granted, a key never reaches a project its owner cannot.
What gets recorded when an agent calls Mailgun?
Every attempt, with the agent that made it and the person that agent belongs to, the full request payload, the response payload, the status, the duration, and what the call cost in sandbox time and model tokens. Values whose key names a secret are masked out before the record is shown to anyone. An operation the connector marks as not retained never has its response body written at all, so the gateway keeps no second copy of what was read.