Gemini Email Subject Generator MCP
An MCP server that utilizes Google's Gemini Flash 2 model to generate AI-driven email subjects and detailed reasoning processes. It enables users to send emails via SMTP with dynamic content and save complex brainstorming sessions to local files.
README
Gemini Email Subject Generator MCP
A powerful Model Context Protocol (MCP) server that leverages Google's Gemini Flash 2 AI model to generate engaging email subjects and detailed thinking processes. This tool integrates seamlessly with Claude Desktop to provide intelligent email subject generation and advanced content creation.
š Features
1. Email Tool with AI Subject Generation (send-email)
- Sends emails with AI-generated subjects using Gemini Flash 2
- Features:
- Dynamic subject generation based on provided prompt
- Support for HTML and plain text email content
- Image attachments with inline display capability
- Secure authentication using environment variables
- Error handling and status reporting
- Fully customizable content with rich formatting options
- Instant delivery with message tracking
2. Thinking Generation Tool (generate-thinking)
- Generates detailed thinking process text using Gemini's Flash 2 model
- Supports complex reasoning and analysis
- Saves responses with timestamps
- Customizable output directory
- Ideal for brainstorming, planning, and content creation
š Quick Start
Prerequisites
- Node.js (v16 or higher)
- TypeScript
- Claude Desktop
- Google Gemini API Key
- SMTP Email Account (for email functionality)
Installation
- Clone and setup:
git clone [your-repo-url]
cd gemini-email-subject-generator
npm install
- Create
.envfile:
GEMINI_API_KEY=your_api_key_here
NODEMAILER_EMAIL=your.email@gmail.com
NODEMAILER_PASSWORD=your_app_password_here
- Build the project:
npm run build
Claude Desktop Configuration
- Create/Edit
%AppData%/Claude/claude_desktop_config.json:
{
"mcpServers": {
"Gemini Email Generator": {
"command": "node",
"args": ["path/to/gemini-email-subject-generator/dist/index.js"],
"cwd": "path/to/gemini-email-subject-generator",
"env": {
"GEMINI_API_KEY": "your_api_key_here",
"NODEMAILER_EMAIL": "your.email@gmail.com",
"NODEMAILER_PASSWORD": "your_app_password_here"
}
}
}
}
- Restart Claude Desktop
š Using the Tools
Email Sending with AI Subject Generation
{
"name": "send-email",
"arguments": {
"to": "recipient@example.com",
"subjectPrompt": "Create a catchy subject line for a marketing email about our new AI-powered analytics platform",
"text": "Hello! This is the plain text version of our email.",
"html": "<h1>Hello!</h1><p>This is the <b>HTML</b> version of our email with an inline image: <img src='cid:image0'/></p>",
"images": [
{
"name": "chart.png",
"data": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA..."
}
]
}
}
Important Note About Email Tool: When you use the
send-emailtool, Claude will display a confirmation message that the email was sent successfully. This confirmation message is NOT the content of the email - it's just feedback to you that the operation succeeded. The actual email sent to the recipient will contain only the content you specified in thetextandhtmlfields, with the subject generated by Gemini based on your prompt.
Thinking Generation
{
"name": "generate-thinking",
"arguments": {
"prompt": "Your complex analysis prompt here",
"outputDir": "./custom_output"
}
}
š Output Structure
output/
āāā thinking/
āāā gemini_thinking_[timestamp].txt
š ļø Development
Available Scripts
npm run build: Compile TypeScript to JavaScriptnpm run start: Start the MCP servernpm run dev: Run in development mode with ts-node
Environment Variables
GEMINI_API_KEY: Your Google Gemini API keyNODEMAILER_EMAIL: Your email address for sending emailsNODEMAILER_PASSWORD: Your email app password (for Gmail, use an app password)
š Security Notes
- Store your API keys securely
- Don't share your
.envfile - For Gmail, use app passwords instead of your main account password
- Be careful with the content of emails sent through the system
- Never include sensitive or personal information in email examples
š Troubleshooting
Common Issues
-
API Key Error
- Verify
.envfile exists - Check API key validity
- Ensure proper environment loading
- Verify
-
Claude Desktop Connection
- Verify config.json syntax
- Check file paths in config
- Restart Claude Desktop
-
Email Sending Issues
- Check that NODEMAILER_EMAIL and NODEMAILER_PASSWORD are set correctly
- For Gmail, ensure you've created an app password
- Verify that less secure app access is enabled for non-Gmail providers
- Check recipient email address format
- Ensure image data is properly formatted as data URI (data:image/type;base64,)
Debug Mode
Add DEBUG=true to your .env file for verbose logging:
GEMINI_API_KEY=your_key_here
DEBUG=true
š API Reference
Email Sending Tool
interface SendEmailParams {
to: string; // Recipient email address
subjectPrompt: string; // Prompt for generating email subject
text: string; // Plain text version of email
html?: string; // HTML version of email (optional)
images?: { // Optional images to attach
name: string; // Image filename
data: string; // Base64 encoded image data
}[];
}
Thinking Generation Tool
interface GenerateThinkingParams {
prompt: string; // Analysis prompt
outputDir?: string; // Optional output directory
}
š¤ Contributing
- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
š License
MIT License - See LICENSE file for details
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.