Gmail MCP Server

Gmail MCP Server

Integrates with the Gmail API to send and read emails through MCP tools using Google OAuth authentication.

Category
Visit Server

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

  1. Clone the repository
git clone https://github.com/your-username/mcp-practice.git
cd mcp-practice
  1. Create a virtual environment
python -m venv .venv
  1. Activate the environment

Windows

.venv\Scripts\activate

Linux/macOS

source .venv/bin/activate
  1. 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

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.

Official
Featured
TypeScript
Audiense Insights MCP Server

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.

Official
Featured
Local
TypeScript
Magic Component Platform (MCP)

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.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

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.

Official
Featured
TypeScript
Kagi MCP Server

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.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

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.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured