A basic MCP server for reading files from Google Drive.
This project exposes Google Drive content through an MCP server built with
FastMCP. It uses Google Application Default Credentials locally and a Google
Cloud service account when deployed to Cloud Run.
The application has been containerized, stored in Google Artifact Registry, and deployed on Google Cloud Run.
You can try the deployed MCP server using this endpoint:
https://claude-drive-mcp-1016616131697.us-central1.run.app/mcp
Add this URL as a remote MCP server in any AI agent or MCP-compatible client that supports streamable HTTP MCP servers.
- List files from Google Drive
- Search files by full-text query
- Read supported Drive files as text
- Supports Google Docs, Google Sheets, Google Slides, plain text, JSON, CSV, and
Microsoft Word
.docxfiles - Preserves hyperlinks from
.docxfiles as Markdown links - Uses Google Drive read-only access
The server exposes three MCP tools:
Lists files from Google Drive.
Optional inputs:
folder_id: list files inside a specific Google Drive foldername_contains: filter files by name
Returns:
idnamemimeTypemodifiedTime
Reads the content of a supported Google Drive file by file ID.
Supported formats include:
- Google Docs
- Text files
- JSON files
- CSV files
- Microsoft Word
.docxfiles
Unsupported binary files return a short placeholder message instead of raw bytes.
Performs a full-text search across files available to the authenticated account or service account.
Returns up to 20 matching files.
- Python 3.12 or later
- Google Cloud SDK
- Access to a Google Cloud project
- Google Drive API enabled
- A Google service account with access to the required Drive files
Python dependencies are listed in requirements.txt.
Install dependencies:
pip install -r requirements.txtAuthenticate with Google Application Default Credentials:
gcloud auth application-default loginRun the server:
python server.pyBy default, the server runs on port 8080. You can override this with the
PORT environment variable.
Build the container:
docker build -t google-drive-mcp .Run the container:
docker run -p 8080:8080 google-drive-mcpThis server is designed to run on Google Cloud Run.
Typical deployment flow:
- Enable the Google Drive API in your Google Cloud project.
- Create or configure a Google service account.
- Share the required Google Drive files or folders with that service account.
- Build the Docker image.
- Push the image to Google Artifact Registry.
- Deploy the image to Google Cloud Run.
- Attach the service account to the Cloud Run service.
On Cloud Run, authentication is handled automatically by Google Cloud using the attached service account.
| Variable | Description | Default |
|---|---|---|
PORT |
Port used by the MCP HTTP server | 8080 |
.
|-- Dockerfile
|-- README.md
|-- requirements.txt
`-- server.py
- The server uses the Google Drive read-only scope:
https://www.googleapis.com/auth/drive.readonly - The service account must have access to the files or folders you want the MCP server to read.
- The MCP server runs with the
streamable-httptransport.