SuperAPIAI Directory

honest-gmail-mcp

github.com · AI developer platforms

honest-gmail-mcp is a locally running Gmail MCP server written in Python that provides 6 Gmail operation tools to local AI clients (such as Claude Code, Claude Desktop, or other MCP-compatible clients) over stdio: search messages, read messages, send messages (with support for local attachments and in-thread replies), create drafts, list labels, and modify labels. It connects directly to the Gmail API using user-created Google OAuth credentials; the data path is only “user ↔ local machine server ↔ Google Gmail API,” without going through third-party hosted services or proxies. The project emphasizes auditability: the server core is a single file of a few hundred lines, credentials and tokens are stored locally and excluded by .gitignore, and the requested gmail.modify scope covers reading, labels, sending, and drafts, and does not involve Gmail settings, filters, delegation, or account management.

Open website Alternatives
PricingOpen source开源项目(可免费自部署)

About this tool

Purpose honest-gmail-mcp is a local Gmail MCP server whose goal is to let AI assistants access Gmail without going through a third-party server. The project description notes that most Gmail integrations (including the “official” MCP connector) forward email through a third-party server to the AI, so the third party can see the plaintext of messages that are searched, read, or sent; this project instead runs locally, authenticates directly to the Google Gmail API with the user's own OAuth credentials, and exposes tools to local AI clients over stdio.

Main capabilities The server exposes 6 tools via MCP:

  • search_messages: uses Gmail search syntax, e.g. from:foo@bar is:unread newer_than:7d.
  • get_message: returns the full headers and the decoded text/plain body.
  • send_message: supports optional local file attachments and can reply within a thread via reply_to_message_id (sets In-Reply-To / References and the Gmail threadId; to / subject default to the original sender and Re: <subject>).
  • create_draft: same fields as send (including replies), but does not actually send.
  • list_labels: lists all labels and their ids.
  • modify_labels: adds or removes labels on messages.

Usage Before use, you need a Google account to authorize and a one-time setup in the Google Cloud Console (about 10 minutes): create a project, enable the Gmail API, configure the OAuth consent screen (User Type: External, add test users), create an OAuth client ID of type “Desktop app” and download the JSON, saving it as credentials.json in the repository root. Then install dependencies and run authorize.py to complete the one-time OAuth authorization, log in in the browser and click Allow, and the refresh token is saved locally as token.json. If this step is skipped, the server performs the same browser flow on the first tool call.

When registering with an MCP client, taking Claude Desktop as an example, edit claude_desktop_config.json, add the command and arguments under mcpServers, and after restarting the client the tools appear in forms such as mcp__gmail-personal__search_messages. Claude Code's .mcp.json can use the same entries.

Regarding multiple accounts, one server instance serves one account; for more accounts, register one instance per account (the same code), specifying each one's token file and name via the environment variables GMAIL_TOKEN_PATH and GMAIL_SERVER_NAME. Paths are used as-is (no ~ expansion), so absolute paths should be used. You also need to add the additional addresses as test users on the OAuth consent screen, and use authorize.py to generate their tokens (a relative file name and an optional email can be passed to preselect the account). .gitignore covers token*.json to avoid committing them.

It can also be installed from PyPI (pip / uvx); the package contains only the server module (command honest-gmail-mcp), not authorize.py. The default credentials.json / token.json paths resolve next to the installed module (site-packages or the uv cache), which is unsuitable for storing secrets and may be cleared on upgrade, so both variables should be set to absolute paths in your own directory. If the token file does not yet exist, the server opens the browser consent flow on the first tool call and writes to GMAIL_TOKEN_PATH. These variables and the mcp 2.x API require version 0.2.0 or newer; 0.1.0 does not read them and fails to start with mcp 2.x.

Data flow and security The data path is: user ↔ local server ↔ Google Gmail API. There is no hosted service, no proxy, no telemetry, no analytics, and no network dependency other than Google. credentials.json (OAuth client secret) and token.json (refresh token) stay on disk, both excluded by .gitignore. The OAuth client is owned by the user, and access can be revoked at any time on the Google account permissions page. The requested scope is gmail.modify, covering reading,labeling, sending, and drafts, but not Gmail settings, filters, delegation, or account management. The main server, server.py, is a few hundred lines of Python and can be read through for auditing.

Use cases and limitations It is intended for users who want a local AI client to handle Gmail search, reading, sending, drafts, and labels while not wanting email content to pass through a third-party server. Limitations include: you must complete the Google Cloud Console configuration and OAuth authorization yourself; one instance corresponds to one account; the permission scope is limited; the project provides no hosted service; and specific pricing, cost, and performance information is not yet available. The project uses the MIT license, and the author is Bartosz Kuć.

Up/Down to navigate · Enter to open · ESC to closeBrowse all tools