MCP ExplorerExplorer

Mcp Gmail Calender

@harshdabhion 8 days ago
1 MIT
FreeCommunity
AI Systems
Langchain agent that orchestrates interactions with multiple MCP (Multi-tool Coordination Protocol) servers, including custom Gmail and Google Calendar , Duck Duck go integrations,

Overview

What is Mcp Gmail Calender

The Langchain MCP Agent is a project that integrates various Multi-tool Coordination Protocol (MCP) servers, specifically focusing on a custom Gmail MCP server and a Google Calendar MCP server, along with additional utilities like math and search tools within the Langchain framework.

Use cases

The agent can be utilized for managing and automating tasks related to email and calendar functionalities, allowing users to send emails, schedule meetings, and perform calculations seamlessly through interactive commands. It can be especially useful for users looking to streamline their productivity and automate repetitive tasks using natural language queries.

How to use

To use the Langchain MCP Agent, clone the repository, install the necessary dependencies, and set up the environment variables in a .env file. Configure the MCP servers accordingly, authenticate with Gmail and Google Calendar, and then run the Langchain agent using a provided command. Users can interact with the agent through a terminal interface to execute various tasks.

Key features

Key features of the Langchain MCP Agent include integration with multiple MCP servers, support for Gmail and Google Calendar functionality, utility tools for mathematics and search, and the ability to trace agent interactions with LangSmith for better insights and debugging.

Where to use

The Langchain MCP Agent can be effectively used in personal productivity environments, including individual users looking to manage their emails and calendars, as well as teams that require automated scheduling and communication tools. It is suited for applications where automation and coordination between multiple tools are essential.

Content

Langchain MCP Agent

This project demonstrates a Langchain agent integrated with multiple MCP (Multi-tool Coordination Protocol) servers, including a custom Gmail MCP server, a Google Calendar MCP server, and other utility tools like math and search.

Setup and Running Locally

To run this project on your local system using uv, follow these steps:

  1. Clone the repository:

    git clone https://github.com/harshdabhi/mcp_gmail_calender.git
    cd mcp_gmail_calender
    
    
    
  2. Install uv:

    If you don’t have uv installed, you can install it using pip:

    pip install uv
    

    Or, if you prefer a standalone executable, follow the instructions on the official uv documentation.

  3. Install Python Dependencies:

    Ensure you have all the necessary Python packages installed. From the project root, run:

    uv pip install -r requirements.txt
    
  4. Set up Environment Variables (.env file):

    Create a .env file in the root of your project and add your GROQ_API_KEY:

    GROQ_API_KEY=your_groq_api_key
    

    Replace your_groq_api_key with your actual Groq API key.

  5. Configure MCP Servers:

    The project uses a mcp_config/mcp_servers_file.json to configure the MCP servers. Ensure this file is correctly set up with the paths to your local MCP server implementations.

  6. Gmail MCP Server Setup:

    For detailed instructions on how to enable and authenticate the Gmail MCP server, refer to its documentation:
    https://glama.ai/mcp/servers/@GongRzhe/Gmail-MCP-Server

    A common step involves moving your gcp-oauth.keys.json to ~/.gmail-mcp/ and running an npx command for authentication:

    mkdir -p ~/.gmail-mcp/
    mv <path_to_your_gcp-oauth.keys.json> ~/.gmail-mcp/
    npx @gongrzhe/server-gmail-autoauth-mcp auth
    

    Note: You need Node.js and npm installed for npx to work. If you encounter npx: command not found, please install Node.js and npm (e.g., using brew install node on macOS).

  7. Google Calendar MCP Server Setup:

    For detailed instructions on how to enable and use the Google Calendar MCP server, refer to its documentation:
    https://glama.ai/mcp/servers/@cablate/mcp-google-calendar

    Similar to Gmail, you might need to set up authentication and ensure GOOGLE_CALENDAR_ID, GOOGLE_TIME_ZONE, and GOOGLE_CREDENTIALS_PATH are correctly configured, preferably via environment variables in your .env file.

  8. Run the Langchain Agent:

    Once all dependencies are installed and configurations are in place, you can run the Langchain agent:

    python server/langchain_server
    

    This will start an interactive chat in your terminal. Type your queries, and the agent will respond using the configured MCP tools. Type exit or quit to end the session.

LangSmith Tracing

This project is configured to use LangSmith for tracing agent interactions. To enable tracing, ensure you have the following environment variables set in your .env file:

LANGCHAIN_TRACING_V2=true
LANGCHAIN_API_KEY=your_langsmith_api_key
LANGCHAIN_PROJECT=your_project_name  # Optional: Replace with your desired project name

Replace your_langsmith_api_key with your actual LangSmith API key.

After setting these variables, run the agent as described in step 8 of the “Setup and Running Locally” section. Your traces will automatically appear in your LangSmith account.

Video Demonstration

Watch the video

Tools

No tools

Comments