An MCP (Model Context Protocol) server that provides Gmail integration capabilities to MCP clients like Claude Desktop.
credentials.json
# 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 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.
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.
gmail://inbox/recent
- Returns your 10 most recent emailssearch_emails
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?
This server requires OAuth2 authentication with Gmail:
GMAIL_CREDENTIALS_FILE
(required): Path to your Google OAuth credentials fileGMAIL_TOKEN_FILE
(required): Path where the authentication token will be savedFor 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
The server uses the Model Context Protocol to provide:
The server logs detailed information about its operations to stderr, including:
Pull requests are welcome! Please ensure to:
Seamless access to top MCP servers powering the future of AI integration.