FINCH285/SendGrid-MCP-Server
If you are the rightful owner of SendGrid-MCP-Server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
A production-ready Model Context Protocol (MCP) Server for SendGrid email services, built with FastMCP 2.0.
SendGrid MCP Server
A production-ready Model Context Protocol (MCP) Server for SendGrid email services, built with FastMCP 2.0. This server enables AI models like Claude, GPT, and others to send emails, manage contacts, and interact with SendGrid's powerful email platform.
š Features
- š§ Email Management: Send HTML/text emails with templates and attachments
- š„ Contact Management: Add contacts and manage mailing lists
- š Secure Authentication: Bearer token authentication with fallback support
- ā” Rate Limiting: Built-in API rate limiting to prevent abuse
- š”ļø Production Ready: Comprehensive error handling and logging
- š§ Easy Configuration: Environment-based configuration management
š Requirements
- Python 3.8+
- SendGrid API Key
- FastMCP 2.0
š ļø Installation
-
Clone the repository:
git clone https://github.com/FINCH285/SendGrid-MCP-Server.git cd SendGrid-MCP-Server
-
Install dependencies:
pip install -r requirements.txt
-
Set up environment variables:
cp .env.example .env
Edit
.env
with your SendGrid configuration:SENDGRID_API_KEY=your_sendgrid_api_key_here DEFAULT_FROM_EMAIL=your-verified-email@example.com DEFAULT_FROM_NAME=Your Name DEFAULT_TEMPLATE_ID=your-template-id RATE_LIMIT=10 DEBUG=false
š Usage
Running the Server
python main.py
The server will start and listen for MCP connections via STDIO.
Available Tools
Email Tools
send_email
- Send HTML/text emails to multiple recipientsget_template_info
- Fetch SendGrid template detailssend_template_email
- Send emails using dynamic templates
Contact Tools
add_contact
- Add/update contacts with custom fieldsget_contact_lists
- Retrieve all contact lists
š§ Configuration
Authentication
The server supports two authentication methods:
- Environment Variable: Set
SENDGRID_API_KEY
in your.env
file - Bearer Token: Pass API key via Authorization header in MCP requests
š SendGrid Configuration example
{
"mcpServers": {
"sendgrid-mcp": {
"command": "python",
"args": ["/path/to/your/project/main.py"],
"cwd": "/path/to/your/project",
"disabled": false,
"env": {
"SENDGRID_API_KEY": "SG.your-actual-api-key-here"
}
}
}
}
For Windows users, use paths like:
"args": ["C:\\Users\\YourUsername\\project-folder\\main.py"]
"cwd": "C:\\Users\\YourUsername\\project-folder"
For macOS/Linux users, use paths like:
"args": ["/Users/yourusername/project-folder/main.py"]
"cwd": "/Users/yourusername/project-folder"
Key configuration elements:
-
"sendgrid-mcp": The server name/identifier (customizable)
-
args: Specifies the path to your main.py file
-
cwd: Sets the working directory to your project folder
-
disabled: Set to false to enable the server
-
env: Contains your SendGrid API key (replace with your actual key starting with "SG.")
šļø Architecture
āāāāāāāāāāāāāāāāāāā āāāāāāāāāāāāāāāāāāā āāāāāāāāāāāāāāāāāāā
ā AI Model āāāāāŗā FastMCP āāāāāŗā SendGrid ā
ā (Claude/GPT) ā ā Server ā ā API ā
āāāāāāāāāāāāāāāāāāā āāāāāāāāāāāāāāāāāāā āāāāāāāāāāāāāāāāāāā
ā ā ā
ā MCP Protocol ā HTTP/REST ā
ā¼ ā¼ ā¼
āāāāāāāāāāāāāāāāāāā āāāāāāāāāāāāāāāāāāā āāāāāāāāāāāāāāāāāāā
ā Tools Layer ā ā Auth Layer ā ā Config Layer ā
ā ⢠email_tools ā ā ⢠Bearer Token ā ā ⢠Environment ā
ā ⢠contact_tools ā ā ⢠API Key Auth ā ā ⢠Rate Limits ā
āāāāāāāāāāāāāāāāāāā āāāāāāāāāāāāāāāāāāā āāāāāāāāāāāāāāāāāāā
š¤ Contributing
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
š License
This project is licensed under the MIT License - see the file for details.
š Support
- Issues: GitHub Issues
- SendGrid Documentation: SendGrid API Docs
- FastMCP Documentation: FastMCP Docs