- Home
- MCP servers
- Gmail
Gmail
- python
8
GitHub Stars
python
Language
4 months ago
First Indexed
3 weeks ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
Installation
Add the following to your MCP client configuration file.
Configuration
View docs{
"mcpServers": {
"ajbr0wn-gmail-mcp-server": {
"command": "/path/to/conda/envs/mcp-gmail/bin/python",
"args": [
"-m",
"gmail_mcp_server.server"
],
"env": {
"PYTHONPATH": "/path/to/gmail-mcp-server/src",
"GMAIL_TOKEN_FILE": "/path/to/token.json",
"GMAIL_CREDENTIALS_FILE": "/path/to/credentials.json"
}
}
}
}This Gmail MCP Server enables MCP clients to access Gmail data securely and interactively. You can view your recent emails and search your inbox using Gmail’s familiar query syntax, all through an OAuth2-backed integration that keeps your credentials locally and refreshes tokens automatically.
How to use
To use Gmail inside an MCP client, connect to the Gmail MCP Server and perform two primary actions: view recent emails and search your inbox. Use the available resource for recent emails to fetch your 10 most recent messages. Use the search tool to run Gmail-style queries and return matching emails. All operations are protected by OAuth2 authentication; your browser will prompt you to authorize access on the first use.
How to install
Prerequisites: Python 3.12 and a working Conda installation.
Create and activate a Conda environment for the server.
/bin/bash
conda create -n mcp-gmail python=3.12
conda activate mcp-gmail
Install the Gmail MCP Server package in editable mode.
/bin/bash
cd gmail-mcp-server
pip install -e .
Additional sections
Configuration for Claude Desktop is provided via a dedicated MCP server entry. You will run the server from your Conda environment and supply credentials through environment variables so the server can authenticate with Gmail.
Security notes: You will undergo an OAuth2 authorization flow in your browser on first use. Credentials are stored locally in a token file, and you can revoke access at any time from your Google Account settings. The server requests read-only access to Gmail.
Environment variables you will configure include the path to your Gmail credentials file and the token file used to store your access token.
Example usage via Claude Desktop: you can request the 10 most recent emails or run a Gmail search like “from:sanrio in the last 2 days” to filter results.
Examples and resources
Resource: gmail://inbox/recent returns your 10 most recent emails.
Tool: search_emails allows you to search Gmail emails with a query. Parameters: query (required) and max_results (optional, default 10). Example query: could you show me any emails from sanrio in the last two days?
Available tools
search_emails
Search Gmail emails with a Gmail-style query and optionally limit the number of results