Gmail MCP Server enables secure email access, search, and integration with Claude Desktop via OAuth2 authentication
The Gmail MCP Server provides an essential integration capability, enabling AI applications like Claude Desktop, Continue, Cursor, and others to interface with a user's Gmail account via the Model Context Protocol (MCP). This protocol acts as a standardized adapter between AI models and specific data sources or tools, allowing these applications to access email content, search functionality, and securely manage OAuth2 authentication. The server enhances how users interact with their emails within the context of various AI-driven workflows.
The Google MCP Server integrates seamlessly into AI ecosystems by offering several core features:
These features are implemented in line with MCP standards, ensuring compatibility across a wide range of AI applications.
The architecture of the Gmail MCP Server includes several key components:
claude_desktop_config.json
file with specific paths and command-line arguments directed towards the MCP server.These components interact through a well-defined Model Context Protocol flow which ensures secure and efficient data exchange between the AI application and Gmail.
credentials.json
to local storage.# Create a Conda environment
conda create -n mcp-gmail python=3.12
conda activate mcp-gmail
# Install the package
cd gmail-mcp-server
pip install -e .
Add this configuration to your claude_desktop_config.json
:
{
"mcpServers": {
"gmail": {
"command": "/path/to/conda/envs/mcp-gmail/bin/python",
"args": ["-m", "gmail_mcp_server.server"],
"env": {
"PYTHONPATH": "/path/to/gmail-mcp-server/src",
"GMAIL_CREDENTIALS_FILE": "/path/to/credentials.json",
"GMAIL_TOKEN_FILE": "/path/to/token.json"
}
}
}
}
Upon first interaction, you will be prompted to authorize the server in your browser. Once authorized, the credentials are saved for future use.
Email Review and Analysis:
Actionable Email Search:
The Gmail MCP Server is designed for compatibility with multiple MCP clients, including:
MCP Client | Resources | Tools | Prompts | Status |
---|---|---|---|---|
Claude Desktop | ✔️ | ✔️ | ✔️ | Full Support |
Continue | ✔️ | ✔️ | ✔️ | Full Support |
Cursor | - | ✔️ | - | Tools Only |
The server runs with environment variables that control its behavior and security. These include:
GMAIL_CREDENTIALS_FILE
: Path to your Google OAuth credentials file.GMAIL_TOKEN_FILE
: Path where the authentication token will be saved.For testing, you can run the server directly:
GMAIL_CREDENTIALS_FILE="/path/to/credentials.json" \
GMAIL_TOKEN_FILE="/path/to/token.json" \
python -m gmail_mcp_server.server
How does the OAuth2 flow work during first use? The server opens a browser to prompt you for authorization, then saves tokens for future access.
Can I revoke access anytime? Yes, you can disable apps using the Google Account settings where the credentials are stored.
Does this server support multiple users on the same machine? Configuration files per user can be set up to manage different accounts securely.
What permissions does the server request? Only read access is required—no write or modify permissions.
How do I handle errors during token refresh? The server logs these issues, and you can use the provided logging details to address them.
The Gmail MCP Server is part of a broader ecosystem where AI applications connect with various data sources through standardized protocols. For more information, refer to the official Model Context Protocol documentation and community forums.
graph TD
A[AI Application] -->|MCP Client| B[MCP Protocol]
B --> C[MCP Server]
C --> D[Data Source/Tool]
style A fill:#e1f5fe
style C fill:#f3e5f5
style D fill:#e8f5e8
MCP Client | Resources | Tools | Prompts | Status |
---|---|---|---|---|
Claude Desktop | ✔️ | ✔️ | ✔️ | Full Support |
Continue | ✔️ | ✔️ | ✔️ | Full Support |
Cursor | - | ✔️ | - | Tools Only |
{
"mcpServers": {
"[server-name]": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-[name]"],
"env": {
"API_KEY": "your-api-key"
}
}
}
}
This comprehensive documentation positions the Gmail MCP Server as a vital tool for enhancing AI application integration with Gmail, providing detailed steps and examples for developers to follow.
RuinedFooocus is a local AI image generator and chatbot image server for seamless creative control
Access NASA APIs for space data, images, asteroids, weather, and exoplanets via MCP integration
Simplify MySQL queries with Java-based MysqlMcpServer for easy standard input-output communication
Build stunning one-page websites track engagement create QR codes monetize content easily with Acalytica
Learn to set up MCP Airflow Database server for efficient database interactions and querying airflow data
Explore CoRT MCP server for advanced self-arguing AI with multi-LLM inference and enhanced evaluation methods