Gmail MCP serverand Python AI tasks
qbash hosts a Gmail MCP server you can use in Claude, ChatGPT, Codex, Cursor, Grok Bot and Muse.
Developers use qbash Tasks to write cloud-hosted Python functions that pair Gmail with models such as Claude and GPT.
MCP server
Build a Gmail MCP server
Give ChatGPT, Claude and your other AI tools access to Gmail through one server. You pick which Gmail tools it shares, and you can add other connectors, memory folders and Tasks to the same server.
How to set it up
- Connect Gmail on the qbash Connectors page.
- Create an MCP server and add the Gmail tools you want to share.
- Paste the server URL into your client. It connects with OAuth or an access token.
Python AI task
Write a Gmail task in Python
A qbash Task is a hosted Python function that calls Gmail and AI models.
Review unread customer emails
Search the last day of unread inbox messages, then ask an inline prompt to identify questions and requested deadlines.
report = qbash.integrations.gmail.search_messages(
query="in:inbox is:unread newer_than:1d",
max_results=20,
fetch_full=True,
)
messages = report.get("messages", [])
if messages:
review = qbash.ai.run_prompt(
slug="inbox-review",
variables={"messages": json.dumps(messages)},
)
qbash.output(review)
else:
qbash.output("No matching unread messages were returned.")
Sample search_messages response
{
"success": true,
"messages": [
{
"id": "mail-123",
"thread_id": "thread-123",
"subject": "Contract renewal",
"from": "customer@example.com",
"body": "Can you send the revised contract by Friday?"
}
],
"count": 1,
"nextPageToken": null
}
What the Gmail connector can do
- Fetch a Gmail message by ID
- Get the authenticated Gmail user's profile
- Search Gmail messages using a query string
- Download a single Gmail attachment
- Download all attachments from a Gmail message
- Add or remove labels on a Gmail message
- Add labels to a Gmail message
- Remove labels from a Gmail message
- Mark a Gmail message as read
- Mark a Gmail message as unread
- Archive a Gmail message (remove from Inbox)
- Star a Gmail message
- Remove the star from a Gmail message
- Move a Gmail message to trash
- Set up Gmail push notifications via Google Cloud Pub/Sub
- List changes to the user's mailbox since a given history ID
- Poll for new Gmail messages since a given history ID
qbash Tasks: AI applications in Python
A Task is a Python function that calls Gmail, your other connectors and models such as Claude, GPT, Gemini and Grok. qbash hosts and runs it.
Run Tasks on a schedule or from your team's tools
- Deterministic where it counts Write the logic in Python and call a model only for the steps that need judgement, so the rest runs the same way every time.
- Version controlled Every save is a revision you can compare and roll back.
- Logged Each run records its inputs, output, errors and what started it.
- Shared credentials Connections belong to your organization, so a Task keeps working when its author is away.
Gmail MCP questions
Can the Gmail MCP server send email?
No. None of the 17 Gmail methods sends a message or creates a draft, so the server can sort and read mail but cannot reply.
Can it permanently delete messages?
No. trash_message moves a message to Trash, and the connection requests the gmail.modify scope rather than the full mailbox access Google requires for permanent deletion.
Guides that use Gmail
Claude Fable 5.1 is live, and every run is in one place
Fable 5.1 is in the catalog with cache reads at a quarter of the old price, every task and prompt run now sits in one table, four connector fixes, simpler memory access in Task scripts, two new posts, and this week's AI Ticker.
GPT 5.1, Gmail Integration, and Workflow View Page
GPT 5.1 in Aisle, Gmail as a workflow trigger, and dedicated workflow view page. Trigger automations from email and see execution context at a glance.
Related communication connectors
Build a Gmail task
Write it in Python with AI steps, and qbash hosts it with versions and run logs.
Build a Gmail MCP server
Pick the Gmail tools to share and connect ChatGPT, Claude or Grok Bot.