Skip to main content
Glama
Gmail AI Agent MCP Server

Gmail AI Agent MCP Server

by 0x8687

Gmail AI Agent MCP Server

A Model Context Protocol (MCP) server that provides Gmail integration capabilities for AI models and tools. This server enables AI assistants to connect to Gmail accounts, check connection status, and send emails through a secure interface.

Tools

The server implements the following Gmail-related tools:

connect-gmail

Initiates a connection to a Gmail account. This tool will provide a redirect URL for OAuth authentication.

check-gmail-connection

Checks the current Gmail connection status and displays user profile information including email address, total messages, and total threads.

send-email

Sends an email through the connected Gmail account. Parameters:

  • to: The email address of the recipient

  • subject: The subject of the email

  • body: The body content of the email

Related MCP server: gmail-mcp

Setup

Prerequisites

  1. Composio API Key: You'll need a Composio API key to use the Gmail integration. You can get one by signing up at Composio.

  2. Gmail Account: A Gmail account that you want to connect to the AI agent.

Installation

You can configure the Gmail AI agent server in your MCP client. Here is an example configuration for Claude Desktop (Settings -> Developer -> Edit Config):

{
  "mcpServers": {
    "gmail-agent": {
      "command": "node",
      "args": ["path/to/your/gmail-mcp/dist/index.js"],
      "env": {
        "COMPOSIO_API_KEY": "<YOUR_COMPOSIO_API_KEY>"
      }
    }
  }
}

Development Setup

If you're running from source:

# Clone the repository
git clone <repository-url>
cd gmail-mcp

# Install dependencies
npm install

# Build the project
npm run build

# Run the server
npm start

Then configure your MCP client to point to the built server:

{
  "mcpServers": {
    "gmail-agent": {
      "command": "node",
      "args": ["/path/to/gmail-mcp/dist/index.js"],
      "env": {
        "COMPOSIO_API_KEY": "<YOUR_COMPOSIO_API_KEY>"
      }
    }
  }
}

Usage

  1. Configure the server in your MCP client (like Claude Desktop)

  2. Restart your client to load the new configuration

  3. Connect to Gmail by using the connect-gmail tool - this will provide an OAuth link

  4. Authorize the connection by clicking the provided link and following the Gmail authorization flow

  5. Check connection using check-gmail-connection to verify everything is working

  6. Send emails using the send-email tool with recipient, subject, and body parameters

Security

  • The server uses OAuth 2.0 for secure Gmail authentication

  • No passwords are stored locally

  • All Gmail operations are performed through secure API calls

  • The connection is maintained securely through Composio's infrastructure

Example Workflow

  1. Initial Setup: Use connect-gmail to start the OAuth flow

  2. Verification: Use check-gmail-connection to confirm successful connection

  3. Email Operations: Use send-email to compose and send emails through your connected Gmail account

Troubleshooting

  • Connection Issues: If you encounter connection problems, try using connect-gmail again to re-authenticate

  • API Key Issues: Ensure your Composio API key is correctly set in the environment variables

  • Permission Errors: Make sure you've granted the necessary permissions during the OAuth flow

Available Tools

12 tools
check_gmail_connectionB

Check Gmail connection status

Inputs: no named parameters.

connect_gmailC

Connect to Gmail

Inputs: no named parameters.

forward_emailC

Forward an email to other recipients

Inputs: to (required), emailId (required), message.

get_emailB

Get a specific email by ID

Inputs: emailId (required).

get_emailsC

Get emails from inbox

Inputs: query, labelIds, maxResults.

get_gmail_settingsB

Get Gmail settings

Inputs: no named parameters.

mark_as_readC

Mark emails as read

Inputs: emailIds (required).

mark_as_unreadA

Mark emails as unread

Inputs: emailIds (required).

move_to_trashB

Move emails to trash

Inputs: emailIds (required).

reply_to_emailB

Reply to an existing email

Inputs: emailId (required), message (required).

search_emailsC

Search emails using Gmail search syntax

Inputs: query (required), maxResults.

send_emailC

Send an email

Inputs: to (required), body (required), subject (required).

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.5/5.0

    Scored across 12 tools

    Disambiguation5/5

    Each tool has a clearly distinct purpose, with no overlap. Even get_emails and search_emails are differentiated by scope (inbox vs. general search).

    Naming Consistency5/5

    All tool names follow a consistent verb_noun snake_case pattern (e.g., send_email, mark_as_read), making them predictable and easy to understand.

    Tool Count5/5

    12 tools is well-scoped for a Gmail assistant, covering essential operations without being overwhelming or too sparse.

    Completeness4/5

    Covers core CRUD operations and email management, but lacks features like label management, draft creation, or permanent deletion, which are minor gaps.

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables AI assistants to manage Gmail emails, including sending, searching, and organizing with labels and attachments via OAuth2.
      41 npm
      2
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables AI assistants to manage Gmail accounts programmatically, including sending emails, managing labels, creating filters, and handling attachments via OAuth2 authentication.
      41 npm
      4
      MIT
    • F
      license
      Not graded
      quality
      D
      maintenance
      Enables AI assistants to manage Gmail (list, search, send, label emails) and Google Calendar (list, create, update, delete events) via OAuth 2.0.
      19 npm
      -

    Appeared in Searches