Gmail MCP Server
Enables sending emails, creating and managing drafts, and accessing user information through the Gmail API with OAuth2 authentication and multi-user support
Uses Google Cloud Console for OAuth2 credential management and Gmail API access configuration
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Gmail MCP Serversend an email to alex@company.com about our meeting tomorrow"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Gmail MCP Server
A remote FastMCP server for sending Gmail messages through a single owner Gmail identity. The server is designed for Prefect Horizon and relies on Horizon's gateway authentication for MCP access.
Features
Horizon-managed MCP authentication
Server-owned Gmail refresh token for the owner Gmail identity
Gmail send, draft creation, draft listing, and draft sending tools
Professional email composition prompts, resources, and helper tools
Remote-only Horizon entry point at
main.py:mcp
Related MCP server: Gmail MCP Server
Deployment
Deploy this repository to Prefect Horizon from the default branch.
Configure Horizon with:
Entrypoint:
main.py:mcpHorizon authentication: enabled
Set these deployment environment variables:
GOOGLE_OAUTH_CLIENT_ID: Google OAuth client ID for the owner Gmail tokenGOOGLE_OAUTH_CLIENT_SECRET: Google OAuth client secret for the owner Gmail tokenGOOGLE_OAUTH_REFRESH_TOKEN: refresh token for the owner Gmail identityALLOWED_GMAIL_EMAIL: the Gmail address the refresh token must belong to
The Google OAuth refresh token must include these scopes:
https://www.googleapis.com/auth/gmail.send
https://www.googleapis.com/auth/gmail.modifyHorizon controls who may connect to the MCP server. The backend uses the configured owner Gmail refresh token for Gmail API calls.
Local Verification
Install dependencies:
uv syncInspect the Horizon entry point with dummy local configuration:
GOOGLE_OAUTH_CLIENT_ID=test.apps.googleusercontent.com \
GOOGLE_OAUTH_CLIENT_SECRET=test \
GOOGLE_OAUTH_REFRESH_TOKEN=test-refresh-token \
ALLOWED_GMAIL_EMAIL=owner@example.com \
uv run fastmcp inspect main.py:mcpFor a real local OAuth test, copy the example environment file and fill in your Google OAuth web client values:
cp .env.example .envThen load it before running the local HTTP server:
set -a
source .env
set +a
uv run fastmcp run main.py:mcp --transport http --host 127.0.0.1 --port 8000Run quality checks:
uv run ruff check .
uv run pytestAvailable MCP Tools
Core Gmail Tools
send_email: send an email immediatelycreate_draft: create an email draftsend_draft: send an existing Gmail draftlist_drafts: list Gmail draftsget_user_info: return the authenticated Gmail profile
Email Assistance Tools
get_subject_line_helpvalidate_subject_line_toolget_email_templates
MCP Prompts
professional_email_composerfollow_up_email_generatormeeting_request_composerdraft_strategy_advisoremail_review_checklist
MCP Resources
Template resources are exposed for professional HTML emails, signatures, and email guidelines.
This server cannot be deployed
Maintenance
Related MCP Connectors
Manage Gmail end-to-end: search, read, send, draft, label, and organize threads. Automate workflow…
Manage Gmail messages, threads, labels, drafts, and settings from your workflows. Send and organiz…
Email inboxes and calendars for AI agents: send, receive, search, draft and schedule.
Email inboxes and calendars for AI agents: send, receive, search, draft and schedule.
Related MCP Servers
- AlicenseNot gradedqualityNot gradedmaintenanceEnables AI assistants to interact with Gmail through natural language, supporting email sending/reading, searching, draft management, label organization, and batch operations with secure OAuth authentication.-
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to manage Gmail accounts through natural language for tasks like sending, reading, searching, and organizing emails. It supports advanced features including draft management, label operations, and batch actions via secure OAuth 2.0 authentication.MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI assistants to manage Gmail emails, including sending, searching, and organizing with labels and attachments via OAuth2.48 npm1MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI assistants to manage Gmail accounts programmatically, including sending emails, managing labels, creating filters, and handling attachments via OAuth2 authentication.48 npm4MIT