Google Docs & Drive MCP Server

Google Docs & Drive MCP Server

Enables comprehensive interaction with Google Docs and Google Drive through AI assistants, supporting document reading/writing, rich formatting, table/image insertion, comment management, and complete file/folder operations with secure OAuth authentication.

Category
访问服务器

README

GoogleDocsMCP - AgenticLedger Platform

Google Docs & Drive MCP Server

TypeScript Node.js License: MIT Google Docs API Google Drive API

Production-ready MCP server providing comprehensive Google Docs and Drive integration for the AgenticLedger AI Agent Platform.

🚀 Features

  • 30+ Production-Ready Tools - Document editing, formatting, comments, Drive file operations
  • OAuth 2.0 Authentication - Secure user-based authorization with automatic token refresh
  • Multi-Tab Document Support - Work with new Google Docs multi-tab feature
  • Rich Text Formatting - Bold, italic, colors, fonts, paragraph styles, named styles
  • Comment Management - Full CRUD operations on document comments
  • Google Drive Integration - List, search, create, move, copy, delete documents
  • Type-Safe - Full TypeScript with Zod schema validation
  • 100% Documented - Comprehensive guides for developers and AI agents

📦 Quick Start

Installation

# Clone repository
git clone https://github.com/oregpt/Agenticledger_MCP_DocsOnly.git
cd Agenticledger_MCP_DocsOnly

# Install dependencies
npm install

# Build
npm run build

Authentication Setup

  1. Create Google Cloud Project (see GOOGLE_CLOUD_SETUP.md)
  2. Enable Google Docs API + Google Drive API
  3. Configure OAuth Consent Screen
  4. Create OAuth 2.0 credentials and download credentials.json
  5. Place credentials.json in this directory
  6. Run first-time authorization:
node dist/server.js
# Follow OAuth flow in browser
# token.json will be created automatically

Run Tests

npm run test:integration

🛠️ Available Tools (30+)

<details> <summary><b>Document Access & Editing (5 tools)</b></summary>

  • readGoogleDoc - Read document (text/json/markdown formats)
  • appendToGoogleDoc - Append text to end of document
  • insertText - Insert text at specific index
  • deleteRange - Delete content range
  • listDocumentTabs - List tabs in multi-tab documents

</details>

<details> <summary><b>Formatting & Styling (3 tools)</b></summary>

  • applyTextStyle - Character-level formatting (bold, colors, fonts)
  • applyParagraphStyle - Paragraph formatting (alignment, spacing, styles)
  • formatMatchingText - Legacy formatting tool

</details>

<details> <summary><b>Document Structure (4 tools)</b></summary>

  • insertTable - Create tables
  • insertPageBreak - Insert page breaks
  • insertImageFromUrl - Insert image from URL
  • insertLocalImage - Upload and insert local image

</details>

<details> <summary><b>Comment Management (6 tools)</b></summary>

  • listComments - List all document comments
  • getComment - Get specific comment details
  • addComment - Create comment anchored to text
  • replyToComment - Reply to existing comment
  • resolveComment - Mark comment as resolved
  • deleteComment - Remove comment

</details>

<details> <summary><b>Google Drive Integration (12 tools)</b></summary>

  • listGoogleDocs - List all documents
  • searchGoogleDocs - Search documents by name/content
  • getRecentGoogleDocs - Get recently modified documents
  • getDocumentInfo - Get file metadata
  • createDocument - Create new document
  • createFromTemplate - Create from template
  • createFolder - Create Drive folder
  • listFolderContents - List folder files
  • getFolderInfo - Get folder metadata
  • moveFile - Move to different folder
  • copyFile - Create copy
  • renameFile - Rename document
  • deleteFile - Delete (move to trash)

</details>

📖 Documentation

For Developers

For AI Agents

Example Files

  • credentials.example.json - OAuth credentials format
  • token.example.json - Token format example
  • test-integration.ts - Integration test suite

💡 Example Usage

Read Document

const result = await readGoogleDoc({
  documentId: "1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms",
  format: "text"  // or "json" or "markdown"
});

Append Text

await appendToGoogleDoc({
  documentId: "1BxiMVs0XRA...",
  textToAppend: "\n\nNew section added by AI Agent"
});

Apply Formatting

await applyTextStyle({
  documentId: "1BxiMVs0XRA...",
  target: {
    textToFind: "Important Note",
    matchInstance: 1
  },
  style: {
    bold: true,
    foregroundColor: "#FF0000",
    fontSize: 14
  }
});

Create Document

const newDoc = await createDocument({
  title: "AI Generated Report",
  folderId: "your-folder-id"
});

Work with Multi-Tab Documents

// List tabs
const tabs = await listDocumentTabs({
  documentId: "1BxiMVs0XRA..."
});

// Read specific tab
await readGoogleDoc({
  documentId: "1BxiMVs0XRA...",
  tabId: tabs.data.tabs[0].tabId
});

🔐 Security

  • Never commit credentials (credentials.json, token.json)
  • OAuth tokens expire after 1 hour (auto-refresh handled)
  • Revoke access at https://myaccount.google.com/permissions
  • User-based authentication - only accesses user's documents
  • Monitor usage in Google Cloud Console

📊 Performance

  • Average Response Time: 725ms per operation (includes Drive API)
  • Document Read: ~300ms (fast, cached by Google)
  • Text Editing: ~450ms (simple updates)
  • Drive Operations: ~650ms (includes Drive API calls)
  • API Quotas: 300 requests per minute per user

🔄 Multi-Tab Document Support

Google Docs now supports multiple tabs. This server fully supports this feature:

// Tab-aware tools accept optional tabId parameter
- readGoogleDoc
- appendToGoogleDoc
- insertText
- deleteRange

Usage:

  1. List tabs with listDocumentTabs
  2. Target specific tab with tabId parameter
  3. Works without tabId (targets first tab/legacy doc body)

🤝 Contributing

This is an AgenticLedger platform-customized version of a-bonus/google-docs-mcp.

AgenticLedger Customizations:

  • Platform-specific documentation
  • Integration test suite
  • AI agent guides
  • Example files and templates
  • Enhanced error handling

📜 License

MIT License - See LICENSE file

🔗 Links

  • Repository: https://github.com/oregpt/Agenticledger_MCP_DocsOnly
  • Upstream Source: https://github.com/a-bonus/google-docs-mcp
  • AgenticLedger Platform: [Platform Documentation]
  • Google Docs API: https://developers.google.com/docs/api
  • Google Drive API: https://developers.google.com/drive/api

📞 Support

  1. Check Documentation:

  2. Run Diagnostics:

    npm run test:integration
    
  3. Review Examples:

    • See test-integration.ts for real API usage examples

🆚 Comparison: Docs vs Sheets

Use GoogleDocsMCP when:

  • Creating reports, letters, proposals
  • Need rich text formatting
  • Working with narrative content
  • Require document structure (headings, TOC)
  • Need comment collaboration

Use GoogleSheetsMCP when:

  • Working with tabular data
  • Need calculations/formulas
  • Creating charts and graphs
  • Data analysis tasks
  • Structured records

Status: ✅ Production Ready Version: 1.0.0 Last Updated: 2025-11-03 Total Tools: 30+ Platform: AgenticLedger

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选