Provides Gmail access via MCP to list, read, send, search, and manage Gmail emails.
Configuration
View docs{
"mcpServers": {
"brentwpeterson-mcp-gmail": {
"command": "node",
"args": [
"/absolute/path/to/mcp-gmail/dist/index.js"
],
"env": {
"GMAIL_CONFIG_DIR": "~/.mcp-gmail",
"GMAIL_CREDENTIALS_PATH": "~/.mcp-gmail/credentials.json"
}
}
}
}This Gmail MCP Server provides seamless Gmail access for Claude Code and other MCP-compatible clients. It lets you list, read, compose, and search emails, manage labels, and keeps emails threaded correctly for replies, all through a standardized MCP interface.
You connect to this Gmail MCP Server from your MCP client by configuring a server entry that points to the local runtime of the Gmail MCP Server. Once configured and running, you can list emails from folders like inbox or sent, fetch full email contents, compose or reply to messages with automatic send-signatures, and search using Gmail-style queries. You can also apply labels such as read, star, or archive to organize messages. Use the server to access Gmail programmatically from your MCP-enabled tooling without switching apps.
Prerequisites you need before installing the Gmail MCP Server:
Step-by-step setup and installation commands:
# 1. Create a Google Cloud Project
# If you don’t have one yet
# - Create a project
# - Set it as active
# - Enable Gmail API
gcloud projects create your-project-name --name="Your MCP Tools"
gcloud config set project your-project-name
gcloud services enable gmail.googleapis.com
# 2. Configure OAuth Consent Screen
# Choose Internal for Google Workspace users or External for personal Gmail
# Add scopes: read-only, send, modify
# 3. Create OAuth Credentials
# Create an OAuth client ID for a Desktop app and download the JSON
# 4. Install and Build
git clone https://github.com/brentwpeterson/mcp-gmail.git
cd mcp-gmail
npm install
npm run build
# 5. Authenticate
npm run auth
# This opens a browser to approve permissions; tokens are saved to the local token store
# 6. Configure Your MCP Client
# Provide the runtime path to the built server in your MCP client configThe server is configured as a standard MCP stdio server. You run it locally and point your MCP client at the script that starts the server.
{
"mcpServers": {
"gmail": {
"command": "node",
"args": ["/absolute/path/to/mcp-gmail/dist/index.js"]
}
}
}OAuth tokens and credentials are stored locally to keep your Gmail access separate from the MCP runner. Tokens live in your config directory and can be revoked at any time from your Google Account permissions. Protect access to your token and credentials files to prevent unauthorized use.
If you encounter authentication issues, re-run the authentication flow to refresh tokens. Ensure the OAuth credentials JSON is saved to the configured path and that Gmail API access remains enabled for your project.
List recent emails with optional folder and search query to refine results.
Fetch the full content of a single email by ID.
Send a new email or reply to an existing thread using Gmail send capabilities with automatic signature.
Search emails using Gmail query syntax such as from:, to:, subject:, has:attachment, and date-based filters.
Retrieve all messages within a conversation thread.
Add or remove labels like read, star, and archive on selected messages.
List all available Gmail labels for the authenticated account.