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
| 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 |
git clone https://github.com/mrbit-dev/mcp-google-driver.git
cd mcp-google-driver
npm install- Truy cập Google Cloud Console
- Tạo project mới hoặc chọn project có sẵn
- Vào APIs & Services > Enable APIs
- Bật Google Drive API
- Vào APIs & Services > Credentials
- Tạo OAuth 2.0 Client ID:
- Application type: Desktop app
- Tải file JSON về
- Copy
client_idvàclient_secret
cp .env.example .envMở .env và điền thông tin:
GOOGLE_CLIENT_ID=your_client_id.apps.googleusercontent.com
GOOGLE_CLIENT_SECRET=your_client_secretnpm run buildScript 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.
npm run buildThê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
.envtrong project directory, bạn có thể bỏ qua phầnenvtrong 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 mcp add google-drive node /path/to/mcp-google-drive/dist/index.jsHoặc thêm vào .claude/settings.json:
{
"mcpServers": {
"google-drive": {
"command": "node",
"args": ["/path/to/mcp-google-drive/dist/index.js"]
}
}
}Thêm vào ~/.cursor/mcp.json:
{
"mcpServers": {
"google-drive": {
"command": "node",
"args": ["/path/to/mcp-google-drive/dist/index.js"]
}
}
}Thêm vào ~/.codeium/windsurf/mcp_config.json:
{
"mcpServers": {
"google-drive": {
"command": "node",
"args": ["/path/to/mcp-google-drive/dist/index.js"]
}
}
}npm run inspectorMở trình duyệt tại http://localhost:5173 để kiểm tra từng tool.
- File
.envvàservice-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
→ Kiểm tra file .env đã có đủ GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET, GOOGLE_REFRESH_TOKEN
→ Chạy lại npm run auth để lấy refresh token mới
→ Chạy npm run build trước khi start
→ Đảm bảo OAuth Client Type là Desktop app (không phải Web app)