MCP cover image
See in Github
2025-03-20

A Model Context Protocol (MCP) server implementation for Google Sheets

1

Github Watches

1

Github Forks

0

Github Stars

Google Sheets MCP Server

A Model Context Protocol (MCP) server for Google Sheets that enables Claude Desktop to interact with Google Sheets directly. This server provides tools for creating, reading, writing, and managing Google Sheets through Claude Desktop.

Features

  • Create new Google Sheets
  • Read and write data to existing sheets
  • Format cells and ranges
  • Add and delete sheets
  • Write formulas
  • Search for sheets
  • List available sheets

Prerequisites

  • Python 3.10 or higher
  • Google Cloud Project with Google Sheets API enabled
  • OAuth 2.0 credentials from Google Cloud Console
  • Claude Desktop application
  • uv package manager (recommended)

Installation

  1. Clone the repository:
git clone https://github.com/yourusername/google-sheets-mcp-server.git
cd google-sheets-mcp-server
  1. Create and activate a virtual environment:
python -m venv .venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate
  1. Install dependencies using uv:
uv pip install -e .
  1. Set up Google Cloud credentials:
    • Go to Google Cloud Console
    • Create a new project or select an existing one
    • Enable the Google Sheets API and Google Drive API
    • Create OAuth 2.0 credentials (Desktop app)
    • Download the credentials and save as ~/.config/google_sheets_mcp/google-sheets-mcp.json

Configuration

  1. Configure Claude Desktop:
    • Open Claude Desktop settings
    • Add the following to your claude_desktop_config.json:
{
  "mcpServers": {
    "google_sheets": {
      "command": "/path/to/your/.venv/bin/python",
      "args": [
        "/path/to/your/google_sheets.py",
        "--credentials-path",
        "/Users/yourusername/.config/google_sheets_mcp/google-sheets-mcp.json",
        "--log-level",
        "DEBUG"
      ]
    }
  }
}
  1. First-time setup:
    • Run the server manually to complete OAuth authentication:
python google_sheets.py --credentials-path ~/.config/google_sheets_mcp/google-sheets-mcp.json
  • Follow the browser prompts to authorize the application
  • The token will be saved automatically for future use

Usage

After setup, you can use the following commands in Claude Desktop:

  • Create a new sheet: create_sheet(title: str)
  • Format cells: format_range(file_id: str, range: str, format: dict)
  • Write formulas: write_formula(file_id: str, range: str, formula: str)
  • Add sheets: add_sheet(file_id: str, title: str)
  • Delete sheets: delete_sheet(file_id: str, sheet_id: int)
  • Get sheet properties: get_sheet_properties(file_id: str)

Development

Project Structure

google-sheets-mcp-server/
├── .venv/                  # Virtual environment
├── google_sheets.py        # Main server implementation
├── pyproject.toml         # Project configuration and dependencies
├── tests/                 # Test files
└── README.md             # This file

Adding New Features

  1. Add new tool methods to the GoogleSheetsMCP class
  2. Decorate them with @mcp.tool()
  3. Update the README with new feature documentation

Running Tests

pytest

Troubleshooting

  1. Server Connection Issues

    • Check if the server is running
    • Verify credentials path in config
    • Check logs in Claude Desktop
  2. Authentication Issues

    • Ensure OAuth credentials are valid
    • Check if your email is added as a test user
    • Try deleting token.json and re-authenticating
  3. API Errors

    • Verify Google Sheets API is enabled
    • Check API quotas and limits
    • Review error logs for specific issues

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Commit your changes
  4. Push to the branch
  5. Create a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

相关推荐

  • NiKole Maxwell
  • I craft unique cereal names, stories, and ridiculously cute Cereal Baby images.

  • https://suefel.com
  • Latest advice and best practices for custom GPT development.

  • Yusuf Emre Yeşilyurt
  • I find academic articles and books for research and literature reviews.

  • https://maiplestudio.com
  • Find Exhibitors, Speakers and more

  • Bora Yalcin
  • Evaluator for marketplace product descriptions, checks for relevancy and keyword stuffing.

  • Carlos Ferrin
  • Encuentra películas y series en plataformas de streaming.

  • Joshua Armstrong
  • Confidential guide on numerology and astrology, based of GG33 Public information

  • Contraband Interactive
  • Emulating Dr. Jordan B. Peterson's style in providing life advice and insights.

  • rustassistant.com
  • Your go-to expert in the Rust ecosystem, specializing in precise code interpretation, up-to-date crate version checking, and in-depth source code analysis. I offer accurate, context-aware insights for all your Rust programming questions.

  • Elijah Ng Shi Yi
  • Advanced software engineer GPT that excels through nailing the basics.

  • Emmet Halm
  • Converts Figma frames into front-end code for various mobile frameworks.

  • apappascs
  • Discover the most comprehensive and up-to-date collection of MCP servers in the market. This repository serves as a centralized hub, offering an extensive catalog of open-source and proprietary MCP servers, complete with features, documentation links, and contributors.

  • modelcontextprotocol
  • Model Context Protocol Servers

  • Mintplex-Labs
  • The all-in-one Desktop & Docker AI application with built-in RAG, AI agents, No-code agent builder, MCP compatibility, and more.

  • ShrimpingIt
  • Micropython I2C-based manipulation of the MCP series GPIO expander, derived from Adafruit_MCP230xx

  • OffchainLabs
  • Go implementation of Ethereum proof of stake

  • n8n-io
  • Fair-code workflow automation platform with native AI capabilities. Combine visual building with custom code, self-host or cloud, 400+ integrations.

  • huahuayu
  • A unified API gateway for integrating multiple etherscan-like blockchain explorer APIs with Model Context Protocol (MCP) support for AI assistants.

    Reviews

    3 (1)
    Avatar
    user_uuoRH6TM
    2025-04-16

    I've been using the google-sheets-mcp-server by amaboh and it has significantly streamlined my workflow. The seamless integration with Google Sheets and the server's efficient performance have truly been game-changers. Highly recommend this for anyone looking to enhance their productivity with Google Sheets. Check it out on GitHub: https://github.com/amaboh/google-sheets-mcp-server