Access and Search Google Drive Files
MCP server for Google Drive - search files by query and read them as resources, with Google Workspace files auto-converted (Docs to Markdown, Sheets to CSV).
1.0.0Add to Favorites
Why it matters
Integrate Google Drive with your AI, enabling it to search for files, read their content, and access cloud storage for enhanced data retrieval and analysis.
Outcomes
What it gets done
Search for files using Drive's query syntax.
Read the content of specific files by ID.
List files within a specified folder.
Access files via resource URIs (e.g., gdrive:///file_id).
Source
Get it from source
Spark does not host a copy of it.
Open sourceReports
Agent outcome reports
No reports yet
Capabilities
Tools your agent gets
Search for files in Google Drive by query string
Overview
Google Drive MCP
An MCP server exposing a single search tool and per-file resources for Google Drive, auto-converting Google Workspace documents to plain formats on read. Use when an LLM needs to search and read a user's Google Drive files - after a one-time Google Cloud OAuth setup granting read-only access.
What it does
This MCP server integrates Google Drive with an LLM for listing, reading, and searching over files. It exposes a single tool, search, which takes a query string and returns the names and MIME types of matching files. Files themselves are exposed as resources at gdrive:///<file_id>, supporting every file type - Google Workspace files are automatically exported on read (Docs to Markdown, Sheets to CSV, Presentations to plain text, Drawings to PNG), while everything else is returned in its native format.
When to use - and when NOT to
Use it when an LLM needs to search a Google Drive and read specific files - Docs, Sheets, Slides, Drawings, or any other file type - as part of a conversation. Setup requires creating a Google Cloud project, enabling the Drive API, and completing an OAuth consent flow with the read-only drive.readonly scope, so it isn't a zero-setup connector - budget for the Google Cloud Console steps before first use.
Inputs and outputs
Input: a query string for the search tool, or a gdrive:///<file_id> resource URI to read a specific file. Output: matching file names and MIME types from search, or the file's content (auto-converted for Google Workspace formats) from a resource read.
How to install
Setup: create a Google Cloud project, enable the Google Drive API, configure an OAuth consent screen ("internal" is fine for testing), add the https://www.googleapis.com/auth/drive.readonly scope, and create a Desktop App OAuth Client ID. Save the downloaded credentials as gcp-oauth.keys.json in the repo root, then build with npm run build. Authenticate by running node ./dist auth, which opens a browser flow and saves credentials to .gdrive-server-credentials.json.
Via Docker, authenticate first with the OAuth keys file bind-mounted in, then run with GDRIVE_CREDENTIALS_PATH pointing at the saved credentials volume:
docker run -i --rm --mount type=bind,source=/path/to/gcp-oauth.keys.json,target=/gcp-oauth.keys.json -v mcp-gdrive:/gdrive-server -e GDRIVE_OAUTH_PATH=/gcp-oauth.keys.json -e "GDRIVE_CREDENTIALS_PATH=/gdrive-server/credentials.json" -p 3000:3000 mcp/gdrive auth
Or via npx:
npx -y @modelcontextprotocol/server-gdrive
with GDRIVE_CREDENTIALS_PATH set in the client's env config. Both variants are added under mcpServers in the desktop app config; VS Code has one-click install buttons for the npx and Docker variants, or manual setup via .vscode/mcp.json. The server itself is MIT-licensed.
Who it's for
Users and developers who want an LLM to search and read their own Google Drive files - including native conversion of Google Workspace documents - and are willing to complete a one-time Google Cloud OAuth setup to grant read-only access.
Source README
Google Drive server
This MCP server integrates with Google Drive to allow listing, reading, and searching over files.
Components
Tools
- search
- Search for files in Google Drive
- Input:
query(string): Search query - Returns file names and MIME types of matching files
Resources
The server provides access to Google Drive files:
- Files (
gdrive:///<file_id>)- Supports all file types
- Google Workspace files are automatically exported:
- Docs → Markdown
- Sheets → CSV
- Presentations → Plain text
- Drawings → PNG
- Other files are provided in their native format
Getting started
- Create a new Google Cloud project
- Enable the Google Drive API
- Configure an OAuth consent screen ("internal" is fine for testing)
- Add OAuth scope
https://www.googleapis.com/auth/drive.readonly - Create an OAuth Client ID for application type "Desktop App"
- Download the JSON file of your client's OAuth keys
- Rename the key file to
gcp-oauth.keys.jsonand place into the root of this repo (i.e.servers/gcp-oauth.keys.json)
Make sure to build the server with either npm run build or npm run watch.
Authentication
To authenticate and save credentials:
- Run the server with the
authargument:node ./dist auth - This will open an authentication flow in your system browser
- Complete the authentication process
- Credentials will be saved in the root of this repo (i.e.
servers/.gdrive-server-credentials.json)
Usage with Desktop App
To integrate this server with the desktop app, add the following to your app's server configuration:
Docker
Authentication:
Assuming you have completed setting up the OAuth application on Google Cloud, you can now auth the server with the following command, replacing /path/to/gcp-oauth.keys.json with the path to your OAuth keys file:
docker run -i --rm --mount type=bind,source=/path/to/gcp-oauth.keys.json,target=/gcp-oauth.keys.json -v mcp-gdrive:/gdrive-server -e GDRIVE_OAUTH_PATH=/gcp-oauth.keys.json -e "GDRIVE_CREDENTIALS_PATH=/gdrive-server/credentials.json" -p 3000:3000 mcp/gdrive auth
The command will print the URL to open in your browser. Open this URL in your browser and complete the authentication process. The credentials will be saved in the mcp-gdrive volume.
Once authenticated, you can use the server in your app's server configuration:
{
"mcpServers": {
"gdrive": {
"command": "docker",
"args": ["run", "-i", "--rm", "-v", "mcp-gdrive:/gdrive-server", "-e", "GDRIVE_CREDENTIALS_PATH=/gdrive-server/credentials.json", "mcp/gdrive"]
}
}
}
NPX
{
"mcpServers": {
"gdrive": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-gdrive"
],
"env": {
"GDRIVE_CREDENTIALS_PATH": "/path/to/.gdrive-server-credentials.json"
}
}
}
}
Usage with VS Code
For quick installation, use one of the one-click install buttons below..
For manual installation, add the following JSON block to your User Settings (JSON) file in VS Code. You can do this by pressing Ctrl + Shift + P and typing Preferences: Open User Settings (JSON).
Optionally, you can add it to a file called .vscode/mcp.json in your workspace. This will allow you to share the configuration with others.
Note that the
mcpkey is not needed in the.vscode/mcp.jsonfile.
NPX
{
"mcp": {
"servers": {
"gdrive": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-gdrive"
],
"env": {
"GDRIVE_CREDENTIALS_PATH": "/path/to/.gdrive-server-credentials.json"
}
}
}
}
}
Docker
{
"mcp": {
"servers": {
"gdrive": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-v",
"mcp-gdrive:/gdrive-server",
"-e",
"GDRIVE_CREDENTIALS_PATH=/gdrive-server/credentials.json",
"mcp/gdrive"
]
}
}
}
}
FAQ
Common questions
Discussion
Questions & comments · 0
Sign In Sign in to leave a comment.