Google Docs & Gmail MCP Server
Enables AI agents to create and edit Google Docs and draft Gmail emails through natural language.
README
Google Docs & Gmail MCP Server
An MCP (Model Context Protocol) server that enables AI agents (e.g., Claude Desktop) to interact with Google Docs and Gmail — creating documents, appending content, replacing placeholders, and drafting emails.
Project Structure
MCP/
├── src/
│ ├── index.ts # MCP server entry point (all tool handlers)
│ ├── auth.ts # One-time OAuth 2.0 token generation script
│ ├── googleClient.ts # Centralized authenticated Google API clients
│ └── tools/
│ ├── docsTools.ts # Google Docs & Drive tool implementations
│ └── gmailTools.ts # Gmail draft tool implementations
├── credentials.json # ← You must download this from Google Cloud Console
├── token.json # ← Generated automatically by: npm run auth
├── claude_desktop_config.json # Claude Desktop MCP server configuration
├── package.json
├── tsconfig.json
├── .env.example
└── .gitignore
Getting Started
Prerequisites
- Node.js v18+
- A Google account with access to Google Workspace (Docs + Gmail)
Step 1: Google Cloud Console Setup
- Go to https://console.cloud.google.com/
- Create a new project (e.g.,
MCP-Server) - Enable the following APIs:
- Google Docs API
- Google Drive API
- Gmail API
- Go to APIs & Services → Credentials
- Click Create Credentials → OAuth 2.0 Client ID
- Application Type: Desktop App
- Name:
MCP Server
- Download the JSON file and rename it to
credentials.json - Place
credentials.jsonin the project root:C:\Users\Vaibhav Singh\Desktop\MCP\
Step 2: Authorize the Application (one-time)
powershell -ExecutionPolicy Bypass -Command "npm run auth"
This will:
- Print a Google authorization URL
- You open the URL, log in, and paste the authorization code back
token.jsonis saved automatically
Step 3: Test the MCP Server
# Start the server directly
powershell -ExecutionPolicy Bypass -Command "npm run dev"
# Or launch the MCP Inspector UI for testing
powershell -ExecutionPolicy Bypass -Command "npm run inspect"
Step 4: Connect to Claude Desktop (Phase 5)
Copy the contents of claude_desktop_config.json into your Claude Desktop configuration file, located at:
- Windows:
%APPDATA%\Claude\claude_desktop_config.json
Then restart Claude Desktop. You should see 7 tools available from this MCP server.
Available Tools
| Tool | Description |
|---|---|
create_document |
Creates a new Google Doc and returns ID + URL |
search_documents |
Searches Google Drive for Docs by name |
append_text |
Appends text to the end of a document |
insert_at_placeholder |
Replaces {{placeholder}} text in a document |
read_document |
Returns the full text content of a document |
create_gmail_draft |
Creates a Gmail draft email (To, Subject, Body, CC) |
list_gmail_drafts |
Lists recent Gmail drafts |
Example Prompts for Claude
"Create a new Google Doc titled 'Q3 Report' and append a summary of our meeting."
"Search for a document called 'Meeting Notes' and append today's agenda."
"Create a Gmail draft to john@example.com with subject 'Project Update' and a professional body."
"Find the document 'Email Log' and replace the placeholder
{{latest_draft}}with the email I just dictated."
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.