Basic information
About Gmail MCP Server
Mirror of
Gmail MCP Server is a MCP server in the Communication category listed in the AddMCP.net directory, published by MCP-Mirror. It exposes 1 tool, including search_emails. Supported transport: stdio. Source code is hosted on github.com. Related topics: email-integration, gmail, mcp-server.
Setup
{
"mcpServers": {
"ajbr0wn_gmail-mcp-server": {
"command": "python",
"args": [
"-m",
"gmail_mcp_server.server"
]
}
}
}
{
"mcpServers": {
"ajbr0wn_gmail-mcp-server": {
"command": "python",
"args": [
"-m",
"gmail_mcp_server.server"
]
}
}
}
{
"servers": {
"ajbr0wn_gmail-mcp-server": {
"command": "python",
"args": [
"-m",
"gmail_mcp_server.server"
]
}
}
}
Gmail MCP Server — by MCP-Mirror config
Add this server to your MCP-compatible client using the configuration below.
{
"mcpServers": {
"ajbr0wn_gmail-mcp-server": {
"command": "python",
"args": [
"-m",
"gmail_mcp_server.server"
]
}
}
}
Gmail MCP Server — by MCP-Mirror tools
- search_emails — takes a required `query` (any Gmail search string) and an optional `max_results` (default 10). Use it to find messages by sender, date range, subject or label.
Overview
What is Gmail MCP Server?
Gmail MCP Server is a small, community-built Gmail MCP server written in Python that lets MCP clients such as Claude Desktop read your recent inbox and search your mail through the Gmail API, using OAuth2 with read-only access.
The project was created by GitHub user ajbr0wn (source: github.com/ajbr0wn/gmail-mcp-server). It is not made by Google. It exposes one resource and one tool, and it cannot send, delete or label messages. That makes it a narrow, low-risk choice when you only want an assistant to look things up in your mailbox.
How to use Gmail MCP Server?
The server runs locally over stdio. You need Python 3.12 (the README uses a conda environment), a Google Cloud project, and an OAuth client for the Gmail API. It is not published to PyPI, so you install it from a clone of the repository.
1. Create Google OAuth credentials
- Create a project in the Google Cloud Console.
- Enable the Gmail API.
- Create OAuth 2.0 credentials with application type Desktop application.
- Download the file and save it as
credentials.json.
2. Install the server
git clone https://github.com/ajbr0wn/gmail-mcp-server.git
conda create -n mcp-gmail python=3.12
conda activate mcp-gmail
cd gmail-mcp-server
pip install -e .
3. Set the two required environment variables
GMAIL_CREDENTIALS_FILE: path to your Google OAuth credentials fileGMAIL_TOKEN_FILE: path where the authentication token will be saved (created automatically on first sign-in)
You can test the server directly before wiring it into a client:
GMAIL_CREDENTIALS_FILE="/path/to/credentials.json" \
GMAIL_TOKEN_FILE="/path/to/token.json" \
python -m gmail_mcp_server.server
Claude Desktop
Add this to claude_desktop_config.json, replacing every /path/to/ with your real paths:
{
"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"
}
}
}
}
Restart Claude Desktop. The first time Claude touches Gmail, a browser window opens so you can authorize the app; the token is then saved to GMAIL_TOKEN_FILE and refreshed automatically.
Claude Code
The README only documents Claude Desktop, but any stdio client can launch the same command with the same environment variables. In Claude Code:
claude mcp add gmail \
-e PYTHONPATH=/path/to/gmail-mcp-server/src \
-e GMAIL_CREDENTIALS_FILE=/path/to/credentials.json \
-e GMAIL_TOKEN_FILE=/path/to/token.json \
-- /path/to/conda/envs/mcp-gmail/bin/python -m gmail_mcp_server.server
For Cursor, VS Code and other clients, reuse the command, args and env values from the Claude Desktop block in that client's MCP config file.
Key features of Gmail MCP Server
- Reads the 10 most recent emails in your inbox through the
gmail://inbox/recentresource. - Searches mail with Gmail's standard search syntax (
from:,after:,subject:and so on). - Requests read-only Gmail access; no write permissions are asked for.
- OAuth2 sign-in in the browser on first use, with automatic token refresh afterwards.
- Credentials and tokens stay on your machine in files you choose.
- Detailed logging to stderr covering startup, authentication, resource and tool use, and errors.
- Small Python codebase that is easy to read and extend.
Gmail MCP Server tools
The server has a single tool plus one resource:
search_emailstakes a requiredquery(any Gmail search string) and an optionalmax_results(default 10). Use it to find messages by sender, date range, subject or label.- The
gmail://inbox/recentresource is not a tool; clients that support MCP resources can attach it to give the model your 10 newest messages as context.
There are no tools for sending, drafting, archiving or deleting mail.
Use cases of Gmail MCP Server
- Quick inbox checks without leaving your assistant: "What are my latest emails about?"
- Finding a specific message: "Could you show me any emails from sanrio in the last two days?" (the README's own example)
- Pulling details out of receipts or confirmations: "Search for emails from my airline this month and list the booking references."
- Summarizing a thread of updates from one sender: "Find emails from GitHub about failed builds this week and summarize them."
- Feeding email context into a coding or writing task, for example looking up a customer's bug report before drafting a reply elsewhere.
Gmail MCP Server vs alternatives
- Google's Gmail MCP server: Google runs a remote Gmail MCP endpoint at
https://gmailmcp.googleapis.com/mcp/v1as part of the Google Workspace Developer Preview Program (setup guide). It uses Streamable HTTP and OAuth 2.0, and its tools includesearch_threads,get_thread,create_draftand label management. Pick it if you want a Google-hosted server that can also create drafts; pick this Gmail MCP server if you want a local, read-only setup with no preview enrollment. - Fuller community servers: Other open-source Gmail MCP servers add sending, labels and attachments. Their scope is larger, so review the permissions they request before connecting a real mailbox.
Troubleshooting Gmail MCP Server
ModuleNotFoundError: gmail_mcp_server: the client is using a different Python. Pointcommandat the interpreter inside yourmcp-gmailenvironment and setPYTHONPATHto the repo'ssrcfolder.- Server fails at startup: check that both
GMAIL_CREDENTIALS_FILEandGMAIL_TOKEN_FILEare set; the README marks both as required. Use full paths, not placeholders. - No browser prompt or authorization errors: make sure the OAuth client type is Desktop application and the Gmail API is enabled in the same Google Cloud project as the credentials.
- Need to re-authorize or switch accounts: revoke access in your Google Account settings, delete the token file and run again to trigger a new sign-in.
- Unclear failures: read the server's stderr output; the server logs authentication status and errors there.
Frequently asked questions
1 Is Gmail MCP Server an official Google product?
No. It is a community project by ajbr0wn on GitHub. Google offers its own Gmail MCP server as a Developer Preview, which is a separate product.
2 Is Gmail MCP Server free?
Yes. The code is free to use and the Gmail API calls it makes come from your own Google Cloud project. You only need a Google account and a project with the Gmail API enabled.
3 Can Gmail MCP Server send or delete emails?
No. It requests read-only access and offers only search_emails plus the recent-inbox resource.
4 Which environment variables does it need?
GMAIL_CREDENTIALS_FILE (your OAuth credentials file) and GMAIL_TOKEN_FILE (where the token is stored). When you launch it from a client, also set PYTHONPATH to the repo's src directory as in the README.
5 Does this Gmail MCP server work with Claude Code, Cursor or VS Code?
The README documents Claude Desktop. Because it is a standard stdio server, Claude Code, Cursor and VS Code can run the same Python command with the same environment variables.
6 Is it local or remote?
Local. It runs on your computer over stdio; there is no hosted URL.
7 Where is my Gmail data stored?
The OAuth token is stored locally in the file you set with GMAIL_TOKEN_FILE. Email content goes from Gmail to the server and then to your MCP client, and you can revoke access at any time in your Google Account settings.
8 Why does mcp.so list this under MCP-Mirror?
The listing was imported from an MCP-Mirror copy of the repository. The original project is maintained at github.com/ajbr0wn/gmail-mcp-server.
Comments
No comments yet
Be the first to share feedback about this listing. Sign in to leave a comment.
Sign In