Skip to content

Gmail inbox analytics via MCP: fetch, search, and summarize email metrics in Node.js.

Notifications You must be signed in to change notification settings

winitramesh2/email-analyzer

Repository files navigation

Email Analyzer with Gmail MCP Integration

A Node.js application that connects to your Gmail account via MCP (Model Context Protocol) and analyzes your emails.

Features

  • Connect to Gmail via MCP
  • Fetch recent emails
  • Search emails with custom queries
  • Analyze email metrics:
    • Total emails
    • Unread count
    • Important emails
    • Emails with attachments
    • Top senders
    • Label distribution

Setup

  1. Install dependencies:

    npm install
  2. Your Gmail credentials are already configured in .env file.

  3. Run the analyzer:

    npm start

Usage

Run the analyzer

npm start

This will:

  1. Connect to Gmail via MCP
  2. Fetch your 50 most recent emails
  3. Analyze and display metrics
  4. Search for unread emails

Customize the analysis

Edit index.js to customize:

  • Number of emails to fetch
  • Search queries
  • Analysis parameters

Available Gmail MCP Tools

The Gmail MCP server provides these tools:

  • gmail_list_messages - List recent messages
  • gmail_get_message - Get a specific message by ID
  • gmail_search_messages - Search messages with Gmail query syntax
  • gmail_send_message - Send an email
  • gmail_create_draft - Create a draft email

File Structure

  • index.js - Main entry point
  • email-analyzer.js - Email analysis logic
  • gmail-client.js - Gmail MCP client wrapper
  • gmail-mcp-config.json - MCP server configuration
  • .env - Environment variables (credentials)

Security Note

The .env file contains your OAuth credentials. Keep it secure and never commit it to version control.

About

Gmail inbox analytics via MCP: fetch, search, and summarize email metrics in Node.js.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published