workspace-mcp 0.2.0__tar.gz

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.
Files changed (37) hide show
  1. workspace_mcp-0.2.0/LICENSE +21 -0
  2. workspace_mcp-0.2.0/PKG-INFO +29 -0
  3. workspace_mcp-0.2.0/README.md +346 -0
  4. workspace_mcp-0.2.0/auth/__init__.py +1 -0
  5. workspace_mcp-0.2.0/auth/google_auth.py +549 -0
  6. workspace_mcp-0.2.0/auth/oauth_callback_server.py +241 -0
  7. workspace_mcp-0.2.0/auth/oauth_responses.py +223 -0
  8. workspace_mcp-0.2.0/auth/scopes.py +108 -0
  9. workspace_mcp-0.2.0/auth/service_decorator.py +404 -0
  10. workspace_mcp-0.2.0/core/__init__.py +1 -0
  11. workspace_mcp-0.2.0/core/server.py +219 -0
  12. workspace_mcp-0.2.0/core/utils.py +162 -0
  13. workspace_mcp-0.2.0/gcalendar/__init__.py +1 -0
  14. workspace_mcp-0.2.0/gcalendar/calendar_tools.py +496 -0
  15. workspace_mcp-0.2.0/gchat/__init__.py +6 -0
  16. workspace_mcp-0.2.0/gchat/chat_tools.py +254 -0
  17. workspace_mcp-0.2.0/gdocs/__init__.py +0 -0
  18. workspace_mcp-0.2.0/gdocs/docs_tools.py +244 -0
  19. workspace_mcp-0.2.0/gdrive/__init__.py +0 -0
  20. workspace_mcp-0.2.0/gdrive/drive_tools.py +362 -0
  21. workspace_mcp-0.2.0/gforms/__init__.py +3 -0
  22. workspace_mcp-0.2.0/gforms/forms_tools.py +318 -0
  23. workspace_mcp-0.2.0/gmail/__init__.py +1 -0
  24. workspace_mcp-0.2.0/gmail/gmail_tools.py +807 -0
  25. workspace_mcp-0.2.0/gsheets/__init__.py +23 -0
  26. workspace_mcp-0.2.0/gsheets/sheets_tools.py +393 -0
  27. workspace_mcp-0.2.0/gslides/__init__.py +0 -0
  28. workspace_mcp-0.2.0/gslides/slides_tools.py +316 -0
  29. workspace_mcp-0.2.0/main.py +165 -0
  30. workspace_mcp-0.2.0/pyproject.toml +53 -0
  31. workspace_mcp-0.2.0/setup.cfg +4 -0
  32. workspace_mcp-0.2.0/workspace_mcp.egg-info/PKG-INFO +29 -0
  33. workspace_mcp-0.2.0/workspace_mcp.egg-info/SOURCES.txt +35 -0
  34. workspace_mcp-0.2.0/workspace_mcp.egg-info/dependency_links.txt +1 -0
  35. workspace_mcp-0.2.0/workspace_mcp.egg-info/entry_points.txt +2 -0
  36. workspace_mcp-0.2.0/workspace_mcp.egg-info/requires.txt +6 -0
  37. workspace_mcp-0.2.0/workspace_mcp.egg-info/top_level.txt +11 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Taylor Wilsdon
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.
@@ -0,0 +1,29 @@
1
+ Metadata-Version: 2.4
2
+ Name: workspace-mcp
3
+ Version: 0.2.0
4
+ Summary: Comprehensive, highly performant Google Workspace Streamable HTTP & SSE MCP Server for Calendar, Gmail, Docs, Sheets, Slides & Drive
5
+ Author-email: Taylor Wilsdon <taylor@taylorwilsdon.com>
6
+ License-Expression: MIT
7
+ Keywords: mcp,google,workspace,llm,ai,claude,model,context,protocol,server
8
+ Classifier: Development Status :: 4 - Beta
9
+ Classifier: Environment :: Console
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: Natural Language :: English
12
+ Classifier: Operating System :: OS Independent
13
+ Classifier: Programming Language :: Python
14
+ Classifier: Programming Language :: Python :: 3 :: Only
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
18
+ Classifier: Topic :: Internet :: WWW/HTTP :: HTTP Servers
19
+ Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
20
+ Classifier: Typing :: Typed
21
+ Requires-Python: >=3.11
22
+ License-File: LICENSE
23
+ Requires-Dist: fastapi>=0.115.12
24
+ Requires-Dist: fastmcp>=2.3.3
25
+ Requires-Dist: google-api-python-client>=2.168.0
26
+ Requires-Dist: google-auth-httplib2>=0.2.0
27
+ Requires-Dist: google-auth-oauthlib>=1.2.2
28
+ Requires-Dist: httpx>=0.28.1
29
+ Dynamic: license-file
@@ -0,0 +1,346 @@
1
+ <div align="center">
2
+
3
+ # Google Workspace MCP Server <img src="https://github.com/user-attachments/assets/b89524e4-6e6e-49e6-ba77-00d6df0c6e5c" width="80" align="right" />
4
+
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
6
+ [![Python 3.11+](https://img.shields.io/badge/Python-3.11%2B-blue.svg)](https://www.python.org/downloads/)
7
+ [![UV](https://img.shields.io/badge/Package%20Installer-UV-blueviolet)](https://github.com/astral-sh/uv)
8
+ [![Website](https://img.shields.io/badge/Website-workspacemcp.com-green.svg)](https://workspacemcp.com)
9
+
10
+ **The world's most feature-complete Google Workspace MCP server**
11
+
12
+ *Connect MCP Clients, AI assistants and developer tools to Google Calendar, Drive, Gmail, Docs, Sheets, Slides, Forms, and Chat*
13
+
14
+ </div>
15
+
16
+ <div align="center">
17
+ <a href="https://glama.ai/mcp/servers/@taylorwilsdon/google_workspace_mcp">
18
+ <img width="195" src="https://glama.ai/mcp/servers/@taylorwilsdon/google_workspace_mcp/badge" alt="Google Workspace Server MCP server" align="center"/>
19
+ </a>
20
+ <a href="https://www.pulsemcp.com/servers/taylorwilsdon-google-workspace">
21
+ <img width="456" src="https://github.com/user-attachments/assets/0794ef1a-dc1c-447d-9661-9c704d7acc9d" align="center"/>
22
+ </a>
23
+ </div>
24
+
25
+ ---
26
+
27
+
28
+ **See it in action:**
29
+ <div align="center">
30
+ <video width="832" src="https://github.com/user-attachments/assets/a342ebb4-1319-4060-a974-39d202329710"></video>
31
+ </div>
32
+
33
+ ---
34
+
35
+
36
+ ## 🌐 Overview
37
+
38
+ A production-ready MCP server that integrates all major Google Workspace services with AI assistants. Built with FastMCP for optimal performance, featuring advanced authentication handling, service caching, and streamlined development patterns.
39
+
40
+ ## ✨ Features
41
+
42
+ - **🔐 Advanced OAuth 2.0**: Secure authentication with automatic token refresh, transport-aware callback handling, session management, and centralized scope management
43
+ - **📅 Google Calendar**: Full calendar management with event CRUD operations
44
+ - **📁 Google Drive**: File operations with native Microsoft Office format support (.docx, .xlsx)
45
+ - **📧 Gmail**: Complete email management with search, send, and draft capabilities
46
+ - **📄 Google Docs**: Document operations including content extraction and creation
47
+ - **📊 Google Sheets**: Comprehensive spreadsheet management with flexible cell operations
48
+ - **🖼️ Google Slides**: Presentation management with slide creation, updates, and content manipulation
49
+ - **📝 Google Forms**: Form creation, retrieval, publish settings, and response management
50
+ - **💬 Google Chat**: Space management and messaging capabilities
51
+ - **🔄 Multiple Transports**: HTTP with SSE fallback, OpenAPI compatibility via `mcpo`
52
+ - **⚡ High Performance**: Service caching, thread-safe sessions, FastMCP integration
53
+ - **🧩 Developer Friendly**: Minimal boilerplate, automatic service injection, centralized configuration
54
+
55
+ ---
56
+
57
+ ## 🚀 Quick Start
58
+
59
+ ### Prerequisites
60
+
61
+ - **Python 3.11+**
62
+ - **[uv](https://github.com/astral-sh/uv)** (recommended) or pip
63
+ - **Google Cloud Project** with OAuth 2.0 credentials
64
+
65
+ ### Installation
66
+
67
+ ```bash
68
+ git clone https://github.com/taylorwilsdon/google_workspace_mcp.git
69
+ cd google_workspace_mcp
70
+ uv run main.py
71
+ ```
72
+
73
+ ### Configuration
74
+
75
+ 1. **Google Cloud Setup**:
76
+ - Create OAuth 2.0 credentials (web application) in [Google Cloud Console](https://console.cloud.google.com/)
77
+ - Enable APIs: Calendar, Drive, Gmail, Docs, Sheets, Slides, Forms, Chat
78
+ - Download credentials as `client_secret.json` in project root
79
+ - Add redirect URI: `http://localhost:8000/oauth2callback`
80
+
81
+ 2. **Environment**:
82
+ ```bash
83
+ export OAUTHLIB_INSECURE_TRANSPORT=1 # Development only
84
+ ```
85
+
86
+ 3. **Server Configuration**:
87
+ The server's base URL and port can be customized using environment variables:
88
+ - `WORKSPACE_MCP_BASE_URI`: Sets the base URI for the server (default: http://localhost). This affects the server_url used for Gemini native function calling and the OAUTH_REDIRECT_URI.
89
+ - `WORKSPACE_MCP_PORT`: Sets the port the server listens on (default: 8000). This affects the server_url, port, and OAUTH_REDIRECT_URI.
90
+
91
+ ### Start the Server
92
+
93
+ ```bash
94
+ # Default (stdio mode for MCP clients)
95
+ uv run main.py
96
+
97
+ # HTTP mode (for web interfaces and debugging)
98
+ uv run main.py --transport streamable-http
99
+
100
+ # Single-user mode (simplified authentication)
101
+ uv run main.py --single-user
102
+
103
+ # Selective tool registration (only register specific tools)
104
+ uv run main.py --tools gmail drive calendar
105
+ uv run main.py --tools sheets docs
106
+ uv run main.py --single-user --tools gmail # Can combine with other flags
107
+
108
+ # Docker
109
+ docker build -t google-workspace-mcp .
110
+ docker run -p 8000:8000 -v $(pwd):/app google-workspace-mcp --transport streamable-http
111
+ ```
112
+
113
+ **Available Tools for `--tools` flag**: `gmail`, `drive`, `calendar`, `docs`, `sheets`, `forms`, `chat`
114
+
115
+ ### Connect to Claude Desktop
116
+
117
+ The server supports two transport modes:
118
+
119
+ #### Stdio Mode (Default - Recommended for Claude Desktop)
120
+ **Option 1: Auto-install (Recommended)**
121
+ ```bash
122
+ python install_claude.py
123
+ ```
124
+
125
+ **Option 2: Manual Configuration**
126
+ 1. Open Claude Desktop Settings → Developer → Edit Config
127
+ 2. This creates/opens the config file at:
128
+ - **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
129
+ - **Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
130
+ 3. Add the server configuration:
131
+
132
+ ```json
133
+ {
134
+ "mcpServers": {
135
+ "google_workspace": {
136
+ "command": "uv",
137
+ "args": ["run", "main.py"],
138
+ "cwd": "/path/to/google_workspace_mcp"
139
+ }
140
+ }
141
+ }
142
+ ```
143
+
144
+ #### HTTP Mode (For debugging or web interfaces)
145
+ If you need to use HTTP mode with Claude Desktop:
146
+
147
+ ```json
148
+ {
149
+ "mcpServers": {
150
+ "google_workspace": {
151
+ "command": "npx",
152
+ "args": ["mcp-remote", "http://localhost:8000/mcp"]
153
+ }
154
+ }
155
+ }
156
+ ```
157
+
158
+ *Note: Make sure to start the server with `--transport streamable-http` when using HTTP mode.*
159
+
160
+ ### First-Time Authentication
161
+
162
+ The server features **transport-aware OAuth callback handling**:
163
+
164
+ - **Stdio Mode**: Automatically starts a minimal HTTP server on port 8000 for OAuth callbacks
165
+ - **HTTP Mode**: Uses the existing FastAPI server for OAuth callbacks
166
+ - **Same OAuth Flow**: Both modes use `http://localhost:8000/oauth2callback` for consistency
167
+
168
+ When calling a tool:
169
+ 1. Server returns authorization URL
170
+ 2. Open URL in browser and authorize
171
+ 3. Server handles OAuth callback automatically (on port 8000 in both modes)
172
+ 4. Retry the original request
173
+
174
+ ---
175
+
176
+ ## 🧰 Available Tools
177
+
178
+ > **Note**: All tools support automatic authentication via `@require_google_service()` decorators with 30-minute service caching.
179
+
180
+ ### 📅 Google Calendar ([`calendar_tools.py`](gcalendar/calendar_tools.py))
181
+
182
+ | Tool | Description |
183
+ |------|-------------|
184
+ | `list_calendars` | List accessible calendars |
185
+ | `get_events` | Retrieve events with time range filtering |
186
+ | `create_event` | Create events (all-day or timed) |
187
+ | `modify_event` | Update existing events |
188
+ | `delete_event` | Remove events |
189
+
190
+ ### 📁 Google Drive ([`drive_tools.py`](gdrive/drive_tools.py))
191
+
192
+ | Tool | Description |
193
+ |------|-------------|
194
+ | `search_drive_files` | Search files with query syntax |
195
+ | `get_drive_file_content` | Read file content (supports Office formats) |
196
+ | `list_drive_items` | List folder contents |
197
+ | `create_drive_file` | Create new files |
198
+
199
+ ### 📧 Gmail ([`gmail_tools.py`](gmail/gmail_tools.py))
200
+
201
+ | Tool | Description |
202
+ |------|-------------|
203
+ | `search_gmail_messages` | Search with Gmail operators |
204
+ | `get_gmail_message_content` | Retrieve message content |
205
+ | `send_gmail_message` | Send emails |
206
+ | `draft_gmail_message` | Create drafts |
207
+
208
+ ### 📝 Google Docs ([`docs_tools.py`](gdocs/docs_tools.py))
209
+
210
+ | Tool | Description |
211
+ |------|-------------|
212
+ | `search_docs` | Find documents by name |
213
+ | `get_doc_content` | Extract document text |
214
+ | `list_docs_in_folder` | List docs in folder |
215
+ | `create_doc` | Create new documents |
216
+
217
+ ### 📊 Google Sheets ([`sheets_tools.py`](gsheets/sheets_tools.py))
218
+
219
+ | Tool | Description |
220
+ |------|-------------|
221
+ | `list_spreadsheets` | List accessible spreadsheets |
222
+ | `get_spreadsheet_info` | Get spreadsheet metadata |
223
+ | `read_sheet_values` | Read cell ranges |
224
+ | `modify_sheet_values` | Write/update/clear cells |
225
+ | `create_spreadsheet` | Create new spreadsheets |
226
+ | `create_sheet` | Add sheets to existing files |
227
+
228
+ ### 📝 Google Forms ([`forms_tools.py`](gforms/forms_tools.py))
229
+
230
+ | Tool | Description |
231
+ |------|-------------|
232
+ | `create_form` | Create new forms with title and description |
233
+ | `get_form` | Retrieve form details, questions, and URLs |
234
+ | `set_publish_settings` | Configure form template and authentication settings |
235
+ | `get_form_response` | Get individual form response details |
236
+ | `list_form_responses` | List all responses to a form with pagination |
237
+
238
+ ### 💬 Google Chat ([`chat_tools.py`](gchat/chat_tools.py))
239
+
240
+ | Tool | Description |
241
+ |------|-------------|
242
+ | `list_spaces` | List chat spaces/rooms |
243
+ | `get_messages` | Retrieve space messages |
244
+ | `send_message` | Send messages to spaces |
245
+ | `search_messages` | Search across chat history |
246
+
247
+ ---
248
+
249
+ ## 🛠️ Development
250
+
251
+ ### Project Structure
252
+
253
+ ```
254
+ google_workspace_mcp/
255
+ ├── auth/ # Authentication system with decorators
256
+ ├── core/ # MCP server and utilities
257
+ ├── g{service}/ # Service-specific tools
258
+ ├── main.py # Server entry point
259
+ ├── client_secret.json # OAuth credentials (not committed)
260
+ └── pyproject.toml # Dependencies
261
+ ```
262
+
263
+ ### Adding New Tools
264
+
265
+ ```python
266
+ from auth.service_decorator import require_google_service
267
+
268
+ @require_google_service("drive", "drive_read") # Service + scope group
269
+ async def your_new_tool(service, param1: str, param2: int = 10):
270
+ """Tool description"""
271
+ # service is automatically injected and cached
272
+ result = service.files().list().execute()
273
+ return result # Return native Python objects
274
+ ```
275
+
276
+ ### Architecture Highlights
277
+
278
+ - **Service Caching**: 30-minute TTL reduces authentication overhead
279
+ - **Scope Management**: Centralized in `SCOPE_GROUPS` for easy maintenance
280
+ - **Error Handling**: Native exceptions instead of manual error construction
281
+ - **Multi-Service Support**: `@require_multiple_services()` for complex tools
282
+
283
+ ---
284
+
285
+ ## 🔒 Security
286
+
287
+ - **Credentials**: Never commit `client_secret.json` or `.credentials/` directory
288
+ - **OAuth Callback**: Uses `http://localhost:8000/oauth2callback` for development (requires `OAUTHLIB_INSECURE_TRANSPORT=1`)
289
+ - **Transport-Aware Callbacks**: Stdio mode starts a minimal HTTP server only for OAuth, ensuring callbacks work in all modes
290
+ - **Production**: Use HTTPS for callback URIs and configure accordingly
291
+ - **Network Exposure**: Consider authentication when using `mcpo` over networks
292
+ - **Scope Minimization**: Tools request only necessary permissions
293
+
294
+ ---
295
+
296
+ ## 🌐 Integration with Open WebUI
297
+
298
+ To use this server as a tool provider within Open WebUI:
299
+
300
+ ### 1. Create MCPO Configuration
301
+
302
+ Create a file named `config.json` with the following structure to have `mcpo` make the streamable HTTP endpoint available as an OpenAPI spec tool:
303
+
304
+ ```json
305
+ {
306
+ "mcpServers": {
307
+ "google_workspace": {
308
+ "type": "streamablehttp",
309
+ "url": "http://localhost:8000/mcp"
310
+ }
311
+ }
312
+ }
313
+ ```
314
+
315
+ ### 2. Start the MCPO Server
316
+
317
+ ```bash
318
+ mcpo --port 8001 --config config.json --api-key "your-optional-secret-key"
319
+ ```
320
+
321
+ This command starts the `mcpo` proxy, serving your active (assuming port 8000) Google Workspace MCP on port 8001.
322
+
323
+ ### 3. Configure Open WebUI
324
+
325
+ 1. Navigate to your Open WebUI settings
326
+ 2. Go to **"Connections"** → **"Tools"**
327
+ 3. Click **"Add Tool"**
328
+ 4. Enter the **Server URL**: `http://localhost:8001/google_workspace` (matching the mcpo base URL and server name from config.json)
329
+ 5. If you used an `--api-key` with mcpo, enter it as the **API Key**
330
+ 6. Save the configuration
331
+
332
+ The Google Workspace tools should now be available when interacting with models in Open WebUI.
333
+
334
+ ---
335
+
336
+ ## 📄 License
337
+
338
+ MIT License - see `LICENSE` file for details.
339
+
340
+ ---
341
+
342
+ <div align="center">
343
+ <img width="810" alt="Gmail Integration" src="https://github.com/user-attachments/assets/656cea40-1f66-40c1-b94c-5a2c900c969d" />
344
+ <img width="810" alt="Calendar Management" src="https://github.com/user-attachments/assets/d3c2a834-fcca-4dc5-8990-6d6dc1d96048" />
345
+ <img width="842" alt="Batch Emails" src="https://github.com/user-attachments/assets/0876c789-7bcc-4414-a144-6c3f0aaffc06" />
346
+ </div>
@@ -0,0 +1 @@
1
+ # Make the auth directory a Python package