Mailgun

A local MCP server enabling MCP-compatible clients to access Mailgun features for sending, managing domains, and analytics.
  • typescript

42

GitHub Stars

typescript

Language

6 months ago

First Indexed

2 months ago

Catalog Refreshed

Documentation & install

Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.

Installation

Add the following to your MCP client configuration file.

Configuration

View docs

You can run a local Mailgun MCP Server that exposes Mailgun’s email service features through MCP-compatible clients. This lets you perform tasks like sending emails, managing domains, handling webhooks, and analyzing performance directly from AI-assisted workflows while your data stays on your machine.

How to use

You interact with the Mailgun MCP Server by configuring your MCP client to connect to the local server using the provided command and environment variables. The server exposes a range of capabilities that you can invoke from your MCP client, including messaging, domain management, webhooks, routing, mailing lists, templates, analytics, and more. Use well-structured prompts to perform specific actions such as sending emails, checking deliverability, creating or updating templates, and retrieving statistics. Ensure your AI prompts request only the operations you intend to perform and review tool-call confirmations before actions that modify data.

How to install

Prerequisites you need before starting:

  • Node.js (v18 or higher)

Install and run the MCP server configuration locally by using your MCP client setup. The following configuration snippet shows how to enable the Mailgun MCP Server and pass your API key and region to the server via environment variables.

{
  "mcpServers": {
    "mailgun": {
      "command": "npx",
      "args": ["-y", "@mailgun/mcp-server"],
      "env": {
        "MAILGUN_API_KEY": "YOUR-mailgun-api-key",
        "MAILGUN_API_REGION": "us"
      }
    }
  }
}

Step-by-step commands to set up and run from a typical project root (adjust paths as needed):

git clone https://github.com/mailgun/mailgun-mcp-server.git
cd mailgun-mcp-server
npm install

Note: If you need to run the server from your MCP client configuration instead of a standalone CLI, you can replace the npx command with the explicit runtime command and script path used by your environment (as shown in the development notes).

Additional sections

Configuration and environment variables you will use with the server are documented here. The key environment variables required to access Mailgun are described below so you can provide them securely to the MCP server.

Environment variables shown in the configuration snippet are treated as sensitive data. They are passed to the MCP server process and are not exposed to AI models. Use a dedicated Mailgun API key scoped to the operations you need.

Security and usage notes to keep in mind: run the server locally with TLS for outbound requests to Mailgun. The MCP server implements API-key isolation and limits exposure to the AI by keeping keys in environment variables only.

Sample prompts and workflows

Create practical prompts to perform common tasks, such as sending an email, retrieving statistics, or managing templates. Ensure you specify the domain, recipient, subject, and body as needed, and validate results against Mailgun’s responses.

Development

To run from source, you can follow the development steps, clone the repository, install dependencies, and run tests. If you are integrating with an MCP client, you can point the client at the local runtime as shown in the setup steps.

Troubleshooting and debugging

If you encounter issues, use the MCP debugging guidance to diagnose connectivity between your client and the local server. Check that your API key and region are correctly configured and that the server process has permission to access the environment variables.

Notes

This MCP server operates locally on your machine. No data leaves the host except to communicate with Mailgun over HTTPS. Ensure you comply with rate limits and provide the minimum required permissions on your API key.

Available tools

send_email

Send an email using a specified domain, recipient, subject, and body.

retrieve_messages

Fetch stored messages for a given mailbox or domain.

resend_message

Resend a previously sent or stored message.

view_domain_details

View details for a domain including DNS configuration and tracking settings.

verify_dns

Verify DNS configuration for a domain to ensure deliverability.

manage_tracking

Enable or disable tracking for clicks and opens on domains.

list_webhooks

List webhooks configured for Mailgun events.

create_webhook

Create a new event webhook with a target URL.

update_webhook

Update an existing webhook configuration.

delete_webhook

Remove a webhook from the account.

view_routes

View inbound email routing rules.

update_routes

Update inbound email routing rules.

create_mailing_list

Create a mailing list and add members.

manage_mailing_list

Manage mailing list members and settings.

create_template

Create an email template with versioning support.

update_template

Update an existing email template.

version_template

Access template version history.

query_metrics

Query sending metrics and usage metrics.

query_logs

Retrieve delivery logs and activity.

view_stats

View aggregate statistics by domain, tag, provider, device, and country.

view_suppressions

View bounces, unsubscribes, complaints, and allowlist entries.

view_ips

View IP assignments and IP pool configurations.

classify_bounce

Analyze bounce types and delivery issues.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational