Gmail MCP Server
Integrates with the Gmail API to send and read emails through MCP tools using Google OAuth authentication.
README
š§ Gmail MCP Server using FastMCP
A Model Context Protocol (MCP) server built with FastMCP that integrates with the Gmail API. This project demonstrates how to create AI-accessible tools for reading and sending emails using Google OAuth authentication.
š Features
- š Google OAuth 2.0 authentication
- š© Send emails through Gmail
- š„ Read Gmail messages
- š ļø MCP tools using FastMCP
- ā” Lightweight Python implementation
- š Secure credential management using environment variables
š ļø Tech Stack
- Python 3.13
- FastMCP
- Gmail API
- Google OAuth 2.0
- Uvicorn
- python-dotenv
š Project Structure
.
āāā main.py
āāā oauth.py
āāā tools/
ā āāā gmail.py
ā āāā __init__.py
āāā .env
āāā requirements.txt
āāā README.md
āļø Installation
- Clone the repository
git clone https://github.com/your-username/mcp-practice.git
cd mcp-practice
- Create a virtual environment
python -m venv .venv
- Activate the environment
Windows
.venv\Scripts\activate
Linux/macOS
source .venv/bin/activate
- Install dependencies
pip install -r requirements.txt
š Configure Environment Variables
Create a .env file and add:
GOOGLE_CLIENT_SECRET_PATH=client_secret.json
GOOGLE_TOKEN_PATH=token.json
ā¶ļø Authenticate Gmail
python oauth.py
This will open a browser for Google authentication and generate token.json.
ā¶ļø Run the MCP Server
python main.py
or
uv run fastmcp dev main.py:mcp
š Learning Objectives
This project was created to practice:
- Model Context Protocol (MCP)
- FastMCP framework
- Tool decorators
- Prompt decorators
- Google OAuth
- Gmail API integration
- AI tool development
š Future Improvements
- Email search
- Delete emails
- Mark emails as read/unread
- Attachment support
- Async MCP tools
- Better error handling
š¤ Contributing
Contributions and suggestions are welcome.
š License
This project is for educational and learning purposes.
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.