mcp-google-gdrive 0.1.0 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +172 -41
- package/SPEC.md +8 -6
- package/package.json +8 -3
- package/src/index.js +1040 -327
package/README.md
CHANGED
|
@@ -1,35 +1,137 @@
|
|
|
1
1
|
# mcp-google-gdrive
|
|
2
2
|
|
|
3
|
-
An [MCP](https://modelcontextprotocol.io) server for
|
|
3
|
+
An [MCP](https://modelcontextprotocol.io/) server for Google Drive, Docs, Sheets, and Slides. Lets AI assistants manage files, folders, permissions, labels, and trash with full read/write access across multiple Google accounts. Includes automatic Workspace format conversion (Docs to Markdown, Sheets to CSV/JSON, Slides to text).
|
|
4
4
|
|
|
5
5
|
## Tools
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
|
10
|
-
|
|
11
|
-
|
|
|
12
|
-
|
|
|
13
|
-
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
|
18
|
-
|
|
19
|
-
|
|
|
20
|
-
|
|
|
21
|
-
|
|
|
22
|
-
|
|
|
7
|
+
### Account Management
|
|
8
|
+
|
|
9
|
+
| Tool | Description |
|
|
10
|
+
|------|-------------|
|
|
11
|
+
| `gdrive_list_accounts` | List all configured Google accounts with labels and emails |
|
|
12
|
+
| `gdrive_switch_account` | Set the active account for subsequent calls |
|
|
13
|
+
| `gdrive_add_account` | Generate an authorization URL to add a new Google account |
|
|
14
|
+
|
|
15
|
+
### Files
|
|
16
|
+
|
|
17
|
+
| Tool | Description |
|
|
18
|
+
|------|-------------|
|
|
19
|
+
| `gdrive_list_files` | List files with optional search query and folder filtering |
|
|
20
|
+
| `gdrive_get_metadata` | Get detailed metadata for a file by ID |
|
|
21
|
+
| `gdrive_read_file` | Read file content with automatic Workspace format conversion |
|
|
22
|
+
| `gdrive_download_file` | Download a file to local disk (supports Workspace export) |
|
|
23
|
+
| `gdrive_create_file` | Create a new file with optional OCR on image/PDF uploads |
|
|
24
|
+
| `gdrive_update_file` | Update a file's content, name, or description |
|
|
25
|
+
| `gdrive_copy_file` | Copy a file, optionally to a different folder |
|
|
26
|
+
| `gdrive_move_file` | Move a file to a different folder |
|
|
27
|
+
| `gdrive_search_files` | Full-text search across file names and content |
|
|
28
|
+
|
|
29
|
+
### Folders
|
|
30
|
+
|
|
31
|
+
| Tool | Description |
|
|
32
|
+
|------|-------------|
|
|
33
|
+
| `gdrive_create_folder` | Create a new folder |
|
|
34
|
+
| `gdrive_list_folder` | List contents of a specific folder |
|
|
35
|
+
| `gdrive_delete_folder` | Delete a folder (trash or permanent) |
|
|
36
|
+
|
|
37
|
+
### Trash
|
|
38
|
+
|
|
39
|
+
| Tool | Description |
|
|
40
|
+
|------|-------------|
|
|
41
|
+
| `gdrive_trash_file` | Move a file or folder to trash |
|
|
42
|
+
| `gdrive_untrash_file` | Restore a file or folder from trash |
|
|
43
|
+
| `gdrive_empty_trash` | Permanently delete all trashed files (irreversible) |
|
|
44
|
+
| `gdrive_list_trash` | List files currently in trash |
|
|
45
|
+
|
|
46
|
+
### Permissions
|
|
47
|
+
|
|
48
|
+
| Tool | Description |
|
|
49
|
+
|------|-------------|
|
|
50
|
+
| `gdrive_share_file` | Share a file with a user, group, domain, or anyone |
|
|
51
|
+
| `gdrive_list_permissions` | List all permissions on a file or folder |
|
|
52
|
+
| `gdrive_update_permission` | Update a permission's role |
|
|
53
|
+
| `gdrive_remove_permission` | Remove a permission (unshare) |
|
|
54
|
+
| `gdrive_transfer_ownership` | Transfer file ownership to another user |
|
|
55
|
+
|
|
56
|
+
### Labels
|
|
57
|
+
|
|
58
|
+
| Tool | Description |
|
|
59
|
+
|------|-------------|
|
|
60
|
+
| `gdrive_list_labels` | List available Drive labels |
|
|
61
|
+
| `gdrive_list_file_labels` | List labels applied to a file |
|
|
62
|
+
| `gdrive_set_file_labels` | Add, update, or remove labels on a file |
|
|
63
|
+
|
|
64
|
+
### Google Docs
|
|
65
|
+
|
|
66
|
+
| Tool | Description |
|
|
67
|
+
|------|-------------|
|
|
68
|
+
| `gdrive_export_doc` | Export a Google Doc (markdown, html, text, docx, pdf). Use `savePath` to save binary formats to disk |
|
|
69
|
+
| `gdrive_create_doc` | Create a Google Doc from Markdown content |
|
|
70
|
+
| `gdrive_update_doc` | Replace a Google Doc's content with Markdown |
|
|
71
|
+
|
|
72
|
+
### Google Sheets
|
|
73
|
+
|
|
74
|
+
| Tool | Description |
|
|
75
|
+
|------|-------------|
|
|
76
|
+
| `gdrive_create_sheet` | Create a new spreadsheet with named tabs |
|
|
77
|
+
| `gdrive_export_sheet` | Export a sheet to CSV, JSON, or XLSX. Use `savePath` to save XLSX to disk |
|
|
78
|
+
| `gdrive_list_sheets` | List all sheets/tabs in a spreadsheet |
|
|
79
|
+
| `gdrive_read_sheet_range` | Read a specific range from any tab (A1 notation) |
|
|
80
|
+
| `gdrive_write_sheet_range` | Write data to a specific range |
|
|
81
|
+
|
|
82
|
+
### Google Slides
|
|
83
|
+
|
|
84
|
+
| Tool | Description |
|
|
85
|
+
|------|-------------|
|
|
86
|
+
| `gdrive_create_slides` | Create a new presentation |
|
|
87
|
+
| `gdrive_export_slides` | Export slides to text, PDF, or PPTX. Use `savePath` to save binary formats to disk |
|
|
88
|
+
| `gdrive_get_slide_thumbnail` | Get a thumbnail image URL for a specific slide |
|
|
89
|
+
|
|
90
|
+
## What's New in v2.2
|
|
91
|
+
|
|
92
|
+
- **`outputFormat` parameter** — 12 read/list tools now accept `outputFormat: "json" | "yaml" | "text"`. Default is `json` (backwards compatible). Use `yaml` for structured output or `text` for compact human-readable tables. Supported on: `list_accounts`, `list_files`, `list_folder`, `list_trash`, `list_permissions`, `list_labels`, `list_file_labels`, `list_sheets`, `get_metadata`, `read_sheet_range`, `get_slide_thumbnail`, `search_files`.
|
|
93
|
+
|
|
94
|
+
### v2.1
|
|
95
|
+
|
|
96
|
+
- **`gdrive_download_file`** — Download any file from Drive to a local disk path. Workspace files (Docs, Sheets, Slides) are automatically exported to the specified format (pdf, docx, xlsx, pptx, csv, txt, html, or markdown).
|
|
97
|
+
- **`savePath` on export tools** — `gdrive_export_doc`, `gdrive_export_sheet`, and `gdrive_export_slides` now accept an optional `savePath` parameter. When provided, binary exports (docx, pdf, xlsx, pptx) are saved to disk instead of returned as base64. Omitting `savePath` preserves the v2.0 behavior.
|
|
98
|
+
- **`gdrive_list_accounts` email resolution** — Accounts migrated from v0.x that showed "migrated" instead of an email address now auto-resolve via the Google userinfo API on first call.
|
|
99
|
+
- **Documentation fixes** — `gdrive_empty_trash` notes eventual consistency; `gdrive_transfer_ownership` notes cross-org limitation.
|
|
100
|
+
|
|
101
|
+
## Output Formats
|
|
102
|
+
|
|
103
|
+
All read and list tools support an `outputFormat` parameter:
|
|
104
|
+
|
|
105
|
+
| Format | Description | Use Case |
|
|
106
|
+
|--------|-------------|----------|
|
|
107
|
+
| `json` | Pretty-printed JSON (default) | Machine consumption, API pipelines |
|
|
108
|
+
| `yaml` | YAML serialization | Human-readable structured data, config files |
|
|
109
|
+
| `text` | Compact aligned tables and key-value pairs | Quick scanning, terminal output, token-efficient LLM context |
|
|
110
|
+
|
|
111
|
+
Example: `gdrive_list_files({ query: "name contains 'report'", outputFormat: "text" })` returns:
|
|
112
|
+
|
|
113
|
+
```
|
|
114
|
+
files:
|
|
115
|
+
id name mimeType modifiedTime size
|
|
116
|
+
------------- ---------------- --------------- ------------ ----
|
|
117
|
+
abc123def456 Q1 Report.pdf application/pdf 2026-04-01 1024
|
|
118
|
+
ghi789jkl012 Q2 Report.docx application/pdf 2026-03-15 2048
|
|
119
|
+
resultCount: 2
|
|
120
|
+
```
|
|
23
121
|
|
|
24
122
|
## Prerequisites
|
|
25
123
|
|
|
26
|
-
- Node.js 18
|
|
27
|
-
- A Google Cloud project with
|
|
124
|
+
- Node.js 18+
|
|
125
|
+
- A Google Cloud project with these APIs enabled:
|
|
126
|
+
- Google Drive API
|
|
127
|
+
- Google Docs API
|
|
128
|
+
- Google Sheets API
|
|
129
|
+
- Google Slides API
|
|
28
130
|
- OAuth2 desktop application credentials
|
|
29
131
|
|
|
30
132
|
## Setup
|
|
31
133
|
|
|
32
|
-
1. Create a project in the [Google Cloud Console](https://console.cloud.google.com/) and enable the
|
|
134
|
+
1. Create a project in the [Google Cloud Console](https://console.cloud.google.com/) and enable the Drive, Docs, Sheets, and Slides APIs
|
|
33
135
|
2. Create OAuth2 credentials (Application type: Desktop app) and download the JSON file
|
|
34
136
|
3. Save the credentials file:
|
|
35
137
|
|
|
@@ -42,21 +144,32 @@ chmod 600 ~/.config/mcp-google-gdrive/credentials.json
|
|
|
42
144
|
4. Run the one-time authorization flow:
|
|
43
145
|
|
|
44
146
|
```bash
|
|
45
|
-
npx mcp-google-gdrive --auth
|
|
147
|
+
npx mcp-google-gdrive --auth primary
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
This prints a URL for Google consent. After granting access, paste the authorization code back into the terminal.
|
|
151
|
+
|
|
152
|
+
### Multi-Account Setup
|
|
153
|
+
|
|
154
|
+
Add additional accounts with unique labels:
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
npx mcp-google-gdrive --auth work
|
|
158
|
+
npx mcp-google-gdrive --auth personal
|
|
46
159
|
```
|
|
47
160
|
|
|
48
|
-
|
|
161
|
+
Each account gets its own token file at `~/.config/mcp-google-gdrive/tokens/{label}.json`. Use the `account` parameter on any tool to specify which account to use, or call `gdrive_switch_account` to change the default.
|
|
49
162
|
|
|
50
163
|
## Configuration
|
|
51
164
|
|
|
52
|
-
###
|
|
165
|
+
### Gemini CLI
|
|
53
166
|
|
|
54
|
-
Add to `~/.
|
|
167
|
+
Add to `~/.gemini/settings.json`:
|
|
55
168
|
|
|
56
169
|
```json
|
|
57
170
|
{
|
|
58
171
|
"mcpServers": {
|
|
59
|
-
"google-
|
|
172
|
+
"google-gdrive": {
|
|
60
173
|
"command": "npx",
|
|
61
174
|
"args": ["-y", "mcp-google-gdrive"]
|
|
62
175
|
}
|
|
@@ -64,29 +177,31 @@ Add to `~/.claude/settings.json`:
|
|
|
64
177
|
}
|
|
65
178
|
```
|
|
66
179
|
|
|
67
|
-
###
|
|
180
|
+
### watsonx Orchestrate
|
|
68
181
|
|
|
69
|
-
|
|
182
|
+
```bash
|
|
183
|
+
orchestrate toolkits import --kind mcp \
|
|
184
|
+
--name google-gdrive \
|
|
185
|
+
--description "Google Drive, Docs, Sheets, Slides" \
|
|
186
|
+
--command "npx -y mcp-google-gdrive" \
|
|
187
|
+
--tools "*"
|
|
188
|
+
```
|
|
70
189
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
"command": "npx",
|
|
76
|
-
"args": ["-y", "mcp-google-gdrive"]
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}
|
|
190
|
+
### Claude Code
|
|
191
|
+
|
|
192
|
+
```bash
|
|
193
|
+
claude mcp add -s user google-gdrive -- npx -y mcp-google-gdrive
|
|
80
194
|
```
|
|
81
195
|
|
|
82
|
-
###
|
|
196
|
+
### VS Code / Cursor
|
|
83
197
|
|
|
84
|
-
Add to
|
|
198
|
+
Add to `.vscode/mcp.json` in your workspace:
|
|
85
199
|
|
|
86
200
|
```json
|
|
87
201
|
{
|
|
88
202
|
"mcpServers": {
|
|
89
|
-
"google-
|
|
203
|
+
"google-gdrive": {
|
|
204
|
+
"type": "stdio",
|
|
90
205
|
"command": "npx",
|
|
91
206
|
"args": ["-y", "mcp-google-gdrive"]
|
|
92
207
|
}
|
|
@@ -96,9 +211,25 @@ Add to `~/.gemini/settings.json`:
|
|
|
96
211
|
|
|
97
212
|
## Authentication
|
|
98
213
|
|
|
99
|
-
The server uses OAuth2 for Google Drive access.
|
|
214
|
+
The server uses OAuth2 for Google Drive access. Credentials are stored locally:
|
|
215
|
+
|
|
216
|
+
- `~/.config/mcp-google-gdrive/credentials.json` — OAuth2 client (shared across accounts)
|
|
217
|
+
- `~/.config/mcp-google-gdrive/tokens/{label}.json` — Per-account tokens (chmod 600)
|
|
218
|
+
- `~/.config/mcp-google-gdrive/config.json` — Active account and account registry
|
|
219
|
+
|
|
220
|
+
Access tokens expire after one hour and are refreshed automatically using stored refresh tokens. Token refresh is transparent and requires no user interaction.
|
|
221
|
+
|
|
222
|
+
### Migrating from v0.x
|
|
223
|
+
|
|
224
|
+
If upgrading from a single-account v0.x installation, the server automatically migrates your existing `token.json` to `tokens/primary.json` on first start.
|
|
225
|
+
|
|
226
|
+
## Related MCP Servers
|
|
100
227
|
|
|
101
|
-
|
|
228
|
+
- [mcp-redhat-account](https://github.com/sleepytimeshon/mcp-redhat-account) - Red Hat account management
|
|
229
|
+
- [mcp-redhat-knowledge](https://github.com/sleepytimeshon/mcp-redhat-knowledge) - Red Hat Knowledge Base search
|
|
230
|
+
- [mcp-redhat-manpage](https://github.com/sleepytimeshon/mcp-redhat-manpage) - RHEL man pages
|
|
231
|
+
- [mcp-redhat-subscription](https://github.com/sleepytimeshon/mcp-redhat-subscription) - Subscription management
|
|
232
|
+
- [mcp-redhat-support](https://github.com/sleepytimeshon/mcp-redhat-support) - Support case management
|
|
102
233
|
|
|
103
234
|
## License
|
|
104
235
|
|
package/SPEC.md
CHANGED
|
@@ -9,17 +9,19 @@ MCP server providing Claude Code with full read/write access to a personal Googl
|
|
|
9
9
|
| Item | Value |
|
|
10
10
|
|------|-------|
|
|
11
11
|
| Package name | mcp-google-gdrive |
|
|
12
|
-
| Version |
|
|
13
|
-
| Runtime | Node.js 18+ (ESM)
|
|
12
|
+
| Version | 2.2.0 |
|
|
13
|
+
| Runtime | Node.js 18+ (ESM) |
|
|
14
14
|
| MCP SDK | @modelcontextprotocol/sdk ^1.26.0 |
|
|
15
15
|
| Validation | zod ^3.25.0 |
|
|
16
|
-
| Auth | Google OAuth2 (desktop app flow) |
|
|
17
|
-
| API | Google Drive API v3 |
|
|
18
|
-
|
|
|
19
|
-
|
|
|
16
|
+
| Auth | Google OAuth2 (desktop app flow), multi-account |
|
|
17
|
+
| API | Google Drive API v3, Docs v1, Sheets v4, Slides v1, Labels v2 |
|
|
18
|
+
| Deps | googleapis ^144.0.0, turndown ^7.2.0, js-yaml ^4.1.1 |
|
|
19
|
+
| Source | github.com/sleepytimeshon/mcp-google-gdrive |
|
|
20
|
+
| npm | npmjs.com/package/mcp-google-gdrive |
|
|
20
21
|
| Entry point | src/index.js |
|
|
21
22
|
| Transport | stdio (JSON-RPC) |
|
|
22
23
|
| License | MIT |
|
|
24
|
+
| Tools | 38 across 9 categories |
|
|
23
25
|
|
|
24
26
|
---
|
|
25
27
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mcp-google-gdrive",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "MCP server for Google Drive
|
|
3
|
+
"version": "2.2.0",
|
|
4
|
+
"description": "MCP server for Google Drive, Docs, Sheets, and Slides with multi-account support, permissions, labels, and full CRUD",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
7
|
"mcp-google-gdrive": "./src/index.js"
|
|
@@ -14,8 +14,12 @@
|
|
|
14
14
|
"keywords": [
|
|
15
15
|
"mcp",
|
|
16
16
|
"google-drive",
|
|
17
|
+
"google-docs",
|
|
18
|
+
"google-sheets",
|
|
19
|
+
"google-slides",
|
|
17
20
|
"google-workspace",
|
|
18
|
-
"file-management"
|
|
21
|
+
"file-management",
|
|
22
|
+
"multi-account"
|
|
19
23
|
],
|
|
20
24
|
"license": "MIT",
|
|
21
25
|
"repository": {
|
|
@@ -29,6 +33,7 @@
|
|
|
29
33
|
"dependencies": {
|
|
30
34
|
"@modelcontextprotocol/sdk": "^1.26.0",
|
|
31
35
|
"googleapis": "^144.0.0",
|
|
36
|
+
"js-yaml": "^4.1.1",
|
|
32
37
|
"turndown": "^7.2.0",
|
|
33
38
|
"zod": "^3.25.0"
|
|
34
39
|
}
|