workspace-mcp 1.0.1__tar.gz → 1.0.2__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 (44) hide show
  1. {workspace_mcp-1.0.1/workspace_mcp.egg-info → workspace_mcp-1.0.2}/PKG-INFO +6 -3
  2. {workspace_mcp-1.0.1 → workspace_mcp-1.0.2}/README.md +4 -2
  3. {workspace_mcp-1.0.1 → workspace_mcp-1.0.2}/auth/service_decorator.py +31 -32
  4. {workspace_mcp-1.0.1 → workspace_mcp-1.0.2}/core/utils.py +36 -0
  5. workspace_mcp-1.0.2/gcalendar/calendar_tools.py +546 -0
  6. workspace_mcp-1.0.2/gchat/chat_tools.py +227 -0
  7. workspace_mcp-1.0.2/gdocs/docs_tools.py +216 -0
  8. {workspace_mcp-1.0.1 → workspace_mcp-1.0.2}/gdrive/drive_tools.py +168 -171
  9. workspace_mcp-1.0.2/gforms/forms_tools.py +279 -0
  10. workspace_mcp-1.0.2/gmail/gmail_tools.py +726 -0
  11. workspace_mcp-1.0.2/gsheets/sheets_tools.py +340 -0
  12. workspace_mcp-1.0.2/gslides/slides_tools.py +272 -0
  13. {workspace_mcp-1.0.1 → workspace_mcp-1.0.2}/main.py +30 -24
  14. {workspace_mcp-1.0.1 → workspace_mcp-1.0.2}/pyproject.toml +24 -15
  15. {workspace_mcp-1.0.1 → workspace_mcp-1.0.2/workspace_mcp.egg-info}/PKG-INFO +6 -3
  16. {workspace_mcp-1.0.1 → workspace_mcp-1.0.2}/workspace_mcp.egg-info/requires.txt +1 -0
  17. workspace_mcp-1.0.1/gcalendar/calendar_tools.py +0 -496
  18. workspace_mcp-1.0.1/gchat/chat_tools.py +0 -254
  19. workspace_mcp-1.0.1/gdocs/docs_tools.py +0 -244
  20. workspace_mcp-1.0.1/gforms/forms_tools.py +0 -318
  21. workspace_mcp-1.0.1/gmail/gmail_tools.py +0 -807
  22. workspace_mcp-1.0.1/gsheets/sheets_tools.py +0 -393
  23. workspace_mcp-1.0.1/gslides/slides_tools.py +0 -316
  24. {workspace_mcp-1.0.1 → workspace_mcp-1.0.2}/LICENSE +0 -0
  25. {workspace_mcp-1.0.1 → workspace_mcp-1.0.2}/auth/__init__.py +0 -0
  26. {workspace_mcp-1.0.1 → workspace_mcp-1.0.2}/auth/google_auth.py +0 -0
  27. {workspace_mcp-1.0.1 → workspace_mcp-1.0.2}/auth/oauth_callback_server.py +0 -0
  28. {workspace_mcp-1.0.1 → workspace_mcp-1.0.2}/auth/oauth_responses.py +0 -0
  29. {workspace_mcp-1.0.1 → workspace_mcp-1.0.2}/auth/scopes.py +0 -0
  30. {workspace_mcp-1.0.1 → workspace_mcp-1.0.2}/core/__init__.py +0 -0
  31. {workspace_mcp-1.0.1 → workspace_mcp-1.0.2}/core/server.py +0 -0
  32. {workspace_mcp-1.0.1 → workspace_mcp-1.0.2}/gcalendar/__init__.py +0 -0
  33. {workspace_mcp-1.0.1 → workspace_mcp-1.0.2}/gchat/__init__.py +0 -0
  34. {workspace_mcp-1.0.1 → workspace_mcp-1.0.2}/gdocs/__init__.py +0 -0
  35. {workspace_mcp-1.0.1 → workspace_mcp-1.0.2}/gdrive/__init__.py +0 -0
  36. {workspace_mcp-1.0.1 → workspace_mcp-1.0.2}/gforms/__init__.py +0 -0
  37. {workspace_mcp-1.0.1 → workspace_mcp-1.0.2}/gmail/__init__.py +0 -0
  38. {workspace_mcp-1.0.1 → workspace_mcp-1.0.2}/gsheets/__init__.py +0 -0
  39. {workspace_mcp-1.0.1 → workspace_mcp-1.0.2}/gslides/__init__.py +0 -0
  40. {workspace_mcp-1.0.1 → workspace_mcp-1.0.2}/setup.cfg +0 -0
  41. {workspace_mcp-1.0.1 → workspace_mcp-1.0.2}/workspace_mcp.egg-info/SOURCES.txt +0 -0
  42. {workspace_mcp-1.0.1 → workspace_mcp-1.0.2}/workspace_mcp.egg-info/dependency_links.txt +0 -0
  43. {workspace_mcp-1.0.1 → workspace_mcp-1.0.2}/workspace_mcp.egg-info/entry_points.txt +0 -0
  44. {workspace_mcp-1.0.1 → workspace_mcp-1.0.2}/workspace_mcp.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: workspace-mcp
3
- Version: 1.0.1
3
+ Version: 1.0.2
4
4
  Summary: Comprehensive, highly performant Google Workspace Streamable HTTP & SSE MCP Server for Calendar, Gmail, Docs, Sheets, Slides & Drive
5
5
  Author-email: Taylor Wilsdon <taylor@taylorwilsdon.com>
6
6
  License: MIT
@@ -36,6 +36,7 @@ Requires-Dist: google-api-python-client>=2.168.0
36
36
  Requires-Dist: google-auth-httplib2>=0.2.0
37
37
  Requires-Dist: google-auth-oauthlib>=1.2.2
38
38
  Requires-Dist: httpx>=0.28.1
39
+ Requires-Dist: pyjwt>=2.10.1
39
40
  Requires-Dist: tomlkit
40
41
  Dynamic: license-file
41
42
 
@@ -48,10 +49,11 @@ Dynamic: license-file
48
49
  [![PyPI](https://img.shields.io/pypi/v/workspace-mcp.svg)](https://pypi.org/project/workspace-mcp/)
49
50
  [![UV](https://img.shields.io/badge/Package%20Installer-UV-blueviolet)](https://github.com/astral-sh/uv)
50
51
  [![Website](https://img.shields.io/badge/Website-workspacemcp.com-green.svg)](https://workspacemcp.com)
52
+ [![Verified on MseeP](https://mseep.ai/badge.svg)](https://mseep.ai/app/eebbc4a6-0f8c-41b2-ace8-038e5516dba0)
51
53
 
52
- **The world's most feature-complete Google Workspace MCP server**
54
+ **This is the single most feature-complete Google Workspace MCP server**
53
55
 
54
- *Connect MCP Clients, AI assistants and developer tools to Google Calendar, Drive, Gmail, Docs, Sheets, Slides, Forms, and Chat*
56
+ *Full natural language control over Google Calendar, Drive, Gmail, Docs, Sheets, Slides, Forms, and Chat through all MCP clients, AI assistants and developer tools*
55
57
 
56
58
  </div>
57
59
 
@@ -137,6 +139,7 @@ uv run main.py
137
139
  - Create OAuth 2.0 credentials (web application) in [Google Cloud Console](https://console.cloud.google.com/)
138
140
  - Enable APIs: Calendar, Drive, Gmail, Docs, Sheets, Slides, Forms, Chat
139
141
  - Download credentials as `client_secret.json` in project root
142
+ - To use a different location for `client_secret.json`, you can set the `GOOGLE_CLIENT_SECRETS` environment variable with that path
140
143
  - Add redirect URI: `http://localhost:8000/oauth2callback`
141
144
 
142
145
  2. **Environment**:
@@ -7,10 +7,11 @@
7
7
  [![PyPI](https://img.shields.io/pypi/v/workspace-mcp.svg)](https://pypi.org/project/workspace-mcp/)
8
8
  [![UV](https://img.shields.io/badge/Package%20Installer-UV-blueviolet)](https://github.com/astral-sh/uv)
9
9
  [![Website](https://img.shields.io/badge/Website-workspacemcp.com-green.svg)](https://workspacemcp.com)
10
+ [![Verified on MseeP](https://mseep.ai/badge.svg)](https://mseep.ai/app/eebbc4a6-0f8c-41b2-ace8-038e5516dba0)
10
11
 
11
- **The world's most feature-complete Google Workspace MCP server**
12
+ **This is the single most feature-complete Google Workspace MCP server**
12
13
 
13
- *Connect MCP Clients, AI assistants and developer tools to Google Calendar, Drive, Gmail, Docs, Sheets, Slides, Forms, and Chat*
14
+ *Full natural language control over Google Calendar, Drive, Gmail, Docs, Sheets, Slides, Forms, and Chat through all MCP clients, AI assistants and developer tools*
14
15
 
15
16
  </div>
16
17
 
@@ -96,6 +97,7 @@ uv run main.py
96
97
  - Create OAuth 2.0 credentials (web application) in [Google Cloud Console](https://console.cloud.google.com/)
97
98
  - Enable APIs: Calendar, Drive, Gmail, Docs, Sheets, Slides, Forms, Chat
98
99
  - Download credentials as `client_secret.json` in project root
100
+ - To use a different location for `client_secret.json`, you can set the `GOOGLE_CLIENT_SECRETS` environment variable with that path
99
101
  - Add redirect URI: `http://localhost:8000/oauth2callback`
100
102
 
101
103
  2. **Environment**:
@@ -193,29 +193,37 @@ def require_google_service(
193
193
  # Original authentication logic is handled automatically
194
194
  """
195
195
  def decorator(func: Callable) -> Callable:
196
+ # Inspect the original function signature
197
+ original_sig = inspect.signature(func)
198
+ params = list(original_sig.parameters.values())
199
+
200
+ # The decorated function must have 'service' as its first parameter.
201
+ if not params or params[0].name != 'service':
202
+ raise TypeError(
203
+ f"Function '{func.__name__}' decorated with @require_google_service "
204
+ "must have 'service' as its first parameter."
205
+ )
206
+
207
+ # Create a new signature for the wrapper that excludes the 'service' parameter.
208
+ # This is the signature that FastMCP will see.
209
+ wrapper_sig = original_sig.replace(parameters=params[1:])
210
+
196
211
  @wraps(func)
197
212
  async def wrapper(*args, **kwargs):
198
- # Extract user_google_email from function parameters
199
- sig = inspect.signature(func)
200
- param_names = list(sig.parameters.keys())
213
+ # Note: `args` and `kwargs` are now the arguments for the *wrapper*,
214
+ # which does not include 'service'.
201
215
 
202
- # Find user_google_email parameter
203
- user_google_email = None
204
- if 'user_google_email' in kwargs:
205
- user_google_email = kwargs['user_google_email']
206
- else:
207
- # Look for user_google_email in positional args
208
- try:
209
- user_email_index = param_names.index('user_google_email')
210
- if user_email_index < len(args):
211
- user_google_email = args[user_email_index]
212
- except ValueError:
213
- pass
216
+ # Extract user_google_email from the arguments passed to the wrapper
217
+ bound_args = wrapper_sig.bind(*args, **kwargs)
218
+ bound_args.apply_defaults()
219
+ user_google_email = bound_args.arguments.get('user_google_email')
214
220
 
215
221
  if not user_google_email:
216
- raise Exception("user_google_email parameter is required but not found")
222
+ # This should ideally not be reached if 'user_google_email' is a required parameter
223
+ # in the function signature, but it's a good safeguard.
224
+ raise Exception("'user_google_email' parameter is required but was not found.")
217
225
 
218
- # Get service configuration
226
+ # Get service configuration from the decorator's arguments
219
227
  if service_type not in SERVICE_CONFIGS:
220
228
  raise Exception(f"Unknown service type: {service_type}")
221
229
 
@@ -226,7 +234,7 @@ def require_google_service(
226
234
  # Resolve scopes
227
235
  resolved_scopes = _resolve_scopes(scopes)
228
236
 
229
- # Check cache first if enabled
237
+ # --- Service Caching and Authentication Logic (largely unchanged) ---
230
238
  service = None
231
239
  actual_user_email = user_google_email
232
240
 
@@ -236,7 +244,6 @@ def require_google_service(
236
244
  if cached_result:
237
245
  service, actual_user_email = cached_result
238
246
 
239
- # If not cached, authenticate
240
247
  if service is None:
241
248
  try:
242
249
  tool_name = func.__name__
@@ -247,30 +254,22 @@ def require_google_service(
247
254
  user_google_email=user_google_email,
248
255
  required_scopes=resolved_scopes,
249
256
  )
250
-
251
- # Cache the service if caching is enabled
252
257
  if cache_enabled:
253
258
  cache_key = _get_cache_key(user_google_email, service_name, service_version, resolved_scopes)
254
259
  _cache_service(cache_key, service, actual_user_email)
255
-
256
260
  except GoogleAuthenticationError as e:
257
261
  raise Exception(str(e))
258
262
 
259
- # Inject service as first parameter
260
- if 'service' in param_names:
261
- kwargs['service'] = service
262
- else:
263
- # Insert service as first positional argument
264
- args = (service,) + args
265
-
266
- # Call the original function with refresh error handling
263
+ # --- Call the original function with the service object injected ---
267
264
  try:
268
- return await func(*args, **kwargs)
265
+ # Prepend the fetched service object to the original arguments
266
+ return await func(service, *args, **kwargs)
269
267
  except RefreshError as e:
270
- # Handle token refresh errors gracefully
271
268
  error_message = _handle_token_refresh_error(e, actual_user_email, service_name)
272
269
  raise Exception(error_message)
273
270
 
271
+ # Set the wrapper's signature to the one without 'service'
272
+ wrapper.__signature__ = wrapper_sig
274
273
  return wrapper
275
274
  return decorator
276
275
 
@@ -160,3 +160,39 @@ def extract_office_xml_text(file_bytes: bytes, mime_type: str) -> Optional[str]:
160
160
  except Exception as e:
161
161
  logger.error(f"Failed to extract office XML text for {mime_type}: {e}", exc_info=True)
162
162
  return None
163
+
164
+ import functools
165
+ from googleapiclient.errors import HttpError
166
+
167
+ def handle_http_errors(tool_name: str):
168
+ """
169
+ A decorator to handle Google API HttpErrors in a standardized way.
170
+
171
+ It wraps a tool function, catches HttpError, logs a detailed error message,
172
+ and raises a generic Exception with a user-friendly message.
173
+
174
+ Args:
175
+ tool_name (str): The name of the tool being decorated (e.g., 'list_calendars').
176
+ This is used for logging purposes.
177
+ """
178
+ def decorator(func):
179
+ @functools.wraps(func)
180
+ async def wrapper(*args, **kwargs):
181
+ try:
182
+ return await func(*args, **kwargs)
183
+ except HttpError as error:
184
+ user_google_email = kwargs.get('user_google_email', 'N/A')
185
+ message = (
186
+ f"API error in {tool_name}: {error}. "
187
+ f"You might need to re-authenticate for user '{user_google_email}'. "
188
+ f"LLM: Try 'start_google_auth' with the user's email and the appropriate service_name."
189
+ )
190
+ logger.error(message, exc_info=True)
191
+ raise Exception(message)
192
+ except Exception as e:
193
+ # Catch any other unexpected errors
194
+ message = f"An unexpected error occurred in {tool_name}: {e}"
195
+ logger.exception(message)
196
+ raise Exception(message)
197
+ return wrapper
198
+ return decorator