Skip to main content
Glama

MCP Google Workspace 集成

一个全面的 MCP(Metoro 控制协议)工具,用于与 Google Workspace 服务(包括 Google 文档、表格、幻灯片和云端硬盘)进行交互。

特征

Google Drive 功能

  • 列出文件

  • 复制文件

  • 重命名文件

  • 创建空白电子表格

  • 从模板创建电子表格

  • 复制现有电子表格

Google 表格功能

  • 列表表

  • 复印件

  • 重命名工作表

  • 获取工作表数据

  • 添加/删除行

  • 添加/删除列

  • 更新单元格

  • 创建/更新/删除图表

  • 更新单元格格式

Google Docs 功能

  • 创建文档

  • 插入带格式的文本

  • 添加标题

  • 插入图片

  • 创建和管理表

  • 插入分页符

  • 添加水平线

  • 更新文档样式

  • 管理表格样式和内容

Google 幻灯片功能

  • 创建演示文稿

  • 添加幻灯片

  • 插入图片

  • 添加形状和线条

  • 更新文本样式

  • 修改幻灯片背景

  • 更新幻灯片布局

  • 添加幻灯片切换

  • 添加演讲者备注

Related MCP server: Spreadsheet MCP Server

安装

1.虚拟环境设置

macOS/Linux

# Create virtual environment python -m venv venv # Activate virtual environment source venv/bin/activate

视窗

# Create virtual environment python -m venv venv # Activate virtual environment venv\Scripts\activate

2.安装所需的软件包

pip install -r requirements.txt

3. Google Cloud Console 设置

  1. 在 Google Cloud Console 中创建项目

  2. 创建 OAuth 2.0 客户端 ID

  3. 启用所需的 API:

    • Google 表格 API

    • Google Drive API

    • Google 文档 API

    • Google 幻灯片 API

4.环境变量设置

export MCPGD_CLIENT_SECRET_PATH="/path/to/client_secret.json" export MCPGD_FOLDER_ID="your_folder_id" export MCPGD_TOKEN_PATH="/path/to/token.json" # Optional

用法

1.运行程序

python main.py

2. 通过 MCP 使用工具

Google Drive 示例

# List files mcp list_files # Copy a file mcp copy_file --file-id "file_id" --new_name "new_name"

Google 表格示例

# Get sheet data mcp get_sheet_data --spreadsheet_id "your_spreadsheet_id" --range "Sheet1!A1:D10" # Create chart mcp create_chart --chart_type "LINE" --range "A1:B10" --sheet_name "Sheet1" --title "Sales Trend"

Google 文档示例

# Create document mcp create_document --title "My Document" # Insert formatted text mcp insert_text_to_document --document_id "doc_id" --text "Hello World" --font_family "Arial" --font_size 12

Google 幻灯片示例

# Create presentation mcp create_presentation --title "My Presentation" # Add slide with content mcp add_slide_to_presentation --presentation_id "presentation_id" --title "Slide Title" --content "Slide Content"

环境变量

  • MCPGD_CLIENT_SECRET_PATH :Google OAuth 2.0 客户端密钥文件的路径

  • MCPGD_FOLDER_ID :Google Drive 文件夹 ID

  • MCPGD_TOKEN_PATH :令牌存储文件的路径(可选,默认值:~/.mcp_google_spreadsheet.json)

执照

MIT 许可证

-
security - not tested
A
license - permissive license
-
quality - not tested

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/dev-ithitchhiker/mcp-google-docs'

If you have feedback or need assistance with the MCP directory API, please join our Discord server