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.

F
license - not found
-
quality - not tested
C
maintenance

Maintenance

–Maintainers
–Response time
–Release cycle
–Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

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

Related MCP Servers

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

View all related MCP servers

Related MCP Connectors

  • Read, search, send, organize, draft and schedule email across your inboxes from any MCP client.

  • Manage Gmail messages, threads, labels, drafts, and settings from your workflows. Send and organiz…

  • Manage Gmail end-to-end: search, read, send, draft, label, and organize threads. Automate workflow…

View all MCP Connectors

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