MCP-Client-Server-EMAIL

LariZia/MCP-Client-Server-EMAIL

3.2

If you are the rightful owner of MCP-Client-Server-EMAIL and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

This project demonstrates an MCP-based client-server application that fetches recent Outlook emails via the Microsoft Graph API and summarizes them using Google Gemini.

Tools
  1. summarize_outlook_emails

    Fetches the latest emails from an authenticated Outlook mailbox and returns a summarized view using Gemini.

MCP Client-Server: Outlook Email Summarizer with Gemini

This project demonstrates an MCP-based client-server application that fetches recent Outlook emails via the Microsoft Graph API and summarizes them using Google Gemini. The system uses the Model Context Protocol (MCP) for structured, real-time interaction between client and server.


Overview

Features:

  • Fetches Outlook emails using Microsoft Graph API with OAuth2 (via MSAL).
  • Summarizes emails using Google Gemini for clear, concise insights.
  • Powered by FastMCP for a real-time tool-based interface.
  • Modular and easy to extend with additional tools.

Project Structure

.
β”œβ”€β”€ pyproject.toml          # Project configuration
β”œβ”€β”€ README.md               # Project documentation
β”œβ”€β”€ requirements.txt        # Project dependencies 
β”œβ”€β”€ client.py               # MCP client implementation
β”œβ”€β”€ server.py               # MCP server with summarization tool
└── uv.lock                 # Dependency lock file

Server Implementation

The server exposes the following tool:

summarize_outlook_emails

Fetches the latest emails from an authenticated Outlook mailbox and returns a summarized view using Gemini.

Arguments:

  • limit (int): Number of emails to fetch (default: 5)

Returns:

  • A textual summary of senders, subjects, and content highlights.

Client Implementation

The client connects to the server, lists the tools, and allows the user to call summarize_outlook_emails with a simple command-line prompt.


Prerequisites

  • Python 3.9+
  • uv
  • API credentials in a .env file:

Required Environment Variables

GOOGLE_API_KEY=your_google_api_key
GEMINI_MODEL=gemini-pro

CLIENT_ID=your_azure_app_client_id
CLIENT_SECRET=your_azure_app_client_secret
TENANT_ID=your_azure_tenant_id

Installation

# Install all dependencies
uv add -r requirements.txt .

Running the Example

# Run the client (which starts the server)
uv run client.py

Example Interaction

Available tools: ['summarize_outlook_emails']

You: summarize_outlook_emails limit=3

Assistant:
Here’s a summary of your latest 3 emails:
- From: Alice Smith – Subject: Q3 Report Reminder – Discusses upcoming Q3 deadlines.
- From: IT Support – Subject: Scheduled Maintenance – Notifies planned server downtime.
- From: John Doe – Subject: Lunch Meeting – Proposes rescheduling this week’s lunch.

You: Exit
Exiting...

Debugging & Inspection

You can inspect tool calls and server behavior using the MCP Inspector.

  1. Start the server directly:
mcp dev server.py
  1. Open the inspector in your browser: http://localhost:5173

Resources


License

This project is licensed under the MIT License. See LICENSE for details.