Gmail MCP Server
Provides tools for sending emails through Gmail, enabling automated email composition and delivery.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Gmail MCP Serversend an email to john@example.com about the project update"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Gmail MCP Server
This MCP (Model Context Protocol) server provides tools for common operations with gmail.
Features
send_mail: Send new emails
Related MCP server: Gmail MCP Server
Prerequisites
Python 3.12+
uv - Fast Python package installer and resolver
Google Cloud Console Setup
Go to: Google Cloud Console
Create a new project for this MCP Server
Enable Gmail API
Go to: APIs and services > Library
Search: Gmail API
Click on: Gmail API tile in the results
Click on: Enable
Setup OAuth
Go to: APIs and services > Credentials
Click on": Create Credentials > OAuth client ID
Choose Application Type: Web application
Add: Authorised redirect URIs: http://localhost:4321/
Create client
Download the JSON and save it to
credentials.jsonin this project root. This has the Client ID, Client Secret, etc.
Installation
Clone this repository:
git clone https://github.com/heuristech/gmail-mcp-server.git cd gmail-mcp-serverCreate a virtual environment and install the package in development mode:
# Create a virtual environment uv venv # Activate the virtual environment # On macOS/Linux: source .venv/bin/activate # On Windows: .venv\Scripts\activate # Install dependencies uv sync
Get Refresh Token
python get_refresh_token.pyThis will:
Start a server on
port:4321to receivetokenspost Google OAuthOpen your browser for Google OAuth
On succeeful authentication it will save
token.jsonwithrefresh_tokenalong withclient_id, andclient_secret.It will also display the
refresh_tokenon console.
Create .env
copy example.env .envSetup the corresponding value using what you received in the previous step.
Inspect
Use MCP Inspector to test it in the development mode.
mcp dev server.pyClaude Desktop Integration
Once your server is ready, install it in Claude Desktop
mcp install server.py --with google-auth --with google-auth-oauthlib --with google-auth-httplib2 --with google-api-python-client -f .envMCP server configuration:
{
"mcpServers": {
"gmail-mcp-server": {
"command": "uv",
"args": [
"--directory",
"/:your.path.to/gmail-mcp-server/server.py",
"run",
"server.py"
],
"env": {
"CLIENT_ID": "google.auth.app.client.id",
"CLIENT_SECRET": "google.auth.app.client.secret",
"REFRESH_TOKEN": "google.auth.app.refresh.token"
}
}
}
}This server cannot be deployed
Maintenance
Related MCP Connectors
Manage Gmail messages, threads, labels, drafts, and settings from your workflows. Send and organiz…
Manage Gmail end-to-end: search, read, send, draft, label, and organize threads. Automate workflow…
Permissioned access to Gmail, Drive and Calendar via the user's own Google account
Related MCP Servers
- AlicenseCqualityDmaintenanceEnables comprehensive Gmail management through the Gmail API, including sending/receiving emails, organizing labels and threads, managing drafts, and configuring account settings with secure OAuth2 authentication.64695 npm1MIT
- AlicenseCqualityDmaintenanceProvides complete Gmail API integration for email management, including sending/receiving messages, managing labels and threads, creating drafts, and configuring settings through OAuth2 authentication.64695 npmMIT
- AlicenseNot gradedqualityCmaintenanceEnables reading, sending, archiving, and managing Gmail emails and labels through Google OAuth authentication, acting as an OAuth proxy to the Gmail API.292 npm11MIT
- AlicenseAqualityDmaintenanceEnables sending emails and creating drafts through the Gmail API with OAuth 2.0 authentication.28 npmMIT