# Mailgun MCP

> Mailgun MCP lets you manage your entire transactional email infrastructure directly from your AI client. Use this to send secure, high-priority emails while simultaneously monitoring domain health, auditing delivery failures, and cleaning up bounce lists. It gives you full visibility into every part of your email sending workflow.

## Overview
- **Category:** ship-it
- **Price:** Free
- **Tags:** transactional-email, email-infrastructure, delivery-logs, domain-health, suppression-management, smtp-api

## Description

Managing reliable email delivery is a headache that usually involves jumping between dashboards, checking DNS records in one tab, and reviewing logs in another. This MCP changes that. You connect it to any AI client through Vinkius and gain natural conversational control over everything Mailgun handles.

You can tell your agent exactly what you need: send an order confirmation email using a specific verified domain; check if a target address is valid *before* sending anything; or audit your DNS records (SPF, DKIM) to prove deliverability. Need to know why emails are failing? You can query raw event logs detailing every bounce and drop. Plus, you get tools to manage the suppression list, letting you selectively delete old bounces so you can re-send campaigns safely. This gives developers and ops teams immediate, actionable data about their email systems.

## Tools

### list_bounces
Checks the bounce logs for a domain to detect inactive or invalid email addresses in your audience.

### delete_bounce
Removes a specific bounced email address from the suppression list, allowing you to try sending to it again.

### get_domain
Retrieves detailed DNS records and configuration information for any configured Mailgun domain.

### get_stats
Pulls analytics and performance statistics, like open rates and click-through rates, for a specified domain.

### get_templates
Lists all stored HTML Handlebars templates that are associated with your Mailgun domains.

### list_domains
Shows a complete list of every domain name currently configured on the Mailgun account.

### list_logs
Lists raw event logs, including details on deliveries, opens, drops, and bounces for a given domain.

### list_unsubscribes
Retrieves a list of email addresses that have opted out or unsubscribed from your mailing lists.

### send_email
Sends a high-priority transactional or marketing email directly using Mailgun's secure sending capabilities.

### validate_email
Performs an immediate check on an email address to confirm if it is valid and deliverable via the Mailgun API.

## Prompt Examples

**Prompt:** 
```
Send a transactional email to 'user@example.com' from 'support@mg.domain.com' with subject 'Order Confirmed'
```

**Response:** 
```
Dispatching email… I've successfully sent the message to 'user@example.com' via the 'mg.domain.com' domain. The Message ID is '202603271234.abc@mg.domain.com'. Would you like me to monitor the event logs for delivery status?
```

**Prompt:** 
```
Check the DNS health for domain 'mg.mycompany.com'
```

**Response:** 
```
Retrieving domain details… For 'mg.mycompany.com', SPF and DKIM records are verified and active. However, the MX records are currently marked as 'Unverified'. You may need to update your DNS settings to receive replies. Would you like the exact MX values to add?
```

**Prompt:** 
```
List all bounced emails for 'mg.mycompany.com' from the last hour
```

**Response:** 
```
Retrieving bounce logs… I've identified 3 bounced addresses: 'old-user@gmail.com' (5.1.1 User unknown), 'invalid-addr@yahoo.com', and 'full-mailbox@outlook.com'. Would you like me to remove 'full-mailbox@outlook.com' from the suppression list so you can try again?
```

## Capabilities

### Validate Email Addresses
Checks if an email address is actually deliverable or if it's a typo before you try sending anything.

### Send Transactional Emails
Dispatches high-priority, custom emails using verified domains and specific text bodies right from your agent.

### Audit Domain Records
Retrieves detailed DNS records for your domain, confirming things like SPF, DKIM, and MX status to ensure mail gets through.

### View Delivery Logs
Pulls raw event logs showing every delivery attempt, open, drop, or bounce that happened across your accounts.

### Manage Bounces and Unsubscribes
Lists out failed emails, unsubscribes, and complaints, giving you the ability to manually remove specific bounces from the suppression list.

## Use Cases

### Post-Incident Investigation
A DevOps engineer notices an email send failure. Instead of digging through multiple tabs, they ask the agent to run 'list_logs' for the specific domain and narrow down the timeframe. The agent immediately presents a chronological list showing exactly where the delivery failed.

### Pre-Send Validation
A developer needs to send an account verification email but isn't sure if the recipient address is correct. They ask the agent to 'validate_email'. The response confirms deliverability, preventing a broken workflow and saving time.

### Domain Health Audit
Before launching a major campaign, a growth engineer needs proof of domain validity. They prompt the agent using 'get_domain', which instantly pulls all required DNS records to confirm SPF/DKIM compliance.

### Cleaning Up Bounces
The marketing team finds an old bounce address that might be valid now. Rather than manually logging into the dashboard, they ask the agent to 'list_bounces' and then use 'delete_bounce' on the specific record.

## Benefits

- Never manually check DNS records again. Use 'get_domain' to instantly verify SPF, DKIM, and MX settings right within your conversation with the agent.
- Eliminate guesswork about failed emails. By calling 'list_bounces', you get immediate access to who bounced so you can clean up bad data sets.
- Speed up campaign analysis by asking for domain metrics. The 'get_stats' tool pulls open rates and click-through data without opening a single dashboard tab.
- Improve compliance and save time with suppression lists. Use 'list_unsubscribes' or 'delete_bounce' to manage who can receive emails, ensuring you follow best practices.
- Test email sends safely before launch. You can use 'validate_email' on any address to confirm it works *before* running a full campaign via 'send_email'.

## How It Works

The bottom line is you talk to your agent, and the MCP handles all the complex API calls behind the scenes.

1. Subscribe to this MCP and provide your private Mailgun API key.
2. Your AI client connects using that key, authenticating access to your email infrastructure.
3. You ask the agent a natural language question—like 'What's the status of our domain records?' or 'Send an alert email.'—and it executes the required action.

## Frequently Asked Questions

**How does Mailgun MCP help with bounce rates?**
It helps by providing the 'list_bounces' tool, which shows you exactly who bounced. You can then use 'delete_bounce' to selectively remove those addresses from the suppression list if they are good to receive mail again.

**Can I check my domain status before sending an email?**
Yes, always run 'get_domain' first. This confirms your SPF and DKIM records are set up correctly before you use the 'send_email' tool to prevent bounces.

**What is the difference between list_logs and get_stats?**
While 'get_stats' gives high-level performance numbers like open rates, 'list_logs' provides raw, chronological data. Use logs if you need to investigate a specific failure or anomaly.

**Does Mailgun MCP cover unsubscribed users?**
Yes, it has the 'list_unsubscribes' tool. This lets you audit who explicitly opted out so your agent can keep those contacts separate from active mailing lists.