MCP Email Orchestrator
Allows sending emails via Gmail's SMTP server using the send_email tool.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
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 deployed
Maintenance
Related MCP Connectors
Email infrastructure for AI agents — send, receive, search, and reply to email over MCP.
Let AI agents send email from your own Gmail, Microsoft 365 or SMTP inbox, with guardrails.
AI-native email for businesses, developers, and AI agents.
Connect AI agents to Emitd email sending, message tracking, templates, and automations. Emitd hosts a Model Context Protocol server for integrating supported email operations into AI-agent workflows. Connect a compatible client to the hosted endpoint (https://mcp.emitd.com/mcp) and authenticate with an Emitd API key. Available tools depend on the key's permissions and enabled features. Emitd's capability areas include sending email, message activity, templates, contacts, audiences, segments, domains, analytics, inbound email, broadcasts, automations, webhooks, and suppressions. Use restricted keys, sending guardrails, and approval settings appropriate to each workflow. For more information check https://emitd.com
Related MCP Servers
- AlicenseNot gradedqualityFmaintenanceA Model Context Protocol server that enables LLMs to compose and send emails with attachments, as well as search for files in specified directories that match given patterns.81MIT
- AlicenseCqualityBmaintenanceA Model Context Protocol server that enables AI models to send emails via simple tool calls, supporting both plain text and HTML formats with JWT authentication.115 npm17ISC

@sendraven/mcpofficial
AlicenseBqualityCmaintenanceEnables AI agents to send and manage email, read threaded replies, run campaigns and automations, and handle approvals through the Model Context Protocol from any compatible client.45200 npm1MIT- AlicenseNot gradedqualityAmaintenanceEnables AI assistants to read, search, send, manage, schedule, and analyze email across multiple IMAP and SMTP accounts, with tools, prompts, and resources exposed over the Model Context Protocol. It also supports real-time inbox watching with AI triage, provider-aware label management, calendar extraction, analytics, and OAuth2 authentication.18 npmISC