Skip to main content
Glama
sejalpatole

Gmail MCP Server

by sejalpatole

πŸ“§ 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

Related MCP server: Gmail MCP Server

πŸ› οΈ 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.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

No tool schema history has been recorded yet.

Maintenance

ActivityMaintained
ResponsivenessSyncing

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables interaction with Gmail through the MCP protocol, supporting sending, reading, searching, replying, forwarding, managing drafts and labels, and saving attachments.
    11
    3
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables Gmail operations such as reading, sending, searching, and managing emails, threads, labels, and drafts via MCP tools.
    1
    MIT
  • A
    license
    Not graded
    quality
    F
    maintenance
    Enables AI agents and Telegram bots to read and send Gmail messages via MCP with OAuth authentication.
    19
    MIT

Appeared in Searches

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/sejalpatole/Gmail-MCP-Server-using-FastMCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server