How it works
Adding mcp-mailtrap to your OpenCode config gives the agent access to Mailtrap’s Email API to send transactional emails, manage templates, check delivery logs, review sending stats, and configure sending domains. Describe what you need in plain language; the agent resolves the right Mailtrap tool and executes the call after you confirm.

Configuration
Step 1: Install Node.js (mcp-mailtrap runs as a Node.js CLI utility).
Step 2: Add the following to opencode.json in your project root (or ~/.config/opencode/opencode.json for global access):
{
"mcp": {
"mailtrap": {
"type": "local",
"command": ["npx", "-y", "mcp-mailtrap"],
"environment": {
"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"
},
"enabled": true
}
}
}
Step 3: Replace the placeholder values with your Mailtrap credentials (API token, verified sender address, account ID, and test inbox ID).
Step 4: Launch opencode in your project directory; the Mailtrap MCP server starts automatically and its tools become available to the agent.
For detailed guidance, consult the knowledge base article.
Use cases
- Check delivery logs mid-debugging.
- Generate and send email content in one step.
- Manage templates without leaving the CLI.
- Send transactional emails while building features.
Supported functionality
- Send emails via Email API
- Manage email templates
- View email delivery logs with filtering and pagination.
- Track sending statistics across date ranges with breakdowns
- Manage sending domains