Let AI assistants like Claude Desktop, ChatGPT and Claude Code read, search, organize and reply to your GMail email — all from your own computer, with no cloud connector and no sharing your password with a third party.
MCP (Model Context Protocol) is an open standard that lets AI assistants connect to the apps and data you already use. When an app exposes an "MCP server", assistants like Claude and ChatGPT can call it to look things up and take actions on your behalf.
gmail.com (Google Mail) doesn't offer an MCP server of its own, but it supports IMAP, which means you can use an email program like Mailspring to sync your GMail mailbox to your computer. Mailspring includes a built-in MCP server that runs locally, so any MCP-compatible assistant on your machine can work with your GMail email.
Follow these steps to connect your GMail account to your AI assistant:
Mailspring is a free desktop email application with a built-in MCP server for AI assistants. It works on Mac, Linux, and Windows.
Run Mailspring and choose Gmail or G Suite on the email setup screen, then sign in to your GMail account in the browser window that appears. Mailspring also supports the IMAP / SMTP settings for GMail if you prefer. Mailspring is a full email client and syncs your gmail.com (Google Mail) email to your computer, which is what makes it available to your AI assistant. Your email should be displayed in a few minutes.
Open Preferences in Mailspring and click the MCP Server tab.
Flip the Enable MCP Server switch on — you'll see a green "Running" badge
when it's ready. The server is off by default and only listens on your own computer
(127.0.0.1), so nothing is exposed to your network or the internet.
From this screen you can also choose an Access Level that controls what your assistant is allowed to do:
Under Account Access, you can limit which accounts and folders are visible to the assistant, so it can see your GMail inbox but not, say, a personal account or a confidential folder.
The Quick Setup buttons write the connection details into each app's config file for you. Click the one for the assistant you use — that's all you need to do! Restart the assistant and start a new chat, and Mailspring will appear as a connected tool.
claude mcp add so Claude Code can work with your email from the terminal.
Using something else, like Cursor, VS Code or another MCP-compatible tool? Mailspring's server uses the standard Streamable HTTP transport, so any MCP client can connect to it. Copy the Endpoint and Bearer Token shown in the Connection panel into your client's MCP settings. For most clients that means a JSON entry like this:
{
"mcpServers": {
"mailspring": {
"url": "http://127.0.0.1:2587/mcp",
"headers": {
"Authorization": "Bearer <your token from the MCP Server tab>"
}
}
}
}
Open a new chat in your assistant and ask it about your GMail email. Try prompts like:
Every call the assistant makes is recorded in the Activity Log at the bottom of the MCP Server tab, so you can always see exactly what it looked at and what it changed.
Mailspring's MCP server exposes a focused set of tools. The Access Level you choose in Step 3 determines which groups are available:
| Read & search |
search_mail list_threads get_thread get_message
get_attachment list_folders list_accounts
Search with Gmail-style queries like from:alice is:unread has:attachment since:"last week", read full threads, and view attachments.
|
|---|---|
| Insights |
get_message_tracking list_tracked_messages get_top_links
list_scheduled_sends
See which sent messages were opened, which links were clicked, and what's queued to send later.
|
| Organize & draft |
create_draft reply_to_thread archive_threads trash_threads
move_to_folder set_labels set_unread set_starred
cancel_scheduled_send
Requires Read & Write. Drafts are saved in Mailspring for you to review — nothing is sent.
|
| Send |
send_draft schedule_send
Requires Read, Write & Send. Send a draft now or schedule it for later, just like the composer's "Send Later" button.
|
Unlike cloud email integrations, Mailspring never uploads your GMail mailbox to a
third-party service to make it available to AI. The MCP server runs inside the Mailspring app on
your machine, listens only on localhost, and requires a secret bearer token that you
can regenerate at any time. Combined with the access level, per-account and per-folder controls,
and the activity log, you stay in charge of what your assistant can see and do.
Click your email provider below to learn how to connect it to your AI assistant via MCP: