MCP Gmail Server logo

MCP Gmail Server

by jeremyjordan

An MCP server that provides Gmail access for LLMs, powered by the MCP Python SDK. It exposes Gmail messages as MCP resources and provides tools for composing, sending, and managing emails.

View on GitHub

Last updated: N/A

What is MCP Gmail Server?

The MCP Gmail Server is a Model Context Protocol (MCP) server that allows Large Language Models (LLMs) to access and interact with Gmail accounts. It leverages the MCP Python SDK to expose Gmail messages as MCP resources, enabling LLMs to read, compose, send, and manage emails.

How to use MCP Gmail Server?

To use the server, you need to configure a Google Cloud project, enable the Gmail API, set up OAuth 2.0 credentials, and install the necessary dependencies. You can then run the server in development mode or install it for use with Claude Desktop. After the server is running, you can connect to it using any MCP client or via Claude Desktop.

Key features of MCP Gmail Server

  • Expose Gmail messages as MCP resources

  • Provide tools for composing, sending, and managing emails

  • OAuth 2.0 authentication with Google's Gmail API

  • Search and query emails

  • Manage email labels

Use cases of MCP Gmail Server

  • Allow LLMs to read and summarize email content.

  • Enable LLMs to compose and send emails based on user instructions.

  • Automate email management tasks using LLMs.

  • Integrate Gmail functionality into LLM-powered applications.

FAQ from MCP Gmail Server

What is MCP?

MCP stands for Model Context Protocol, a protocol for connecting LLMs to external resources and tools.

What are the prerequisites for running the server?

You need Python 3.10+, a Gmail account with API access, and uv for Python package management.

How do I configure Gmail OAuth credentials?

You need to create a Google Cloud project, enable the Gmail API, configure the OAuth consent screen, create OAuth credentials, and add the necessary scopes.

What environment variables can I use to configure the server?

You can use MCP_GMAIL_CREDENTIALS_PATH, MCP_GMAIL_TOKEN_PATH, and MCP_GMAIL_MAX_RESULTS.

What resources and tools are available?

Available resources include gmail://messages/{message_id} and gmail://threads/{thread_id}. Available tools include compose_email, send_email, search_emails, query_emails, get_emails, list_available_labels, mark_message_read, add_label_to_message, and remove_label_from_message.