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

@jessicaoy89/gmail-mcp

v1.2.0

Published

Gmail MCP server with multi-account support and token refresh persistence

Readme

Gmail MCP — Multi-Account

A Gmail MCP server that actually supports multiple accounts. Fork of the archived GongRzhe/Gmail-MCP-Server with two fixes the original never shipped:

  1. Token refresh persistence — refreshed OAuth tokens are saved back to disk. Without this, each account silently loses auth after the first token expiry.
  2. Account isolation — each server instance knows which account it is via GMAIL_ACCOUNT_NAME. The MCP server name becomes gmail-personal, gmail-business, etc. instead of all four showing as gmail.

Works with Claude Desktop, Cursor, or any MCP-compatible client.


Setup

1. Google Cloud credentials

You need a gcp-oauth.keys.json for each account — or one shared OAuth app with separate tokens. The simplest approach: one Google Cloud project, one OAuth client, one gcp-oauth.keys.json file used by all accounts.

  1. Go to Google Cloud Console
  2. Create a project → Enable the Gmail API
  3. Create OAuth 2.0 credentials (Desktop app type)
  4. Download as gcp-oauth.keys.json

2. Create per-account directories

mkdir -p ~/.gmail-personal ~/.gmail-business ~/.gmail-newsletter ~/.gmail-payments

Copy your gcp-oauth.keys.json into each:

cp gcp-oauth.keys.json ~/.gmail-personal/
cp gcp-oauth.keys.json ~/.gmail-business/
# repeat for each account

3. Authenticate each account

Run auth for each account, one at a time. Each opens a browser — sign in with the correct Google account:

GMAIL_OAUTH_PATH=~/.gmail-personal/gcp-oauth.keys.json \
GMAIL_CREDENTIALS_PATH=~/.gmail-personal/credentials.json \
npx -y @jessicaoy89/gmail-mcp auth
GMAIL_OAUTH_PATH=~/.gmail-business/gcp-oauth.keys.json \
GMAIL_CREDENTIALS_PATH=~/.gmail-business/credentials.json \
npx -y @jessicaoy89/gmail-mcp auth

Repeat for each account. Each writes a credentials.json to its directory.

4. Create wrapper scripts

Create a start script per account:

~/.gmail-personal/start-mcp.sh

#!/bin/bash
export GMAIL_OAUTH_PATH=~/.gmail-personal/gcp-oauth.keys.json
export GMAIL_CREDENTIALS_PATH=~/.gmail-personal/credentials.json
export GMAIL_ACCOUNT_NAME=personal
exec npx -y @jessicaoy89/gmail-mcp
chmod +x ~/.gmail-personal/start-mcp.sh

5. Add to your MCP config

Cursor (~/.cursor/mcp.json) or Claude Desktop (~/Library/Application Support/Claude/claude_desktop_config.json):

{
  "mcpServers": {
    "gmail-personal": {
      "command": "/Users/YOUR_NAME/.gmail-personal/start-mcp.sh",
      "args": []
    },
    "gmail-business": {
      "command": "/Users/YOUR_NAME/.gmail-business/start-mcp.sh",
      "args": []
    }
  }
}

Restart your client. Each account shows up as a separate MCP server with its own name.


Environment variables

| Variable | Required | Default | Description | |---|---|---|---| | GMAIL_OAUTH_PATH | Yes | ~/.gmail-mcp/gcp-oauth.keys.json | Path to your OAuth client keys | | GMAIL_CREDENTIALS_PATH | Yes | ~/.gmail-mcp/credentials.json | Where tokens are stored/refreshed | | GMAIL_ACCOUNT_NAME | No | default | Label for this account (e.g. personal, work) |


What it can do

  • Send, draft, read, search emails
  • Attachments (send and download)
  • Label management (create, update, delete, list)
  • Gmail filters
  • Batch operations (mark read, move, delete)
  • HTML emails

Single-account setup

If you only need one account, skip the wrapper scripts and configure directly:

{
  "mcpServers": {
    "gmail": {
      "command": "npx",
      "args": ["-y", "@jessicaoy89/gmail-mcp"],
      "env": {
        "GMAIL_OAUTH_PATH": "/Users/YOU/.gmail/gcp-oauth.keys.json",
        "GMAIL_CREDENTIALS_PATH": "/Users/YOU/.gmail/credentials.json",
        "GMAIL_ACCOUNT_NAME": "main"
      }
    }
  }
}

Credit

Originally built by GongRzhe. Forked and maintained here after the original was archived in March 2026.