> Documentation index: https://metorial.com/llms.txt. Every page is available as Markdown by adding .md to its URL.

# Set up Mailgun in Metorial for Claude, ChatGPT and Cursor
URL: https://metorial.com/docs/integrations/mailgun
Last updated: 2026-11-24

Share Mailgun with your team in Claude, ChatGPT and Cursor through Metorial: API key sign-in, 49 tools (22 read-only).

---

To give your team Mailgun in Claude, ChatGPT, Cursor and other AI clients, an admin shares the Mailgun integration in a Metorial portal, and each person connects with an API key. Agents can send, receive, and track transactional and marketing emails via Mailgun. The integration has 49 tools, 22 read-only, 18 write and 9 destructive, plus 1 trigger.

**What you will learn**

- How an admin shares Mailgun in a portal and how each person connects
- What Mailgun asks for when you connect, and where to find it
- How to keep the 22 read-only tools and reject the other 27

**Before you start**

- A [portal](https://metorial.com/docs/platform/workforce/portals) with at least one access group
- An API key from Mailgun for each person, or one for a shared connection
- For the CLI steps: the [Metorial CLI](https://metorial.com/docs/platform/cli), signed in to your portal

## Sign-in method

| Method | Type | What a person provides |
| --- | --- | --- |
| **API Key** | API token | `apiKey` |

### API Key

To connect, a person enters:

- `apiKey`: Your Mailgun API key (Account API Key or Domain Sending Key)

### Setup settings

Setup also asks for:

- `region` (optional): Mailgun region where your domain is registered. US or EU. One of "us", "eu".

## Admin: share Mailgun in a portal

### In the dashboard

1. **Open Shared Resources**

   Open **Workforce**, choose the portal, and select **Shared Resources** under **Access**.

2. **Share a new integration**

   Select **Share a Resource**, then **New Integration**, and choose Mailgun. For how members connect, choose **Each person connects** so everyone enters their own API key, or **Shared connection** to enter one API key for everyone.

3. **Limit the tools**

   Under **Tool Filters**, set the write and destructive groups to **Reject** if agents should only read from Mailgun.

4. **Choose who gets it**

   Add the access groups that should see Mailgun. When a person asks for access from the portal, the request appears under **Access Requests**.

### With the CLI

The CLI cannot create the per-user Mailgun integration. Once it exists, check which groups have it:

```bash
metorial-admin portals access list <portal-id> --type provider_template --search mailgun
```

## Employee: connect Mailgun

### In the portal

1. **Open Mailgun in the catalog**

   Sign in to your portal and open Mailgun. The status reads **Available**.

2. **Authenticate**

   Under **Quick setup**, select **Authenticate**. In the setup window, enter your API key (apiKey).

3. **Confirm**

   The status changes to **Configured**. If it later reads **Needs reconnect**, select **Reconnect** and sign in again.

### With the CLI

```bash
metorial catalog search mailgun
metorial setup <catalog-item-id>
```

`catalog search` prints the catalog item ID. 

### Add it to your AI client

`metorial install` adds your Mailgun connection to a local MCP client such as Claude Code, Cursor or Codex. `metorial list` prints the integration ID and `metorial client list` the client identifiers.

```bash
metorial list mailgun
metorial client list
metorial install <client-identifier> <integration-id>
```

For a client that takes a server URL, such as ChatGPT, `metorial install custom <integration-id>` creates an installation token and shows the endpoint details.

## Make it read-only

Open the integration's **Tool Filters** and set the write and destructive groups to **Reject**. Agents keep the 22 read-only tools, such as `get_stats` and `get_domain`, and lose the 18 write tools, such as `send_email` or `create_route`, and the 9 destructive tools, such as `delete_route` or `delete_domain`.

Employees see the result on the integration's page in the portal under **Tool access**. For the full walkthrough, see [Tool permissions](https://metorial.com/docs/platform/guides/tool-permissions).

## Check it worked

```bash
metorial list mailgun
metorial tools <integration-id>
metorial call <integration-id> list_routes -d '{}'
```

`metorial tools` lists the 49 tools, minus any you rejected. `list_routes` takes no input. It lists all inbound email routes.

To see every input a tool takes, run `metorial schema <integration-id> <tool-key>`.

## Tools

### Read-only tools (22)

- `get_events`: Query Mailgun's legacy Events API for a domain. Needs `domain`.
- `list_mailing_lists`: List all mailing lists in the account.
- `list_mailing_list_members`: List members of a mailing list. Needs `listAddress`.
- `get_template`: Get a specific email template with its active version content. Needs `domain` and `templateName`.
- `list_suppressions`: List suppressed email addresses for a domain. Needs `domain` and `type`.
- `validate_email`: Validate an email address in real-time using Mailgun's Email Validation API. Needs `address`.
- `get_stats`: Get email sending statistics from Mailgun's legacy Stats API for a domain. Needs `domain` and `events`.
- `get_domain`: Get detailed information about a specific domain including DNS records and verification status. Needs `domainName`.
- `list_webhooks`: List all configured webhooks for a domain. Needs `domain`.
- `list_templates`: List all email templates for a domain. Needs `domain`.
- `list_domains`: List all sending domains in the Mailgun account.
- `list_routes`: List all inbound email routes.
- `get_domain_tracking`: Get the current tracking settings for a domain. Needs `domainName`.
- `get_stored_message`: Retrieve a message stored by Mailgun from a storage key found in events, logs, or inbound route store actions. Needs `domain` and `storageKey`.
- `get_mailing_list`: Get one Mailgun mailing list by address, including access level, reply preference, and member count. Needs `listAddress`.
- `list_template_versions`: List versions for a domain-level Mailgun template. Needs `domain` and `templateName`.
- `list_allowlist`: List Mailgun allowlist entries for a domain. Needs `domain`.
- `query_metrics`: Query Mailgun's current Metrics API for account or domain analytics.
- `get_template_version`: Get a specific version of a domain-level Mailgun template, including its content and active status. Needs `domain`, `templateName` and `tag`.
- `get_webhook`: Get configured webhook URLs for one Mailgun domain event type. Needs `domain` and `eventType`.
- `get_mailing_list_member`: Get a specific member from a Mailgun mailing list, including subscription status and custom variables. Needs `listAddress` and `memberAddress`.
- `query_logs`: Query Mailgun's current Logs API for account event logs.

### Write tools (18)

- `add_suppression`: Add an email address to a suppression list (bounce, complaint, or unsubscribe). Needs `domain`, `type` and `address`.
- `update_mailing_list`: Update an existing mailing list's properties including name, description, access level, and reply preference. Needs `listAddress`.
- `verify_domain`: Trigger DNS verification for a domain. Needs `domainName`.
- `create_webhook`: Create a webhook for a specific event type on a domain. Needs `domain`, `eventType` and `url`.
- `update_domain_tracking`: Update tracking settings for a domain. Needs `domainName`, `trackingType` and `active`.
- `create_domain`: Create a new sending domain in Mailgun. Needs `name`.
- `create_mailing_list`: Create a new mailing list. Needs `address`.
- `add_mailing_list_member`: Add a new member to a mailing list or update an existing member using the upsert option. Needs `listAddress` and `memberAddress`.
- `create_template_version`: Create a new version of an existing template. Needs `domain`, `templateName`, `content` and `tag`.
- `update_route`: Update an existing inbound email route's expression, actions, priority, or description. Needs `routeId`.
- `send_email`: Send an email through Mailgun. Needs `domain`, `from` and `to`.
- `create_route`: Create a new inbound email route. Needs `expression` and `actions`.
- `create_template`: Create a new email template for a domain. Needs `domain` and `name`.
- `update_template`: Update a domain-level Mailgun template's metadata. Needs `domain` and `templateName`.
- `add_allowlist_entry`: Add an email address or domain to Mailgun's allowlist for a domain. Needs `domain`, `entryType` and `value`.
- `update_template_version`: Update a domain-level Mailgun template version's content, comment, or active status. Needs `domain`, `templateName` and `tag`.
- `update_webhook`: Replace the webhook URL list for a Mailgun domain event type with a new URL. Needs `domain`, `eventType` and `url`.
- `update_mailing_list_member`: Update a Mailgun mailing list member's display name, custom variables, or subscription status. Needs `listAddress` and `memberAddress`.

### Destructive tools (9)

- `delete_domain`: Delete a sending domain from Mailgun. Needs `domainName`.
- `remove_mailing_list_member`: Remove a member from a mailing list. Needs `listAddress` and `memberAddress`.
- `delete_webhook`: Delete a webhook for a specific event type on a domain. Needs `domain` and `eventType`.
- `remove_suppression`: Remove an email address from a suppression list (bounce, complaint, or unsubscribe). Needs `domain`, `type` and `address`.
- `delete_template`: Delete an email template and all its versions permanently. Needs `domain` and `templateName`.
- `delete_mailing_list`: Delete a mailing list and all its members permanently. Needs `listAddress`.
- `delete_route`: Delete an inbound email route permanently. Needs `routeId`.
- `delete_template_version`: Delete a specific version from a Mailgun domain-level template. Needs `domain`, `templateName` and `tag`.
- `remove_allowlist_entry`: Remove an email address or domain from Mailgun's allowlist for a domain. Needs `domain` and `value`.

## Triggers

Mailgun has 1 trigger, which fire on events in Mailgun:

- `email_events`: Triggers when email events occur such as delivery, opens, clicks, bounces, complaints, and unsubscribes.

## Next steps

- [Claude Code](https://metorial.com/docs/platform/clients/claude-code), [Cursor](https://metorial.com/docs/platform/clients/cursor), [Codex](https://metorial.com/docs/platform/clients/codex) and [ChatGPT](https://metorial.com/docs/platform/clients/chatgpt): connect each client to your portal and use Mailgun there
- [Tool permissions](https://metorial.com/docs/platform/guides/tool-permissions): tool filters and what employees see
- [Mailgun on metorial.com](https://metorial.com/integrations/mailgun): the integration overview