@nexionsoftware/pi-gmail1.0.0
Gmail extension for pi — read, search, and manage emails and create drafts (it does not send) through the Gmail MCP server
Untested on omp
This is a pi package. No one has reported whether it works on omp yet. If you try it, add your result below.
Reports 0
No reports yet.
Readme
@nexionsoftware/pi-gmail
Gmail integration for pi — read, search, draft, reply, and manage emails through the Gmail MCP server (gmailmcp.googleapis.com).
Features
- Read & search — search with Gmail query syntax, read individual emails or full threads
- Draft & reply — create drafts and reply drafts in plain text or HTML, with optional file attachments. The extension never sends: you send the draft from Gmail
- Manage — archive, trash, label, mark read/unread
- Attachments — attach files from the home directory when drafting, and download inbound attachments to disk
- Notifications — temporarily unavailable: MCP returns matching threads without identifying matching messages; notification settings are ignored
- Web UI — OAuth flow and auth status page via pi-webserver
Why the Gmail MCP server
Google requires AI agents to use the Workspace MCP servers instead of REST, with technical enforcement from 2027-02-01 (announcement). Since 0.7.0 pi-gmail talks only to https://gmailmcp.googleapis.com/mcp/v1. The Gmail MCP server has no send operation and no draft deletion, which shapes the actions below.
Setup
Prerequisite: Developer Preview Program
On 2026-11-25 the Google Cloud project had to be enrolled in the Google Workspace Developer Preview Program. Without enrollment every call failed with: "Access to this tool requires that your Google Cloud project (...) is enrolled in the Google Workspace Developer Preview Program". Whether this is still required later has not been verified.
1. Create an agent OAuth client
- Open Google's personal-mode setup
- Select or create a project
- Application type: Web application
- Add the redirect URI
http://localhost:<port>/gmail/callback(the exact URI is shown on the/gmailpage of pi-webserver) - Verify that Use this client for an AI-powered agent is selected
- Accept the Google API Services User Data Policy
- Copy the Client ID and Client Secret
Manual alternative (Workspace accounts):
- Enable
gmail.googleapis.comandgmailmcp.googleapis.comin the project - Configure the consent screen with the scopes
https://www.googleapis.com/auth/gmail.readonly,https://www.googleapis.com/auth/gmail.composeandhttps://www.googleapis.com/auth/gmail.modify - In Google Auth Platform > Clients, create a Web application client with the AI agent option selected
2. Configure pi settings
Add to ~/.pi/agent/settings.json:
{
"pi-gmail": {
"clientId": "your-client-id.apps.googleusercontent.com",
"clientSecret": "your-client-secret"
}
}
Set clientId and clientSecret directly in settings.json; env:VAR_NAME substitution is not supported.
3. Authenticate
Start pi-webserver with /web, then run /gmail-auth. Pi requests the default browser and also prints a clickable, copyable local authentication URL in the conversation as a fallback. The running webserver handles the OAuth callback and the resulting tokens are stored locally. The extension also requests openid email to learn the account address.
Upgrading from 0.6.x
Tokens from 0.6.x are rejected. Create the new agent client, update clientId and clientSecret, and run /gmail-auth again.
Settings
| Key | Type | Default | Description |
|---|---|---|---|
clientId |
string | — | Google OAuth client ID (required) |
clientSecret |
string | — | Google OAuth client secret (required) |
notifications.enabled |
boolean | false |
Temporarily ignored; notification polling is disabled |
notifications.intervalMinutes |
number | 5 |
Polling interval in minutes |
notifications.query |
string | "is:unread" |
Gmail search query for notifications |
Tool: gmail
All actions are accessed through a single gmail tool with an action parameter.
Actions
| Action | Description | Key params |
|---|---|---|
search |
Search threads with Gmail query syntax (up to 50) | query, max_results |
read |
Read a single email by ID | id |
read_thread |
Read a full conversation thread | thread_id |
list_inbox |
List recent inbox threads (up to 50) | max_results |
list_unread |
List unread threads (up to 50) | max_results |
list_labels |
List all Gmail labels | — |
compose |
Create a plain-text or HTML draft | to, subject, body and/or html_body, cc, bcc, attachments |
reply |
Create a reply draft on a thread | thread_id, body and/or html_body, reply_all, attachments |
send |
Does not send: creates a draft and returns its Gmail link | to, subject, body and/or html_body, attachments |
send_draft |
Does not send: returns the draft's Gmail link | draft_id |
list_drafts |
List drafts | — |
delete_draft |
Does not delete: returns the draft's Gmail link | draft_id |
archive |
Archive messages (remove from inbox); asks for confirmation | id or ids |
trash |
Move messages to trash; asks for confirmation | id or ids |
label |
Add or remove labels | id or ids, add_labels, remove_labels |
mark_read |
Mark messages as read | id or ids |
mark_unread |
Mark messages as unread | id or ids |
download_attachment |
Save an attachment selected from read |
id, exactly one of filename / attachment_index (preferred) or freshly validated deprecated attachment_id; optional save_path |
Notes:
search,list_inbox,list_unreadandlist_draftsreturn at most 50 results;max_resultsabove 50 is capped.archive,label,mark_read,mark_unreadandtrashact per message. If some messages fail, the result lists the successes and the failures.download_attachmentdownloads the whole message (raw MIME) and extracts the file from it.- Use
list/search -> read -> download_attachment: compact listings are discovery-only and do not expose attachment selectors. attachmentsaccepts relative or absolute paths (array or comma-separated string), including~/.... Resolved paths must stay inside the home directory. Combined size is limited to 25 MB (the Gmail MCP server limit). Inbounddownload_attachmentwrites only inside the working directory or the system temp directory (default:.pi/gmail-attachments/<filename>).
Known limitations
- No send:
sendandsend_draftreturn a Gmail link; you send from Gmail. - No draft deletion:
delete_draftreturns a Gmail link; you delete from Gmail. - Recipient display names are dropped in drafts; only addresses are used.
- Attachments nested inside a forwarded message (
message/rfc822) are not extracted. Dateis shown as an RFC 3339 UTC timestamp instead of the original header.- List rows cannot show the attachment marker because thread summaries carry no attachment metadata.
- Attachment sizes are not shown (the MCP server does not report them).
- If Google asks for human-in-the-loop confirmation of an operation, this client cannot answer the request and the call surfaces as an error. Behavior of such confirmations (for example on trash) has not been verified.
Commands
| Command | Description |
|---|---|
/gmail-auth |
Start OAuth authentication flow |
/gmail-logout |
Disconnect Gmail account |
/gmail-status |
Show current authentication status |
Web UI
When pi-webserver is running, the extension mounts:
/gmail— Auth status page with connect/disconnect/gmail/auth— OAuth redirect to Google/gmail/callback— OAuth callback handler/api/gmail/status— JSON auth status endpoint
Install
pi install npm:@nexionsoftware/pi-gmail
License
MIT