MCP Gmail Server
Allows reading unread Gmail emails and creating draft replies in Gmail without sending them.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
š§ MCP Gmail Server
A Model Context Protocol (MCP) server that enables Claude Desktop to read Gmail emails and create draft replies.

šÆ What This Server Does
This MCP server connects Claude Desktop to your Gmail account, allowing you to:
Read unread emails - Fetch and display unread emails from your inbox
Create draft replies - Automatically draft responses to emails without sending them
Related MCP server: gmail-mcp-server
š Table of Contents
⨠Features
Feature | Description |
š§ Read Emails | Fetch unread emails with sender, subject, and preview |
š Draft Replies | Create draft replies in Gmail (doesn't send automatically) |
š OAuth 2.0 | Secure authentication with Google |
š„ļø Claude Desktop | Native integration with Claude Desktop app |
š¦ Prerequisites
Python 3.10+ (Required - MCP doesn't support Python 3.9 or below)
Claude Desktop installed on your computer
Google Cloud Project with Gmail API enabled
Git (optional, for cloning)
Check Your Python Version
python --versionMust show
Python 3.10.xor higher.
š Installation
Step 1: Clone the Repository
git clone https://github.com/TheMlengineer-py/MCP_Server.git
cd MCP_ServerStep 2: Create Virtual Environment (Optional but Recommended)
python -m venv venv
# Windows
venv\Scripts\activate
# macOS/Linux
source venv/bin/activateStep 3: Install Dependencies
pip install mcp google-api-python-client google-auth-oauthlib google-auth-httplib2Or use requirements.txt:
pip install -r requirements.txtš Google Cloud Setup
Step 1: Create a Google Cloud Project
Go to Google Cloud Console
Click "Create Project"
Name your project (e.g.,
mcp-gmail-local)Click "Create"
Step 2: Enable Gmail API
Go to APIs & Services ā Library
Search for "Gmail API"
Click "Enable"
Step 3: Configure OAuth Consent Screen
Go to APIs & Services ā OAuth consent screen
Select "External" ā Click "Create"
Fill in required fields:
App name:
Local MCP GmailUser support email: Your email
Developer contact: Your email
Click "Save and Continue"
Add scopes:
https://www.googleapis.com/auth/gmail.readonlyhttps://www.googleapis.com/auth/gmail.compose
Add your email as a Test User
Click "Save and Continue"
Step 4: Create OAuth Credentials
Go to APIs & Services ā Credentials
Click "+ Create Credentials" ā "OAuth client ID"
Application type: "Desktop app"
Name:
Local MCP Gmail ClientClick "Create"
Click "Download JSON"
Rename the file to
credentials.jsonMove it to the
MCP_Server/folder
Step 5: Authenticate
Run this command to generate token.json:
cd MCP_Server
python -c "from app.gmail_auth import get_gmail_service; get_gmail_service(); print('Auth complete')"A browser window will open. Sign in and grant permissions.
āļø Configuration
Claude Desktop Config
Locate your Claude Desktop configuration file:
OS | Path |
Windows |
|
macOS |
|
Linux |
|
Configuration File
Add this configuration (adjust paths for your system):
Windows
{
"mcpServers": {
"gmail": {
"command": "C:\\Users\\YourUsername\\AppData\\Local\\Programs\\Python\\Python313\\python.exe",
"args": [
"C:\\Users\\YourUsername\\MCP_Gmail\\MCP_Server\\app\\server.py"
]
}
}
}macOS/Linux
{
"mcpServers": {
"gmail": {
"command": "python3",
"args": [
"/Users/YourUsername/MCP_Gmail/MCP_Server/app/server.py"
]
}
}
}Verify Your Python Path
# Windows (Git Bash)
which python
# macOS/Linux
which python3Use the full path in your config.
š® Usage
Start Claude Desktop
Save your
claude_desktop_config.jsonCompletely close Claude Desktop (check system tray)
Reopen Claude Desktop
Look for the Gmail MCP server in the tools
Verify Connection
In Claude Desktop, you should see the Gmail MCP server connected. If you see an error, check the Troubleshooting section.
š¬ Example Prompts
Reading Emails
"Show me my unread emails"
Claude will fetch and display your unread emails with:
Sender name
Subject line
Email preview snippet
"Check my Gmail inbox"
"What emails do I have?"
"List my latest unread messages"
Creating Draft Replies
"Draft a reply to the Usertesting email saying I'm interested in the test opportunity"
Claude will:
Find the email
Create a draft reply
Save it to your Gmail Drafts folder
"Create a draft reply to the first email thanking them for reaching out"
"Reply to the Airtm email explaining I haven't had time to use the service yet"
"Draft a response to Vaultleap asking for more information about their product"
Combined Workflows
"Show me my unread emails and draft a polite decline to any promotional emails"
"Check my inbox and summarize what needs my attention"
š§ Troubleshooting
Server Disconnected Error
Check the logs:
OS | Log Location |
Windows |
|
macOS |
|
Common Issues
1. ModuleNotFoundError: No module named 'mcp'
Cause: MCP not installed in the Python version Claude is using.
Fix:
# Use the same Python as in your config
/path/to/python -m pip install mcp2. ModuleNotFoundError: No module named 'app'
Cause: Missing __init__.py files.
Fix: Create these files:
touch MCP_Server/__init__.py
touch MCP_Server/app/__init__.py3. MCP requires Python >=3.10
Cause: Using Python 3.9 or older.
Fix: Install Python 3.10+ and update your config path.
4. Expecting value: line 1 column 1 (char 0)
Cause: Empty or corrupted token.json or credentials.json.
Fix:
# Delete and re-authenticate
rm token.json
python -c "from app.gmail_auth import get_gmail_service; get_gmail_service()"5. OAuth Error - Browser Won't Open
Fix: Manually copy the URL from terminal and paste in browser.
Test Your Setup
Run this diagnostic:
cd MCP_Server
python tests/test_server.pyExpected output:
[OK] Path configured
[OK] MCP imported successfully
[OK] gmail_auth imported successfully
[OK] gmail_client imported successfully
[OK] Gmail authentication successful
=== All checks passed! Server should work. ===š Project Structure
MCP_Server/
āāā .github/
ā āāā workflows/
ā āāā deploy.yml # CI/CD pipeline
āāā app/
ā āāā __init__.py
ā āāā server.py # MCP server entry point
ā āāā gmail_auth.py # OAuth 2.0 authentication
ā āāā gmail_client.py # Gmail API operations
āāā tests/
ā āāā __init__.py
ā āāā conftest.py # Pytest configuration
ā āāā test_server.py # Test suite
āāā docs/
ā āāā images/ # Screenshots & diagrams
āāā credentials.json # Google OAuth credentials (DO NOT COMMIT)
āāā token.json # OAuth token (DO NOT COMMIT)
āāā requirements.txt # Python dependencies
āāā .gitignore # Git ignore rules
āāā LICENSE # MIT License
āāā README.md # This fileš Security Notes
ā ļø Never commit these files:
credentials.jsontoken.json
Add to your .gitignore:
credentials.json
token.json
*.pyc
__pycache__/
venv/
.envš Available MCP Tools
Tool | Description | Gmail Scope |
| Fetch unread emails from inbox |
|
| Create a draft reply to an email |
|
š ļø Development
Run Server Manually
cd MCP_Server
python app/server.pyThe server communicates via stdin/stdout using JSON-RPC (MCP protocol).
Run Tests
# Manual test
python tests/test_server.py
# Pytest
python -m pytest tests/ -vš Requirements
mcp>=1.0.0
google-api-python-client>=2.0.0
google-auth-oauthlib>=1.0.0
google-auth-httplib2>=0.1.0š¤ Contributing
Fork the repository
Create a feature branch (
git checkout -b feature/amazing-feature)Commit your changes (
git commit -m 'Add amazing feature')Push to the branch (
git push origin feature/amazing-feature)Open a Pull Request
š License
This project is licensed under the MIT License - see the LICENSE file for details.
š Acknowledgments
š§ Contact
Dave - dave.resume.job@gmail.com
Project Link: https://github.com/TheMlengineer-py/MCP_Server
Made with ā¤ļø for the Claude Desktop community
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogā¦
This server cannot be deployed
Maintenance
Related MCP Connectors
Connect any IMAP/SMTP mailbox to Claude & ChatGPT: search, read, sort, draft. Sends only with OK.
Connect any mailbox to Claude, ChatGPT & AI: read, send, reply, schedule & search emails.
Your mailboxes in ChatGPT and Claude: Gmail, iCloud, Fastmail, any IMAP. Passwords stay yours.
Your SyncGaze Mail in any AI app: search, summarise and draft mail. Sending needs your approval.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceIntegrates Gmail with Claude Desktop to fetch unread emails, generate AI-powered draft replies with customizable tone and style guides, and manage your inbox through natural language commands.MIT
- FlicenseNot gradedqualityDmaintenanceEnables reading unread emails and creating draft replies in Gmail via Claude Desktop.-
- FlicenseNot gradedqualityDmaintenanceEnables Claude to read unread emails and create draft replies in Gmail with proper threading.-
- FlicenseBqualityDmaintenanceEnables Claude to read unread emails and create draft responses using the Gmail API.2-