Get the FREE Ultimate OpenClaw Setup Guide →

gmail

A robust Model Context Protocol server for Gmail integration with intelligent authentication and comprehensive email operations

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio devdattatalele-gmail-mcp-server node /absolute/path/to/gmail-mcp-server/dist/index.js \
  --env GCP_OAUTH_KEYS="~/.gmail-mcp/gcp-oauth.keys.json" \
  --env GMAIL_MCP_CREDENTIALS="~/.gmail-mcp/credentials.json"

How to use

This Gmail MCP Server exposes a set of Gmail-enabled capabilities that you can drive from Claude Desktop or any MCP client. It handles authentication, token refresh, and a full suite of email operations directly against the Gmail API, without relying on external AI services for processing. You can send emails, draft messages, read and search emails, manage labels, and perform batch operations including attachments handling. The server is built in TypeScript and ships with robust error handling to help you recover from common auth or API issues. To connect, configure Claude Desktop (or your MCP client) to point at the local Node.js server entry point, then invoke the available tools to perform actions against your Gmail inbox.

How to install

Prerequisites:

  • Node.js 16+ installed on your machine
  • npm (comes with Node.js)
  • A Google Cloud Platform project with Gmail API enabled and OAuth credentials configured as described in the Quick Start

Installation steps:

  1. Clone the repository and install dependencies
git clone https://github.com/devdattatalele/gmail-mcp-server.git
cd gmail-mcp-server
npm install
  1. Build the TypeScript project
npm run build
  1. Run the server (example)
node dist/index.js
  1. If you want to install as a global package (optional)
npm install -g @devdattatalele/gmail-mcp-server
  1. Start authentication flow when needed (see Quick Start for details)
node dist/index.js auth

Configure Claude Desktop to point to the server as described in the Quick Start section.

Additional notes

Tips and notes:

  • Ensure your OAuth credentials JSON is placed as ~/.gmail-mcp/gcp-oauth.keys.json and that the server can read it.
  • The server stores tokens and refreshed credentials in ~/.gmail-mcp/credentials.json; keep this directory secure.
  • When configuring Claude Desktop, use the absolute path to the compiled dist/index.js file.
  • If you encounter authentication errors, re-run the auth command with --force to re-authenticate and refresh tokens.
  • For large attachments or batch operations, be mindful of Gmail API rate limits and the server’s retry behavior.
  • The npm package name for this server is @devdattatalele/gmail-mcp-server; use the exact package name if installing globally or referencing in scripts.

Related MCP Servers

Sponsor this space

Reach thousands of developers