Provides email sending capabilities and allows fetching and visualizing email delivery statistics from the Mailgun service.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Mailgun MCP Serversend a welcome email to newuser@example.com with our onboarding template"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Mailgun MCP Server
Overview
A Model Context Protocol (MCP) server for Mailgun, enabling MCP-compatible AI clients to interact with the Mailgun email service.
Note: This MCP server runs locally on your machine. Mailgun does not currently offer a hosted version of this server.
Capabilities
Messaging — Send emails, retrieve stored messages, resend messages
Domains — View domain details, verify DNS configuration, manage tracking settings (click, open, unsubscribe)
Webhooks — List, create, update, and delete event webhooks
Routes — View and update inbound email routing rules
Mailing Lists — Create and manage mailing lists and their members
Templates — Create and manage email templates with versioning
Analytics — Query sending metrics, usage metrics, and logs
Stats — View aggregate statistics by domain, tag, provider, device, and country
Suppressions — View bounces, unsubscribes, complaints, and allowlist entries
IPs & IP Pools — View IP assignments and dedicated IP pool configuration
Bounce Classification — Analyze bounce types and delivery issues
Related MCP server: Enhanced Gmail MCP Server
Prerequisites
Node.js (v18 or higher)
Mailgun account and API key
Quick Start
Configuration
Add the following to your MCP client configuration:
Environment Variables
Variable | Required | Default | Description |
| Yes | — | Your Mailgun API key |
| No |
| API region: |
Client-Specific Config Paths
Claude Desktop (macOS):
~/Library/Application Support/Claude/claude_desktop_config.jsonClaude Desktop (Windows):
%APPDATA%/Claude/claude_desktop_config.jsonClaude Code: Run
claude mcp addor edit~/.claude.json
Sample Prompts
Send an Email
Note: some MCP clients require a paid plan to invoke tools that send data. If sending fails silently, check your client's plan.
Fetch and Visualize Sending Statistics
Manage Templates
Investigate Deliverability
Troubleshoot DNS
Review Suppressions
Manage Routing Rules
Create a Mailing List
Compare Domains
Engagement by Region
Review Tracking Settings
Development
To run from source, clone the repository and use node directly:
In your MCP client config, replace the npx command with:
Security Considerations
API key isolation
Your Mailgun API key is passed as an environment variable and is never exposed to the AI model itself — it is only used by the MCP server process to authenticate requests. The server does not log API keys, request parameters, or response data.
Local execution
The server runs locally on your machine. All communication with the Mailgun API is over HTTPS with TLS certificate validation enforced. No data is sent to third-party services beyond the Mailgun API.
API key permissions
Use a dedicated Mailgun API key with permissions scoped to only the operations you need. The server exposes read and update operations but does not expose any delete operations, which limits the blast radius of unintended actions.
Rate limiting
The server does not implement client-side rate limiting. Each tool call from the AI translates directly into a Mailgun API request. The server relies on Mailgun's server-side rate limits to prevent abuse — requests that exceed those limits will return an error to the AI assistant.
Prompt injection
As with any MCP server, a crafted or adversarial prompt could trick the AI assistant into calling operations you did not intend — for example, modifying tracking settings or reading mailing list members. Review your AI assistant's tool-call confirmations before approving actions, especially in untrusted prompt contexts.
Webhook URLs
Webhook create and update operations accept arbitrary URLs provided through the AI assistant. The MCP server passes these URLs to the Mailgun API without additional validation. Mailgun is responsible for validating webhook destinations. Ensure your AI assistant does not set webhook URLs to unintended internal or sensitive addresses.
Input validation
All tool parameters are validated against the Mailgun OpenAPI specification using Zod schemas. However, validation depends on the accuracy of the OpenAPI spec, and some edge-case parameters may fall back to permissive validation. The Mailgun API performs its own server-side validation as an additional layer of protection.
Debugging
The MCP server communicates over stdio. Refer to the MCP Debugging Guide for troubleshooting.
License
Apache 2.0 — see LICENSE for details.
Contributing
We welcome contributions! Please feel free to submit a Pull Request or open an Issue.