Local MCP server for Gmail — send, search, label emails with your Google account. No cloud middle.
Project description
honest-gmail-mcp
Local Gmail MCP server. Your emails never leave your machine except to Google. No third party in the middle.
Why this exists
Most Gmail integrations for AI assistants — including the "official" MCP connectors — route your emails through a third-party server before they reach the AI. That means the third party sees plaintext of every message you search, read, or send.
This project takes a different path: it runs on your machine, authenticates directly to Google Gmail API with your OAuth credentials, and exposes 6 tools to your local AI client (Claude Code, Claude Desktop, or any MCP-compatible client) over stdio.
Data flow: You ↔ this server (on your Mac) ↔ Google Gmail API. That's the whole path. No hosted service. No proxy. No third-party access to your inbox.
You can read the entire server — one file, ~240 lines of Python — and confirm for yourself.
Features
Six tools exposed over MCP:
search_messages— Gmail search syntax (e.g.from:foo@bar is:unread newer_than:7d)get_message— full headers + decoded text/plain bodysend_message— with optional local file attachments (this is a feature the official connector lacks)create_draft— same fields as send, does not sendlist_labels— all labels with idsmodify_labels— add/remove labels on a message
Requirements
- Python 3.10+
- A Google account you want to give it access to
- A one-time setup in Google Cloud Console (~10 min)
Setup
1. Clone
git clone https://github.com/bartosz-kuc/honest-gmail-mcp.git
cd honest-gmail-mcp
2. Install dependencies
python3 -m venv venv
./venv/bin/pip install -r requirements.txt
3. Get Google OAuth credentials
You create your own OAuth client in your own Google Cloud project. Nobody but you controls it.
- Go to https://console.cloud.google.com/ (signed in with the account you want to authorize)
- Create a new project (name it whatever, e.g.
gmail-mcp) - APIs & Services → Library → search Gmail API → Enable
- APIs & Services → OAuth consent screen:
- User Type: External → Create
- App name:
gmail-mcp - User support email + Developer contact: your email
- Test users: add the email you'll authorize
- APIs & Services → Credentials → + Create Credentials → OAuth client ID:
- Application type: Desktop app
- Download the JSON
- Save it as
credentials.jsonin this repo's root directory
4. First run (does the OAuth dance)
./venv/bin/python server.py
A browser tab will open. Sign in, click Allow. Token is saved locally as token.json. The server then starts serving MCP over stdio (nothing visible — it's designed to be launched by an MCP client, not run manually).
You can press Ctrl+C after the browser flow finishes — the token is saved.
5. Register with your MCP client
Claude Code:
claude mcp add gmail-personal /absolute/path/to/venv/bin/python /absolute/path/to/server.py
Claude Desktop: edit claude_desktop_config.json (find via Claude menu → Settings → Developer → Edit Config):
{
"mcpServers": {
"gmail-personal": {
"command": "/absolute/path/to/venv/bin/python",
"args": ["/absolute/path/to/server.py"]
}
}
}
Restart the client. Tools appear as mcp__gmail-personal__search_messages etc.
Data flow (in detail)
Your AI client (Claude Code / Claude Desktop)
↕ MCP protocol over stdio (local process pipe)
This server (Python, on your machine)
↕ HTTPS to googleapis.com
Google Gmail API
No cloud in the middle. No telemetry. No analytics. The server has no network dependencies beyond Google itself.
The credentials.json (your OAuth client secret) and token.json (your refresh token) stay on your disk. Both are .gitignored so a stray git push cannot leak them.
Security notes
- You own the OAuth client. Nobody else can revoke, rotate, or misuse it.
- You can revoke access anytime at https://myaccount.google.com/permissions.
- Scope requested:
gmail.modify— covers read, labels, send, drafts. It does not cover Gmail settings, filters, delegates, or account management. - No secrets are in git.
.gitignoreblockscredentials.json,token.json, and virtualenvs. - Audit the code.
server.pyis ~240 lines. Read it once and you know exactly what it can and cannot do.
Author
Bartosz Kuć — Warsaw-based developer, JDG owner running skanfirmy.pl.
-
Site: https://skanfirmy.pl
-
GitHub: https://github.com/bartosz-kuc
-
Email: firma@bartosza.pl
Consulting
Available for consulting on Polish tax and business integrations (KSeF, GUS/NFZ/GIOŚ APIs, mBank data), MCP server design, and AI-assisted tooling for JDGs and small teams. Reach out via email.
License
MIT — see LICENSE.
Contributing
Issues and PRs welcome. Please keep the code minimal and auditable — the whole selling point is that a user can read it in one sitting.
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 honest_gmail_mcp-0.1.0.tar.gz.
File metadata
- Download URL: honest_gmail_mcp-0.1.0.tar.gz
- Upload date:
- Size: 7.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
54d7b527b7616b5ae587e1d20b02b6f63bdb8b2985ffb67a6ba94e2660037a69
|
|
| MD5 |
b516d242762bcb4c86b2822aed4f897f
|
|
| BLAKE2b-256 |
e7f220490ab47f482dcf75bb86d2b34124ff8bf5ec862162bb3031e548a2525d
|
Provenance
The following attestation bundles were made for honest_gmail_mcp-0.1.0.tar.gz:
Publisher:
publish.yml on bartosz-kuc/honest-gmail-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
honest_gmail_mcp-0.1.0.tar.gz -
Subject digest:
54d7b527b7616b5ae587e1d20b02b6f63bdb8b2985ffb67a6ba94e2660037a69 - Sigstore transparency entry: 2218248255
- Sigstore integration time:
-
Permalink:
bartosz-kuc/honest-gmail-mcp@26391af81f4badba72be192b9131ad4fdf3a98d8 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/bartosz-kuc
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@26391af81f4badba72be192b9131ad4fdf3a98d8 -
Trigger Event:
push
-
Statement type:
File details
Details for the file honest_gmail_mcp-0.1.0-py3-none-any.whl.
File metadata
- Download URL: honest_gmail_mcp-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4e4cedfc9bfaf57160dc74cefbf4c7c962734788314006f60b8bdbb7ceabd592
|
|
| MD5 |
620ac19cfcfbf88a8258aa847c4c2030
|
|
| BLAKE2b-256 |
56746acbcbddba2a812c64ca36609f6735bcc413e721140556d3141d4ad83f2f
|
Provenance
The following attestation bundles were made for honest_gmail_mcp-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on bartosz-kuc/honest-gmail-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
honest_gmail_mcp-0.1.0-py3-none-any.whl -
Subject digest:
4e4cedfc9bfaf57160dc74cefbf4c7c962734788314006f60b8bdbb7ceabd592 - Sigstore transparency entry: 2218248285
- Sigstore integration time:
-
Permalink:
bartosz-kuc/honest-gmail-mcp@26391af81f4badba72be192b9131ad4fdf3a98d8 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/bartosz-kuc
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@26391af81f4badba72be192b9131ad4fdf3a98d8 -
Trigger Event:
push
-
Statement type: