About Gmail MCP Server
Gmail MCP Server connects AI assistants to Gmail for inbox retrieval, message search, unread-mail access, and sending. It uses IMAP and SMTP with Gmail authentication.
Key features
- 01Fetch inbox messages
- 02Search by subject or sender
- 03Retrieve unread messages
- 04Send email
Use cases
- 01Review recent inbox messages
- 02Find messages from a sender
- 03Check unread mail
- 04Send email through an assistant
MCP support
It exposes Gmail operations as standardized tools for MCP clients, including email retrieval, search, and sending.
Configuration
Local server config is the same for every client. Copy it into your client’s MCP config file.
We haven’t collected a package or remote endpoint for this server. Follow the instructions in the project README.
Tools
Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.
Details
From the project READMEGmail MCP Server
A Model Context Protocol (MCP) server for Gmail integration, built with FastMCP. This server provides AI assistants with the ability to interact with Gmail through a set of standardized tools.
Overview
This project implements an MCP server that allows AI assistants to perform various Gmail operations including:
- Fetching emails from your inbox
- Searching emails by subject
- Searching emails from specific senders
- Retrieving unread emails
- Sending emails to recipients
The server uses IMAP for email retrieval and SMTP for sending emails, all secured through Gmail's authentication system.
Setup
- Clone the repository
git clone https://github.com/shubhiscoding/Gmail-MCP-Server
cd gmail-mcp
- Install dependencies
npm install
- Create a
.envfile in the root directory with the following variables:
GMAIL_USER=your_gmail_address
GMAIL_APP_PASSWORD=your-app-password
To generate an App Password for your Gmail account:
- Go to your Google Account > Security
- Enable 2-Step Verification if not already enabled
- Go to App passwords
- Select "Mail" and your device
- Click "Generate"
Usage
Starting the Server
Start the server in development mode:
npm run dev
Configuration to run with Windsurf
Configure mcp_config.json to add gmail-mcp server:
{
"mcpServers": {
"gmail-mcp": {
"command": "bash",
"args": [
"-c",
"cd ~Your-Path-To-The-Repo/Gmail-MCP-Server && npm run start"
],
"disabled": false
}
}
}
Configuration to run with Claude desktop on Windows
{
"mcpServers": {
"gmail-mcp": {
"command": "cmd",
"args": ["/c", "cd /d ~Your-Path-To-The-Repo\\Gmail-MCP-Server && npm run start"]
}
}
}
Video Demo
Windsruf demo
https://github.com/user-attachments/assets/0c45ec24-be45-4271-b7d0-fc6cd58b850f
Claude Desktop Demo
https://github.com/user-attachments/assets/ad1650e8-bcc4-481e-ab95-eaefd8de7472
Available Tools
The server provides the following tools for AI assistants:
1. fetchEmails
Fetches emails from your inbox with optional filtering.
Parameters:
limit(optional): Maximum number of emails to fetch (default: 10)mailbox(optional): Mailbox to fetch emails from (default: 'INBOX')searchCriteria(optional): IMAP search criteria (default: ['ALL'])
2. fetchEmailsBySubject
Fetches emails with a specific subject.
Parameters:
subject: Subject to search forlimit(optional): Maximum number of emails to fetch (default: 10)
3. fetchEmailsFromSender
Fetches emails from a specific sender.
Parameters:
sender: Email address of the senderlimit(optional): Maximum number of emails to fetch (default: 10)
4. fetchUnreadEmails
Fetches unread emails from your inbox.
Parameters:
limit(optional): Maximum number of emails to fetch (default: 10)
5. sendEmails
Sends an email to a specified recipient.
Parameters:
to: Email address of the recipientsubject: Subject of the emailbody: Body of the email
Security
This server uses environment variables to store sensitive information like your Gmail credentials. Never commit your .env file to version control.
Technical Details
The project is built with:
- TypeScript for type safety
- Node.js IMAP and Nodemailer libraries for email operations
- FastMCP for MCP server implementation
- dotenv for environment variable management
Comments
New to MCP?
From what the protocol is to installing your first server, these answers cover most first questions.
An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.