MCP Google Docs工具添加福利群:解决AI开发者的「MCP实战痛点」一个全面的 MCP(Metoro 控制协议)工具,用于与 Google Workspace 服务进行交互,包括 Google 文档、表格、幻灯片和云端硬盘。
# 创建虚拟环境
python -m venv venv
# 激活虚拟环境
source venv/bin/activate

# 创建虚拟环境
python -m venv venv
# 激活虚拟环境
venv\Scripts\activate

pip install -r requirements.txt
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" # 可选

python main.py
# 列出文件
mcp list_files
# 复制文件
mcp copy_file --file-id "file_id" --new_name "new_name"

# 获取工作表数据
mcp get_sheet_data --spreadsheet_id "your_spreadsheet_id" --range "Sheet1!A1:D10"
# 创建图表
mcp create_chart --chart_type "LINE" --range "A1:B10" --sheet_name "Sheet1" --title "Sales Trend"

# 创建文档
mcp create_document --title "My Document"
# 插入带格式的文本
mcp insert_text_to_document --document_id "doc_id" --text "Hello World" --font_family "Arial" --font_size 12

# 创建演示文稿
mcp create_presentation --title "My Presentation"
# 添加带内容的幻灯片
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 云端硬盘文件夹 IDMCPGD_TOKEN_PATH: 令牌存储文件路径(可选,默认:~/.mcp_google_spreadsheet.json)MIT 许可证