官方说明Google Workspace MCP Server A Model Context Protocol (MCP) server that acts as a secure bridge between your personal Google Workspace account (Gmail, Calendar, etc.) and any MCP-compatible AI client, such as Claude Desktop.
配置模板(请按你的客户端调整)
claude mcp add google-workspace-mcp-server -- npx -y google-workspace-mcp-server
A Model Context Protocol (MCP) server that acts as a secure bridge between your personal Google Workspace account (Gmail, Calendar, etc.) and any MCP-compatible AI client, such as Claude Desktop. Features * **Google Calendar**: * Effortlessly list and search for events on your primary calendar within a specific date range. * Create new events with detailed information like title, description, start, and end times. * Update existing events, allowing for partial modifications such as changing the title or time. * Delete events directly from your calendar. * **Gmail**: * Read the content of your most recent email to stay up-to-date. * Search for specific emails by their subject line to find important conversations. * Compose and send new emails directly from your account. * **Google Drive**: * Search for files and folders using powerful query strings. * Create new Google Docs with a specified title and initial content. * Update the entire content of an existing Google Doc. * Manage your files by moving them to the bin or deleting them permanently. Getting Started Follow these steps to set up the server and run the example AI agent. Prerequisites * Python 3.9+ and uv (or pip). * A Google Cloud project with the necessary APIs enabled. * Claude Desktop. Step 1: Configure your Google Cloud Project You need to authorize this application to access your Google data. This is a one-time setup. 1. **Go to the Google Cloud Console**: https://console.cloud.google.com/ 2. **Create a new project** (or use an existing one). 3. **Enable APIs**: * Go to "APIs & Services" -> "Library". * Search for and **Enable** the **Gmail API**. * Search for and **Enable** the **Google Calendar API**. * Search for and **Enable** the **Google Drive API**. 4. **Create OAuth Credentials**: * Go to "APIs & Services" -> "Credentials". * Click "Create Credentials" -> "OAuth client ID". * If prompted, configure the "OAuth consent screen". Choose **External** and provide a name for the app. You can skip most other fields for personal use. Add your Google account email as a Test User. * For "Application type", select **Desktop app**. * Give it a name (e.g., "GSuite MCP Client"). 5. **Download Credentials**: * After creating the client ID, click the "Download JSON" icon. * Rename the downloaded file to client_secrets.json and place it in the **root directory of this project**. Step 2: Install Dependencies Clone this repository and install the required Python packages for both the server and the client. Step 3: Run the One-Time Authorization Before you can run the server, you need to authorize it with your Google account. Run the get_credentials.py script from your terminal: * This will open a browser window. * Log in with your Google account and grant the requested permissions. * After you approve, the script will automatically create a token.json file in the project directory. This file stores your authorization tokens so you don't have to log in every time. Step 4: Set Up and Run the AI Agent Client