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-google-workspace

v0.1.5

Published

MCP server for Google Workspace (Drive, Sheets, Gmail, Calendar).

Readme

MCP Google Workspace

MCP server cho Google Workspace (Drive, Sheets, Gmail, Calendar), chạy qua stdio để tích hợp trực tiếp với MCP client như Claude Desktop/Cursor.

Luong MCP hien co (ASCII)

[MCP Client: Claude/Cursor]
          |
          | stdio JSON-RPC
          v
[dist/cli.js MCP Server]
          |
          +--> [Auth Layer: personalAuth.ts]
          |          |
          |          +--> OAuth Browser flow (lan dau)
          |          +--> TokenStore provider (file/firestore/hybrid)
          |
          +--> [Tool Layer]
                     |
                     +--> Drive / Sheets / Gmail / Calendar APIs
                     |
                     +--> Ket qua tra ve cho MCP Client

Cài và chạy bằng npx

npx -y mcp-google-workspace

Lệnh trên sẽ chạy server và chờ MCP client giao tiếp qua stdio.

Cấu hình MCP client

Ví dụ cấu hình (claude_desktop_config.json hoặc config tương tự):

{
  "mcpServers": {
    "google-workspace": {
      "command": "npx",
      "args": ["-y", "mcp-google-workspace"],
      "env": {
        "GOOGLE_CLIENT_ID": "<your-client-id>",
        "GOOGLE_CLIENT_SECRET": "<your-client-secret>",
        "GOOGLE_REDIRECT_URI": "http://localhost:3000/oauth2callback"
      }
    }
  }
}

OAuth setup

Có 2 cách cấu hình OAuth:

  1. Qua env:
  • GOOGLE_CLIENT_ID
  • GOOGLE_CLIENT_SECRET
  • GOOGLE_REDIRECT_URI (khuyến nghị http://localhost:3000/oauth2callback)
  1. Qua file:
  • Đặt oauth2.json tại $MCP_CONFIG_DIR/oauth2.json
  • Nếu không set MCP_CONFIG_DIR, mặc định là ~/.mcp-google-workspace/oauth2.json

Token user sẽ lưu tại:

  • $MCP_CONFIG_DIR/user-tokens.json
  • hoặc mặc định ~/.mcp-google-workspace/user-tokens.json

Legacy local dev (keys/oauth2.json, keys/user-tokens.json) vẫn còn hỗ trợ để migrate.

Nếu dùng Firestore token store (TOKEN_STORE_PROVIDER=firestore hoặc hybrid), bắt buộc set thêm:

  • TOKEN_STORE_ENCRYPTION_KEY (base64 32 bytes hoặc hex 64 ký tự; passphrase cũng hỗ trợ và sẽ được derive SHA-256)
  • tùy chọn: TOKEN_STORE_ENCRYPTION_KEY_VERSION

User key mặc định trên token store sẽ được resolve theo Google account (ưu tiên email/sub) để tách record theo từng user.

Local development

npm install
cp .env.example .env
npm run build
npm run tools:list

Smoke test MCP:

node scripts/mcp-smoke.mjs

Publish lên npm (tự tay từng bước)

  1. Đăng nhập npm:
npm login
  1. Kiểm tra name trong package.json là tên chưa bị dùng.

  2. Tăng version:

npm version patch
  1. Build:
npm run build
  1. Kiểm tra gói thực tế sẽ publish:
npm run pack:check
  1. Publish public:
npm run release:public
  1. Verify sau publish:
npm view mcp-google-workspace version

Nếu bị lỗi 403 khi publish

Lỗi thường gặp:

  • 403 Forbidden ... Two-factor authentication or granular access token with bypass 2fa enabled is required to publish packages.

Checklist xử lý:

  1. Đăng xuất session npm cũ:
npm logout
  1. Tạo granular token có quyền publish và bật Bypass 2FA trên npm website, sau đó nạp lại token:
npm config set //registry.npmjs.org/:_authToken=<TOKEN_MOI>
  1. Kiểm tra token đã được nhận:
npm whoami
  1. Publish lại:
npm run release:public
  1. Nếu tài khoản/package policy bắt buộc interactive 2FA, publish bằng OTP/security key theo prompt của npm CLI.

Lưu ý bảo mật:

  • Không commit token vào repo.
  • Nếu token đã lộ trong terminal/chat, revoke token cũ ngay và tạo token mới.

Sau khi publish

MCP client có thể dùng ngay bằng:

npx -y mcp-google-workspace

Nếu đổi package name, hãy đổi luôn trong config MCP client.