How it works
Connect Mailtrap to GitHub Copilot and send transactional or test emails, inspect sandbox inboxes and messages, and manage templates – all via simple prompts. No coding required, just tell the agent what you need, and GitHub Copilot will execute the API call.

Configuration
Step 1: Run GitHub Copilot in your preferred code editor
Step 2: Navigate to settings.json.
Step 3: Paste the following configuration:
{
"mcpServers": {
"mailtrap": {
"command": "npx",
"args": ["-y", "mcp-mailtrap"],
"env": {
"MAILTRAP_API_TOKEN": "your_mailtrap_api_token",
"DEFAULT_FROM_EMAIL": "your_sender@example.com",
"MAILTRAP_ACCOUNT_ID": "your_account_id",
"MAILTRAP_TEST_INBOX_ID": "your_test_inbox_id"
}
}
}
}
Step 4: Replace the placeholder values with your actual Mailtrap credentials.
Step 5: Open the Copilot Chat panel, select Agent mode, and confirm the Mailtrap MCP server appears in the tool list.
Note: DEFAULT_FROM_EMAIL must be an address on a domain you’ve already verified in Mailtrap’s Sending Domains. You can find MAILTRAP_ACCOUNT_ID under Settings → Account Settings, and MAILTRAP_TEST_INBOX_ID in your sandbox inbox URL.
For detailed guidance, including the quick install link and step-by-step credential retrieval, consult the knowledge base article.
Use cases
- Integrate Mailtrap into your project or migrate from another solution.
- Send transactional emails to single or multiple recipients (with CC/BCC).
- Send sandbox emails for safe testing without affecting production.
- Retrieve and search the sandbox inbox messages.
- Create, list, update, and delete email templates.
Supported functionality
- Send transactional emails
- Manage email templates
- Use Email Sandbox for testing
- Track delivery statistics (opens, clicks, bounces)
- Manage sending streams