@dguido/google-workspace-mcp 1.0.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/LICENSE +21 -0
- package/README.md +213 -0
- package/dist/index.js +11433 -0
- package/dist/index.js.map +7 -0
- package/package.json +74 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Dan Guido
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
# Google Workspace MCP Server
|
|
2
|
+
|
|
3
|
+
MCP server providing Claude access to Google Drive, Docs, Sheets, Slides, Calendar, and Gmail.
|
|
4
|
+
|
|
5
|
+
## Quick Start
|
|
6
|
+
|
|
7
|
+
### Prerequisites
|
|
8
|
+
|
|
9
|
+
- **Node.js** 22+ (LTS recommended)
|
|
10
|
+
- **Google Cloud Project** with Drive, Docs, Sheets, and Slides APIs enabled
|
|
11
|
+
- **OAuth 2.0 Credentials** (Desktop application type)
|
|
12
|
+
|
|
13
|
+
### 1. Set Up Google Cloud
|
|
14
|
+
|
|
15
|
+
See [Google Cloud Setup](#google-cloud-setup) below for detailed instructions.
|
|
16
|
+
|
|
17
|
+
### 2. Authenticate
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npx @dguido/google-workspace-mcp auth
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
This opens your browser for Google OAuth consent. Tokens are saved to `~/.config/google-workspace-mcp/tokens.json`.
|
|
24
|
+
|
|
25
|
+
### 3. Configure Claude Desktop
|
|
26
|
+
|
|
27
|
+
**macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
28
|
+
**Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
|
|
29
|
+
|
|
30
|
+
```json
|
|
31
|
+
{
|
|
32
|
+
"mcpServers": {
|
|
33
|
+
"google-workspace": {
|
|
34
|
+
"command": "npx",
|
|
35
|
+
"args": ["@dguido/google-workspace-mcp"],
|
|
36
|
+
"env": {
|
|
37
|
+
"GOOGLE_DRIVE_OAUTH_CREDENTIALS": "/path/to/your/gcp-oauth.keys.json",
|
|
38
|
+
"GOOGLE_WORKSPACE_SERVICES": "drive,gmail,calendar"
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## What You Can Do
|
|
46
|
+
|
|
47
|
+
```
|
|
48
|
+
Create a Google Doc called "Project Plan" in /Work/Projects with an outline for Q1.
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
```
|
|
52
|
+
Search for files containing "budget" and organize them into the Finance folder.
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
```
|
|
56
|
+
Create a presentation called "Product Roadmap" with slides for Q1 milestones.
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Google Cloud Setup
|
|
60
|
+
|
|
61
|
+
### 1. Create a Google Cloud Project
|
|
62
|
+
|
|
63
|
+
- Go to the [Google Cloud Console](https://console.cloud.google.com)
|
|
64
|
+
- Click "Select a project" > "New Project"
|
|
65
|
+
- Name your project (e.g., "Google Drive MCP")
|
|
66
|
+
|
|
67
|
+
### 2. Enable Required APIs
|
|
68
|
+
|
|
69
|
+
- Go to "APIs & Services" > "Library"
|
|
70
|
+
- Enable: **Google Drive API**, **Google Docs API**, **Google Sheets API**, **Google Slides API**
|
|
71
|
+
|
|
72
|
+
### 3. Configure OAuth Consent Screen
|
|
73
|
+
|
|
74
|
+
- Go to "APIs & Services" > "OAuth consent screen"
|
|
75
|
+
- Fill in app name, support email, and developer contact
|
|
76
|
+
- Choose "External" (or "Internal" for Workspace)
|
|
77
|
+
- Add your email as a test user
|
|
78
|
+
- Add scopes: `drive.file`, `documents`, `spreadsheets`, `presentations`, `drive`, `drive.readonly`
|
|
79
|
+
|
|
80
|
+
### 4. Create OAuth 2.0 Credentials
|
|
81
|
+
|
|
82
|
+
- Go to "APIs & Services" > "Credentials"
|
|
83
|
+
- Click "+ CREATE CREDENTIALS" > "OAuth client ID"
|
|
84
|
+
- Application type: **Desktop app**
|
|
85
|
+
- Download the JSON file and rename to `gcp-oauth.keys.json`
|
|
86
|
+
|
|
87
|
+
## Configuration
|
|
88
|
+
|
|
89
|
+
| Method | Description |
|
|
90
|
+
| --------------------------------- | ------------------------------------------------- |
|
|
91
|
+
| `GOOGLE_DRIVE_OAUTH_CREDENTIALS` | Environment variable pointing to credentials file |
|
|
92
|
+
| `gcp-oauth.keys.json` | Default file in project root |
|
|
93
|
+
| `GOOGLE_WORKSPACE_MCP_TOKEN_PATH` | Custom token storage location |
|
|
94
|
+
| `GOOGLE_WORKSPACE_SERVICES` | Comma-separated list of services to enable |
|
|
95
|
+
|
|
96
|
+
Tokens are stored at `~/.config/google-workspace-mcp/tokens.json` by default.
|
|
97
|
+
|
|
98
|
+
### Service Configuration
|
|
99
|
+
|
|
100
|
+
By default, we recommend enabling only the core services (`drive,gmail,calendar`) as shown in Quick Start. This provides file management, email, and calendar capabilities without the complexity of document editing tools.
|
|
101
|
+
|
|
102
|
+
To enable additional services, add them to `GOOGLE_WORKSPACE_SERVICES`:
|
|
103
|
+
|
|
104
|
+
```json
|
|
105
|
+
{
|
|
106
|
+
"mcpServers": {
|
|
107
|
+
"google-workspace": {
|
|
108
|
+
"command": "npx",
|
|
109
|
+
"args": ["@dguido/google-workspace-mcp"],
|
|
110
|
+
"env": {
|
|
111
|
+
"GOOGLE_DRIVE_OAUTH_CREDENTIALS": "/path/to/gcp-oauth.keys.json",
|
|
112
|
+
"GOOGLE_WORKSPACE_SERVICES": "drive,gmail,calendar,docs,sheets,slides"
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
**Available services:** `drive`, `docs`, `sheets`, `slides`, `calendar`, `gmail`
|
|
120
|
+
|
|
121
|
+
- Omit `GOOGLE_WORKSPACE_SERVICES` entirely to enable all services
|
|
122
|
+
- Unified tools (`create_file`, `update_file`, `get_file_content`) require `drive`, `docs`, `sheets`, and `slides`
|
|
123
|
+
|
|
124
|
+
See [Advanced Configuration](docs/ADVANCED.md) for multi-account setup and environment variables.
|
|
125
|
+
|
|
126
|
+
## Available Tools
|
|
127
|
+
|
|
128
|
+
### Drive Operations
|
|
129
|
+
|
|
130
|
+
`search` `listFolder` `createFolder` `deleteItem` `renameItem` `moveItem` `copyFile`
|
|
131
|
+
|
|
132
|
+
### File Operations
|
|
133
|
+
|
|
134
|
+
`createTextFile` `updateTextFile`
|
|
135
|
+
|
|
136
|
+
### Google Docs
|
|
137
|
+
|
|
138
|
+
`createGoogleDoc` `updateGoogleDoc` `getGoogleDocContent` `formatGoogleDocRange`
|
|
139
|
+
|
|
140
|
+
### Google Sheets
|
|
141
|
+
|
|
142
|
+
`createGoogleSheet` `updateGoogleSheet` `getGoogleSheetContent` `formatGoogleSheetCells` `formatGoogleSheetText` `formatGoogleSheetNumbers` `setGoogleSheetBorders` `mergeGoogleSheetCells` `addGoogleSheetConditionalFormat`
|
|
143
|
+
|
|
144
|
+
### Google Slides
|
|
145
|
+
|
|
146
|
+
`createGoogleSlides` `updateGoogleSlides` `getGoogleSlidesContent` `formatGoogleSlidesElement` `createGoogleSlidesTextBox` `createGoogleSlidesShape` `getGoogleSlidesSpeakerNotes` `updateGoogleSlidesSpeakerNotes`
|
|
147
|
+
|
|
148
|
+
[Full API Reference](docs/API.md)
|
|
149
|
+
|
|
150
|
+
## Troubleshooting
|
|
151
|
+
|
|
152
|
+
### "OAuth credentials not found"
|
|
153
|
+
|
|
154
|
+
Set `GOOGLE_DRIVE_OAUTH_CREDENTIALS` environment variable or place `gcp-oauth.keys.json` in project root.
|
|
155
|
+
|
|
156
|
+
### "Authentication failed" or browser doesn't open
|
|
157
|
+
|
|
158
|
+
Ensure credential type is "Desktop app" (not "Web application") and ports 3000-3004 are available.
|
|
159
|
+
|
|
160
|
+
### "Tokens expired" or "Invalid grant"
|
|
161
|
+
|
|
162
|
+
Apps in "Testing" status expire tokens after 7 days. Re-authenticate:
|
|
163
|
+
|
|
164
|
+
```bash
|
|
165
|
+
rm ~/.config/google-workspace-mcp/tokens.json
|
|
166
|
+
npx @dguido/google-workspace-mcp auth
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
### "API not enabled"
|
|
170
|
+
|
|
171
|
+
Enable the missing API in [Google Cloud Console](https://console.cloud.google.com) > APIs & Services > Library.
|
|
172
|
+
|
|
173
|
+
### "Login Required" even with valid tokens
|
|
174
|
+
|
|
175
|
+
Revoke app access at [Google Account Permissions](https://myaccount.google.com/permissions), clear tokens, and re-authenticate.
|
|
176
|
+
|
|
177
|
+
[Full Troubleshooting Guide](docs/TROUBLESHOOTING.md)
|
|
178
|
+
|
|
179
|
+
## Security
|
|
180
|
+
|
|
181
|
+
- OAuth 2.0 with automatic token refresh
|
|
182
|
+
- Tokens stored with 0600 permissions
|
|
183
|
+
- All processing happens locally
|
|
184
|
+
- Never commit `gcp-oauth.keys.json` or tokens to version control
|
|
185
|
+
|
|
186
|
+
## Development
|
|
187
|
+
|
|
188
|
+
```bash
|
|
189
|
+
npm install
|
|
190
|
+
npm run build # Compile TypeScript
|
|
191
|
+
npm run check # typecheck + lint + format check
|
|
192
|
+
npm test # Run tests
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
See [Contributing Guide](CONTRIBUTING.md) for project structure and development workflow.
|
|
196
|
+
|
|
197
|
+
## Docker
|
|
198
|
+
|
|
199
|
+
See [Docker Usage](docs/DOCKER.md) for containerized deployment.
|
|
200
|
+
|
|
201
|
+
## Links
|
|
202
|
+
|
|
203
|
+
- [GitHub Repository](https://github.com/dguido/google-workspace-mcp)
|
|
204
|
+
- [Issue Tracker](https://github.com/dguido/google-workspace-mcp/issues)
|
|
205
|
+
- [Model Context Protocol](https://modelcontextprotocol.io)
|
|
206
|
+
|
|
207
|
+
## Origin
|
|
208
|
+
|
|
209
|
+
This project is a substantial rewrite of [piotr-agier/google-drive-mcp](https://github.com/piotr-agier/google-drive-mcp), originally created by Piotr Agier.
|
|
210
|
+
|
|
211
|
+
## License
|
|
212
|
+
|
|
213
|
+
MIT - See LICENSE file for details.
|