mcp-gmail mcp

v1.1.0 · MCP Tool · communication · registry.pascalai.org

Gmail API v1. Manage messages, labels, threads and drafts. Operations: list (search query), get (full message + body), send, reply, trash, untrash, delete, labels, modify (add/remove label IDs), threads, thread, drafts, create_draft. Auth via access_token param or GOOGLE_ACCESS_TOKEN env var; auto-refresh with refresh_token+client_id+client_secret.

gmailgoogleemailmailproductivitycommunicationoauth2

Input Parameters

ParameterTypeDescription
operationrequired string Operation to perform. Default: list. One of: list, get, send, reply, trash, untrash, delete, labels, modify, threads, thread, drafts, create_draft.
accessTokenoptional string OAuth2 access token. Can also be set via GOOGLE_ACCESS_TOKEN env var.
refreshTokenoptional string OAuth2 refresh token for auto-refresh. Can also be set via GOOGLE_REFRESH_TOKEN env var.
clientIdoptional string OAuth2 client ID for token refresh. Can also be set via GOOGLE_CLIENT_ID env var.
clientSecretoptional string OAuth2 client secret for token refresh. Can also be set via GOOGLE_CLIENT_SECRET env var.
messageIdoptional string Message ID — required for get, trash, untrash, delete, modify. For reply, use reply_to_id instead.
threadIdoptional string Thread ID — required for thread operation.
replyToIdoptional string Message ID to reply to (sets In-Reply-To and References headers). Required for reply.
toAddroptional string Recipient(s), comma-separated. Required for send, reply, create_draft.
fromAddroptional string Sender address (must match authenticated account).
cCAddroptional string CC address(es), comma-separated.
subjectoptional string Email subject. Required for send, reply, create_draft.
bodyoptional string Plain text body.
htmlBodyoptional string HTML body (used instead of body if provided).
labelIdsAddoptional string Comma-separated label IDs to add (for modify operation). E.g. 'STARRED,Label_123'.
labelIdsRemoveoptional string Comma-separated label IDs to remove (for modify operation). E.g. 'UNREAD'.
queryoptional string Gmail search query for list/threads operations. E.g. 'from:boss@company.com is:unread', 'subject:invoice after:2024/01/01'.
maxResultsoptional integer Max results to return for list, threads, drafts. Default: 20. Default: 20.
pageTokenoptional string Page token for pagination (from previous response).
userIdoptional string Gmail user ID. Default: 'me' (authenticated user). Default: me.

Output Fields

FieldTypeDescription
messages array[object]
threads array[object]
drafts array[object]
labels array[object]
id string
threadId string
snippet string
headers object
body string
ok boolean
nextPageToken string

Examples

List unread emails from a specific sender

// Input
{
  "operation": "list",
  "accessToken": "ya29.xxx",
  "query": "from:boss@company.com is:unread",
  "maxResults": 10
}

// Output
{
  "messages": [],
  "nextPageToken": ""
}

Send an HTML email

// Input
{
  "operation": "send",
  "accessToken": "ya29.xxx",
  "toAddr": "recipient@example.com",
  "subject": "Monthly Report",
  "htmlBody": "<h1>Report</h1><p>Please find attached...</p>"
}

// Output
{
  "id": "18e...",
  "threadId": "18e..."
}

Reply to a message

// Input
{
  "operation": "reply",
  "accessToken": "ya29.xxx",
  "replyToId": "18e4a2b3c4d5e6f7",
  "toAddr": "sender@example.com",
  "subject": "Re: Monthly Report",
  "body": "Thanks, received."
}

// Output
{
  "id": "18e..."
}

Move message to trash

// Input
{
  "operation": "trash",
  "accessToken": "ya29.xxx",
  "messageId": "18e4a2b3c4d5e6f7"
}

// Output
{
  "id": "18e4a2b3c4d5e6f7"
}

Mark message as read by removing UNREAD label

// Input
{
  "operation": "modify",
  "accessToken": "ya29.xxx",
  "messageId": "18e4a2b3c4d5e6f7",
  "labelIdsRemove": "UNREAD"
}

// Output
{
  "id": "18e4a2b3c4d5e6f7"
}

Auto-refresh token and list threads

// Input
{
  "operation": "threads",
  "refreshToken": "1//0xxx",
  "clientId": "123.apps.googleusercontent.com",
  "clientSecret": "GOCSPX-xxx",
  "query": "is:unread",
  "maxResults": 5
}

// Output
{
  "threads": []
}

Install & Discovery

Install

ppm install mcp-gmail

Get JSON Schema

GET /v1/packages/mcp-gmail/1.1.0/schema

Discover by keyword

GET /v1/mcp/discover?q=gmail
Discovery hint: Install with ppm install mcp-gmail or invoke remotely via POST /v1/invoke/mcp-gmail on the MCP Service.