email-analyzer
Gmail inbox analytics via MCP: fetch, search, and summarize email metrics in Node.js.
claude mcp add --transport stdio winitramesh2-email-analyzer node index.js \ --env GMAIL_CLIENT_ID="OAuth client ID from Google Cloud Console" \ --env GMAIL_REDIRECT_URI="OAuth redirect URI (if applicable)" \ --env GMAIL_CLIENT_SECRET="OAuth client secret from Google Cloud Console" \ --env GMAIL_REFRESH_TOKEN="OAuth refresh token for the Gmail account"
How to use
This MCP server is a Node.js application that connects to your Gmail account via the Model Context Protocol (MCP) to fetch and analyze your emails. It exposes a set of Gmail MCP tools that let you list messages, retrieve specific messages, search with Gmail query syntax, send messages, and create drafts. The analyzer computes metrics such as total emails, unread count, important emails, attachments, top senders, and label distribution. To use it, ensure the server is running (the app reads credentials from a .env file). Once started, you can invoke the available MCP tools through your MCP client to perform tasks like listing recent messages, performing searches, or analyzing your mailbox according to the configured parameters. You can customize how many emails to fetch and which search queries to apply by editing the main index.js and the configuration in gmail-mcp-config.json.
How to install
Prerequisites:
- Node.js (recommended LTS) and npm installed
- Git (optional, for cloning the repository)
Steps:
-
Install dependencies
- npm install
-
Configure credentials
- Create or populate the .env file with your Gmail OAuth credentials (client ID, client secret, refresh token, etc.).
- Example environment values to include: GMAIL_CLIENT_ID=your-client-id GMAIL_CLIENT_SECRET=your-client-secret GMAIL_REFRESH_TOKEN=your-refresh-token GMAIL_REDIRECT_URI=your-redirect-uri
-
Start the server
- npm start
-
Verify it's running
- Access the MCP endpoint provided by your environment (check console output for the running port and endpoint).
If you need to run the server directly without npm start, you can run:
- node index.js
Additional notes
Tips and common issues:
- The server reads Gmail OAuth credentials from the .env file; ensure this file is secure and not committed to version control.
- The default analysis fetches a set number of recent emails (as configured in index.js). Update the fetch limit to suit your needs.
- Available tools under Gmail MCP include:
- 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
- If you modify index.js or related config, restart the server for changes to take effect.
- Ensure the Gmail API scope includes read access for listing and reading messages if you intend to fetch data.
- Check logs for authentication errors and ensure the OAuth token is valid or refreshed as needed.
Related MCP Servers
pluggedin-app
The Crossroads for AI Data Exchanges. A unified, self-hostable web interface for discovering, configuring, and managing Model Context Protocol (MCP) servers—bringing together AI tools, workspaces, prompts, and logs from multiple MCP sources (Claude, Cursor, etc.) under one roof.
grumpydev
Let the grumpy senior dev review your code with this MCP server
mcp-agent
Lightweight, focused utilities to manage connections and execute MCP tools with minimal integration effort. Use it to directly call tools or build simple agents within your current architecture.
puppeteer
Self-hosted Puppeteer MCP server with remote SSE access, API key authentication, and Docker deployment. Complete tool suite for browser automation via Model Context Protocol.
MCP-Client -Project-using-NodeJS
A minimal Model Context Protocol (MCP) implementation built with Node.js and TypeScript. This project demonstrates client–server communication over stdio, structured message handling, and local data access, developed with VS Code and GitHub Copilot to explore modern AI tool integration workflows.
Email MCP server with full IMAP + SMTP support — read, search, send, manage, and organize email from any AI assistant via the Model Context Protocol