Set up Mailgun in Metorial for Claude, ChatGPT and Cursor
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'll 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 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, 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
Open Shared Resources
Open Workforce, choose the portal, and select Shared Resources under Access.
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.
Limit the tools
Under Tool Filters, set the write and destructive groups to Reject if agents should only read from Mailgun.
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:
Employee: connect Mailgun
In the portal
Open Mailgun in the catalog
Sign in to your portal and open Mailgun. The status reads Available.
Authenticate
Under Quick setup, select Authenticate. In the setup window, enter your API key (apiKey).
Confirm
The status changes to Configured. If it later reads Needs reconnect, select Reconnect and sign in again.
With the CLI
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.
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.
Check it worked
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. Needsdomain.list_mailing_lists: List all mailing lists in the account.list_mailing_list_members: List members of a mailing list. NeedslistAddress.get_template: Get a specific email template with its active version content. NeedsdomainandtemplateName.list_suppressions: List suppressed email addresses for a domain. Needsdomainandtype.validate_email: Validate an email address in real-time using Mailgun's Email Validation API. Needsaddress.get_stats: Get email sending statistics from Mailgun's legacy Stats API for a domain. Needsdomainandevents.get_domain: Get detailed information about a specific domain including DNS records and verification status. NeedsdomainName.list_webhooks: List all configured webhooks for a domain. Needsdomain.list_templates: List all email templates for a domain. Needsdomain.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. NeedsdomainName.get_stored_message: Retrieve a message stored by Mailgun from a storage key found in events, logs, or inbound route store actions. NeedsdomainandstorageKey.get_mailing_list: Get one Mailgun mailing list by address, including access level, reply preference, and member count. NeedslistAddress.list_template_versions: List versions for a domain-level Mailgun template. NeedsdomainandtemplateName.list_allowlist: List Mailgun allowlist entries for a domain. Needsdomain.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. Needsdomain,templateNameandtag.get_webhook: Get configured webhook URLs for one Mailgun domain event type. NeedsdomainandeventType.get_mailing_list_member: Get a specific member from a Mailgun mailing list, including subscription status and custom variables. NeedslistAddressandmemberAddress.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). Needsdomain,typeandaddress.update_mailing_list: Update an existing mailing list's properties including name, description, access level, and reply preference. NeedslistAddress.verify_domain: Trigger DNS verification for a domain. NeedsdomainName.create_webhook: Create a webhook for a specific event type on a domain. Needsdomain,eventTypeandurl.update_domain_tracking: Update tracking settings for a domain. NeedsdomainName,trackingTypeandactive.create_domain: Create a new sending domain in Mailgun. Needsname.create_mailing_list: Create a new mailing list. Needsaddress.add_mailing_list_member: Add a new member to a mailing list or update an existing member using the upsert option. NeedslistAddressandmemberAddress.create_template_version: Create a new version of an existing template. Needsdomain,templateName,contentandtag.update_route: Update an existing inbound email route's expression, actions, priority, or description. NeedsrouteId.send_email: Send an email through Mailgun. Needsdomain,fromandto.create_route: Create a new inbound email route. Needsexpressionandactions.create_template: Create a new email template for a domain. Needsdomainandname.update_template: Update a domain-level Mailgun template's metadata. NeedsdomainandtemplateName.add_allowlist_entry: Add an email address or domain to Mailgun's allowlist for a domain. Needsdomain,entryTypeandvalue.update_template_version: Update a domain-level Mailgun template version's content, comment, or active status. Needsdomain,templateNameandtag.update_webhook: Replace the webhook URL list for a Mailgun domain event type with a new URL. Needsdomain,eventTypeandurl.update_mailing_list_member: Update a Mailgun mailing list member's display name, custom variables, or subscription status. NeedslistAddressandmemberAddress.
Destructive tools (9)
delete_domain: Delete a sending domain from Mailgun. NeedsdomainName.remove_mailing_list_member: Remove a member from a mailing list. NeedslistAddressandmemberAddress.delete_webhook: Delete a webhook for a specific event type on a domain. NeedsdomainandeventType.remove_suppression: Remove an email address from a suppression list (bounce, complaint, or unsubscribe). Needsdomain,typeandaddress.delete_template: Delete an email template and all its versions permanently. NeedsdomainandtemplateName.delete_mailing_list: Delete a mailing list and all its members permanently. NeedslistAddress.delete_route: Delete an inbound email route permanently. NeedsrouteId.delete_template_version: Delete a specific version from a Mailgun domain-level template. Needsdomain,templateNameandtag.remove_allowlist_entry: Remove an email address or domain from Mailgun's allowlist for a domain. Needsdomainandvalue.
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, Cursor, Codex and ChatGPT: connect each client to your portal and use Mailgun there
- Tool permissions: tool filters and what employees see
- Mailgun on metorial.com: the integration overview