gmail-send
Enables AI agents to send emails via Gmail using App Password authentication with Markdown content support.
README
Gmail Send Skill - MCP Server
๐ AI-Powered Email Sending Skill with Model Context Protocol (MCP) support
Send emails via Gmail using App Password authentication with Markdown content support, specifically designed for AI agents and MCP-compatible applications.
โจ Features
๐ง Core Email Functionality
- Gmail SMTP Integration - Send emails through Gmail's secure SMTP server (Port 587, TLS)
- App Password Authentication - Secure authentication using Gmail App Passwords
- Rich Error Reporting - Detailed success/failure feedback with error types
- Input Validation - Comprehensive email and parameter validation
๐ Enhanced Markdown Support (v1.1.0+)
- Advanced Markdown Conversion - Full markdown library support with extensions (BSD license)
- Professional Email Styling - Email-safe CSS with responsive design
- Graceful Fallback System - Basic Markdown converter when external library unavailable
- Commercial License Compliance - BSD-licensed dependencies for commercial use
- Email Client Compatibility - Optimized HTML for major email clients
๐ค AI Integration
- MCP Compatible - Full Model Context Protocol support for AI agents
- OpenAI Function Calling - Compatible with OpenAI Function Calling standard
- Skill Framework - Standalone and integrated execution modes
๐ Quick Start
1. Installation
# Clone the repository
git clone <repository-url>
cd mcp-server-gmail-send
# Run automated installation
chmod +x install.sh
./install.sh
2. Gmail Setup
- Enable 2-Factor Authentication in your Gmail account
- Generate App Password:
- Go to Google Account โ Security โ 2-Step Verification โ App Passwords
- Select "Mail" and generate password
- Save the 16-character password (e.g.,
abcd efgh ijkl mnop)
3. Claude Desktop Integration
# Copy configuration to Claude Desktop
cp claude_desktop_config.json ~/Library/Application\ Support/Claude/claude_desktop_config.json
# Restart Claude Desktop
4. Test the Setup
# Test the MCP server
python3 mcp_server.py --test
# Run comprehensive tests
python3 test_gmail_skill.py
๐ง Usage Example
Enhanced Markdown to HTML Conversion (v1.1.0+)
The skill now supports advanced Markdown conversion with professional email styling:
Supported Markdown Features
- Headers (H1-H6) with proper hierarchy
- Text Formatting - Bold, italic, strikethrough
- Lists - Ordered and unordered with nesting
- Links - Automatic link formatting
- Code Blocks - Syntax highlighting and inline code
- Blockquotes - Professional quote styling
- Tables - Responsive table design (with markdown library)
Email Styling Features
- ๐ฑ Responsive Design - Adapts to desktop and mobile email clients
- ๐จ Professional CSS - Clean, modern email appearance
- ๐ง Email Client Compatibility - Works with Gmail, Outlook, Apple Mail, etc.
- ๐ง Graceful Fallback - Basic conversion when advanced features unavailable
Markdown Content Example
# Project Status Report
## Executive Summary
The project is **on track** with key milestones achieved:
### Completed Tasks โ
1. User authentication system
2. Database schema design
3. API endpoints implementation
### In Progress ๐ง
- Front-end development
- Integration testing
- Performance optimization
> **Note**: All deliverables are meeting quality standards.
For technical details, see: [Project Documentation](https://example.com/docs)
```python
def get_project_status():
return "Active"
This Markdown will be converted to professional HTML email format automatically.
### Basic Email Sending
```python
from gmail_send_skill import GmailSendSkill
from skill_compat import ExecutionContext
# Initialize
skill = GmailSendSkill()
ctx = ExecutionContext()
# Send email
result = skill.execute(ctx,
username="your.email@gmail.com",
app_password="abcd efgh ijkl mnop",
content="# Hello World!\n\nThis is a **test** email with *markdown*.",
to_email="recipient@example.com",
subject="Test Email from Skill"
)
print(f"Success: {result['success']}")
Via AI Agent (Claude Desktop)
Simply ask Claude:
Can you send an email using the gmail_send function? I need to send:
- From: my.email@gmail.com
- To: colleague@company.com
- Subject: Project Update
- Content: A markdown report about our progress
I'll provide my app password when prompted.
๐ Function Schema
OpenAI Function Calling Format
{
"name": "gmail_send",
"description": "Send email via Gmail using App Password authentication with Markdown support",
"parameters": {
"type": "object",
"properties": {
"username": {
"type": "string",
"description": "Gmail address for authentication"
},
"app_password": {
"type": "string",
"description": "16-character Gmail App Password"
},
"content": {
"type": "string",
"description": "Email content in Markdown format"
},
"to_email": {
"type": "string",
"description": "Recipient email address"
},
"subject": {
"type": "string",
"description": "Email subject line",
"default": "Email from Gmail Send Skill"
},
"from_name": {
"type": "string",
"description": "Display name for sender",
"default": null
}
},
"required": ["username", "app_password", "content", "to_email"]
}
}
๐ Project Structure
mcp-server-gmail-send/
โโโ ๐ gmail_send_skill.py # Main skill implementation
โโโ ๐ง skill_compat.py # Framework compatibility layer
โโโ ๐ฅ๏ธ mcp_server.py # MCP server with stdio transport
โโโ ๐ version.py # Version management
โโโ ๐งช test_gmail_skill.py # Comprehensive test suite
โโโ โ๏ธ mcp_config.json # MCP client configuration
โโโ ๐ claude_desktop_config.json # Claude Desktop integration
โโโ ๐ฆ requirements.txt # Python dependencies
โโโ ๐ ๏ธ install.sh # Automated installation script
โโโ ๐ GMAIL_SEND_USAGE.md # Detailed usage guide
โโโ ๐ MCP_DEPLOYMENT.md # MCP deployment instructions
โโโ ๐ README.md # This file
๐ง Configuration
MCP Server Configuration
Update paths in mcp_config.json:
{
"mcpServers": {
"gmail-send": {
"command": "python",
"args": ["/absolute/path/to/mcp_server.py"],
"env": {
"PYTHONPATH": "/absolute/path/to/project"
}
}
}
}
Claude Desktop Configuration
Update claude_desktop_config.json with your installation path and copy to:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Linux:
~/.config/claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json
๐งช Testing
Automated Testing
# Run all tests
python3 test_gmail_skill.py
# Test specific components
python3 test_gmail_skill.py --test TestGmailSendSkill
# Verbose output
python3 test_gmail_skill.py --verbose
Manual Testing
# Test skill directly
python3 gmail_send_skill.py
# Test MCP server
python3 mcp_server.py --test
# Check version and info
python3 version.py --info
โ๏ธ Technical Details
Dependencies and Licensing
Core Dependencies (Built-in Python)
smtplib- SMTP email sendingemail.mime- Email compositionssl- TLS encryptionjson- Configuration handlingre- Regular expressions for fallback conversion
Optional Enhancement (Commercial-Friendly)
- markdown library (BSD 3-Clause License)
- โ Commercial use allowed
- โ Distribution allowed
- โ Modification allowed
- ๐ง Graceful fallback when unavailable
System Requirements
- Python 3.7+ (tested up to 3.12)
- Internet connection for Gmail SMTP
- Gmail account with 2FA enabled
Architecture
Gmail Send Skill Architecture
โโโ gmail_send_skill.py # Core skill implementation
โโโ skill_compat.py # Framework compatibility layer
โโโ mcp_server.py # MCP Protocol server
โโโ version.py # Version management
HTML Conversion Pipeline:
Markdown Content โ Advanced/Basic Converter โ CSS Styling โ Email HTML
Conversion System Details
Advanced Mode (with markdown library)
- Full CommonMark specification support
- Extensions: tables, strikethrough, task lists
- Professional syntax highlighting
- Advanced table rendering
Fallback Mode (built-in)
- Regex-based Markdown parsing
- Core element support (headers, lists, formatting)
- Email-safe HTML generation
- Professional CSS styling maintained
๐ Documentation
- ๐ Usage Guide - Comprehensive usage instructions and examples
- ๐ MCP Deployment - Complete MCP integration guide
- ๐ง Installation Script - Automated setup and configuration
- ๐งช Test Suite - Comprehensive testing framework
๐ Security
Best Practices
- โ Use App Passwords - Never use regular Gmail passwords
- โ Enable 2FA - Required for App Password generation
- โ Secure Storage - Never commit credentials to version control
- โ Input Validation - All parameters are validated before use
- โ Error Handling - Sensitive information is not exposed in errors
Supported Authentication
- Gmail App Passwords (recommended)
- G Suite/Workspace accounts with App Passwords
- 2-Factor Authentication required
๐ Response Format
Success Response
{
"success": true,
"function_name": "gmail_send",
"result": {
"message": "Email sent successfully to recipient@example.com",
"timestamp": "2026-02-14T10:30:00",
"from": "sender@gmail.com",
"to": "recipient@example.com",
"subject": "Email Subject"
}
}
Error Response
{
"success": false,
"function_name": "gmail_send",
"error": {
"message": "Authentication failed. Please check your credentials.",
"type": "authentication_error",
"details": "SMTP Authentication Error: (535, 'Incorrect password')"
}
}
๐ Version Information
Current Version: 1.0.0 (2026-02-14)
# Check version
python3 version.py --version
# Full version info
python3 version.py --info
# View changelog
python3 version.py --changelog
๐ ๏ธ Requirements
System Requirements
- Python 3.7+ (required)
- Internet connection for SMTP access
- Gmail account with 2FA enabled
Dependencies
- Built-in Python libraries:
smtplib,email,json,logging - Optional:
markdown>=3.4.0(for rich formatting)
Compatibility
- โ MCP Protocol 2024-11-05
- โ OpenAI Function Calling compatible
- โ Claude Desktop integration
- โ Cross-platform (macOS, Linux, Windows)
๐ Troubleshooting
Common Issues
Authentication Errors
# Verify App Password format (16 characters)
# Check 2FA is enabled
# Generate new App Password
Module Import Errors
# Check Python path
export PYTHONPATH=/path/to/mcp-server-gmail-send
# Verify file permissions
chmod 644 gmail_send_skill.py
MCP Connection Issues
# Test MCP server
python3 mcp_server.py --test
# Check Claude Desktop logs
tail -f ~/Library/Logs/Claude/claude-desktop.log
Support Resources
- ๐ Usage Guide - Detailed troubleshooting
- ๐ง Deployment Guide - MCP-specific issues
- ๐งช Test Suite -
python3 test_gmail_skill.py - ๐ Logs - Check
gmail_send_mcp.log
๐ค Contributing
- Fork the repository
- Create feature branch:
git checkout -b feature/amazing-feature - Commit changes:
git commit -m 'Add amazing feature' - Push to branch:
git push origin feature/amazing-feature - Open Pull Request
Development Setup
# Clone for development
git clone <repository-url>
cd mcp-server-gmail-send
# Install development dependencies
pip3 install -r requirements.txt
pip3 install pytest pytest-asyncio # For testing
# Run tests
python3 test_gmail_skill.py
# Check code style
python3 -m flake8 gmail_send_skill.py
๏ฟฝ Version History
v1.1.0 (2024-12-19) - Enhanced Markdown Support
- โจ Advanced Markdown Conversion - Full markdown library support with extensions
- ๐จ Professional Email Styling - Responsive CSS for email clients
- ๐ง Graceful Fallback System - Basic converter when external library unavailable
- โ๏ธ Commercial License Compliance - BSD-licensed dependencies
- ๐ง Email Client Optimization - Improved compatibility across platforms
- ๐งช Enhanced Testing - Comprehensive conversion and styling tests
v1.0.0 (2024-12-19) - Initial Release
- ๐ง Gmail SMTP Integration - Secure email sending via Gmail
- ๐ App Password Authentication - Secure credential handling
- ๐ค MCP Protocol Support - Full Model Context Protocol implementation
- ๐ Basic Markdown Support - Simple markdown to HTML conversion
- โ Comprehensive Testing - 18 unit tests with edge case coverage
- ๐ ๏ธ Local Development Tools - Configuration templates and testing utilities
๏ฟฝ๐ License
This project is licensed under the terms specified in the LICENSE file.
Third-Party License Compliance
- markdown library (Optional) - BSD 3-Clause License - Commercial use allowed
- Python Standard Library - Python Software Foundation License
๐ Acknowledgments
- Model Context Protocol - For the standardized AI agent integration
- OpenAI Function Calling - For the function schema standard
- Gmail SMTP - For reliable email delivery infrastructure
- Python Community - For the excellent libraries and tools
- Markdown Community - For the BSD-licensed markdown processing library
Built for AI-Powered Applications ๐ค | MCP Compatible ๐ | Production Ready ๐
Gmail Send Skill v1.1.0 - Enhanced Markdown conversion with professional email styling Send mail through gmail.
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.