A Node.js application that connects to your Gmail account via MCP (Model Context Protocol) and analyzes your emails.
- 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
-
Install dependencies:
npm install
-
Your Gmail credentials are already configured in
.envfile. -
Run the analyzer:
npm start
npm startThis will:
- Connect to Gmail via MCP
- Fetch your 50 most recent emails
- Analyze and display metrics
- Search for unread emails
Edit index.js to customize:
- Number of emails to fetch
- Search queries
- Analysis parameters
The Gmail MCP server provides these tools:
gmail_list_messages- List recent messagesgmail_get_message- Get a specific message by IDgmail_search_messages- Search messages with Gmail query syntaxgmail_send_message- Send an emailgmail_create_draft- Create a draft email
index.js- Main entry pointemail-analyzer.js- Email analysis logicgmail-client.js- Gmail MCP client wrappergmail-mcp-config.json- MCP server configuration.env- Environment variables (credentials)
The .env file contains your OAuth credentials. Keep it secure and never commit it to version control.