gdrive-mcp
gdrive-mcp
Google Drive フォルダを Streamable HTTP で公開するMCP(Model Context Protocol)サーバーです。Vercel 上で実行し、GitHub でホストすることを想定しています。
次の 2 つのツールを提供します:
ツール | 説明 |
| 設定された Drive フォルダ内のファイル/フォルダを一覧表示します(検索可能) |
| テキストコンテンツを読み取ります。Google Docs/Sheets/Slides は自動エクスポートします |
アーキテクチャ
server.ts— Node.js HTTP サーバーのエントリポイント(Streamable HTTP のMCPエンドポイント)。src/mcp.ts— MCP サーバーの定義とツール。src/drive.ts— サービス アカウントを使用する Google Drive クライアント。
認証は、Google のサービス アカウントによる読み取り専用(drive.readonly)です。
Related MCP server: gdrive-mcp-server
1. Google Cloud のセットアップ(サービス アカウント)
Google Cloud Console にアクセスして、プロジェクトを作成します。
Google Drive API を有効にします:
APIs & Services→Libraryで "Google Drive API" を検索して [Enable] をクリックします。サービス アカウントを作成します:
IAM & Admin→Service Accounts→Create Service Account。そのアカウントの JSON キーを作成します: サービス アカウントを開く →
Keys→Add Key→Create New Key→ JSON。ファイルをダウンロードします。サービス アカウントのメールアドレスを確認します(
name@project.iam.gserviceaccount.comのような形式です)。Drive フォルダをそのメールアドレスと共有します:
Google Drive でフォルダを開く → 右クリック →
Share。サービス アカウントのメールアドレスを貼り付け、閲覧者アクセス権を付与します。
フォルダ ID(URL 内の
/folders/の後ろの部分)をコピーします。
2. ローカル環境のセットアップ
git clone <your-repo-url>
cd gdrive-mcp
npm install.env ファイルを作成します(.env.example をコピー):
DRIVE_FOLDER_ID=1XM-0CtgvW3PGDekC8qLa2ghxRyvTfjwD
GOOGLE_SERVICE_ACCOUNT_KEY=<base64 of service-account.json>サービス アカウント キーを base64 にエンコードします:
Linux/macOS:
base64 -w0 service-account.jsonPowerShell:
[Convert]::ToBase64String([IO.File]::ReadAllBytes("service-account.json"))
3. Vercel へのデプロイ
オプション A — Vercel + GitHub(推奨)
このリポジトリを GitHub にプッシュします。
Vercel で Add New → Project から GitHub リポジトリをインポートします。
環境変数(
DRIVE_FOLDER_ID、GOOGLE_SERVICE_ACCOUNT_KEY)を追加します。デプロイします。MCP エンドポイントは次のようになります:
https://<your-project>.vercel.app
オプション B — Vercel CLI
npm i -g vercel
vercel login
vercel env add DRIVE_FOLDER_ID
vercel env add GOOGLE_SERVICE_ACCOUNT_KEY
vercel --prod4. GitHub へのプッシュ(初回のみ)
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 main5. MCP クライアントを接続する
クライアントを、Streamable HTTP トランスポートでデプロイされた URL に接続します。claude_desktop_config.json の例:
{
"mcpServers": {
"gdrive": {
"type": "http",
"url": "https://<your-project>.vercel.app"
}
}
}汎用のMCP設定形式を使用するクライアントの場合:
{
"mcpServers": {
"gdrive": {
"url": "https://<your-project>.vercel.app"
}
}
}このエンドポイントはステートレスなので、リクエストごとに新しいトランスポートが作成されます。サーバーレスに最適です。 アクセス制御は、サービス アカウントに対する Google Drive の共有設定によって行われます。
環境変数
変数 | 必須 | 説明 |
| はい | Google Drive のフォルダ ID |
| はい | Base64 エンコードされたサービス アカウントの JSON キー |
This server cannot be deployed
Maintenance
Related MCP Connectors
Streamable HTTP MCP server for Google Calendar and Sheets with OAuth login.
Google Docs MCP Pack — read, create, and edit Google Docs via OAuth.
Give Claude only the Google Drive files you choose. Every action logged.
Notes, files, GitHub, and Drive through one MCP connection.
Related MCP Servers
- FlicenseNot gradedqualityCmaintenanceA 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.13 npm2-
- FlicenseNot gradedqualityDmaintenanceEnables 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.-
- FlicenseNot gradedqualityBmaintenanceA 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.-
- FlicenseNot gradedqualityCmaintenanceEnables 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.-