ConnectGet API Key API Key https://gateway.mewcp.com/google-gmail/mcp Copy Infrastructure You Can Trust for Agentic Products
© 2026 MewCP. All rights reserved.
Manage Gmail inbox, send emails, and organize messages via API.
A Model Context Protocol (MCP) server that exposes Gmail's API for comprehensive email management, including sending, receiving, searching, and organizing messages.
Overview
The Gmail MCP Server provides stateless, multi-user access to Gmail's core operations:
Message Management — Send, receive, retrieve, delete, and organize email messages
Email Organization — Create labels, manage message labels, and organize inbox efficiently
Search & Filtering — Advanced message search using Gmail search syntax
Draft & Thread Management — Create drafts, manage email threads, and track read/unread status
Perfect for:
Automated email workflow automation and processing
Building AI-powered email management systems
Integrating email capabilities into multi-agent applications
get_profile — Get the user's Gmail profile informationInputs:
oauth_token (object, required) — Valid Google OAuth token object with Gmail scopes
Output:
{
"result" : {
"emailAddress" : "user@gmail.com" ,
"messagesTotal" : 1234 ,
"threadsTotal" : 456 ,
"historyId" : "123456789"
}
} Usage Example:
POST /mcp/cl-gmail/get_profile
{
"oauth_token" : {
"token" : "ya29.a0AfH6SMxxxxxxxxxxxxxx",
"refresh_token" : "1//0xxxxx",
"token_uri" : "https://oauth2.googleapis.com/token",
"client_id" : "xxx.apps.googleusercontent.com",
"client_secret" : "xxxxx",
"scopes" : [ "https://www.googleapis.com/auth/gmail.readonly" ]
}
}
get_message — Get a specific message by ID with full detailsInputs:
oauth_token (object, required) — Valid Google OAuth token object
message_id (string, required) — The message ID to retrieve
format (string, optional) — Response format: "full", "minimal", or "raw" (default: "full")
Output:
{
"result" : {
"id" : "msg-123456" ,
"threadId" : "thread-789" ,
"labelIds" : [ "INBOX" , "UNREAD" ],
"snippet" :
send_message — Send an email messageInputs:
oauth_token (object, required) — Valid Google OAuth token object
to (string, required) — Recipient email address
subject (string, required) — Email subject line
body (string, required) — Email body content
cc (string, optional) — CC recipients (comma-separated, default: "")
bcc (string, optional) — BCC recipients (comma-separated, default: "")
Output:
{
"result" : {
"message" : "Email sent successfully" ,
"id"
send_message_with_attachment — Send an email message with file attachmentsInputs:
oauth_token (object, required) — Valid Google OAuth token object
to (string, required) — Recipient email address
subject (string, required) — Email subject line
body (string, required) — Email body content
attachment_path (string, required) — Local file path to attach
cc (string, optional) — CC recipients (comma-separated, default: "")
Output:
{
"result" : {
"message" : "Email with attachment sent successfully" ,
reply_to_message — Reply to an existing email messageInputs:
oauth_token (object, required) — Valid Google OAuth token object
message_id (string, required) — The message ID to reply to
body (string, required) — Reply body content
Output:
{
"result" : {
"message" : "Reply sent successfully" ,
"id" : "msg-555444" ,
"threadId" : "thread-456"
}
}
delete_message — Delete a message permanentlyInputs:
oauth_token (object, required) — Valid Google OAuth token object
message_id (string, required) — The message ID to delete
Output:
{
"result" : {
"message" : "Message deleted permanently" ,
"id" : "msg-123456"
}
} Usage Example:
trash_message — Move a message to trashInputs:
oauth_token (object, required) — Valid Google OAuth token object
message_id (string, required) — The message ID to trash
Output:
{
"result" : {
"message" : "Message moved to trash" ,
"id" : "msg-123456"
}
} Usage Example:
POST /mcp/cl-gmail/trash_message
untrash_message — Remove a message from trashInputs:
oauth_token (object, required) — Valid Google OAuth token object
message_id (string, required) — The message ID to restore
Output:
{
"result" : {
"message" : "Message restored from trash" ,
"id" : "msg-123456"
}
} Usage Example:
modify_message_labels — Add or remove labels from a messageInputs:
oauth_token (object, required) — Valid Google OAuth token object
message_id (string, required) — The message ID to modify
add_labels (array, optional) — Label IDs to add (default: [])
remove_labels (array, optional) — Label IDs to remove (default: [])
Output:
{
"result" : {
"message" : "Message labels updated" ,
"id" : "msg-123456" ,
"labelIds" : [ "INBOX" ,
list_labels — Get all labels in the user's mailboxInputs:
oauth_token (object, required) — Valid Google OAuth token object
Output:
{
"result" : {
"count" : 5 ,
"labels" : [
{ "id" : "INBOX" , "name" : "INBOX" , "type" : "system" },
{ "id" : "LABEL_1" , "name" :
create_label — Create a new labelInputs:
oauth_token (object, required) — Valid Google OAuth token object
name (string, required) — Label name
label_list_visibility (string, optional) — Label visibility in list (default: "labelShow")
message_list_visibility (string, optional) — Label visibility in messages (default: "show")
Output:
{
"result" : {
"message" : "Label created successfully" ,
"label" : {
"id" : "LABEL_3" ,
"name" :
delete_label — Delete a labelInputs:
oauth_token (object, required) — Valid Google OAuth token object
label_id (string, required) — The label ID to delete
Output:
{
"result" : {
"message" : "Label deleted successfully" ,
"id" : "LABEL_3"
}
} Usage Example:
POST /mcp/cl-gmail/delete_label
search_messages — Search messages using Gmail search syntaxInputs:
oauth_token (object, required) — Valid Google OAuth token object
query (string, required) — Gmail search query (e.g., "from:sender@example.com is:unread")
max_results (integer, optional) — Maximum results to return (default: 10)
Output:
{
"result" : {
"count" : 3 ,
"messages" : [
{ "id" : "msg-111" , "threadId" : "thread-1"
mark_as_read — Mark a message as readInputs:
oauth_token (object, required) — Valid Google OAuth token object
message_id (string, required) — The message ID to mark as read
Output:
{
"result" : {
"message" : "Message marked as read" ,
"id" : "msg-123456"
}
} Usage Example:
mark_as_unread — Mark a message as unreadInputs:
oauth_token (object, required) — Valid Google OAuth token object
message_id (string, required) — The message ID to mark as unread
Output:
{
"result" : {
"message" : "Message marked as unread" ,
"id" : "msg-123456"
}
} Usage Example:
get_thread — Get an entire email threadInputs:
oauth_token (object, required) — Valid Google OAuth token object
thread_id (string, required) — The thread ID to retrieve
format (string, optional) — Response format: "full", "minimal", or "raw" (default: "full")
Output:
{
"result" : {
"id" : "thread-456" ,
"historyId" : "987654321" ,
"messages" : [
{ "id" : "msg-111" , "snippet" :
list_drafts — List draft messagesInputs:
oauth_token (object, required) — Valid Google OAuth token object
max_results (integer, optional) — Maximum drafts to return (default: 10)
Output:
{
"result" : {
"count" : 2 ,
"drafts" : [
{ "id" : "draft-1" , "message" : { "id" : "msg-001" } },
{ "id" : "draft-2" ,
create_draft — Create a draft messageInputs:
oauth_token (object, required) — Valid Google OAuth token object
to (string, required) — Recipient email address
subject (string, required) — Email subject line
body (string, required) — Email body content
Output:
{
"result" : {
"message" : "Draft created successfully" ,
"id" : "draft-3"
}
} Usage Example:
Reference & Support
API Parameters Reference Search Query Syntax
is:unread — Unread messages
is:read — Read messages
from:email@example.com — Messages from specific sender
to:email@example.com — Messages to specific recipient
subject:keyword — Messages with keyword in subject
has:attachment — Messages with attachments
before:2026-03-19 — Messages before date
after:2026-03-19 — Messages after date
Label Visibility Options
labelShow — Show label in label list
labelHide — Hide label in label list
OAuth Guide All tools require a valid Google OAuth token. Here's how to obtain one:
Step 1: Create Google Cloud Project
Go to Google Cloud Console
Create a new project or select an existing one
Enable the Gmail API from the API Library
Step 2: Create OAuth 2.0 Credentials
Navigate to Credentials in Google Cloud Console
Click + Create Credentials → OAuth client ID
Select your application type (Desktop, Web, or other)
Download the credentials JSON file
Step 3: Authenticate with Google Use your Google account to obtain the OAuth token. Refer to Google OAuth 2.0 Documentation for detailed authentication steps.
Step 4: Required Scopes Ensure your OAuth token has these scopes:
https://www.googleapis.com/auth/gmail.readonly — Read-only access to Gmail
https://www.googleapis.com/auth/gmail.modify — Modify Gmail messages and labels
https://www.googleapis.com/auth/gmail.send — Send Gmail messages
— Compose Gmail messages as drafts
Troubleshooting Missing or Invalid OAuth Token
Cause: OAuth token not provided in request or incorrect format
Solution:
Verify oauth_token parameter is present in request
Check token is valid and not expired
Obtain a fresh OAuth token from Google
Insufficient Permissions
Cause: OAuth token lacks required scopes for operation
Solution:
Verify token has all required scopes for the operation
Regenerate token with additional scopes if needed
Check Google Cloud project has Gmail API enabled
Insufficient Credits
Cause: API calls have exceeded your requests limits
Solution:
Check credit usage in your Curious Layer dashboard
Upgrade to a paid plan or add credits for higher limits
Contact support for credit adjustments
Cause: JSON payload is invalid or missing required fields
Solution:
Validate JSON syntax before sending
Ensure all required parameters are included ( , , etc.)
"Email preview text..."
,
"payload" : {
"headers" : [
{ "name" : "From" , "value" : "sender@example.com" },
{ "name" : "To" , "value" : "user@gmail.com" },
{ "name" : "Subject" , "value" : "Email Subject" }
],
"body" : { "data" : "base64-encoded-body" }
}
}
}
POST /mcp/cl-gmail/get_message
{
"oauth_token" : {
"token" : "ya29.a0AfH6SMxxxxxxxxxxxxxx",
"refresh_token" : "1//0xxxxx",
"token_uri" : "https://oauth2.googleapis.com/token",
"client_id" : "xxx.apps.googleusercontent.com",
"client_secret" : "xxxxx",
"scopes" : [ "https://www.googleapis.com/auth/gmail.readonly" ]
},
"message_id" : "msg-123456",
"format" : "full"
} :
"msg-789123"
,
"threadId" : "thread-456"
}
}
POST /mcp/cl-gmail/send_message
{
"oauth_token" : {
"token" : "ya29.a0AfH6SMxxxxxxxxxxxxxx",
"refresh_token" : "1//0xxxxx",
"token_uri" : "https://oauth2.googleapis.com/token",
"client_id" : "xxx.apps.googleusercontent.com",
"client_secret" : "xxxxx",
"scopes" : [ "https://www.googleapis.com/auth/gmail.send" ]
},
"to" : "recipient@example.com",
"subject" : "Meeting Confirmation",
"body" : "Hi, please confirm your attendance at the meeting.",
"cc" : "manager@example.com"
} "id" : "msg-987654" ,
"threadId" : "thread-321"
}
}
POST /mcp/cl-gmail/send_message_with_attachment
{
"oauth_token" : {
"token" : "ya29.a0AfH6SMxxxxxxxxxxxxxx",
"refresh_token" : "1//0xxxxx",
"token_uri" : "https://oauth2.googleapis.com/token",
"client_id" : "xxx.apps.googleusercontent.com",
"client_secret" : "xxxxx",
"scopes" : [ "https://www.googleapis.com/auth/gmail.send" ]
},
"to" : "recipient@example.com",
"subject" : "Project Report",
"body" : "Please find the report attached.",
"attachment_path" : "/home/user/reports/Q1_report.pdf"
} Usage Example:
POST /mcp/cl-gmail/reply_to_message
{
"oauth_token" : {
"token" : "ya29.a0AfH6SMxxxxxxxxxxxxxx",
"refresh_token" : "1//0xxxxx",
"token_uri" : "https://oauth2.googleapis.com/token",
"client_id" : "xxx.apps.googleusercontent.com",
"client_secret" : "xxxxx",
"scopes" : [ "https://www.googleapis.com/auth/gmail.send" ]
},
"message_id" : "msg-123456",
"body" : "Thanks for your message. I agree with your proposal."
} /mcp/cl-gmail/delete_message
{
"oauth_token" : {
"token" : "ya29.a0AfH6SMxxxxxxxxxxxxxx",
"refresh_token" : "1//0xxxxx",
"token_uri" : "https://oauth2.googleapis.com/token",
"client_id" : "xxx.apps.googleusercontent.com",
"client_secret" : "xxxxx",
"scopes" : [ "https://www.googleapis.com/auth/gmail.modify" ]
},
"message_id" : "msg-123456"
}
{
"oauth_token" : {
"token" : "ya29.a0AfH6SMxxxxxxxxxxxxxx",
"refresh_token" : "1//0xxxxx",
"token_uri" : "https://oauth2.googleapis.com/token",
"client_id" : "xxx.apps.googleusercontent.com",
"client_secret" : "xxxxx",
"scopes" : [ "https://www.googleapis.com/auth/gmail.modify" ]
},
"message_id" : "msg-123456"
}
/mcp/cl-gmail/untrash_message
{
"oauth_token" : {
"token" : "ya29.a0AfH6SMxxxxxxxxxxxxxx",
"refresh_token" : "1//0xxxxx",
"token_uri" : "https://oauth2.googleapis.com/token",
"client_id" : "xxx.apps.googleusercontent.com",
"client_secret" : "xxxxx",
"scopes" : [ "https://www.googleapis.com/auth/gmail.modify" ]
},
"message_id" : "msg-123456"
}
"STARRED"
,
"LABEL_1"
]
}
}
POST /mcp/cl-gmail/modify_message_labels
{
"oauth_token" : {
"token" : "ya29.a0AfH6SMxxxxxxxxxxxxxx",
"refresh_token" : "1//0xxxxx",
"token_uri" : "https://oauth2.googleapis.com/token",
"client_id" : "xxx.apps.googleusercontent.com",
"client_secret" : "xxxxx",
"scopes" : [ "https://www.googleapis.com/auth/gmail.modify" ]
},
"message_id" : "msg-123456",
"add_labels" : [ "LABEL_1" ],
"remove_labels" : [ "UNREAD" ]
} "Work"
,
"type"
:
"user"
},
{ "id" : "LABEL_2" , "name" : "Personal" , "type" : "user" }
]
}
}
POST /mcp/cl-gmail/list_labels
{
"oauth_token" : {
"token" : "ya29.a0AfH6SMxxxxxxxxxxxxxx",
"refresh_token" : "1//0xxxxx",
"token_uri" : "https://oauth2.googleapis.com/token",
"client_id" : "xxx.apps.googleusercontent.com",
"client_secret" : "xxxxx",
"scopes" : [ "https://www.googleapis.com/auth/gmail.readonly" ]
}
} "Projects"
,
"type" : "user"
}
}
}
POST /mcp/cl-gmail/create_label
{
"oauth_token" : {
"token" : "ya29.a0AfH6SMxxxxxxxxxxxxxx",
"refresh_token" : "1//0xxxxx",
"token_uri" : "https://oauth2.googleapis.com/token",
"client_id" : "xxx.apps.googleusercontent.com",
"client_secret" : "xxxxx",
"scopes" : [ "https://www.googleapis.com/auth/gmail.modify" ]
},
"name" : "Projects",
"label_list_visibility" : "labelShow",
"message_list_visibility" : "show"
}
{
"oauth_token" : {
"token" : "ya29.a0AfH6SMxxxxxxxxxxxxxx",
"refresh_token" : "1//0xxxxx",
"token_uri" : "https://oauth2.googleapis.com/token",
"client_id" : "xxx.apps.googleusercontent.com",
"client_secret" : "xxxxx",
"scopes" : [ "https://www.googleapis.com/auth/gmail.modify" ]
},
"label_id" : "LABEL_3"
}
},
{ "id" : "msg-222" , "threadId" : "thread-2" }
],
"resultSizeEstimate" : 15
}
}
POST /mcp/cl-gmail/search_messages
{
"oauth_token" : {
"token" : "ya29.a0AfH6SMxxxxxxxxxxxxxx",
"refresh_token" : "1//0xxxxx",
"token_uri" : "https://oauth2.googleapis.com/token",
"client_id" : "xxx.apps.googleusercontent.com",
"client_secret" : "xxxxx",
"scopes" : [ "https://www.googleapis.com/auth/gmail.readonly" ]
},
"query" : "is:unread from:manager@company.com",
"max_results" : 10
} /mcp/cl-gmail/mark_as_read
{
"oauth_token" : {
"token" : "ya29.a0AfH6SMxxxxxxxxxxxxxx",
"refresh_token" : "1//0xxxxx",
"token_uri" : "https://oauth2.googleapis.com/token",
"client_id" : "xxx.apps.googleusercontent.com",
"client_secret" : "xxxxx",
"scopes" : [ "https://www.googleapis.com/auth/gmail.modify" ]
},
"message_id" : "msg-123456"
}
/mcp/cl-gmail/mark_as_unread
{
"oauth_token" : {
"token" : "ya29.a0AfH6SMxxxxxxxxxxxxxx",
"refresh_token" : "1//0xxxxx",
"token_uri" : "https://oauth2.googleapis.com/token",
"client_id" : "xxx.apps.googleusercontent.com",
"client_secret" : "xxxxx",
"scopes" : [ "https://www.googleapis.com/auth/gmail.modify" ]
},
"message_id" : "msg-123456"
}
"First message..."
},
{ "id" : "msg-222" , "snippet" : "Reply message..." }
]
}
}
POST /mcp/cl-gmail/get_thread
{
"oauth_token" : {
"token" : "ya29.a0AfH6SMxxxxxxxxxxxxxx",
"refresh_token" : "1//0xxxxx",
"token_uri" : "https://oauth2.googleapis.com/token",
"client_id" : "xxx.apps.googleusercontent.com",
"client_secret" : "xxxxx",
"scopes" : [ "https://www.googleapis.com/auth/gmail.readonly" ]
},
"thread_id" : "thread-456",
"format" : "full"
} "message"
: {
"id"
:
"msg-002"
} }
]
}
}
POST /mcp/cl-gmail/list_drafts
{
"oauth_token" : {
"token" : "ya29.a0AfH6SMxxxxxxxxxxxxxx",
"refresh_token" : "1//0xxxxx",
"token_uri" : "https://oauth2.googleapis.com/token",
"client_id" : "xxx.apps.googleusercontent.com",
"client_secret" : "xxxxx",
"scopes" : [ "https://www.googleapis.com/auth/gmail.readonly" ]
},
"max_results" : 10
} POST /mcp/cl-gmail/create_draft
{
"oauth_token" : {
"token" : "ya29.a0AfH6SMxxxxxxxxxxxxxx",
"refresh_token" : "1//0xxxxx",
"token_uri" : "https://oauth2.googleapis.com/token",
"client_id" : "xxx.apps.googleusercontent.com",
"client_secret" : "xxxxx",
"scopes" : [ "https://www.googleapis.com/auth/gmail.compose" ]
},
"to" : "recipient@example.com",
"subject" : "Follow-up Meeting",
"body" : "Hi, please let me know your availability for next week."
}
show — Show label in message list
hide — Hide label in message list
full — Complete message with headers and body
minimal — Minimal message metadata
raw — Raw RFC 2822 formatted message
messages/{MESSAGE_ID}
Example: messages/15c2fae3cd77a38f threads/{THREAD_ID}
Example: threads/1489237b8fd3c6e6 labels/{LABEL_ID}
Example: labels/INBOX, labels/Label_1 https://www.googleapis.com/auth/gmail.compose
oauth_token
message_id
Check parameter types match expected values (string, integer, array)
Server Not Found
Cause: Incorrect server name in the API endpoint
Solution:
Verify endpoint format: /mcp/{server-name}/{tool-name}
Use lowercase server name: /mcp/cl-gmail/...
Check available servers in documentation
Authentication Token Invalid or Expired
Cause: Token rejected by Gmail API or has expired
Solution:
Obtain a fresh OAuth token from Google
Verify token has all required Gmail scopes
Check token expiration and refresh if needed