Skip to main content
Glama
falahgs

Gemini Email Subject Generator MCP

by falahgs

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

Related MCP server: Gmail AutoAuth MCP Server

πŸš€ 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

Available Tools

2 tools
generate-thinkingC

Generate detailed thinking process text using Gemini Flash 2 model

ParametersJSON Schema
NameRequiredDescriptionDefault
promptYesPrompt for generating thinking process text
outputDirNoDirectory to save output responses (optional)

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. It mentions the specific model being used but doesn't describe important behavioral aspects like rate limits, authentication requirements, response format, error conditions, or whether this is a read-only or mutating operation. The description is minimal and lacks crucial operational context.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise - a single sentence that gets straight to the point without unnecessary words. However, this brevity comes at the cost of completeness. While structurally efficient, it may be too minimal for a tool that likely has important behavioral characteristics that should be disclosed.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a text generation tool with no annotations and no output schema, the description is insufficiently complete. It doesn't explain what the tool returns, how the 'thinking process' output is structured, what limitations exist, or what happens when outputDir is specified. The agent would need to guess about important operational aspects of this tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already fully documents both parameters. The description adds no additional parameter information beyond what's in the schema - it doesn't explain what constitutes appropriate 'thinking process' prompts, provide examples, or clarify the output directory usage. Baseline 3 is appropriate when schema does all the parameter documentation work.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('generate') and resource ('detailed thinking process text') with specific model information ('using Gemini Flash 2 model'). It distinguishes from the sibling 'send-email' tool by focusing on text generation rather than communication. However, it doesn't fully differentiate what makes this 'thinking process' generation unique versus other text generation tools that might exist.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. There's no mention of appropriate use cases, prerequisites, or comparisons to other text generation methods. The sibling tool 'send-email' is completely unrelated, so no comparative guidance is offered.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

send-emailC

Send an email with AI-generated subject using Gemini Flash 2

ParametersJSON Schema
NameRequiredDescriptionDefault
toYesRecipient email address
subjectPromptYesPrompt for Gemini to generate email subject
textYesPlain text version of the email
htmlNoHTML version of the email (optional)
imagesNoImages to attach to the email (optional)

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions AI subject generation but lacks critical details: whether this is a read-only or mutating operation (implied mutation from 'send'), authentication requirements, rate limits, error handling, or what happens upon success/failure. This is inadequate for a tool that likely performs external communication.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with zero wasted words. It front-loads the core purpose and key feature without unnecessary elaboration, making it easy to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with 5 parameters, no annotations, and no output schema, the description is insufficient. It lacks behavioral context (e.g., side effects, permissions), doesn't explain the relationship with the sibling tool, and provides minimal guidance on usage. The AI subject generation is noted but not elaborated, leaving gaps in understanding the tool's full scope.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema fully documents all parameters. The description adds minimal value beyond the schemaβ€”it implies 'subjectPrompt' is used for AI generation but doesn't explain how this interacts with other parameters or provide usage examples. Baseline 3 is appropriate as the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Send an email') and specifies a key feature ('with AI-generated subject using Gemini Flash 2'), which distinguishes it from generic email tools. However, it doesn't explicitly differentiate from the sibling tool 'generate-thinking', which might be related but has an unclear relationship.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives, prerequisites, or constraints. It mentions AI-generated subjects but doesn't specify scenarios where this is beneficial or when manual subjects might be preferred. No exclusions or sibling tool comparisons are included.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 2 tool updatesv1.0.0
    • First observedgenerate-thinking
    • First observedsend-email

TDQS

B3/5.0

Scored across 2 tools

Disambiguation5/5

The two tools have completely distinct purposes: one generates thinking process text, while the other sends emails with AI-generated subjects. There is no overlap or ambiguity between these functions, making it impossible for an agent to confuse them.

Naming Consistency4/5

Both tools use a verb-object naming pattern (generate-thinking, send-email), which is consistent and readable. The minor deviation is the hyphenation style, but this is uniform across both tools, so it does not cause confusion.

Tool Count2/5

With only 2 tools, the server feels thin for its stated purpose of email subject generation. It lacks essential operations like retrieving email history, managing templates, or handling errors, which limits its utility and scope.

Completeness2/5

The server is severely incomplete for email subject generation. It provides no way to list, update, or delete generated content, and lacks supporting tools for email management (e.g., checking sent emails, setting recipients). This creates significant gaps that will hinder agent workflows.

Maintenance

ActivityInactive
ResponsivenessNo issues

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    An MCP server that provides AI applications with a toolset for an Artificial Virtual Assistant (AVA) integrated with the Gmail API. It enables users to automate email management and personal tasks through secure Google OAuth authentication.
    1
    Apache 2.0
  • A
    license
    Not graded
    quality
    D
    maintenance
    An MCP server enabling AI assistants to manage Gmail through natural language, including sending, reading, searching, labeling, and handling attachments with auto authentication.
    1
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    A high-performance MCP server that enables AI assistants to interact with Gmail securely via OAuth 2.0, supporting smart email retrieval and thread-aware drafting.
    1
    MIT
  • A
    license
    A
    quality
    D
    maintenance
    An MCP server providing comprehensive email capabilities via IMAP and SMTP, enabling AI assistants to read, search, send, manage, schedule, and analyze emails across multiple accounts.
    49
    906
    107
    LGPL 3.0