MCP ExplorerExplorer

Agentic Email System Mcp Servers

@MUKILAN-2003on 13 days ago
1 MIT
FreeCommunity
AI Systems
An intelligent email assistant built with Agentic AI using LangChain and MCP tools. It autonomously reads, classifies, marks emails as read, and replies to important messages helping you keep your inbox clean and efficient.

Overview

What is Agentic Email System Mcp Servers

Agentic-Email-System-MCP-Servers is an intelligent email assistant that utilizes Agentic AI, LangChain, and MCP tools to autonomously manage your Gmail inbox by reading, classifying, marking emails as read, and replying to important messages.

Use cases

Use cases include automating email responses, organizing inboxes by classifying emails, managing email drafts, and enhancing productivity by reducing the time spent on email management.

How to use

To use Agentic-Email-System-MCP-Servers, clone the repository, install the required dependencies, configure your Google API credentials, and run the MCP server followed by the Streamlit app to interact with the email assistant.

Key features

Key features include reading the latest emails, sending emails, creating Gmail labels, deleting emails, creating draft emails, managing Gmail signatures, and leveraging LangChain and OpenAI LLMs with Google’s Gmail API via OAuth 2.0.

Where to use

Agentic-Email-System-MCP-Servers can be used in various fields such as personal email management, customer support, and any environment where efficient email handling is required.

Content

Agentic-Email-System-MCP-Servers

An intelligent email assistant built with Agentic AI using LangChain and MCP tools. It autonomously reads, classifies, marks emails as read, and replies to important messages helping you keep your inbox clean and efficient.

The project includes:

  • MCP Server and MCP Client to interface with Gmail APIs asynchronously.
  • LangChain Tools wrapping MCP client calls for use in AI agents.
  • A Streamlit app (app.py) UI to interact with the agent in a user-friendly way.

Features

  • Read latest emails from Gmail inbox.
  • Send emails with subject and body.
  • Create Gmail labels.
  • Delete emails by ID.
  • Create draft emails.
  • Get and set Gmail signature.
  • Powered by LangChain and OpenAI LLMs.
  • Uses Google’s Gmail API via OAuth 2.0.

Getting Started

Prerequisites

  • Python 3.9+
  • Google Cloud Console project with Gmail API enabled.
  • credentials.json file downloaded from Google API Console.
  • OpenAI API key.

Installation

  1. Clone the repository
git clone https://github.com/yourusername/gmail-langchain-agent.git
cd gmail-langchain-agent
  1. Install dependencies
pip install -r requirements.txt
  1. Place your Google API credentials.json in the root directory.

  2. Run the MCP server (this will start the OAuth flow on the first run):

python mcp_server.py
  1. Run the Streamlit app:
streamlit run app.py
  1. Use the Streamlit UI to interact with your Gmail via the AI-powered agent.

File Overview

  • mcp_server.py: MCP server handling Gmail API calls asynchronously.
  • mcp_client.py: MCP client functions to call server tools.
  • gmail_tools.py: LangChain tools wrapping MCP client functions.
  • app.py: Streamlit app UI for interacting with the agent.
  • requirements.txt: Python dependencies.

Configuration

  • Make sure to update your OpenAI API key in app.py or set the environment variable OPENAI_API_KEY.
  • The first run of the MCP server opens a browser for Gmail OAuth consent.

Usage

Enter natural language queries like:

  • “Read 5 latest emails”
  • “Send email to [email protected] with subject Hello and body Hi John”
  • “Create a label named Important”
  • “Set my Gmail signature to Best regards, Mukilan”

The LangChain agent will route the commands to appropriate Gmail API tools.

Tools

No tools

Comments