Orchestrate Email with Gmail and Outlook
A unified Gmail/Outlook MCP server with agentic email tools and OAuth credential helpers for both providers.
Maintainer of this project? Claim this page to edit the listing.
1.0.0Add to Favorites
Why it matters
Unify your email management across Gmail and Outlook with a robust MCP server. Automate complex email tasks and integrate with agentic assistants for enhanced productivity.
Outcomes
What it gets done
Manage email across Gmail and Outlook via a unified interface.
Automate email sending, searching, archiving, and replying.
Securely inject credentials for seamless provider access.
Enable agentic workflows for advanced email management.
Install
Add it to your toolbox
Run in your project directory:
curl -fsSL https://spark.entire.vc/get/vb-mailnet | bash Capabilities
Tools your agent gets
Create and send email messages
Retrieve and view email messages
Prepare email messages as drafts
Finalize and send prepared draft messages
Search mailbox with semantic filters
Change email categories and labels
Archive messages to clean up mailbox
Reply to messages in conversation context
Overview
MailNet MCP Server
A unified MCP server for Gmail and Outlook email, exposing agentic send/read/search/reply/draft tools plus a per-organization tone and signature profile. Use when an assistant needs to send, read, search, label, or reply to email across Gmail and/or Outlook through one consistent tool surface.
What it does
A unified, agentic email orchestration MCP server that abstracts Gmail and Outlook behind one standardized interface - automatic token refresh, credential hygiene, and a common base class other providers can extend. It exposes 11 tools for assistant-driven email work: send_email, read_email, create_draft, send_draft, search_email (semantic inbox filters), toggle_label, archive_email, reply_email (thread-aware), delete_email, plus load_email_settings/update_email_settings for an agentic email-settings profile (language, tone, writing style, sender/organization name, signature template, preferred greeting, auto-adjust-tone, thread-context inclusion, character limit, and a prompt prefix framing the assistant's persona per organization). It's the MCP server that powers the standalone MailNet Mailing Agentic AI project. The provider layer is designed to be extended rather than forked: adding a new email provider means subclassing the server's base client and implementing its predefined hooks, so Gmail and Outlook share one code path instead of duplicated logic per provider.
When to use - and when NOT to
Use it when an assistant needs to send, read, search, label, archive, reply to, or draft email across Gmail and/or Outlook through one consistent tool surface rather than two separate provider integrations. Local/desktop use (including Claude Desktop) requires the is_local environment variable to be set (its value doesn't matter, only its presence) - this flag makes the server flexible enough to run over HTTP(S) or stdio, and routes it to read credentials from local files rather than expect them via client HTTP headers.
Capabilities
git clone https://github.com/Astroa7m/MailNet-MCP-Server.git
cd MailNet-MCP-Server
Beyond the core email actions, the server ships credential-acquisition helpers for both providers: email_client/outlook_helpers.py's acquiring_azure_token_for_personal_use() opens a browser sign-in, redirects to http://localhost:3000/callback, and expects the code parameter pasted back into the terminal to produce a local azure_token.json; email_client/gmail_helpers.py's acquiring_google_token_for_personal_use() runs the equivalent OAuth flow for Gmail, producing google_token.json. Configuration is entirely environment-variable driven: AZURE_APPLICATION_CLIENT_ID/AZURE_CLIENT_SECRET_VALUE/AZURE_PREFERRED_TOKEN_FILE_PATH for Outlook, GOOGLE_CREDENTIALS_FILE_PATH/GOOGLE_PREFERRED_TOKEN_FILE_PATH for Gmail. The agentic email-settings profile itself is a structured record covering language, tone, writing style, sender name, organization name, whether to include a signature (with a {{sender_name}}/{{organization_name}} template), a preferred greeting template, whether tone auto-adjusts per message, whether prior thread context is included, a character limit, a default provider (Gmail or Outlook), and a prompt prefix that frames the assistant's persona for that organization - all readable via load_email_settings and changeable via update_email_settings without redeploying the server.
How to install
Install dependencies with pip install -r requirements.txt, optionally installing uv first (powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"), then launch with uv run -m mcp_launcher.server or python -m mcp_launcher.server. For Claude Desktop, add an email_mcp entry to claude_desktop_config.json pointing command at uv with --directory <path> run -m mcp_launcher.server and the provider env vars (plus is_local: "true") under env. Acquire the Azure and Google tokens first via the credential helpers above, then point the corresponding *_PREFERRED_TOKEN_FILE_PATH/*_CREDENTIALS_FILE_PATH variables at the resulting token files.
Who it's for
Developers building an email-capable AI assistant who want one MCP surface for both Gmail and Outlook - with credential handling, thread-aware replies, and a per-organization tone/signature profile already built in - instead of wiring two separate provider SDKs and reply/threading logic themselves.
Source README
๐ฌ MailNet MCP Server
MailNet Server is a unified, agentic email orchestration server built for the Model Context Protocol. It supports Gmail and Outlook with standardized metadata, secure credential injection, and a rich toolset for assistant-driven workflows. It is the MCP server that powers MailNet Mailing Agentic AI.
๐ Features
- โ Unified Gmail + Outlook abstraction
- โ Automatic token refresh and credential hygiene
- โ Standardized base class for provider extension
- โ Agentic email settings endpoint (tone, signature, thread context, etc.)
- โ Modular toolset: send, read, search, label, archive, reply, delete, draft
๐ Installation
1. Manual Clone & Launch
git clone https://github.com/Astroa7m/MailNet-MCP-Server.git
cd MailNet-MCP-Server
Install requirements
pip install -r requirements.txt
Note if you are going to use uv for launching you should first install it via:
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
Launch
Either with uv via:
uv run -m mcp_launcher.server
or
python -m mcp_launcher.server
Acquiring Azure Token (Personal local use)
- Go to
email_client/outlook_helpers.py. - run the file (by default runs
acquiring_azure_token_for_personal_usefunction.
To acquireclient_id&client_secretPlease check Azure Authorization Guide
And make sure to add them to your env vars with the names shown below.
def acquiring_azure_token_for_personal_use():
load_dotenv()
client_id = os.getenv("AZURE_APPLICATION_CLIENT_ID")
client_secret = os.getenv("AZURE_SECRET_VALUE")
OutlookClient(client_id=client_id, client_secret=client_secret,
redirect_uri="http://localhost:3000/callback")
It will do the following:
- launch the browser and prompt you to sign in to your outlook account.
- After successful login and approval of permissions, it will redirect you to
http://localhost:3000/callbackunless you specified different url in the constructor viaredirect_uriparam. - Copy the code after
code=and before&client_infowithin the browser url and paste it in the terminal where you launched the file. - Done now you will have your azure token under
email_clientnamedazure_token.jsonby default (can be changed viatoken_file_nameparam inOutlookClientconstructor).
- Provide that path to
AZURE_PREFERRED_TOKEN_FILE_PATHenv variable and you are good to go.
Acquiring Google Token (Personal local use)
- Go to
email_client/gmail_helpers.py. - run the file (by default runs
acquiring_google_token_for_personal_usefunction.
To acquiregoogle_credentials_filePlease check Google Authorization Guide
And make sure to add the path to it in your env vars with the name shown below.
def acquiring_google_token_for_personal_use():
load_dotenv()
google_credentials_file = os.getenv("GOOGLE_CREDENTIALS_FILE_PATH")
GmailClient(credential_file=google_credentials_file)
It will do the following:
- launch the browser and prompt you to sign in to your gmail account.
- After successful login and approval of permissions, it will redirect you to a window with a message
The authentication flow has completed. You may close this window.that means you are done here. - Done now you will have your google token under
email_clientnamedgoogle_token.jsonby default (can be changed viatoken_file_nameparam inGmailClientconstructor).
- Provide that path to
GOOGLE_CREDENTIALS_FILE_PATHenv variable and you are good to go.
๐ Environment Variables
Check the Azure Authorization Guide and Google Authorization Guide to learn how to set up both accounts and get your credentials ready.
Set your environment variables for provider credentials:
Gmail
GOOGLE_CREDENTIALS_FILE_PATH=path/to/google_credentials.json
GOOGLE_PREFERRED_TOKEN_FILE_PATH=path/to/google_token.json
Outlook (Azure)
AZURE_APPLICATION_CLIENT_ID=your-client-id
AZURE_CLIENT_SECRET_VALUE=your-secret
AZURE_PREFERRED_TOKEN_FILE_PATH=path/to/azure_token.json
Other (Important for local use)
The following env variable is important to be set when running it locally or for Claude Desktop. The value deosn't matter but as long as the field is there you will be able to run it locally.
It was introduced to make the server flexible to be run over http/s or stdio and to route the server to either look for credentials in local files or expect it from the client via http/s headers.
is_local="true"
๐ฅ Claude Desktop Integration
Add the following to your claude_desktop_config.json:
{
"mcpservers": {
"email_mcp": {
"command": "uv",
"args": [
"--directory",
"C:\\Path\\To\\mcp-server",
"run",
"-m",
"mcp_launcher.server"
],
"env": {
"AZURE_APPLICATION_CLIENT_ID": "<AZURE_APPLICATION_CLIENT_ID>",
"AZURE_CLIENT_SECRET_VALUE": "<AZURE_CLIENT_SECRET_VALUE>",
"AZURE_PREFERRED_TOKEN_FILE_PATH": "C:\\Path\\To\\azure_token.json",
"GOOGLE_CREDENTIALS_FILE_PATH": "C:\\Path\\To\\google_credentials.json",
"GOOGLE_PREFERRED_TOKEN_FILE_PATH": "C:\\Path\\To\\google_token.json",
"is_local": "true"
}
}
}
}
๐ง Agentic Email Settings
You can view settings via the load_email_settings tool or update them via the update_email_settings tool.
{
"language": "en",
"tone": "formal",
"writing_style": "clear_and_concise",
"sender_name": "Ahmed Samir",
"organization_name": "Kalima Tech",
"include_signature": true,
"signature": "Best regards,\n{{sender_name}}\n{{organization_name}}",
"preferred_greeting": "Dear {{recipient_name}},",
"auto_adjust_tone": true,
"include_thread_context": true,
"character_limit": 1000,
"prompt_prefix": "You are an AI email assistant for {{organization_name}}. Keep messages professional, polite, and to the point.",
"default_provider": "google"
}
๐ฆ Tools Supported
| Tool | Description |
|---|---|
| send_email | Compose and send messages |
| read_email | Fetch and inspect messages |
| create_draft | Prepare messages |
| send_draft | Finalize and send |
| search_email | Query inbox with semantic filters |
| toggle_label | Modify categories/labels |
| archive_email | Clean up inbox |
| reply_email | Respond in thread context |
| delete_email | Remove messages |
| load_email_settings | View current email settings |
| update_email_settings | Update runtime email settings |
๐ค Contributing
MailNet server is modular and extensible. To add a new provider, subclass the base client and implement the predefined hooks. PRs welcome!
FAQ
Common questions
Discussion
Questions & comments ยท 0
Sign In Sign in to leave a comment.