This MCP Google Workspace server provides integration between AI assistants and Google services like Gmail and Calendar through the Model Context Protocol. It allows your assistant to read and manage emails, draft responses, view calendar events, and more.
Clone the repository and install dependencies:
git clone https://github.com/j3k0/mcp-google-workspace.git
cd mcp-google-workspace
npm install
npm run build
Create a .gauth.json
file in the project root with your Google OAuth 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": "[email protected]",
"account_type": "personal",
"extra_info": "Primary account with Family Calendar"
}
]
}
Go to the Google Cloud Console
Create a project or select an existing one
Enable Gmail API and Google Calendar API
Create OAuth credentials (Desktop app or Web application)
Add http://localhost:4100/code
as an authorized redirect URI
Ensure your app requests these OAuth scopes:
openid
https://mail.google.com/
https://www.googleapis.com/auth/calendar
https://www.googleapis.com/auth/userinfo.email
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
For development/unpublished servers:
{
"mcpServers": {
"mcp-google-workspace": {
"command": "<dir_to>/mcp-google-workspace/launch"
}
}
}
For published servers:
{
"mcpServers": {
"mcp-google-workspace": {
"command": "npx",
"args": [
"mcp-google-workspace"
]
}
}
}
Start the server with:
npm start
Optional arguments:
--gauth-file
: Custom path to OAuth credentials (default: ./.gauth.json)--accounts-file
: Custom path to accounts configuration (default: ./.accounts.json)--credentials-dir
: Directory to store OAuth credentials (default: current directory)On first run for each account, the server will:
.oauth2.{email}.json
gmail_list_accounts
or calendar_list_accounts
Query Emails: Search emails using Gmail's query syntax
gmail_query_emails
Get Email Content: Retrieve complete email content by ID
gmail_get_email
Bulk Get Emails: Retrieve multiple emails in one request
gmail_bulk_get_emails
Create Drafts: Create new email drafts
gmail_create_draft
Delete Drafts: Remove draft emails
gmail_delete_draft
Reply to Emails: Reply to existing emails
gmail_reply
Handle Attachments: Download email attachments
gmail_get_attachment
and gmail_bulk_save_attachments
Archive Emails: Move emails out of inbox
gmail_archive
and gmail_bulk_archive
List Calendars: View all accessible calendars
calendar_list
Get Events: Retrieve events in a date range
calendar_get_events
Create Events: Add new calendar events
calendar_create_event
Delete Events: Remove calendar events
calendar_delete_event
Try asking your assistant:
To add this MCP server to Claude Code, run this command in your terminal:
claude mcp add-json "mcp-google-workspace" '{"command":"npx","args":["mcp-google-workspace"]}'
See the official Claude Code MCP documentation for more details.
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"mcp-google-workspace": {
"command": "npx",
"args": [
"mcp-google-workspace"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.config/Claude/claude_desktop_config.json
2. Add this to your configuration file:
{
"mcpServers": {
"mcp-google-workspace": {
"command": "npx",
"args": [
"mcp-google-workspace"
]
}
}
}
3. Restart Claude Desktop for the changes to take effect