Skip to main content

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

License

Apache-2.0

Metadata

Release files for mcs-adapter-gmail 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mcs-adapter-gmail 0.1.0
File Size Uploaded
mcs_adapter_gmail-0.1.0.tar.gz 13.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mcs-adapter-gmail 0.1.0
File Interpreter ABI Platform
mcs_adapter_gmail-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 24.3 kB

Release files / mcs_adapter_gmail-0.1.0.tar.gz

Download URL mcs_adapter_gmail-0.1.0.tar.gz
Size 13.0 kB
Tags Source
SHA-256 checksum
How to use checksums
818d0c8c9af91b3846ba8a4ebf84fefd710eabdec5eaf15771bbd092e58698cc
BLAKE2b-256 checksum
How to use checksums
a0f624aefcf93d877b80c98af24b744be5e49a0c3105a1af1a311162677bdfe0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.5

Release files / mcs_adapter_gmail-0.1.0-py3-none-any.whl

Download URL mcs_adapter_gmail-0.1.0-py3-none-any.whl
Size 11.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4581c817f794c0179ad3e43ec891e609f6503777a5aab51a940d876221cb05f6
BLAKE2b-256 checksum
How to use checksums
b983d568ccffb1963ec9a6af13186a314c45200e7b783e2394415541fdf5a1e4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.5

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page