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.
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.