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
访问服务器

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)

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选