Gmail MCP Server
A complete, production-grade Model Context Protocol (MCP) server that empowers an AI assistant to read, search, analyze conversation threads, draft, send, reply to, categorize, and batch-automate Gmail mailboxes.
📁 Project Structure
gmail-mcp-server/
│
├── server.py # 20 FastMCP Tools exposed for AI models / agents
├── auth.py # Google OAuth 2.0 authentication & automatic token refresh
├── gmail_service.py # Gmail API integration (threads, attachments, drafts, labels)
│
├── credentials.json # Google OAuth client secrets (configured)
├── token.json # Generated automatically after login
│
├── web_app.py # Web dashboard & interactive MCP playground
├── requirements.txt # Dependencies (mcp, google-api-client, etc.)
├── .env # Configuration file (custom paths, port)
└── README.md # Documentation
🧰 All 20 Registered MCP Tools
1. 📖 Reading & Analysis
get_user_profile: Returns connected Gmail address and total message statistics.list_unread_emails(max_results): Lists recent unread emails from the inbox with sender, subject, date, and snippet.search_emails(query, max_results): Searches emails with standard Gmail filters (from:,to:,subject:,after:,has:attachment).get_email(message_id): Fetches complete email details, decoded plain-text/HTML body, and attachment metadata (filenames, mime types, sizes).get_thread(thread_id): Retrieves entire conversation threads in chronological order for complete back-and-forth context.
2. ✉️ Drafting & Sending
send_email(to, subject, body, cc, bcc): Immediately sends an email from the user's account.reply_email(message_id, body, reply_all): Sends a reply preserving thread context,In-Reply-To, andReferencesheaders.create_draft(to, subject, body, cc, bcc): Creates a draft email in Gmail without sending.list_drafts(max_results): Lists all pending drafts in the mailbox.get_draft(draft_id): Reads the full content of a draft.send_draft(draft_id): Sends an existing draft after review.delete_draft(draft_id): Discards an unwanted draft.
3. 🗂️ Organization & Management
archive_email(message_id): Archives an email (removes from Inbox, keeps safely in All Mail).mark_as_read(message_id): Removes theUNREADlabel.mark_as_unread(message_id): Adds theUNREADlabel.trash_email(message_id): Moves an email to Trash.list_labels(): Lists all system labels and user custom folders.apply_label(message_id, label_name): Tags an email (e.g.Urgent,Invoices,Work). Creates the label automatically if missing.remove_label(message_id, label_name): Removes a label from an email.batch_modify_emails(message_ids, add_labels, remove_labels): Modifies labels on up to 1,000 emails in a single fast API call (for bulk mark-as-read, bulk archiving, or bulk labeling).
🚀 Running the Server & Frontend
Start the Interactive Frontend & Tools Playground
cd /home/thirunagarisrimehar/Desktop/3_months_plan/Auto_reader/gmail-mcp-server
./venv/bin/python web_app.py
Open http://localhost:5000 in your browser.
Metadata
Release files for autoreader-gmail-mcp 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| autoreader_gmail_mcp-0.1.0.tar.gz | 23.0 kB | Without provenance | Details for autoreader_gmail_mcp-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| autoreader_gmail_mcp-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for autoreader_gmail_mcp-0.1.0-py3-none-any.whl |
Total release size: 48.1 kB
Release files / autoreader_gmail_mcp-0.1.0.tar.gz
| Download URL | autoreader_gmail_mcp-0.1.0.tar.gz |
|---|---|
| Size | 23.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5c1fc737852e7fda05d953d7233695a471aa62f17e98331a375a2bfd4b1f5e3d
|
|
BLAKE2b-256 checksum How to use checksums |
bff61c37a1f4e1a50649f887508256ebfababf43246be2ae6a59afc2f2b7d833
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.10.12
|
Release files / autoreader_gmail_mcp-0.1.0-py3-none-any.whl
| Download URL | autoreader_gmail_mcp-0.1.0-py3-none-any.whl |
|---|---|
| Size | 25.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
16f78030547a1071b1e9f5f73fa1a425ca88cba43183190b1f475e067116e3c5
|
|
BLAKE2b-256 checksum How to use checksums |
8d44a97472f9545a19589b8858e10a1e1d46a36cb86be64295dc21ce39064512
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.10.12
|
Security for autoreader-gmail-mcp 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.