MCP Email Orchestrator
Allows sending emails via Gmail's SMTP server using the send_email tool.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@MCP Email Orchestratorsend an email to alice@example.com with subject 'Hello' and body 'How are you?'"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
MCP Email Orchestrator
An intelligent email orchestration system built using the Model Context Protocol (MCP), FastAPI, and Ollama. This project demonstrates how to seamlessly connect local Large Language Models (LLMs) to external tools—specifically, an SMTP email sender—using a standardized client-server architecture.
Table of Contents
Related MCP server: Email MCP
What is the Model Context Protocol (MCP)?
The Model Context Protocol (MCP) is an open standard introduced by Anthropic in November 2024. It provides a universal, standardized way for AI applications (like LLMs) to connect with external systems, data sources, and tools. Before MCP, developers had to write custom integrations for every new data source or tool they wanted their AI to use. MCP solves this by establishing a consistent, two-way communication protocol based on JSON-RPC 2.0.
MCP Client vs. MCP Server
MCP follows a strict client-server architecture:
MCP Host / Client: The AI application or agent (in this project, the FastAPI orchestrator running the Ollama model). The client maintains a connection to the server, requests context, and asks the server to execute specific tools based on the LLM's reasoning.
MCP Server: A lightweight program that exposes specific capabilities (Tools, Resources, or Prompts) to the client. In this project, the
email_mcp_server.pyacts as the MCP Server, exposing asend_emailtool that handles the actual SMTP communication.
By separating the AI logic (Client) from the execution logic (Server), MCP ensures secure, modular, and scalable AI tool use.
Project Architecture
This project implements a complete MCP lifecycle using a local LLM:
FastAPI Orchestrator (The Host):
main.pyserves as the entry point. It manages the lifecycle of the MCP Server, spawning it as a subprocess via standard input/output (stdio) transport.Dynamic Tool Discovery: Upon startup, the FastAPI app connects to the MCP Server, dynamically fetches the available tools (e.g.,
send_email), and translates the MCP tool schemas into a format that the Ollama LLM understands.The LLM (Ollama): When a user sends a prompt via the
/chatendpoint, the orchestrator passes the prompt and the available tools to the local LLM.Tool Execution: If the LLM determines that an email needs to be sent, it returns a tool call request. The orchestrator routes this request back to the MCP Server.
MCP Server (The Executor):
email_mcp_server.pyreceives the execution request, securely accesses the SMTP credentials from the environment, and sends the email.
LLM Integration
This project utilizes Ollama to run local, open-source models.
Default Model:
qwen2.5:1.5bFunction Calling: The project leverages the native function-calling capabilities of modern LLMs. The system prompt explicitly instructs the model: "You are a helpful assistant. If the user wants to send an email, use the send_email tool."
Bulletproof Extraction: The orchestrator includes robust parsing logic to handle the LLM's responses, ensuring that tool calls are accurately extracted whether the model returns them as dictionaries or Pydantic objects.
What This Project Achieves
Standardized AI Tooling: Demonstrates a working implementation of the newly released Model Context Protocol, moving away from hardcoded tool logic to dynamic discovery.
Local AI Privacy: By using Ollama, the reasoning engine runs entirely locally, ensuring that user prompts are not sent to third-party APIs.
Secure Credential Management: The MCP Server handles the sensitive SMTP credentials (
.env), keeping them isolated from the LLM and the main orchestrator logic.Extensibility: Because it uses MCP, adding new capabilities (like reading files, querying a database, or searching the web) is as simple as adding a new tool to the MCP Server—no changes to the core LLM routing logic are required.
Repository Structure
MCP_Email/
├── main.py # FastAPI app, MCP Client, and Ollama orchestrator
├── email_mcp_server.py # FastMCP Server exposing the send_email tool
├── requirements.txt # Python dependencies
├── .env # (Not tracked) SMTP credentials
└── tools/
├── email_tool.py # Core SMTP execution logic
└── mcp_registry.py # Tool schemas and registryInstallation & Setup
Prerequisites
Python 3.10+
Ollama installed and running locally.
The
qwen2.5:1.5bmodel pulled in Ollama (ollama run qwen2.5:1.5b).
1. Clone the Repository
git clone https://github.com/SOUGUR/MCP_Email.git
cd MCP_Email2. Install Dependencies
pip install -r requirements.txt3. Configure Environment Variables
Create a .env file in the root directory and add your SMTP credentials:
SENDER_EMAIL=your_email@gmail.com
SENDER_PASSWORD=your_app_password
SMTP_SERVER=smtp.gmail.com
SMTP_PORT=587Usage
Start the Orchestrator:
python main.pyNote: The FastAPI app will automatically spawn and connect to the MCP Server on startup.
Send a Request: You can interact with the system by sending a POST request to the
/chatendpoint.curl -X POST "http://localhost:8000/chat" \ -H "Content-Type: application/json" \ -d '{"prompt": "Please send an email to test@example.com with the subject Hello and body This is a test from MCP."}'Expected Output: The LLM will process the natural language request, trigger the
send_emailtool via the MCP Server, and return the execution results.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/SOUGUR/MCP_Email'
If you have feedback or need assistance with the MCP directory API, please join our Discord server