Official · MODEL CONTEXT PROTOCOL

mcp-headless-gmail

A MCP (Model Context Protocol) server that provides get, send Gmails without local credential or token setup.

WHAT IT CONNECTS

mcp-headless-gmail 为 AI Agent 提供什么

  • Get most recent emails from Gmail with the first 1k characters of the body
  • Get full email body content in 1k chunks using offset parameter
  • Send emails through Gmail
  • Refresh access tokens separately
  • Automatic refresh token handling
  • Python 3.10 or higher
  • Google API credentials (client ID, client secret, access token, and refresh token)
  • **Create a new builder instance** (if you haven't already):
  • **Build and push the image for multiple platforms**:
  • **Verify the image is available for the specified platforms**:
  • Email metadata (id, threadId, from, to, subject, date, etc.)
  • First 1000 characters of the email body
  • `body_size_bytes`: Total size of the email body in bytes
  • `contains_full_body`: Boolean indicating if the entire body is included (true) or truncated (false)
  • A 1k chunk of the email body starting from the specified offset
  • `body_size_bytes`: Total size of the email body
  • `chunk_size`: Size of the returned chunk
  • `contains_full_body`: Boolean indicating if the chunk contains the remainder of the body
  • Start by calling the `gmail_refresh_token` tool with either:
  • Your full credentials (access token, refresh token, client ID, and client secret), or
  • Just your refresh token, client ID, and client secret if the access token has expired
  • Use the returned new access token for subsequent API calls.
  • If you get a response indicating token expiration, call the `gmail_refresh_token` tool again to get a new token.
  • Go to the [Google Cloud Console](https://console.cloud.google.com/)
  • Create a new project
  • Enable the Gmail API
  • Configure OAuth consent screen
  • Create OAuth client ID credentials (select "Desktop app" as the application type)
  • Save the client ID and client secret
  • Use OAuth 2.0 to obtain access and refresh tokens with the following scopes:
  • `https://www.googleapis.com/auth/gmail.readonly` (for reading emails)
  • `https://www.googleapis.com/auth/gmail.send` (for sending emails)

SECURITY

MCP 收录不等于安全审核

MCP 服务器可能获得模型上下文、凭据、本地文件或调用外部系统的权限。连接 Agent 前,请检查代码、环境变量、网络行为、软件包来源与维护状态。