Email Sending Skill
Send and manage emails via Gmail MCP server built with FastMCP.
MCP Server Setup
Start Email MCP Server
# Start with stdio transport (for Claude Code integration)
uv run python mcp-servers/email/server.py
# Or start with HTTP transport
uv run python mcp-servers/email/server.py --transport http --port 8801
Configure Claude Code MCP
Add to your Claude Code MCP configuration:
{
"mcpServers": {
"email": {
"command": "uv",
"args": ["run", "python", "mcp-servers/email/server.py"]
}
}
}
Gmail API Setup
- Go to Google Cloud Console
- Create a new project
- Enable Gmail API
- Create OAuth 2.0 credentials
- Download
credentials.json - Place in
~/.gmail_watcher/credentials.json - First run will auto-generate token
Tools
send_email
Send an email via Gmail.
uv run python scripts/mcp-client.py call -t send_email -p '{
"to": "client@example.com",
"subject": "Invoice #123",
"body": "Please find attached your invoice...",
"html": false
}'
Parameters:
to(required): Recipient email addresssubject(required): Email subjectbody(required): Email body contentfrom_email(optional): Sender emailcc(optional): CC recipients (comma-separated)bcc(optional): BCC recipients (comma-separated)html(optional): Whether body is HTML (default: false)
draft_email
Create a draft email in Gmail (does not send).
uv run python scripts/mcp-client.py call -t draft_email -p '{
"to": "client@example.com",
"subject": "Proposal for Project",
"body": "Dear Client, Here is the proposal..."
}'
search_emails
Search emails in Gmail.
# Find unread emails
uv run python scripts/mcp-client.py call -t search_emails -p '{
"query": "is:unread",
"max_results": 10
}'
# Find emails from specific sender
uv run python scripts/mcp-client.py call -t search_emails -p '{
"query": "from:client@example.com",
"max_results": 5
}'
Parameters:
query(required): Gmail search querymax_results(optional): Maximum results (default: 10)
get_email_content
Get full content of a specific email.
uv run python scripts/mcp-client.py call -t get_email_content -p '{
"message_id": "123abc"
}'
mark_as_read
Mark an email as read.
uv run python scripts/mcp-client.py call -t mark_as_read -p '{
"message_id": "123abc"
}'
Workflow: Reply to Client Email
- Search for unread emails
- Get email content
- Draft reply (requires approval)
- On approval, send email
Workflow: Send Invoice
- Create invoice PDF
- Draft email with attachment
- Create approval file in
/Pending_Approval/ - On approval (file moved to
/Approved/), send email
Environment Variables
# Gmail credentials
GMAIL_CREDENTIALS_PATH=~/.gmail_watcher/credentials.json
GMAIL_TOKEN_PATH=~/.gmail_watcher/token.json
# Dry run mode
DRY_RUN=true # Set to 'false' for production
Troubleshooting
| Issue | Solution |
|---|---|
| Authentication failed | Re-run server to trigger OAuth flow |
| Credentials not found | Download from Google Cloud Console |
| Email not sending | Check DRY_RUN environment variable |
| API quota exceeded | Wait and retry, or increase quota |
Related Skills
- linkedin-posting - Social media posting
- whatsapp-monitoring - WhatsApp message monitoring