
gmail agent using mcp
一个通过Gmail MCP服务器集成的自动化邮件处理工具,支持读取、发送、删除等操作。
Repository Info
About This Server
一个通过Gmail MCP服务器集成的自动化邮件处理工具,支持读取、发送、删除等操作。
Model Context Protocol (MCP) - This server can be integrated with AI applications to provide additional context and capabilities, enabling enhanced AI interactions and functionality.
Documentation
Gmail Support Agent
This is a starter Gmail support agent that integrates directly with your Gmail account using gmail mcp server (community server). The agent can perform various actions including reading emails, drafting emails, sending emails, deleting emails, replying to emails within the same thread, and more. You can use this as starting point and customize this as you like.
💼 Use Cases Examples:
-
✅ Automated Email Triage and Summarization
- Scenario: Your Gmail inbox quickly becomes cluttered.
- Usage: The agent can periodically scan your inbox to read incoming emails and generate summaries. It highlights key details (sender, subject, body) to help prioritize important emails.
-
🔁 Smart Email Follow-Up and Reminders
- Scenario: You often forget to follow up on important emails or tasks.
- Usage: The agent can identify emails with flags or keywords like "action required" and either send reminders or trigger auto-replies using your templates.
-
📅 Meeting Scheduling and Confirmations
- Scenario: Coordinating meetings via email is tedious.
- Usage: The agent can detect meeting requests, parse details (dates/times), and respond with confirmations or proposed slots. Optionally, integrate with Google Calendar for full scheduling support.
-
and much more
Repository:
MCP on GitHub
Features
- Read Email: Retrieve and view your emails.
- Draft Email: Create new email drafts.
- Send Email: Send out emails.
- Delete Email: Remove unwanted emails.
- Reply to Email: Reply within the same email thread.
- Other Features: Additional functionalities to enhance your Gmail experience.
Prerequisites
Ensure you have the following installed before proceeding:
-
uv:
Make sureuvis installed on your system. If not, install it. -
npx and Node.js:
Ensure you havenpxinstalled, which requires Node.js.
Installation
-
Add the OpenAI Agents Chainlit Package:
uv add openai-agents chainlit -
Setup Google Cloud to Enable Gmail Usage:
a. Create a Google Cloud Project and Enable the Gmail API
- Go to the Google Cloud Console.
- Create a new project or select an existing one.
- Enable the Gmail API for your project.
b. Create OAuth 2.0 Credentials
- Navigate to APIs & Services > Credentials.
- Click Create Credentials > OAuth client ID.
- Complete the form (this may involve setting up a consent screen).
- Choose either Desktop app or Web application as the application type.
- Provide a descriptive name and click Create.
- For Web Applications: Add
http://localhost:3000/oauth2callbackto the authorized redirect URIs. - Download the JSON file containing your OAuth keys.
- Rename the downloaded file to
gcp-oauth.keys.json.
-
Setup test user:
a. Your account will be created in test mode so you need to add the email in test user so the agent can access the email###
- Visit Audience.
- Scroll down and create test user (Email of the account you want to give the access of).
Authentication
Global Authentication (Recommended)
-
Place the OAuth Keys File:
Place thegcp-oauth.keys.jsonfile in your home directory where yourpyproject.tomlfile is located. -
Make gmail-mcp directory in the home directory.
-
Run the Authentication Command:
npx @gongrzhe/server-gmail-autoauth-mcp authThis process will:
- Search for
gcp-oauth.keys.jsonin the current directory or in~/.gmail-mcp/. - If found in the current directory, copy it to
~/.gmail-mcp/. - Open your default browser for Google authentication.
- Save the obtained credentials as
~/.gmail-mcp/credentials.json.
- Search for
Environment Setup
Create a .env file in your project directory and add your Gemini API key:
GEMINI_API_KEY="YOUR_API_KEY"
Note: Replace
"YOUR_API_KEY"with your actual Gemini API key.
Running the Agent
To run the Gmail support agent with Chainlit, use the following command:
uv run chainlit run main.py
If you prefer not to have Chainlit open your default browser automatically every time, run it in headless mode and then you can open it on any browser or refresh it if already opened:
uv run chainlit run main.py --headless
Enjoy your seamless email management experience with the Gmail Support Agent!
Sample Images of the run
Quick Start
Clone the repository
git clone https://github.com/hubaibmahmood/gmail-agent-using-mcpInstall dependencies
cd gmail-agent-using-mcp
npm installFollow the documentation
Check the repository's README.md file for specific installation and usage instructions.
Repository Details
Recommended MCP Servers
Discord MCP
Enable AI assistants to seamlessly interact with Discord servers, channels, and messages.
Knit MCP
Connect AI agents to 200+ SaaS applications and automate workflows.
Apify MCP Server
Deploy and interact with Apify actors for web scraping and data extraction.
BrowserStack MCP
BrowserStack MCP Server for automated testing across multiple browsers.
Zapier MCP
A Zapier server that provides automation capabilities for various apps.