
Gmail MCP Server
An integration server that provides Claude Desktop access to Gmail, enabling users to view recent emails and search their Gmail inbox using natural language commands.
ajbr0wn
README
Gmail MCP Server
An MCP (Model Context Protocol) server that provides Gmail integration capabilities to MCP clients like Claude Desktop.
Features
- View recent emails from your Gmail inbox
- Search emails using Gmail's search syntax
- Secure OAuth2 authentication with Gmail API
Setup
1. Google Cloud Project Setup
- Create a Google Cloud Project at https://console.cloud.google.com/
- Enable the Gmail API
- Create OAuth 2.0 credentials:
- Application type: Desktop application
- Download the credentials as
credentials.json
2. Installation
# 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 .
3. Configuration for Claude Desktop
Add 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"
}
}
}
}
Replace /path/to/
with your actual paths. The token file will be created automatically when you first authenticate.
4. First Run
When you first try to access Gmail through Claude, you'll be prompted to authorize the application in your browser. After authorization, your credentials will be saved to the token file for future use.
Available Resources
gmail://inbox/recent
- Returns your 10 most recent emails
Available Tools
search_emails
- Description: Search Gmail emails with a query
- Parameters:
query
(required): Gmail search query (uses Gmail's standard search syntax)max_results
(optional): Maximum number of results to return (default: 10)
Example search:
Could you show me any emails from sanrio in the last two days?
Security
This server requires OAuth2 authentication with Gmail:
- You'll be prompted to authorize access in your browser on first use
- Credentials are stored locally in the specified token file
- Access can be revoked at any time through your Google Account settings
- Only read access to Gmail is requested (no write permissions)
Environment Variables
GMAIL_CREDENTIALS_FILE
(required): Path to your Google OAuth credentials fileGMAIL_TOKEN_FILE
(required): 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
Development
The server uses the Model Context Protocol to provide:
- Resource access to recent emails
- Tool support for email search
- Secure OAuth2 authentication flow
- Automatic token refresh
Logging
The server logs detailed information about its operations to stderr, including:
- Server startup information
- Authentication status
- Resource and tool usage
- Any errors or issues
Contributing
Pull requests are welcome! Please ensure to:
- Update documentation for any new features
- Add appropriate error handling
- Test OAuth flow with new features
- Follow existing code style
Recommended Servers
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Excel MCP Server
A Model Context Protocol server that enables AI assistants to read from and write to Microsoft Excel files, supporting formats like xlsx, xlsm, xltx, and xltm.
Playwright MCP Server
Provides a server utilizing Model Context Protocol to enable human-like browser automation with Playwright, allowing control over browser actions such as navigation, element interaction, and scrolling.
Claude Code MCP
An implementation of Claude Code as a Model Context Protocol server that enables using Claude's software engineering capabilities (code generation, editing, reviewing, and file operations) through the standardized MCP interface.
Apple MCP Server
Enables interaction with Apple apps like Messages, Notes, and Contacts through the MCP protocol to send messages, search, and open app content using natural language.
DuckDuckGo MCP Server
A Model Context Protocol (MCP) server that provides web search capabilities through DuckDuckGo, with additional features for content fetching and parsing.
YouTube Transcript MCP Server
This server retrieves transcripts for given YouTube video URLs, enabling integration with Goose CLI or Goose Desktop for transcript extraction and processing.