Labsco
MCP SERVER

Headless Gmail MCP Server

by baryhuang

Read recent Gmail and send new mail with Google credentials handed in on each call, pulling a long body one 1k chunk at a time instead of all at once.

Email: Mailboxes & DeliveryVerified
Summary
Credentials travel with the call, so one server can act for whichever mailbox the caller holds a token for.

That is the decision to understand before installing it: no account is stored, the access token is in the arguments each time, and gmail_refresh_token exists to renew it partway through a long session. Reading is chunked at 1k characters by design — snippets and a first chunk from gmail_get_recent_emails, then one gmail_get_email_body_chunk call per further chunk — which keeps a big thread from arriving all at once but makes reading one long message several calls. Search, labels and delete are not part of the set; it covers recent mail, one body at a time, and sending.

What it is

A Gmail server that takes its Google OAuth credentials as tool arguments rather than from stored configuration, 4 tools covering token refresh, recent mail, body paging and sending.

What you get
  • gmail_get_recent_emails returns metadata, snippets and the first 1k characters of each body, with max_results and an unread_only filter
  • gmail_get_email_body_chunk returns a further 1k character chunk from a given offset, addressed by message_id or thread_id, for anything longer than that first slice
  • gmail_send_email takes to, subject and either a plain body or an html_body
  • gmail_refresh_token exchanges a refresh token and client credentials for a new access token without restarting the session
Requirements

Google OAuth credentials supplied per call: google_access_token on every tool, plus google_client_id, google_client_secret and google_refresh_token for gmail_refresh_token. MIT licensed.

Setup effort

One command — npx @peakmojo/mcp-server-headless-gmail