Google Services MCP Server
Enables AI agents to send and draft Gmail emails and append content to Google Docs through standardized MCP tools.
README
Google Services MCP Server
A Model Context Protocol (MCP) server that exposes Google services — specifically Gmail and Google Docs — as standardized tools for AI agents.
This allows MCP-compatible agents (like Claude Desktop, Cursor, or custom agents) to seamlessly send/draft emails and append content to Google Docs on your behalf.
Capabilities (Tools)
| Tool | Description |
|---|---|
gmail_send_email |
Send an email to one or more recipients with subject, body (text/html), and optional CC/BCC. |
gmail_draft_email |
Create a draft email in your Gmail account without sending it. |
gdocs_append_content |
Append text content to the end of an existing Google Doc, with optional formatting (heading level, bold, italic). |
Prerequisites
- Node.js: Version 20 or higher.
- Google Cloud Project: You need to set up a project and obtain OAuth 2.0 credentials.
🛠️ Google Cloud Setup Guide
- Go to the Google Cloud Console.
- Create a new project (e.g., "MCP Server").
- Go to APIs & Services > Library.
- Search for and enable the Gmail API.
- Search for and enable the Google Docs API.
- Go to APIs & Services > OAuth consent screen.
- Choose External (or Internal if you have a Workspace).
- Fill out the App Name, User support email, and Developer contact information.
- Click Save and Continue.
- Under Scopes, add:
https://www.googleapis.com/auth/gmail.sendhttps://www.googleapis.com/auth/gmail.composehttps://www.googleapis.com/auth/documents
- Finish the consent screen setup.
- Go to APIs & Services > Credentials.
- Click Create Credentials > OAuth client ID.
- Application type: Web application.
- Name: "MCP Server Local".
- Under Authorized redirect URIs, add exactly:
http://localhost:3000/oauth2callback - Click Create.
- Note down your Client ID and Client Secret.
🚀 Installation & Authentication
- Clone or copy this repository.
- Install dependencies:
npm install - Copy the environment template:
cp .env.example .env - Open
.envand fill in yourGOOGLE_CLIENT_IDandGOOGLE_CLIENT_SECRET. - Run the authentication script to obtain your refresh token:
npm run authenticate - Follow the prompt in your browser to authorize the app. Once completed, the terminal will output a
GOOGLE_REFRESH_TOKEN. - Add the
GOOGLE_REFRESH_TOKENto your.envfile. - Build the server:
npm run build
🔌 Connecting to an MCP Client
Claude Desktop
Add the following to your claude_desktop_config.json (usually found at ~/Library/Application Support/Claude/claude_desktop_config.json on macOS):
{
"mcpServers": {
"google-services": {
"command": "node",
"args": [
"/absolute/path/to/google-mcp-server/build/index.js"
],
"env": {
"GOOGLE_CLIENT_ID": "your_client_id",
"GOOGLE_CLIENT_SECRET": "your_client_secret",
"GOOGLE_REFRESH_TOKEN": "your_refresh_token",
"GOOGLE_REDIRECT_URL": "http://localhost:3000/oauth2callback"
}
}
}
}
Note: Replace /absolute/path/to/ with the actual path to this folder.
🔧 Architecture
This server is built using the MCP SDK v2. It uses the stdio transport to communicate with the host agent.
The architecture is designed to be highly modular. Adding a new Google service requires:
- Creating a new folder in
src/tools/. - Defining Zod schemas for inputs.
- Implementing the Google API logic.
- Calling the registration function in
src/tools/index.ts.
It includes built-in exponential backoff for rate limiting and structured error handling for a robust agent experience.
⚠️ Troubleshooting
- Authentication Error / Missing Token: Make sure you ran
npm run authenticateand copied the refresh token into your.envfile or Claude config. - Permission Denied (403): Ensure you added all 3 required scopes during the Google Cloud OAuth consent screen setup, and that the account you authenticated with has access to the target Google Doc.
- Resource Not Found (404): Double check the
document_id. It should be the string between/d/and/editin the Google Docs URL.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。