AgentMail MCP server for AI assistant email integration
Project description
AgentMail MCP Integration
A simple Model Context Protocol (MCP) server that integrates with AgentMail to dynamically manage email inboxes, list messages, and send or reply to emails—all through an AI assistant such as Claude. This reference implementation demonstrates how to use AgentMail’s API within an MCP server to orchestrate mailboxes on the fly.
Important Note
This is a personal project tailored to demonstrate how to integrate AgentMail into an MCP workflow. It’s a minimal example covering only basic mailbox and message operations. For real-world use, you’ll likely need to modify and expand on these ideas.
Features
- Create new inboxes dynamically on the fly
- List and retrieve inboxes to see what’s active
- Send emails from any of your AgentMail inboxes
- Reply to messages within existing threads
- List threads and messages for a chosen inbox
- Retrieve attachments for messages
Prerequisites
- Python 3.10+
- AgentMail account (or valid API key)
- (Optional) Claude Desktop or any other front-end that supports MCP commands
Installation
Below are different ways to install and run the server. Once installed, you can reference it in your Claude Desktop configuration (or run it directly) to enable email management tools.
Option 1(Recommended): PIP (Local or PyPI)
If you maintain your own Python environment, simply install the package from your virtual enviornment (from PyPI or a local source):
pip install agentmail-mcp
Then run:
agentmail-mcp-server –api-key=“YOUR_AGENTMAIL_API_KEY”
This will get the server running on your local machine.
If you want to interact with the server from Claude Desktop, follow these exact steps.
- Activate your virtual environment.
source .venv/bin/activate
- Run which to find out where the MCP server is located.
which agentmail-mcp
-
Copy the path that is returned.
-
Paste the path into the
commandfield in theclaude_desktop_config.jsonfile. -
Restart Claude Desktop.
Here is what the claude_desktop_config.json file should look like:
{
"mcpServers": {
"agentmail-mcp": {
"command": "/path/to/agentmail-mcp",
"args": ["--api-key", "{AGENT_MAIL_API_KEY}"]
}
}
}
If you don't have a claude_desktop_config.json file, create one in the following directory:
On macOS, the config file is typically located at: ~/Library/Application Support/Claude/claude_desktop_config.json
On Windows, it’s usually located at: %APPDATA%/Claude/claude_desktop_config.json
After saving, restart Claude Desktop to load the new MCP server.
Usage
With your server running in Claude Desktop (or another MCP client), you can prompt Claude with natural language commands that map to AgentMail MCP tools. For example: • “Create a new inbox named demo.” • “List all my inboxes.” • “Send an email from inbox test@agentmail.to to test@example.com with subject ‘Hello’ and body explaining the weather in San Francisco for the past week. • “Reply to the most recent message in inbox abc123.”
Internally, Claude calls the exposed MCP tools (create_inbox, list_inboxes, send_message, etc.), which in turn call the AgentMail API.
License
License
MIT License - This project is distributed under the MIT license. Use at your own risk.
⸻
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file agentmail_mcp-0.2.0.tar.gz.
File metadata
- Download URL: agentmail_mcp-0.2.0.tar.gz
- Upload date:
- Size: 19.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4dfff154ee00d5cde05b475e9fc5053a86d5dedc26faa02a13bf033c7f78185b
|
|
| MD5 |
b38c6c2d0eca870808e34ba1e3896fdf
|
|
| BLAKE2b-256 |
14e468357267cd73b56d30c8c11e3c9247f147393c1ada8cedb1d2090512c539
|
File details
Details for the file agentmail_mcp-0.2.0-py3-none-any.whl.
File metadata
- Download URL: agentmail_mcp-0.2.0-py3-none-any.whl
- Upload date:
- Size: 7.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2fb7116442273a56a6c273b899d0ea2e5e8afed41242966cce8be5817fed7e2e
|
|
| MD5 |
e81c5b9579967af56747b402126a5ecf
|
|
| BLAKE2b-256 |
605c76bdc3f98461af97c87f37030cd68d992a6aea8d87225d275dcb99058e20
|