mcp-gsuite
Allows listing, searching, sending, and modifying labels on Gmail emails.
Allows listing, creating, updating, and deleting Google Calendar events.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@mcp-gsuitelist my upcoming events for today"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
mcp-gsuite
A Model Context Protocol (MCP) server for interacting with Google Workspace — Gmail & Google Calendar — via a streamable HTTP transport. Built with TypeScript, Express, and the official Google APIs Node.js client.
Features
📧 Gmail — list, search, send, and label emails
📅 Google Calendar — list, create, update, and delete events
🔐 OAuth 2.0 — offline access via refresh tokens (no re-auth needed)
⚡ Stateful sessions — each MCP client gets its own isolated session
🐳 Docker-ready — includes a production-grade Dockerfile
☁️ Cloud Run compatible — graceful SIGTERM/SIGINT shutdown handling
Related MCP server: Google Calendar MCP Server
Quick Start
npm install
npm run dev # Start with hot reload (tsx watch)Local development:
MCP endpoint:
http://localhost:8080/mcpHealth check:
http://localhost:8080/health
Remote (MCPize hosted):
MCP endpoint:
https://mcp-gsuite.mcpize.run/mcp
Prerequisites
A Google Cloud project with the following APIs enabled:
Gmail API
Google Calendar API
OAuth 2.0 Web Application credentials — download as
credentials.jsonfrom Google Cloud ConsoleA refresh token for offline access (see below)
credentials.json format
{
"web": {
"client_id": "YOUR_CLIENT_ID.apps.googleusercontent.com",
"client_secret": "YOUR_CLIENT_SECRET",
"redirect_uris": [
"https://your-deployed-url/mcp",
"http://localhost:4100/mcp"
],
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://oauth2.googleapis.com/token"
}
}Getting a Refresh Token
npm run generate # Automated OAuth flow (recommended)
# or
node get-refresh-token.jsThe script will open a browser for Google sign-in and save the token to .env automatically.
Environment Variables
Copy .env.example to .env and fill in:
cp .env.example .envVariable | Description | Required |
| OAuth client ID from Google Cloud Console | ✅ |
| OAuth client secret | ✅ |
| Refresh token for offline access | ✅ |
| Server port (default: | ❌ |
| Set to | ❌ |
Note: The server will throw an error on startup if any of the three required credentials are missing.
Development
npm install # Install dependencies
npm run dev # Development mode with hot reload (tsx watch)
npm run build # Compile TypeScript to dist/
npm start # Run compiled server (node dist/index.js)
npm test # Run unit tests (vitest)
npm run test:smoke # Run smoke/connectivity testProject Structure
├── src/
│ └── index.ts # MCP server — all tool handlers & Express setup
├── tests/
│ └── tools.test.ts # Vitest unit tests
├── scripts/
│ ├── list-events.mjs # Standalone calendar event listing script
│ └── smoke-test.js # Basic connectivity smoke test
├── get-refresh-token.js # Automated OAuth flow helper
├── credentials.json # Google OAuth client credentials (not committed)
├── token.json # Cached OAuth tokens (auto-generated, not committed)
├── package.json # Dependencies and npm scripts
├── tsconfig.json # TypeScript compiler configuration
├── mcpize.yaml # MCPize deployment manifest
├── Dockerfile # Container build instructions
├── .env # Your local secrets (not committed)
└── .env.example # Environment variables templateMCP Tools
📧 Gmail
Tool | Description | Key Parameters |
| List recent emails from Gmail inbox |
|
| Search emails with Gmail query syntax |
|
| Send an email (plain text + HTML) |
|
| Add or remove Gmail labels on a message |
|
Gmail search query examples:
from:someone@example.com
subject:invoice
is:unread after:2024/01/01📅 Google Calendar
Tool | Description | Key Parameters |
| List upcoming calendar events |
|
| Create a new calendar event |
|
| Update an existing calendar event (partial patch) |
|
| Delete a calendar event |
|
All datetime values must be valid ISO 8601 strings (e.g.,
2024-12-25T10:00:00Z).
Architecture
The server uses stateful Streamable HTTP sessions from the MCP SDK:
Each new MCP
initializerequest creates a fresh server + transport instanceSessions are tracked in memory by
mcp-session-idheaderA single authenticated
OAuth2client is shared across Gmail and Calendar API calls within a sessionInput validation is handled via Zod schemas on all tool inputs
Client → POST /mcp (initialize) → creates session
Client → POST /mcp (tool call, mcp-session-id: <id>) → reuses sessionTesting
npm test # Run vitest unit tests
npx @anthropic-ai/mcp-inspector # Interactive MCP tool testing UI
npm run test:smoke # Smoke test against running serverConnect MCP Inspector to http://localhost:8080/mcp to test tools interactively.
Deployment
MCPize (recommended)
mcpize deployConfigured via mcpize.yaml:
Runtime: TypeScript
Build:
npm ci && npm run buildStart:
node dist/index.js(HTTP transport on$PORT)
Docker
docker build -t mcp-gsuite .
docker run -p 8080:8080 \
-e GOOGLE_CLIENT_ID=... \
-e GOOGLE_CLIENT_SECRET=... \
-e GOOGLE_REFRESH_TOKEN=... \
mcp-gsuiteGoogle Cloud Run
The server handles SIGTERM gracefully for zero-downtime Cloud Run deploys.
Tech Stack
Package | Version | Purpose |
| ^1.23.0 | MCP server + Streamable HTTP transport |
| ^134.0.0 | Gmail & Calendar API client |
| ^5.1.0 | HTTP server framework |
| ^4.0.0 | Runtime input validation |
| ^16.4.5 | Environment variable loading |
| ^5.4.1 | Colored terminal output |
| ^4.19.4 | TypeScript dev runner (hot reload) |
Node.js requirement: >=20.0.0
License
MIT
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/khokan/mcp-gsuite'
If you have feedback or need assistance with the MCP directory API, please join our Discord server