What it is
The Google Drive server is an MCP server that integrates with Google Drive to allow listing, reading, and searching over files. It exposes a search tool that returns file names and MIME types, and provides files as resources at gdrive:///<file_id>. Google Workspace files are automatically exported (Docs to Markdown, Sheets to CSV, Presentations to plain text, Drawings to PNG), while other files are provided in their native format.
Who it's for
- Developers who want an MCP client to search and read files in Google Drive
- Users of the desktop app or VS Code who want to add a Drive server via Docker or NPX
Requirements
Requirements
- A Google Cloud project with the Google Drive API enabled
- An OAuth consent screen configured, with scope
https://www.googleapis.com/auth/drive.readonly - An OAuth Client ID for application type "Desktop App", with its JSON key file renamed to
gcp-oauth.keys.json - Completed authentication so credentials are saved (e.g.
.gdrive-server-credentials.json) - Docker or NPX to run the server
- The server built with
npm run buildornpm run watchwhen running from the repo
Setup
Create Google Cloud OAuth credentials
Create a new Google Cloud project, enable the Google Drive API, and 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", and download the JSON file of your client's OAuth keys. Rename it togcp-oauth.keys.jsonand place it in the root of the repo (i.e.servers/gcp-oauth.keys.json). Build the server withnpm run buildornpm run watch.Authenticate locally
Run the server with the
authargument. This opens an authentication flow in your system browser. Credentials are saved in the root of the repo (i.e.servers/.gdrive-server-credentials.json).bashnode ./dist authAuthenticate with Docker
Replace
/path/to/gcp-oauth.keys.jsonwith the path to your OAuth keys file. The command prints a URL to open in your browser to complete authentication. Credentials are saved in themcp-gdrivevolume.bashdocker 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 authConfigure the desktop app (NPX)
Add this to your app's server configuration, pointing
GDRIVE_CREDENTIALS_PATHat your saved credentials file.json{ "mcpServers": { "gdrive": { "command": "npx", "args": [ "-y", "@modelcontextprotocol/server-gdrive" ], "env": { "GDRIVE_CREDENTIALS_PATH": "/path/to/.gdrive-server-credentials.json" } } } }Configure the desktop app (Docker)
After authenticating with Docker, use this server configuration.
json{ "mcpServers": { "gdrive": { "command": "docker", "args": ["run", "-i", "--rm", "-v", "mcp-gdrive:/gdrive-server", "-e", "GDRIVE_CREDENTIALS_PATH=/gdrive-server/credentials.json", "mcp/gdrive"] } } }Configure VS Code (NPX)
Add this to your User Settings (JSON) file (Ctrl + Shift + P, then
Preferences: Open User Settings (JSON)), or to.vscode/mcp.jsonin your workspace, where themcpkey is not needed.json{ "mcp": { "servers": { "gdrive": { "command": "npx", "args": [ "-y", "@modelcontextprotocol/server-gdrive" ], "env": { "GDRIVE_CREDENTIALS_PATH": "/path/to/.gdrive-server-credentials.json" } } } } }
Examples
Desktop app config via NPX
json{
"mcpServers": {
"gdrive": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-gdrive"
],
"env": {
"GDRIVE_CREDENTIALS_PATH": "/path/to/.gdrive-server-credentials.json"
}
}
}
}What it does: Registers the Google Drive server in an MCP client using the saved credentials file.
Authenticate the server with Docker
bashdocker 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 authWhat it does: Runs the one-time auth flow and stores credentials in the mcp-gdrive volume.
Search tool input
Promptsearch with query: <your search query>Expected output: The search tool takes a single query string and returns file names and MIME types of matching files. The phrasing here is illustrative, not from the source.
Pros & cons
Pros
- Pro:Read-only OAuth scope (
drive.readonly) limits what the server can access - Pro:Google Docs, Sheets, Presentations and Drawings are auto-exported to Markdown, CSV, plain text and PNG
- Pro:Supports all file types, with non-Workspace files returned in native format
- Pro:Can be run via Docker or NPX, with VS Code and desktop app configuration examples
Cons
- Con:Setup requires creating a Google Cloud project, OAuth consent screen and Desktop App client credentials
- Con:Only one tool (
search) is documented, and it returns only file names and MIME types - Con:Repository is in the archived servers repo, as shown by the URL
Images
