npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

mcp-server-gmail

v0.1.5

Published

Gmail MCP Server - A Model Context Protocol server for Gmail integration

Downloads

43

Readme

Gmail MCP Server

A Model Context Protocol (MCP) server that provides Gmail integration for AI assistants and chatbots.

Quick Start

# Install and run (requires Python 3.10+)
npx mcp-server-gmail

Features

  • 📧 Send emails
  • 📬 Read unread emails
  • 🔍 Search emails by sender
  • 📖 Read specific email content
  • 🗑️ Move emails to trash
  • ✅ Mark emails as read
  • 🌐 Open emails in browser
  • 🎯 AI-powered email drafting and management

Setup

1. Google Cloud Setup

  1. Go to the Google Cloud Console
  2. Create a new project or select an existing one
  3. Enable the Gmail API:
    • Go to APIs & Services > Library
    • Search for "Gmail API"
    • Click Enable

2. OAuth 2.0 Credentials

  1. Go to APIs & Services > Credentials
  2. Click Create Credentials > OAuth client ID
  3. Select Desktop application
  4. Download the credentials file as credentials.json

3. Install and Setup

# Install the MCP server
npx mcp-server-gmail --help

# Create config directory and place credentials
mkdir -p ~/.gmail-mcp
cp /path/to/your/credentials.json ~/.gmail-mcp/credentials.json

4. First Run

# Start the server (will open browser for OAuth)
npx mcp-server-gmail

The first run will open a browser window for OAuth authentication. Grant the necessary permissions, and the server will store the tokens for future use.

Configuration

Claude Desktop

Add to your claude_desktop_config.json:

{
  "mcpServers": {
    "gmail": {
      "command": "npx",
      "args": ["-y", "mcp-server-gmail"]
    }
  }
}

Custom Paths

{
  "mcpServers": {
    "gmail": {
      "command": "npx",
      "args": [
        "-y", 
        "mcp-server-gmail",
        "--creds-file-path", "/path/to/credentials.json",
        "--token-path", "/path/to/token.json"
      ]
    }
  }
}

Other MCP Hosts

For other MCP-compatible applications, use:

npx -y mcp-server-gmail

Available Tools

send-email

Send an email to a recipient.

Parameters:

  • recipient_id (string): Email address of the recipient
  • subject (string): Email subject
  • message (string): Email body content

get-unread-emails

Retrieve all unread emails from your inbox.

read-email

Read the content of a specific email.

Parameters:

  • email_id (string): The ID of the email to read

get-emails-by-sender

Get emails from a specific sender.

Parameters:

  • sender_email (string): Email address of the sender
  • unread_only (boolean, optional): Only fetch unread emails

trash-email

Move an email to trash.

Parameters:

  • email_id (string): The ID of the email to trash

mark-as-read

Mark an email as read.

Parameters:

  • email_id (string): The ID of the email to mark as read

open-email

Open an email in your default web browser.

Parameters:

  • email_id (string): The ID of the email to open

Available Prompts

manage-email

Act as an email administrator with access to Gmail tools.

draft-email

Draft an email with specified content and recipient.

Arguments:

  • content: What the email is about
  • recipient: Who the email should be addressed to
  • recipient_email: Recipient's email address

edit-draft

Edit an existing email draft.

Arguments:

  • changes: What changes should be made to the draft
  • current_draft: The current draft to edit

Usage Examples

With Claude Desktop

Once configured, you can ask Claude:

  • "Check my unread emails"
  • "Send an email to [email protected] about the meeting tomorrow"
  • "Show me all emails from [email protected]"
  • "Draft a professional email to the client about the project update"

Command Line Usage

# Basic usage
npx mcp-server-gmail

# Custom credentials path
npx mcp-server-gmail --creds-file-path /path/to/creds.json

# Custom token storage
npx mcp-server-gmail --token-path /path/to/token.json

# Help
npx mcp-server-gmail --help

Requirements

  • Python 3.10+ (automatically checked during setup)
  • Node.js 18+ (for npx)
  • Google Cloud Project with Gmail API enabled
  • OAuth 2.0 credentials for Gmail access

Troubleshooting

Python Not Found

# Install Python 3.12+
# macOS
brew install python3

# Ubuntu/Debian
sudo apt install python3

# Windows
# Download from python.org

OAuth Errors

  1. Ensure Gmail API is enabled in Google Cloud Console
  2. Check that OAuth consent screen is configured
  3. Verify credentials file is valid JSON
  4. Try deleting token file and re-authenticating

Permission Errors

The server requests minimal permissions:

  • https://www.googleapis.com/auth/gmail.modify

This allows reading, sending, and managing emails but not deleting them permanently.

Security Notes

  • Credentials and tokens are stored locally
  • The server runs locally and doesn't send data to external services
  • OAuth tokens are automatically refreshed as needed
  • No email content is logged or stored beyond the session

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Test thoroughly
  5. Submit a pull request

License

MIT License - see LICENSE file for details.

Support

Changelog

v0.1.0

  • Initial release
  • Basic Gmail integration
  • Support for send, read, search, trash operations
  • OAuth 2.0 authentication
  • Cross-platform compatibility