How to connect Gmail MCP with VS Code

How to connect Gmail MCP with VS Code VS Code is the most popular code editor out there. With its recent AI makeover, it can do more than just help you write code. You can connect your applications to it and let LLMs automate many of the mundane tasks in your workflow. In this guide, I will explain how to connect Gmail with VS Code in the most secure and robust way possible via Composio.

Gmail logoGmail
Oauth2

Gmail is Google's email service with powerful spam protection, search, and G Suite integration. It keeps your inbox organized and makes communication fast and reliable.

61 Tools2 Triggers

How to connect Gmail MCP with VS Code

VS Code is the most popular code editor out there. With its recent AI makeover, it can do more than just help you write code. You can connect your applications to it and let LLMs automate many of the mundane tasks in your workflow.

In this guide, I will explain how to connect Gmail with VS Code in the most secure and robust way possible via Composio.

Also integrate Gmail with

Why use Composio?

Composio provides:

  • Access to 1,000+ managed apps from a single MCP endpoint. This makes it convenient for agents to run cross-app workflows.
  • Programmatic tool calling. Allows LLMs to write its code in a remote workbench to handle complex tool chaining. Reduces to-and-fro with LLMs for frequent tool calling.
  • Large tool response handling outside the LLM context. This minimizes context bloat from large tool responses.
  • Dynamic just-in-time access to thousands of tools across hundreds of apps. Composio loads the tools your agent needs, so LLMs are not overwhelmed by tools they do not need.

Integrate Gmail MCP with VS Code

1. Install with one click

Click the button below to add Composio to VS Code. You will be prompted to authorize. This requires VS Code 1.99+ with GitHub Copilot.

+Install in VS Code

2. Or add manually

Open or create .vscode/mcp.json in your project root and add the following configuration:

bash
{
  "servers": {
    "composio": {
      "type": "http",
      "url": "https://connect.composio.dev/mcp"
    }
  }
}

3. Authorize

Click the install button to authorize VS Code to connect to Composio. VS Code will detect OAuth and prompt you to sign in.

VS Code MCP server install screen for Composio

A browser window will open to authorize.

Composio authorization browser window

4. Authenticate Gmail and start working

Back in VS Code chat, ask the agent to connect to Gmail or give it any Gmail-related task.

For example, ask it to:

  • "Summarize unread emails from this morning"
  • "Create draft replies to urgent messages"
  • "Fetch contact details for recent senders"

It will prompt you to authenticate and authorize access to Gmail.

That is it. Composio tools are now available in VS Code, and your Gmail account is ready to use.

Way Forward

Now that Gmail is connected, extend your setup by connecting the other apps you already use every day, so your agent can run true cross-app workflows end to end.

  • Connect Calendar to turn threads into scheduled meetings automatically.
  • Connect Slack or Teams to post summaries, approvals, and alerts where your team works.
  • Connect Notion, Linear, Jira, or Asana to convert requests into tickets, tasks, and docs.
  • Connect Drive, Dropbox, or OneDrive to fetch, file, and share attachments without manual steps.
  • Connect HubSpot or Salesforce to log customer context, update records, and draft follow-ups.

Start with one workflow you do repeatedly, then keep adding apps as you find new handoffs. With everything behind a single MCP endpoint, your agent can coordinate multiple tools safely and reliably in one conversation.

TOOLS & TRIGGERS

Supported Tools and Triggers

Every Gmail action and event your agent gets out of the box.

Modify email labels

Adds and/or removes specified Gmail labels for a message; ensure `message_id` and all `label_ids` are valid (use 'listLabels' for custom label IDs).

Batch delete Gmail messages

Tool to permanently delete multiple Gmail messages in bulk, bypassing Trash with no recovery possible.

Batch modify Gmail messages

Modify labels on multiple Gmail messages in one efficient API call.

Create email draft

Creates a Gmail email draft.

Create Gmail filter

Tool to create a new Gmail filter with specified criteria and actions.

Create label

Creates a new label with a unique name in the specified user's Gmail account.

Create Prompt Post

Send a one-shot prompt to the Sanity Content Agent.

Delete Draft

Permanently deletes a specific Gmail draft using its ID with no recovery possible; verify the correct `draft_id` and obtain explicit user confirmation before calling.

Delete Gmail filter

Tool to permanently delete a Gmail filter by its ID.

Delete label from account (permanent)

Permanently DELETES a user-created Gmail label from the account (not from a message).

Delete message

Permanently deletes a specific email message by its ID from a Gmail mailbox; for `user_id`, use 'me' for the authenticated user or an email address to which the authenticated user has delegated access.

Delete thread

Tool to immediately and permanently delete a specified thread and all its messages.

Fetch emails

Fetches a list of email messages from a Gmail account, supporting filtering, pagination, and optional full content retrieval.

Fetch message by message ID

Fetches a specific email message by its ID, provided the `message_id` exists and is accessible to the authenticated `user_id`.

Fetch Message by Thread ID

Retrieves messages from a Gmail thread using its `thread_id`, where the thread must be accessible by the specified `user_id`.

Forward email message

Forward an existing Gmail message to specified recipients, preserving original body and attachments.

Get Gmail attachment

Retrieves a specific attachment by ID from a message in a user's Gmail mailbox, requiring valid message and attachment IDs.

Get Auto-Forwarding Settings

Tool to get the auto-forwarding setting for the specified account.

Get contacts

Fetches contacts (connections) for the authenticated Google account, allowing selection of specific data fields and pagination.

Get Draft

Retrieves a single Gmail draft by its ID.

Get Gmail filter

Tool to retrieve a specific Gmail filter by its ID.

Get label details

Gets details for a specified Gmail label.

Get Language Settings

Tool to retrieve the language settings for a Gmail user.

Get People

Retrieves either a specific person's details (using `resource_name`) or lists 'Other Contacts' (if `other_contacts` is true), with `person_fields` specifying the data to return.

Get Profile

Retrieves Gmail profile information (email address, aggregate messagesTotal/threadsTotal, historyId) for a user.

Get Vacation Settings

Tool to retrieve vacation responder settings for a Gmail user.

Import message

Tool to import a message into the user's mailbox with standard email delivery scanning and classification.

Insert message into mailbox

Tool to insert a message into the user's mailbox similar to IMAP APPEND.

List CSE identities

Tool to list client-side encrypted identities for an authenticated user.

List CSE key pairs

Tool to list client-side encryption key pairs for an authenticated user.

List Drafts

Retrieves a paginated list of email drafts from a user's Gmail account.

List Gmail filters

Tool to list all Gmail filters (rules) in the mailbox.

List forwarding addresses

Tool to list all forwarding addresses for the specified Gmail account.

List Gmail history

Tool to list Gmail mailbox change history since a known startHistoryId.

List Gmail labels

Retrieves all system and user-created labels for a Gmail account in a single unpaginated response.

List send-as aliases

Lists the send-as aliases for a Gmail account, including the primary address and custom 'from' aliases.

List S/MIME configs

Lists S/MIME configs for the specified send-as alias.

List threads

Retrieves a list of email threads from a Gmail account, identified by `user_id` (email address or 'me'), supporting filtering and pagination.

Modify thread labels

Adds or removes specified existing label IDs from a Gmail thread, affecting all its messages; ensure the thread ID is valid.

Trash thread

Moves the specified thread to the trash.

Move to Trash

Moves an existing, non-deleted email message to the trash for the specified user.

Patch Label

Patches the specified user-created label.

Patch send-as alias

Tool to patch the specified send-as alias for a Gmail user.

Reply to email thread

Sends a reply within a specific Gmail thread using the original thread's subject; do not provide a custom subject as it will start a new conversation instead of replying in-thread.

Search People

Searches contacts by matching the query against names, nicknames, emails, phone numbers, and organizations, optionally including 'Other Contacts'.

Send Draft

Sends an existing draft email AS-IS to recipients already defined within the draft.

Send Email

Sends an email via Gmail API using the authenticated user's Google profile display name.

Get IMAP Settings

Retrieves the IMAP settings for a Gmail user account, including whether IMAP is enabled, auto-expunge behavior, expunge behavior, and maximum folder size.

Get POP settings

Tool to retrieve POP settings for a Gmail account.

Get send-as alias

Tool to retrieve a specific send-as alias configuration for a Gmail user.

Stop watch notifications

Tool to stop receiving push notifications for a Gmail mailbox.

Untrash Message

Tool to remove a message from trash in Gmail.

Untrash thread

Tool to remove a thread from trash in Gmail.

Update draft

Updates (replaces) an existing Gmail draft's content in-place by draft ID.

Update IMAP settings

Tool to update IMAP settings for a Gmail account.

Update Label

Tool to update the properties of an existing Gmail label.

Update Language Settings

Tool to update the language settings for a Gmail user.

Update POP settings

Tool to update POP settings for a Gmail account.

Update send-as alias

Tool to update a send-as alias for a Gmail user.

Update User Attributes Values

Update user attribute values for a resource.

Update Vacation Settings

Tool to update vacation responder settings for a Gmail user.

FAQ

Frequently asked questions

With a standalone Gmail MCP server, the agents and LLMs can only access a fixed set of Gmail tools tied to that server. However, with the Composio Tool Router, agents can dynamically load tools from Gmail and many other apps based on the task at hand, all through a single MCP endpoint.

Yes, you can. VS Code fully supports MCP integration. You get structured tool calling, message history handling, and model orchestration while Tool Router takes care of discovering and serving the right Gmail tools.

Yes, absolutely. You can configure which Gmail scopes and actions are allowed when connecting your account to Composio. You can also bring your own OAuth credentials or API configuration so you keep full control over what the agent can do.

All sensitive data such as tokens, keys, and configuration is fully encrypted at rest and in transit. Composio is SOC 2 Type 2 compliant and follows strict security practices so your Gmail data and credentials are handled as safely as possible.

Start with Gmail.It takes 30 seconds.

Managed auth, hosted MCP servers, and every Gmail tool your agent needs.Free to start.

Start building