list_emailsLABSCO SUMMARY
Cross-account search is the one that saves real time.
search_all_emails runs one query over every configured Gmail and IMAP account, which is the thing no single mail client does well. Every other tool auto-detects the account type from the name, so you never have to remember which of your addresses is which protocol.
What it is
A server that fronts both Gmail (over OAuth2) and IMAP accounts behind a single interface. The account type is detected from the name you pass, so the same tool works on either.
What you get
- list_emails — messages from any account, with folder, limit and unread-only filters
- search_emails — search one account, with the account type resolved automatically
- search_all_emails — one query across every configured Gmail and IMAP account at once
- get_email_detail — the full message
- archive_email — archive on either account type, optionally clearing unread
- send_email — send from any account, with cc, bcc and attachments
- list_accounts, test_connection and get_account_stats for configuration and health
- Encrypted password storage for IMAP accounts, and helper scripts for the Gmail OAuth setup
Requirements
Node, built from the repository. An encryption key for stored passwords is required. Gmail accounts need OAuth2 client credentials plus a refresh token per account, obtained through the bundled auth script; IMAP accounts need host, user, encrypted password, port and TLS settings per account.
Setup effort
Build from source — git clone https://github.com/kentaroh7777/mcp-email-server.git
USE CASES
Finding a message across all your accounts
Run one search across every configured Gmail and IMAP account and sort the results together.
Clearing what is unread on one address
List unread messages from that account and folder, read the ones that matter and archive the rest.
Sending a reply with a file attached
Send from the right account with cc, bcc and attachments, without switching clients.
Finding out why one account stopped working
List the accounts with their status, test the connection to the failing one, and read the overall stats.
9 tools
Listed in project docs. Your client may show a different list.
search_emailssearch_all_emailsget_email_detailarchive_emailsend_emaillist_accountstest_connectionget_account_statsBEFORE YOU INSTALL
What to know first
Tools you get
9 tools named in the project's documentation. The .mjs, .ts and .sh scripts listed beside the tools, such as gmail-desktop-auth.mjs, are run by hand, not MCP tools. send_email and archive_email write.
Requires
- EMAIL_ENCRYPTION_KEY in .env — required, a 32-character key you make up yourself
- For a Gmail account: GMAIL_CLIENT_ID and GMAIL_CLIENT_SECRET, then a refresh token from scripts/gmail-desktop-auth.mjs
- For an IMAP account: IMAP_HOST_, IMAP_USER_ and IMAP_PASSWORD_, each followed by the account name — one account of either kind is enough
Where it runs
The documented client runs the server on your machine.
INSTALLATION
Connect your client
This one is built from source rather than installed with a single command.
Server setup
git clone https://github.com/kentaroh7777/mcp-email-server.git
cd mcp-email-server
npm install
cp .env.example .envEdit .env (the project uses nano .env): EMAIL_ENCRYPTION_KEY is required (a 32-character key used to encrypt stored passwords); for Gmail add GMAIL_CLIENT_ID, GMAIL_CLIENT_SECRET and GMAIL_REDIRECT_URI=urn:ietf:wg:oauth:2.0:oob; for IMAP add IMAP_HOST_, IMAP_USER_, IMAP_PASSWORD_, IMAP_PORT_ and IMAP_TLS_ each followed by your account name
For each Gmail account, run the OAuth script once, with ACCOUNT_NAME being the label you used in that account's .env variable names.
node scripts/gmail-desktop-auth.mjs ACCOUNT_NAMEFor each IMAP account, run the interactive setup instead.
node scripts/setup-xserver.mjsStart the server. If it was already running when you added an account, run ./scripts/server.sh restart instead so it picks the account up.
./scripts/server.sh startMCP Clients
Any MCP client — HTTP
{
"mcpServers": {
"mcp-email-server": {
"url": "http://localhost:3456/mcp",
"type": "http"
}
}
}