View as Markdown

Gmail Integration

Send, read, and search Gmail messages

The Gmail integration provides access to send, read, and search Gmail messages through the Integrate MCP server.

Installation

The Gmail integration is included with the SDK:

import { gmailIntegration } from "integrate-sdk/server";

Setup

1. Create a Gmail OAuth App

  1. Go to Google Cloud Console
  2. Create a new OAuth application
  3. Configure your redirect URI
  4. Note your Client ID and Client Secret

2. Configure the Integration on Your Server

Add the Gmail integration to your server configuration. The integration automatically reads GMAIL_CLIENT_ID and GMAIL_CLIENT_SECRET from your environment variables:

import { createMCPServer, gmailIntegration } from "integrate-sdk/server";
 
export const { client: serverClient } = createMCPServer({
  apiKey: process.env.INTEGRATE_API_KEY,
  integrations: [
    gmailIntegration({
    }),
  ],
});

You can override the environment variables by passing explicit values:

gmailIntegration({
  clientId: process.env.CUSTOM_GMAIL_ID,
  clientSecret: process.env.CUSTOM_GMAIL_SECRET,
});

3. Client-Side Usage

The default client automatically includes all integrations. You can use it directly:

import { client } from "integrate-sdk";
 
await client.authorize("gmail");
const result = await client.gmail.sendMessage({
  to: "value",
});
 
console.log(result);

If you're using a custom client, add the integration to the integrations array:

import { createMCPClient, gmailIntegration } from "integrate-sdk";
 
const customClient = createMCPClient({
  integrations: [gmailIntegration()],
});

Configuration Options

export interface GmailIntegrationConfig {
  /** Google OAuth client ID (defaults to GMAIL_CLIENT_ID env var) */
  clientId?: string;

Tools

gmail_create_draft

Create a draft message

export interface GmailCreateDraftParams {
    to: string;

gmail_get_attachment

Get a message attachment payload

export interface GmailGetAttachmentParams {
    message_id: string;

gmail_get_message

Get a specific message by ID

export interface GmailGetMessageParams {
    id: string;

gmail_get_thread

Get a specific thread by ID

export interface GmailGetThreadParams {
    thread_id: string;

gmail_list_messages

List messages in the mailbox

export interface GmailListMessagesParams {
    maxResults?: number;

gmail_list_threads

List threads in the mailbox

export interface GmailListThreadsParams {
    query?: string;

gmail_modify_message

Modify labels on a message

export interface GmailModifyMessageParams {
    message_id: string;

gmail_reply_message

Reply to a message in a thread

export interface GmailReplyMessageParams {
    thread_id: string;

gmail_search_messages

Search messages with query

export interface GmailSearchMessagesParams {
    query: string;

gmail_send_message

Send a message

export interface GmailSendMessageParams {
    to: string | string[];

gmail_trash_message

Move a message to trash

export interface GmailTrashMessageParams {
    message_id: string;

Notes

  • Category: Communication
  • Authentication mode: OAuth