Google Workspace MCP Server

Google Workspace MCP Server

Enables AI assistants to create, read, and modify Google Slides, Sheets, Docs, and Drive documents programmatically. Supports file management, content editing, and version history retrieval.

Category
访问服务器

README

Google Workspace MCP Server

MCP server for Google Slides, Sheets, Docs, and Drive. Enables AI assistants to create, read, and modify Google Workspace documents programmatically.

Quick Start

npm install
npm run build
npm run get-token  # One-time OAuth setup
npm start

Configuration

Required Environment Variables

GOOGLE_CLIENT_ID=your_client_id
GOOGLE_CLIENT_SECRET=your_client_secret
GOOGLE_REFRESH_TOKEN=your_refresh_token

Optional Module Toggles

All modules enabled by default. Set to false to disable:

ENABLE_SHEETS=false
ENABLE_SLIDES=false
ENABLE_DOCS=false
ENABLE_REVISIONS=false

Drive tools are always enabled (core functionality).

Claude Code Configuration

Add to your MCP settings:

{
  "mcpServers": {
    "google-workspace-mcp": {
      "command": "node",
      "args": ["/path/to/google-workspace-mcp/build/index.js"],
      "env": {
        "GOOGLE_CLIENT_ID": "your_client_id",
        "GOOGLE_CLIENT_SECRET": "your_client_secret",
        "GOOGLE_REFRESH_TOKEN": "your_refresh_token"
      }
    }
  }
}

Available Tools

Drive (always enabled)

Tool Description
create_folder Create a folder in Google Drive
list_files List files/folders with filtering, pagination, and sorting. Supports Shared Drives.
get_file Get detailed metadata for a specific file (permissions, capabilities, owners)
search_files Search Drive using query syntax (e.g., name contains 'report')
export_file Export Google Docs/Sheets/Slides to PDF, text, CSV, docx, etc.

Sheets

Tool Description
create_spreadsheet Create a new spreadsheet
get_spreadsheet Get spreadsheet metadata
get_sheet_values Read cell values
update_sheet_values Write cell values
batch_update_spreadsheet Apply formatting/structural changes
append_sheet_values Append rows
summarize_spreadsheet Extract all data
copy_sheet Copy sheet between spreadsheets

Slides

Tool Description
create_presentation Create a new presentation
get_presentation Get presentation metadata
batch_update_presentation Apply updates to slides
get_page Get specific slide details
summarize_presentation Extract text from all slides

Docs

Tool Description
create_document Create a new document
get_document Get document content
batch_update_document Insert/delete/format text
summarize_document Extract text content

Version History

Tool Description
list_revisions List document version history
get_revision Get revision details with restore instructions

Security

OAuth Scopes

This server requests the minimum scopes needed:

Scope Purpose
presentations Create/edit Google Slides
spreadsheets Create/edit Google Sheets
documents Create/edit Google Docs
drive.readonly Browse, search, and read file metadata (including Shared Drives)
drive.file Export and manage files created by this app

What This Server CAN Access

  • All Slides presentations in your account
  • All Sheets spreadsheets in your account
  • All Docs documents in your account
  • Drive file metadata, browsing, and search (including Shared Drives)
  • Export Google Workspace files to other formats (PDF, text, CSV, etc.)

What This Server CANNOT Access

  • Gmail, Calendar, or other Google services
  • Delete or permanently modify files you don't own
  • Your Google account password or 2FA settings

Security Best Practices

  1. Never commit .env files to version control
  2. Use a dedicated Google Cloud project for this server
  3. Review access at Google Account Permissions
  4. Regenerate tokens with npm run get-token if compromised

OAuth Setup

1. Enable APIs

In Google Cloud Console:

  1. Create or select a project
  2. Enable: Slides API, Sheets API, Docs API, Drive API

2. Create Credentials

  1. Go to APIs & Services > Credentials
  2. Create OAuth client ID (Desktop app type)
  3. Download client ID and secret

3. Configure Consent Screen

Add these scopes:

  • https://www.googleapis.com/auth/presentations
  • https://www.googleapis.com/auth/spreadsheets
  • https://www.googleapis.com/auth/documents
  • https://www.googleapis.com/auth/drive.readonly
  • https://www.googleapis.com/auth/drive.file

4. Generate Refresh Token

# Add client ID and secret to .env first
npm run get-token

The refresh token is generated once and stored. Regenerate only if:

  • You change OAuth scopes
  • You revoke access from your Google account
  • You need to use a different account

Troubleshooting

"Request had insufficient authentication scopes"

  1. Verify all 5 scopes are in your OAuth consent screen
  2. Regenerate token: npm run get-token
  3. Restart the MCP server

"API has not been used in project"

Enable the missing API in Google Cloud Console. The error message includes a direct link.

One service works but another doesn't

The token was generated without all scopes. Add missing scopes to consent screen and regenerate with npm run get-token.

Development

npm install          # Install dependencies
npm run build        # Compile TypeScript
npm run lint         # Run ESLint
npm test             # Run tests
npm run get-token    # Generate OAuth token

Testing with MCP Inspector

export $(cat .env | xargs) && npx @modelcontextprotocol/inspector node build/index.js

License

ISC

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选