Sponsored by Deepsite.site

Google Drive MCP Server

Created By
festusev7 months ago
An MCP Server for Google Drive
Content

Google Drive MCP Server

A Model Context Protocol (MCP) server for Google Drive integration, built with FastMCP. Provides tools for reading, writing, searching, and listing Google Drive files with a focus on Google Docs operations.

Features

  • File Operations: List and search files in Google Drive with pagination
  • Document Reading: Read Google Docs content with pagination and tab selection
  • Document Writing: Write to Google Docs with tab selection and range operations
  • Authentication: Service account authentication for Google Drive API access
  • Pagination: Handle large documents and file lists efficiently

Setup

1. Install Dependencies

uv sync

2. Google API Setup

  1. Go to the Google Cloud Console
  2. Create a new project or select an existing one
  3. Enable the Google Drive API and Google Docs API
  4. Create a service account and generate a key
  5. Download the service account key file and save it as service-account-key.json in the project root
  6. Share any Google Drive files/folders you want to access with the service account email

3. Running the Server

python -m google_drive_mcp.server

No authentication flow is required - the service account will authenticate automatically using the key file.

Available Tools

list_files

List files in Google Drive with optional filtering and pagination.

Parameters:

  • folder_id (optional): Folder ID to list files from (default: root)
  • page_size (optional): Number of files per page (default: 50, max: 100)
  • page_token (optional): Token for pagination
  • mime_type (optional): Filter by MIME type (e.g., 'application/vnd.google-apps.document')

search_files

Search for files in Google Drive using query syntax.

Parameters:

  • query: Search query (e.g., 'name contains "report"')
  • page_size (optional): Number of files per page (default: 50, max: 100)
  • page_token (optional): Token for pagination

read_document

Read content from a Google Docs document with pagination.

Parameters:

  • document_id: Google Docs document ID
  • tab_id (optional): Specific tab ID to read from
  • start_index (optional): Starting character index (default: 0)
  • length (optional): Number of characters to read (default: 5000, max: 10000)

write_document

Write content to a Google Docs document.

Parameters:

  • document_id: Google Docs document ID
  • content: Content to write
  • tab_id (optional): Specific tab ID to write to
  • insert_index (optional): Index where to insert content (default: end)
  • replace_start (optional): Start index for content replacement
  • replace_end (optional): End index for content replacement

Usage Examples

Search for Google Docs

# Search for documents containing "report"
search_files(query='name contains "report" and mimeType="application/vnd.google-apps.document"')

Read a Document with Pagination

# Read first 5000 characters
read_document(document_id="your_doc_id")

# Read next 5000 characters
read_document(document_id="your_doc_id", start_index=5000)

Write to a Specific Tab

# Write to a specific tab in a document
write_document(
    document_id="your_doc_id",
    content="Hello, World!",
    tab_id="your_tab_id"
)

Development

Project Structure

google_drive_mcp/
├── __init__.py
├── auth.py          # Google Drive authentication
└── server.py        # FastMCP server implementation

Running in Development

# Install in development mode
uv pip install -e .

# Run the server
python -m google_drive_mcp.server

License

This project is licensed under the MIT License.

Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
Howtocook Mcp基于Anduin2017 / HowToCook (程序员在家做饭指南)的mcp server,帮你推荐菜谱、规划膳食,解决“今天吃什么“的世纪难题; Based on Anduin2017/HowToCook (Programmer's Guide to Cooking at Home), MCP Server helps you recommend recipes, plan meals, and solve the century old problem of "what to eat today"
Amap Maps高德地图官方 MCP Server
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.
Serper MCP ServerA Serper MCP Server
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs
ChatWiseThe second fastest AI chatbot™
TimeA Model Context Protocol server that provides time and timezone conversion capabilities. This server enables LLMs to get current time information and perform timezone conversions using IANA timezone names, with automatic system timezone detection.
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.
Tavily Mcp
WindsurfThe new purpose-built IDE to harness magic
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code
DeepChatYour AI Partner on Desktop
BlenderBlenderMCP connects Blender to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Blender. This integration enables prompt assisted 3D modeling, scene creation, and manipulation.
Zhipu Web SearchZhipu Web Search MCP Server is a search engine specifically designed for large models. It integrates four search engines, allowing users to flexibly compare and switch between them. Building upon the web crawling and ranking capabilities of traditional search engines, it enhances intent recognition capabilities, returning results more suitable for large model processing (such as webpage titles, URLs, summaries, site names, site icons, etc.). This helps AI applications achieve "dynamic knowledge acquisition" and "precise scenario adaptation" capabilities.
Context7Context7 MCP Server -- Up-to-date code documentation for LLMs and AI code editors
Playwright McpPlaywright MCP server
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.
CursorThe AI Code Editor