Gmail IMAP MCP Server logo

Gmail IMAP MCP Server

by tonykipkemboi

A Model Context Protocol (MCP) server for Gmail integration using IMAP. This server allows AI assistants to interact with Gmail accounts, providing functionality to read, search, and manage emails.

View on GitHub

Last updated: N/A

What is Gmail IMAP MCP Server?

The Gmail IMAP MCP server is a tool that enables AI assistants to interact with Gmail accounts using the IMAP protocol and the Model Context Protocol (MCP). It provides a set of tools for reading, searching, sending, and managing emails, as well as managing labels and attachments.

How to use Gmail IMAP MCP Server?

To use the server, you need to install it from source, set up a Google Cloud Project with the Gmail API enabled, and authenticate your Gmail account using OAuth2. Once the server is running, AI assistants can interact with it using the provided tools via MCP, such as authenticate-gmail, search-emails, send-email, etc.

Key features of Gmail IMAP MCP Server

  • OAuth2 authentication with Gmail

  • Read emails from Gmail accounts

  • Search emails with advanced query options

  • Send emails with attachments

  • Manage labels (create, delete, list)

  • Move emails between labels

  • Download attachments

  • Mark emails as read/unread

  • Support for multiple Gmail accounts

  • Integration with AI assistants through MCP

Use cases of Gmail IMAP MCP Server

  • Email Triage: Assisting users in prioritizing and managing unread emails.

  • Email Search and Organization: Finding specific emails and organizing them into labels.

  • Email Composition: Drafting and sending emails based on user instructions.

  • Integration with AI assistants to automate email-related tasks.

FAQ from Gmail IMAP MCP Server

How do I authenticate my Gmail account?

Use the authenticate-gmail tool with your email address and follow the OAuth2 authentication flow in your browser.

Where are my OAuth2 credentials stored?

OAuth2 credentials are stored in the user's home directory at ~/.gmail_imap_mcp_credentials/.

What is the format of the email ID?

The email ID format is email://message/{account}_{mailbox}_{id}.

How do I connect this server to Claude Desktop?

Add the Gmail IMAP MCP server configuration to Claude Desktop's MCP Configuration settings, specifying the server URL and available tools.

What should I do if I have authentication issues?

Ensure your client_secret.json is correctly placed, the Gmail API is enabled, and try re-authenticating if your token has expired. Also, check for read-only file system errors in the credentials directory.