# MCP Google Docs工具
## 基本信息
- Slug: `dev-ithitchhiker-mcp-google-docs`
- Source: modelscope
- Publisher: @dev-ithitchhiker/mcp-google-docs
- Categories: cloud-storage / databases
- Hosted: No
- License: MIT License
- Source URL: https://www.modelscope.cn/mcp/servers/@dev-ithitchhiker/mcp-google-docs
## 简介
一种使用MCP（Metoro控制协议）操作Google表格和Google云端硬盘的工具。
## 安装提示

```bash
# 가상 환경 생성 (Create virtual environment) python -m venv venv # 가상 환경 활성화 (Activate virtual environment) source venv/bin/activate ``` #### Windows ```bash # 가상 환경 생성 (Create virtual environment) python -m venv venv # 가상 환경 활성화 (Activate virtual environment) venv\Scripts\activate ``` ### 2. 安装所需包 (Install Required Packages): ```bash pip install -r requirements.txt
```

## MCP Server 详情

# MCP Google Spreadsheet

用于通过MCP（Metoro Control Protocol）操作Google Spreadsheet和Google Drive的工具。
A tool for manipulating Google Spreadsheet and Google Drive using MCP (Metoro Control Protocol).

## 功能 (Features)

### Google Drive 功能 (Google Drive Features)
- 列出文件 (List files)
- 复制文件 (Copy files)
- 重命名文件 (Rename files)
- 创建空电子表格 (Create empty spreadsheets)
- 根据模板创建电子表格 (Create spreadsheets from templates)
- 复制现有电子表格 (Copy existing spreadsheets)

### Google Sheets 功能 (Google Sheets Features)
- 列出工作表 (List sheets)
- 复制工作表 (Copy sheets)
- 重命名工作表 (Rename sheets)
- 获取工作表数据 (Get sheet data)
- 添加/删除行 (Add/Delete rows)
- 添加/删除列 (Add/Delete columns)
- 更新单元格 (Update cells)
- 创建/更新/删除图表 (Create/Update/Delete charts)
- 更改单元格格式 (Update cell formats)

## 安装方法 (Installation)

### 1. 虚拟环境设置 (Virtual Environment Setup)

#### macOS/Linux
```bash
# 가상 환경 생성 (Create virtual environment)
python -m venv venv

# 가상 환경 활성화 (Activate virtual environment)
source venv/bin/activate
```


#### Windows
```bash
# 가상 환경 생성 (Create virtual environment)
python -m venv venv

# 가상 환경 활성화 (Activate virtual environment)
venv\Scripts\activate
```


### 2. 安装所需包 (Install Required Packages):
```bash
pip install -r requirements.txt
```


### 3. Google Cloud Console 设置 (Google Cloud Console Setup)
1. 在Google Cloud Console中创建一个项目。 (Create a project in Google Cloud Console)
2. 生成OAuth 2.0客户端ID。 (Create OAuth 2.0 client ID)
3. 启用必要的API： (Enable required APIs:)
   - Google Sheets API
   - Google Drive API

### 4. 环境变量设置 (Environment Variables Setup):
```bash
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)
```


## 使用方法 (Usage)

### 1. 运行程序 (Run the Program):
```bash
python main.py
```


### 2. 通过MCP使用工具 (Use Tools via MCP):
```bash
# 예시: 파일 목록 조회 (Example: List files)
mcp list_files

# 예시: 시트 데이터 조회 (Example: Get sheet data)
mcp get_sheet_data --spreadsheet-id "your_spreadsheet_id" --range "Sheet1!A1:D10"

# 예시: 차트 생성 (Example: Create chart)
mcp create_chart --chart-type "LINE" --range "A1:B10" --sheet-name "Sheet1" --title "Sales Trend"
```


## 环境变量 (Environment Variables)

- `MCPGD_CLIENT_SECRET_PATH`: Google OAuth 2.0客户端密钥文件路径 (Path to Google OAuth 2.0 client secret file)
- `MCPGD_FOLDER_ID`: Google Drive文件夹ID (Google Drive folder ID)
- `MCPGD_TOKEN_PATH`: 令牌存储文件路径 (Path to token storage file, Optional, Default: ~/.mcp_google_spreadsheet.json)

## 许可证 (License)

MIT License

