Gmail API adapter for the Model Context Standard.
Project description
mcs-adapter-gmail
Gmail API adapter for the Model Context Standard (MCS).
Provides both mail-reading and mail-sending capabilities via the Gmail REST API.
Implements MailboxPort (7 methods) and MailsendPort (2 methods) so it works
as a drop-in replacement for mcs-adapter-imap + mcs-adapter-smtp.
Uses mcs-adapter-http as transport layer -- no direct requests dependency.
Auth-agnostic: receives an OAuth2 access token (or a callable that returns one). Works with Auth0 Token Vault, manual OAuth2, service accounts, or any future credential provider.
Installation
pip install mcs-adapter-gmail
Quick start
from mcs.adapter.gmail import GmailAdapter
# Static token
adapter = GmailAdapter(access_token="ya29.a0...", sender_name="Alice Smith")
# Or with a token provider (e.g. Auth0 Token Vault)
adapter = GmailAdapter(access_token=lambda: get_fresh_token())
# Use with MCS drivers -- same tools, different backend
from mcs.driver.mailread import MailreadToolDriver
from mcs.driver.mailsend import MailsendToolDriver
td_read = MailreadToolDriver(_adapter=adapter)
td_send = MailsendToolDriver(_adapter=adapter)
Gmail labels vs IMAP folders
Gmail uses labels instead of folders. The adapter maps them transparently:
| IMAP concept | Gmail equivalent |
|---|---|
| Folder | Label |
\Seen flag |
Remove UNREAD label |
\Flagged flag |
Add STARRED label |
\Deleted flag |
Add TRASH label |
| Move to folder | Add destination label, remove source label |
Required OAuth2 scopes
| Scope | Purpose |
|---|---|
gmail.readonly |
Read messages and labels |
gmail.labels |
Create and manage labels |
gmail.send |
Send e-mail |
Links
- Homepage: https://www.modelcontextstandard.io
- Source: https://github.com/modelcontextstandard/python-sdk
License
Apache-2.0
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 mcs_adapter_gmail-0.1.0.tar.gz.
File metadata
- Download URL: mcs_adapter_gmail-0.1.0.tar.gz
- Upload date:
- Size: 13.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
818d0c8c9af91b3846ba8a4ebf84fefd710eabdec5eaf15771bbd092e58698cc
|
|
| MD5 |
97f3de73984b6655a04744d61d1003c1
|
|
| BLAKE2b-256 |
a0f624aefcf93d877b80c98af24b744be5e49a0c3105a1af1a311162677bdfe0
|
File details
Details for the file mcs_adapter_gmail-0.1.0-py3-none-any.whl.
File metadata
- Download URL: mcs_adapter_gmail-0.1.0-py3-none-any.whl
- Upload date:
- Size: 11.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4581c817f794c0179ad3e43ec891e609f6503777a5aab51a940d876221cb05f6
|
|
| MD5 |
6d749482aaf5f50acb3f64e4932ef1a0
|
|
| BLAKE2b-256 |
b983d568ccffb1963ec9a6af13186a314c45200e7b783e2394415541fdf5a1e4
|