MCP Google Drive Server

MCP Google Drive Server

Enables AI assistants to interact with Google Drive, supporting file operations like list, search, read, create, update, delete, share, and manage permissions.

Category
Visit Server

README

🚀 MCP Google Drive Server

Một MCP (Model Context Protocol) Server đầy đủ tính năng cho Google Drive, tương thích với tất cả AI clients hỗ trợ MCP:

  • Antigravity (Google DeepMind)
  • Claude Desktop (Anthropic)
  • Claude Code (CLI)
  • Cursor
  • Windsurf
  • Continue.dev
  • ✅ Và bất kỳ MCP-compatible client nào khác

🧩 Tính năng

Tool Mô tả
list_files Liệt kê files/folders trong Drive
search_files Tìm kiếm theo tên hoặc nội dung
get_file_info Xem metadata chi tiết của file
read_file Đọc nội dung file (Docs, Sheets, text...)
create_file Tạo file mới với nội dung
update_file Cập nhật nội dung file
create_folder Tạo thư mục mới
delete_file Xóa file (vào thùng rác hoặc vĩnh viễn)
restore_file Khôi phục từ thùng rác
move_file Di chuyển file sang folder khác
copy_file Sao chép file
rename_file Đổi tên file/folder
share_file Chia sẻ với người dùng hoặc công khai
get_permissions Xem danh sách quyền chia sẻ
get_storage_quota Xem dung lượng Drive

⚙️ Cài đặt

Bước 1: Clone và cài dependencies

git clone https://github.com/mrbit-dev/mcp-google-driver.git
cd mcp-google-driver
npm install

Bước 2: Tạo Google Cloud Project và OAuth2 Credentials

  1. Truy cập Google Cloud Console
  2. Tạo project mới hoặc chọn project có sẵn
  3. Vào APIs & Services > Enable APIs
  4. Bật Google Drive API
  5. Vào APIs & Services > Credentials
  6. Tạo OAuth 2.0 Client ID:
    • Application type: Desktop app
    • Tải file JSON về
  7. Copy client_idclient_secret

Bước 3: Tạo file .env

cp .env.example .env

Mở .env và điền thông tin:

GOOGLE_CLIENT_ID=your_client_id.apps.googleusercontent.com
GOOGLE_CLIENT_SECRET=your_client_secret

Bước 4: Lấy Refresh Token

npm run build

Script sẽ tự động mở trình duyệt, bạn đăng nhập và cấp quyền, sau đó refresh token sẽ được tự động lưu vào .env.

Bước 5: Build project

npm run build

🔧 Cấu hình MCP Client

Antigravity / Claude Desktop

Thêm vào file claude_desktop_config.json (Windows: %APPDATA%\Claude\claude_desktop_config.json):

{
  "mcpServers": {
    "google-drive": {
      "command": "node",
      "args": ["/path/to/mcp-google-driver/dist/index.js"],
      "env": {
        "GOOGLE_CLIENT_ID": "your_client_id",
        "GOOGLE_CLIENT_SECRET": "your_client_secret",
        "GOOGLE_REFRESH_TOKEN": "your_refresh_token"
      }
    }
  }
}

Lưu ý: Nếu đã có file .env trong project directory, bạn có thể bỏ qua phần env trong config (dotenv sẽ tự load).

[!IMPORTANT] Chú ý về đường dẫn (/path/to/mcp-google-drive/): Bạn cần thay thế /path/to/mcp-google-drive bằng đường dẫn thư mục thực tế trên máy tính của bạn sau khi clone dự án về (ví dụ: C:/projects/mcp-google-drive/dist/index.js hoặc e:/laragon/www/MCP_GOOGLE_Driver/dist/index.js).

Claude Code (CLI)

claude mcp add google-drive node /path/to/mcp-google-drive/dist/index.js

Hoặc thêm vào .claude/settings.json:

{
  "mcpServers": {
    "google-drive": {
      "command": "node",
      "args": ["/path/to/mcp-google-drive/dist/index.js"]
    }
  }
}

Cursor

Thêm vào ~/.cursor/mcp.json:

{
  "mcpServers": {
    "google-drive": {
      "command": "node",
      "args": ["/path/to/mcp-google-drive/dist/index.js"]
    }
  }
}

Windsurf

Thêm vào ~/.codeium/windsurf/mcp_config.json:

{
  "mcpServers": {
    "google-drive": {
      "command": "node",
      "args": ["/path/to/mcp-google-drive/dist/index.js"]
    }
  }
}

🧪 Test với MCP Inspector

npm run inspector

Mở trình duyệt tại http://localhost:5173 để kiểm tra từng tool.


🔐 Bảo mật

  • File .envservice-account-key.json đã được thêm vào .gitignore
  • KHÔNG commit credentials lên Git
  • Sử dụng refresh token thay vì access token (tự động làm mới)
  • Hỗ trợ Service Account cho server-to-server authentication

🐛 Troubleshooting

Lỗi "Missing credentials"

→ Kiểm tra file .env đã có đủ GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET, GOOGLE_REFRESH_TOKEN

Lỗi "Access denied"

→ Chạy lại npm run auth để lấy refresh token mới

Lỗi "Cannot find module"

→ Chạy npm run build trước khi start

Lỗi CORS hoặc redirect_uri_mismatch

→ Đảm bảo OAuth Client Type là Desktop app (không phải Web app)

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured