Google Sheets MCP Server
Enables comprehensive interaction with Google Sheets and Google Drive through OAuth2 authentication. Supports spreadsheet creation, data manipulation, formatting, chart creation, and advanced operations like SQL queries and batch updates.
README
Google Sheets MCP Server
A Model Context Protocol (MCP) server that provides tools for interacting with Google Sheets and Google Drive using OAuth2 authentication.
Features
- Authentication: OAuth2-based authentication with Google APIs
- Google Sheets: Create, read, update, and delete spreadsheets and worksheets
- Data Operations: Batch operations and data filtering
- Formatting: Cell formatting, charts, and conditional formatting
Prerequisites
- Python 3.12+
- UV package manager
- Google Cloud Project with Google Sheets API enabled
- OAuth2 credentials from Google Cloud Console
Quick Start
1. Clone and Setup
# Clone the repository
git clone https://github.com/jayeshchowdary/gsheets-mcp
cd gsheets-mcp
# Install dependencies with UV
uv sync
2. Authentication Setup
- Download your
credentials.jsonfrom Google Cloud Console - Place it in the project directory
- Run authentication:
uv run authenticate.py - Follow the prompts to complete OAuth2 authentication
3. Start the MCP Server
# Start the server
uv run simplemcp.py
4. Test with MCP Inspector
# In another terminal, start the inspector
npx @modelcontextprotocol/inspector
# Connect to your server using the inspector interface
# Command: uv
# Args: run simplemcp.py
# Working Directory: . (current directory)
Project Structure
gsheets-mcp/
├── pyproject.toml # UV project configuration
├── uv.lock # Locked dependencies
├── simplemcp.py # Main MCP server
├── authenticate.py # Authentication script
├── credentials.json # OAuth2 credentials (not in git)
├── .token.json # Authentication token (not in git)
├── mcp-server-config.json # MCP client configuration
└── README.md # This file
Available Tools
Spreadsheet Management
list_sheets- List all Google Sheets in your Drivecreate_google_sheet- Create a new Google Sheetdelete_spreadsheet- Delete a Google Sheetget_spreadsheet_info- Get spreadsheet metadata
Worksheet Management
add_worksheet- Add a new worksheet to a spreadsheetdelete_sheet- Delete a worksheet from a spreadsheetget_sheet_names- Get all worksheet namesfind_worksheet_by_title- Find worksheet by exact titlecopy_sheet_to_another_spreadsheet- Copy sheet between spreadsheets
Data Operations
get_cell_data- Get data from specific cellsupdate_sheet_data- Update cell dataappend_values_to_spreadsheet- Append data to spreadsheetbatch_update_by_filter- Update values by data filterexecute_sql_query- Execute SQL-like queries on sheets
Data Filtering
get_spreadsheet_by_data_filter- Get data using filtersbatch_get_spreadsheet_values_by_data_filter- Get values by data filterbatch_clear_spreadsheet_values- Clear multiple rangesbatch_clear_values_by_data_filter- Clear values by data filter
Table Operations
list_tables- List all tables in a spreadsheetget_table_schema- Get table structure and schemacreate_sheet_from_json- Create sheet from JSON data
Formatting and Charts
format_cell- Apply cell formattingcreate_chart- Create charts in sheetsset_basic_filter- Set basic filtersclear_basic_filter- Clear basic filters
Dimension Management
append_dimension- Add rows/columnsinsert_dimension- Insert rows/columns at specific positionsdelete_dimension- Delete rows/columnscreate_spreadsheet_column- Create new columnscreate_spreadsheet_row- Create new rows
Developer Metadata
create_developer_metadata- Create metadatasearch_developer_metadata- Search metadatadelete_developer_metadata- Delete metadata
Properties Management
update_sheet_properties- Update worksheet propertiesupdate_spreadsheet_properties- Update spreadsheet properties
Drive Operations
search_spreadsheets- Search for spreadsheets in Drive
Development
Adding Dependencies
# Add new package
uv add package-name
# Sync after changes
uv sync
Testing
# Test if server can import
uv run python -c "import simplemcp; print('✅ Ready!')"
# Test credentials
uv run python -c "import simplemcp; print(f'Credentials: {simplemcp.creds is not None}')"
Troubleshooting
Common Issues
-
"Credentials file not found"
- Ensure
credentials.jsonexists in project directory - Run
uv run authenticate.pyto set up authentication
- Ensure
-
"Token file not found"
- Run
uv run authenticate.pyto create a new token
- Run
-
"Module not found"
- Run
uv syncto install dependencies
- Run
-
"Authentication required"
- Run
uv run authenticate.pyto set up authentication
- Run
UV-Specific Issues
-
"Command not found: uv"
- Install UV:
curl -LsSf https://astral.sh/uv/install.sh | sh - Restart your terminal
- Install UV:
-
"Failed to install dependencies"
- Clear UV cache:
uv cache clean - Reinstall:
uv sync --reinstall
- Clear UV cache:
Security Notes
- Never commit
credentials.jsonor.token.jsonto version control - Keep your OAuth2 credentials secure
- Tokens are automatically refreshed when needed
Support
For issues or questions:
- Check the troubleshooting section above
- Verify UV is properly installed and dependencies are synced
- Ensure Google Sheets API is enabled in your Google Cloud Project
- Check that your OAuth2 credentials have the correct scopes
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。