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

@yashpatel28/mail-mcp

v1.1.0

Published

Read-only Outlook and Gmail MCP server

Readme

Mail MCP

Read-only Gmail and Outlook MCP. Gmail uses the Gmail API and Google OAuth; Outlook uses Microsoft Graph delegated permissions. Both providers cache tokens locally, so normal mail queries do not start a new browser sign-in.

Gmail setup

For a personal Gmail account, use Google's Personal mode onboarding to create a project and a Desktop app OAuth client for your account. Personal mode avoids the External testing-user cap, app verification, and seven-day test-token expiration. Personal mode is only for the Google account that creates it.

For a multi-user setup, create or select a Google Cloud project, enable Gmail API, configure Google Auth Platform > Branding/Audience/Data Access, and create a Desktop app client under Clients. Choose Internal only for users in your Google Workspace organization; otherwise use External and add your own account as a test user while the app is in Testing. Google's Gmail Python quickstart shows where to create the desktop credentials.

The MCP requests only https://www.googleapis.com/auth/gmail.readonly. Google classifies this as a restricted scope; production distribution to other users may require OAuth app verification. External apps in Testing also have refresh tokens that expire after seven days. See Google's Gmail scope requirements and OAuth token expiration rules.

Set the downloaded Desktop app credentials in your Windows user environment (then fully restart OpenCode):

setx GMAIL_CLIENT_ID "your-client-id.apps.googleusercontent.com"
setx GMAIL_CLIENT_SECRET "your-client-secret"

The example OpenCode config references these as {env:GMAIL_CLIENT_ID} and {env:GMAIL_CLIENT_SECRET}. Do not commit the client secret or downloaded credential JSON.

Outlook setup

  • Register an Entra app for your account type and add Microsoft Graph delegated permissions Mail.Read and User.Read.
  • Enable Allow public client flows in the app's Authentication settings.
  • Set MAIL_MCP_CLIENT_ID and MAIL_MCP_TENANT_ID in OpenCode. No Outlook client secret is needed.
  • Organization policy may require an administrator to consent to the app before sign-in.

OpenCode configuration

Use the mail-server entry from ../configuration/opencode.json. It launches the published npm package. Replace the IDs with your own app's IDs when needed. Version 1.1.0 includes Gmail support; publish that version before using the npm command. OpenCode must be restarted after setting Google environment variables.

First Gmail sign-in

  1. Call begin_gmail_sign_in.
  2. Open the returned authorization URL, sign in to the intended Google account, and approve Gmail read-only access.
  3. The browser redirects to the MCP's local callback. Call complete_gmail_sign_in to confirm.

The Google OAuth tokens are stored under %LOCALAPPDATA%\OutlookMailMCP\gmail-token.bin on Windows and protected with Windows data protection. The Outlook token cache is stored beside it. Set MAIL_MCP_HOME to choose a different location. The token cache persists across projects on the same Windows user account.

Tools

  • Gmail: begin_gmail_sign_in, complete_gmail_sign_in, get_gmail_profile, list_gmail_labels, search_gmail, get_gmail_message.
  • Outlook: begin_outlook_sign_in, complete_outlook_sign_in, get_outlook_profile, list_mail_folders, search_emails, get_email.
  • search_gmail accepts Gmail search syntax and defaults to inbox mail when the query is omitted. Both message detail tools cap body output at 20,000 characters.

Both providers expose read-only operations. Never commit local token caches, OAuth credentials, or passwords.

Local development

python -m venv .venv
.\.venv\Scripts\python.exe -m pip install -r requirements.txt

For local development, point OpenCode's command at the virtual environment's Python and server.py, using the same environment settings from ../configuration/opencode.json.