A community-driven registry for Claude, Cursor, Windsurf, Cline & more. Not affiliated with Anthropic.
Are you the author? Sign in to claim
MCP Server for Gmail and Calendar
A Model Context Protocol server for Google Workspace services. This server provides tools to interact with Gmail and Google Calendar through the MCP protocol.
Multiple Google Account Support
Gmail Integration
Calendar Integration
Try these example prompts with your AI assistant:
Clone the repository:
git clone https://github.com/j3k0/mcp-google-workspace.git
cd mcp-google-workspace
Install dependencies:
npm install
Build the TypeScript code:
npm run build
Google Workspace (G Suite) APIs require OAuth2 authorization. Follow these steps to set up authentication:
Create OAuth2 Credentials:
http://localhost:4100/code for local development)Required OAuth2 Scopes:
[
"openid",
"https://mail.google.com/",
"https://www.googleapis.com/auth/gmail.settings.basic",
"https://www.googleapis.com/auth/calendar",
"https://www.googleapis.com/auth/userinfo.email"
]
Create a .gauth.json file in the project root with your Google OAuth 2.0 credentials:
{
"installed": {
"client_id": "your_client_id",
"project_id": "your_project_id",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_secret": "your_client_secret",
"redirect_uris": ["http://localhost:4100/code"]
}
}
Create a .accounts.json file to specify which Google accounts can use the server:
{
"accounts": [
{
"email": "your.email@gmail.com",
"account_type": "personal",
"extra_info": "Primary account with Family Calendar"
}
]
}
You can specify multiple accounts. Make sure they have access in your Google Auth app. The extra_info field is especially useful as you can add information here that you want to tell the AI about the account (e.g., whether it has a specific calendar).
Once .gauth.json and .accounts.json are configured, authenticate your accounts:
npm run authenticate
This opens a browser for each configured account to complete the OAuth consent flow. The script waits up to 5 minutes per account for the callback.
# Authenticate a specific account
npm run authenticate -- user@gmail.com
# Force re-authentication (e.g. after OAuth scope changes)
npm run authenticate -- user@gmail.com --force
# Custom config paths (same flags as the server)
npm run authenticate -- --gauth-file /path/to/.gauth.json --accounts-file /path/to/.accounts.json
If installed via npm, you can also run:
npx mcp-gmail-authenticate
Configure Claude Desktop to use the mcp-google-workspace server:
On MacOS: Edit ~/Library/Application\ Support/Claude/claude_desktop_config.json
On Windows: Edit %APPDATA%/Claude/claude_desktop_config.json
{
"mcpServers": {
"mcp-google-workspace": {
"command": "<dir_to>/mcp-google-workspace/launch"
}
}
}
{
"mcpServers": {
"mcp-google-workspace": {
"command": "npx",
"args": [
"mcp-google-workspace"
]
}
}
}
You can also build and run the MCP server in Docker:
docker build -t mcp-google-workspace .
docker run --rm -i \
-v "$PWD/.gauth.json:/app/.gauth.json:ro" \
-v "$PWD/.accounts.json:/app/.accounts.json:ro" \
-v "$PWD/.credentials:/app/.credentials" \
-e GMAIL_ALLOW_DRAFTS=true \
-e GMAIL_ATTACHMENTS_DIR=/app/attachments \
mcp-google-workspace \
node dist/server.js --credentials-dir /app/.credentials
Do not bake .gauth.json, .accounts.json, OAuth tokens, or .env files into the image. The included .dockerignore excludes those files; mount them at runtime instead.
Start the server:
npm start
Optional arguments:
--gauth-file: Path to the OAuth2 credentials file (default: ./.gauth.json)--accounts-file: Path to the accounts configuration file (default: ./.accounts.json)--credentials-dir: Directory to store OAuth credentials (default: current directory)The server will start and listen for MCP commands via stdin/stdout.
On first run for each account, it will:
.oauth2.{email}.jsonGMAIL_ALLOW_SENDING — set to true to allow gmail_send to actually send mail. Defaults to disabled.GMAIL_ALLOW_DRAFTS — set to true to allow draft creation tools. Defaults to disabled.GMAIL_ATTACHMENTS_DIR — base directory under which gmail_get_attachment and gmail_bulk_save_attachments may write files. Attachment paths supplied by the caller are treated as relative to this directory; absolute paths, traversal, and symlinks that escape the directory are rejected. Defaults to ~/.mcp-gsuite/attachments.gmail_list_accounts / calendar_list_accounts
gmail_query_emails
gmail_get_email
gmail_bulk_get_emails
gmail_create_draft
gmail_delete_draft
draft_iddraft_id is distinct from the message ID returned by gmail_query_emails. Use gmail_list_drafts to obtain it.gmail_list_drafts
draft_id (required for gmail_delete_draft) alongside its message_id, subject, recipients, and snippetgmail_reply
gmail_get_attachment
gmail_bulk_save_attachments
gmail_archive / gmail_bulk_archive
calendar_list
calendar_get_events
calendar_create_event
calendar_delete_event
src/ directorydist/ directorymcp-google-workspace/
├── src/
│ ├── server.ts # Main server implementation
│ ├── services/
│ │ └── gauth.ts # Google authentication service
│ ├── tools/
│ │ ├── gmail.ts # Gmail tools implementation
│ │ └── calendar.ts # Calendar tools implementation
│ └── types/
│ └── tool-handler.ts # Common types and interfaces
├── .gauth.json # OAuth2 credentials
├── .accounts.json # Account configuration
├── package.json # Project dependencies
└── tsconfig.json # TypeScript configuration
npm run build: Build TypeScript codenpm start: Start the servernpm run dev: Start in development mode with auto-reloadMIT License - see LICENSE file for details
A Jetbrains IDE IntelliJ plugin aimed to provide coding agents the ability to leverage intelliJ's indexing of the codeba
Run Claude Code as an MCP server so any agent can delegate coding tasks to it
Browser automation using accessibility snapshots instead of screenshots