🚀 Model Context Protocol (MCP) server with SendGrid API integration
This project is an MCP server that enables AI assistants (Claude, ChatGPT, etc.) to send emails, manage templates, and track statistics using the SendGrid's API v3.
- Single Email Sending: Send emails in plain text or HTML format
- Batch Email Sending: Send emails to multiple recipients simultaneously
- Template-based Emails: Send dynamic emails using pre-built templates
- Scheduled Emails: Schedule emails to be sent at a future date and time
- Template Listing: View existing email templates
- Template Creation: Create new dynamic email templates
- Email Statistics: View email statistics for specific date ranges
- Detailed Reports: Get daily, weekly, or monthly reports
git clone https://github.com/recepyavuz0/sendgrid-mcp-server.git
cd sendgrid-mcp-server
npm install
Create a .env
file in the project root directory:
SENDGRID_API_KEY=your_sendgrid_api_key_here
FROM_EMAIL=your_verified_sender_email@domain.com
Important Notes:
SENDGRID_API_KEY
: API key obtained from your SendGrid accountFROM_EMAIL
: Verified sender email address in SendGrid
npm run build
npm start
The MCP server works over stdin/stdout. You can use it with various clients:
To use the MCP server in Cursor:
- Go to Cursor Settings > Extensions > MCP section
- Add a new MCP server:
{
"mcpServers": {
"sendgrid-api-mcp-server": {
"command": "npx",
"args": ["-y", "sendgrid-api-mcp-server"],
"env": {
"SENDGRID_API_KEY": "your_api_key",
"FROM_EMAIL": "your_email@domain.com"
}
}
}
}
- Restart Cursor
- Now you can send emails in Chat:
Example Usage:
"Send a project meeting reminder to john@example.com"
"Send an HTML welcome message to user@test.com"
For usage in Claude Desktop application:
- Edit your Claude configuration file (
~/.claude_desktop_config.json
):
{
"mcpServers": {
"sendgrid-api-mcp-server": {
"command": "npx",
"args": ["-y", "sendgrid-api-mcp-server"],
"env": {
"SENDGRID_API_KEY": "your_api_key",
"FROM_EMAIL": "your_email@domain.com"
}
}
}
}
- Restart Claude Desktop
- Give email commands directly in chat
This MCP server is compatible with the following clients since it uses the standard MCP protocol:
- Zed Editor
- VS Code MCP Extension
- Continue.dev
- Custom MCP clients
Similar configuration structure is used for each client.
Basic email sending functionality.
Parameters:
to
: Recipient email addresssubject
: Email subjecttext
: Email texthtml
: HTML format (optional)
Example Usage:
"Send a meeting reminder to ali@example.com: 'We'll meet tomorrow at 2:00 PM.'"
Send dynamic emails using pre-built templates.
Parameters:
to
: Recipient email addresssubject
: Email subjecttemplateId
: SendGrid template IDdynamicData
: Template variables
Example Usage:
"Send email to user@test.com using template d-123456789 with data: {name: 'John', company: 'ABC Corp'}"
Send emails to multiple recipients simultaneously.
Parameters:
toList
: List of recipient email addressessubject
: Email subjecttext
: Email texthtml
: HTML format (optional)
Example Usage:
"Send new feature announcement to john@test.com, jane@test.com, bob@test.com"
View existing email templates.
Example Usage:
"List existing email templates"
Get email statistics for a specific date range.
Parameters:
start_date
: Start date (YYYY-MM-DD)end_date
: End date (YYYY-MM-DD)aggregated_by
: Grouping (day/week/month)
Example Usage:
"Show email statistics for January 2024"
Schedule an email to be sent at a future date.
Parameters:
to
: Recipient email addresssubject
: Email subjecttext
: Email textsend_at
: Unix timestamp (seconds)html
: HTML format (optional)
Example Usage:
"Schedule a meeting reminder to user@test.com for tomorrow at 10:00 AM"
Create a new dynamic email template.
Parameters:
name
: Template namesubject
: Email subject templatehtml_body
: HTML content (with {{variable}} format)plain_body
: Plain text content
Example Usage:
"Create a welcome-email template with {{name}} and {{company}} variables"
AI: "Send an invoice reminder to customer@company.com"
AI: "Send monthly newsletter to all customers using template d-123456789"
AI: "Send new policy announcement to team@company.com, sales@company.com, support@company.com"
AI: "Generate this month's email performance report"
AI: "Schedule weekly meeting reminder to entire team for Monday 9:00 AM"