Gemini Email Subject Generator MCP

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.

Category
访问服务器

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

  1. Clone and setup:
git clone [your-repo-url]
cd gemini-email-subject-generator
npm install
  1. Create .env file:
GEMINI_API_KEY=your_api_key_here
NODEMAILER_EMAIL=your.email@gmail.com
NODEMAILER_PASSWORD=your_app_password_here
  1. Build the project:
npm run build

Claude Desktop Configuration

  1. 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"
      }
    }
  }
}
  1. 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-email tool, 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 the text and html fields, 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 JavaScript
  • npm run start: Start the MCP server
  • npm run dev: Run in development mode with ts-node

Environment Variables

  • GEMINI_API_KEY: Your Google Gemini API key
  • NODEMAILER_EMAIL: Your email address for sending emails
  • NODEMAILER_PASSWORD: Your email app password (for Gmail, use an app password)

🔒 Security Notes

  • Store your API keys securely
  • Don't share your .env file
  • 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

  1. API Key Error

    • Verify .env file exists
    • Check API key validity
    • Ensure proper environment loading
  2. Claude Desktop Connection

    • Verify config.json syntax
    • Check file paths in config
    • Restart Claude Desktop
  3. 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

  1. Fork the repository
  2. Create your feature branch
  3. Commit your changes
  4. Push to the branch
  5. Create a Pull Request

📄 License

MIT License - See LICENSE file for details

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选