Skip to main content
Glama

gdrive-mcp

An MCP (Model Context Protocol) server that exposes a Google Drive folder over Streamable HTTP, built to run on Vercel and hosted on GitHub.

It provides two tools:

Tool

Description

list_files

List files/folders inside the configured Drive folder (optional search)

read_file

Read text content, auto-exporting Google Docs/Sheets/Slides

Architecture

  • server.ts — Node.js HTTP server entrypoint (Streamable HTTP MCP endpoint).

  • src/mcp.ts — MCP server definition + tools.

  • src/drive.ts — Google Drive client using a service account.

Authentication is read-only (drive.readonly) via a Google service account.


Related MCP server: gdrive-mcp-server

1. Google Cloud setup (service account)

  1. Go to Google Cloud Console and create a project.

  2. Enable the Google Drive API: APIs & ServicesLibrary → search "Google Drive API" → Enable.

  3. Create a service account: IAM & AdminService AccountsCreate Service Account.

  4. Create a JSON key for it: open the service account → KeysAdd KeyCreate New Key → JSON. Download the file.

  5. Note the service account email (looks like name@project.iam.gserviceaccount.com).

  6. Share the Drive folder with that email:

    • Open your folder in Google Drive → right-click → Share.

    • Paste the service account email, give it Viewer access.

  7. Copy the folder ID (the part after /folders/ in the URL).


2. Local setup

git clone <your-repo-url>
cd gdrive-mcp
npm install

Create a .env file (copy .env.example):

DRIVE_FOLDER_ID=1XM-0CtgvW3PGDekC8qLa2ghxRyvTfjwD
GOOGLE_SERVICE_ACCOUNT_KEY=<base64 of service-account.json>

Encode the service-account key to base64:

  • Linux/macOS: base64 -w0 service-account.json

  • PowerShell: [Convert]::ToBase64String([IO.File]::ReadAllBytes("service-account.json"))


3. Deploy to Vercel

  1. Push this repo to GitHub.

  2. In VercelAdd New → Project → import the GitHub repo.

  3. Add the environment variables (DRIVE_FOLDER_ID, GOOGLE_SERVICE_ACCOUNT_KEY).

  4. Deploy. The MCP endpoint will be:

    https://<your-project>.vercel.app

Option B — Vercel CLI

npm i -g vercel
vercel login
vercel env add DRIVE_FOLDER_ID
vercel env add GOOGLE_SERVICE_ACCOUNT_KEY
vercel --prod

4. Push to GitHub (first time)

git init
git add .
git commit -m "Add gdrive-mcp server"
git branch -M main
git remote add origin https://github.com/<you>/gdrive-mcp.git
git push -u origin main

5. Connect an MCP client

Point your client at the deployed URL with the Streamable HTTP transport. Example claude_desktop_config.json:

{
  "mcpServers": {
    "gdrive": {
      "type": "http",
      "url": "https://<your-project>.vercel.app"
    }
  }
}

For clients that use the generic MCP config format:

{
  "mcpServers": {
    "gdrive": {
      "url": "https://<your-project>.vercel.app"
    }
  }
}

The endpoint is stateless, so each request creates a fresh transport — ideal for serverless. Access is controlled by Google Drive sharing on the service account.

Environment variables

Variable

Required

Description

DRIVE_FOLDER_ID

Yes

Google Drive folder ID

GOOGLE_SERVICE_ACCOUNT_KEY

Yes

Base64-encoded service-account JSON key

Related MCP Connectors

Related MCP Servers

  • F
    license
    Not graded
    quality
    C
    maintenance
    A read-only Google Drive MCP server that allows searching files, reading file content (with auto-export for Google Docs, Sheets, Slides), and retrieving file metadata via OAuth authentication.
    8 npm
    2
    -
  • F
    license
    Not graded
    quality
    C
    maintenance
    Enables MCP-compatible AI assistants to interact with a user's Google Drive, including listing, searching, reading, creating, updating, and deleting files, with authentication via Google OAuth.
    -
  • F
    license
    Not graded
    quality
    B
    maintenance
    A read-only MCP server that exposes a configured Google Drive folder to MCP clients, enabling them to list, search, and extract content from various file formats like Excel, CSV, PDF, DOCX, and images.
    -
  • F
    license
    Not graded
    quality
    C
    maintenance
    Enables interacting with Google Drive folders through an MCP server, allowing listing, searching, and reading files using tools like list_files, search_files, get_file, and read_file.
    -