communication
Gmail MCP Integration for LangGraph
Connect Gmail to LangGraph through the local KosmoKrator MCP gateway with scoped tools, credentials, and write policy.
Connect Gmail to LangGraph
Run KosmoKrator integration calls from LangGraph nodes while preserving local credentials and permissions.
Use a graph node that calls the KosmoKrator CLI for deterministic steps or an MCP client for dynamic tool selection. The gateway is local, scoped to this integration, and starts with
--write=deny so LangGraph can inspect read-capable tools without receiving write access by default.
Gmail MCP Config for LangGraph
Headless CLI calls fit repeatable graph edges; MCP fits exploratory agent nodes.
{
"mcpServers": {
"kosmokrator-gmail": {
"type": "stdio",
"command": "kosmo",
"args": [
"mcp:serve",
"--integration=gmail",
"--write=deny"
]
}
}
} Run the Gateway Manually
kosmokrator mcp:serve --integration=gmail --write=deny Why Use KosmoKrator Here
Expose only Gmail instead of a broad multi-service tool list.
Reuse credentials already configured for the KosmoKrator CLI and Lua runtime.
Start read-only, then opt into ask or allow for trusted workspaces.
Gmail Tools Visible to LangGraph
LangGraph sees stable MCP tool names generated from the Gmail integration catalog.
| MCP tool | Source function | Type | Description |
|---|---|---|---|
integration__gmail__gmail_add_labels | gmail.gmail_add_labels | Write | Add labels to one or more Gmail messages. Provide messageIds (comma-separated) for batch operations. |
integration__gmail__gmail_archive | gmail.gmail_archive | Read | Archive one or more Gmail messages (remove from inbox). Provide messageIds (comma-separated) for batch operations. |
integration__gmail__gmail_create_draft | gmail.gmail_create_draft | Write | Create a draft email in Gmail (not sent). |
integration__gmail__gmail_mark_read | gmail.gmail_mark_read | Write | Mark one or more Gmail messages as read. Provide messageIds (comma-separated) for batch operations. |
integration__gmail__gmail_mark_unread | gmail.gmail_mark_unread | Write | Mark one or more Gmail messages as unread. Provide messageIds (comma-separated) for batch operations. |
integration__gmail__gmail_read | gmail.gmail_read | Read | Read the full content of a Gmail message by its ID. Returns headers (From, To, Subject, Date), the decoded text body, and a list of attachments. Use gmail_search first to find message IDs, then use this tool to read the full content. |
integration__gmail__gmail_remove_labels | gmail.gmail_remove_labels | Write | Remove labels from one or more Gmail messages. Provide messageIds (comma-separated) for batch operations. |
integration__gmail__gmail_reply | gmail.gmail_reply | Read | Reply to an existing Gmail message (maintains the thread). |
integration__gmail__gmail_count_by_sender | gmail.gmail_count_by_sender | Read | Count all matching Gmail messages grouped by sender. Automatically paginates through ALL results (handles thousands of messages). Returns top senders sorted by count. Use for questions like "who sends me the most email?" or "count unread by sender". |
integration__gmail__gmail_list_labels | gmail.gmail_list_labels | Read | List all labels in the Gmail mailbox (INBOX, SENT, custom labels, etc.). |
integration__gmail__gmail_save_attachment | gmail.gmail_save_attachment | Read | Download an email attachment and save it to workspace files. Requires a messageId and attachmentId (both returned by gmail_read). The file is saved under the agent's folder and can be browsed in the Files page. |
integration__gmail__gmail_search_emails | gmail.gmail_search_emails | Read | Search Gmail messages using Gmail query syntax (e.g., "from:alice subject:meeting is:unread has:attachment after:2026-02-01"). Returns message summaries with headers. Max 100 per page. |
integration__gmail__gmail_send_draft | gmail.gmail_send_draft | Write | Send a previously created Gmail draft by its ID. |
integration__gmail__gmail_send_email | gmail.gmail_send_email | Write | Send an email directly via Gmail. |
integration__gmail__gmail_trash | gmail.gmail_trash | Read | Move one or more Gmail messages to trash. Provide messageIds (comma-separated) for batch operations. |
integration__gmail__gmail_untrash | gmail.gmail_untrash | Read | Remove one or more Gmail messages from trash. Provide messageIds (comma-separated) for batch operations. |