Commit Graph

1185 Commits

Author SHA1 Message Date
Josh Dzielak
a30438bb83 Address Copilot review comments
- Add missing parentheses to .execute() method call
- Remove redundant pass statement after logger.debug
- Keep urlsafe_b64decode() for consistency with codebase convention

Note: Copilot suggested using b64decode() instead of urlsafe_b64decode(),
but the codebase consistently uses urlsafe_b64decode() for Gmail message
body data (lines 72, 87 in gmail_tools.py). We follow the existing
codebase convention for consistency.
2025-12-06 07:49:08 +01:00
Josh Dzielak
d8204eb0df Fix ruff errors: remove unused imports 2025-12-06 07:43:08 +01:00
Josh Dzielak
ee1db221af Add HTTP URL-based attachment serving for Gmail attachments
This commit implements a new feature that allows Gmail attachments to be
served via HTTP URLs instead of returning base64-encoded data in the tool
response. This avoids consuming LLM context window space and token budgets
for large attachments.

Architecture:
-------------
The implementation works in both stdio and streamable-http transport modes:

1. Temp File Storage (core/attachment_storage.py):
   - New AttachmentStorage class manages temporary file storage in ./tmp/attachments/
   - Uses UUID-based file IDs to prevent guessing/unauthorized access
   - Tracks metadata: filename, mime type, size, creation/expiration times
   - Files expire after 1 hour (configurable) with automatic cleanup support
   - Handles base64 decoding and file writing

2. HTTP Route Handlers:
   - Added /attachments/{file_id} route to main FastMCP server (streamable-http mode)
   - Added same route to MinimalOAuthServer (stdio mode)
   - Both routes serve files with proper Content-Type headers via FileResponse
   - Returns 404 for expired or missing attachments

3. Modified get_gmail_attachment_content():
   - Now saves attachments to temp storage and returns HTTP URL
   - Attempts to fetch filename/mimeType from message metadata (best effort)
   - Handles stateless mode gracefully (skips file saving, shows preview)
   - Falls back to base64 preview if file saving fails
   - URL generation respects WORKSPACE_EXTERNAL_URL for reverse proxy setups

Key Features:
-------------
- Works in both stdio and streamable-http modes (uses existing HTTP servers)
- Respects stateless mode (no file writes when WORKSPACE_MCP_STATELESS_MODE=true)
- Secure: UUID-based file IDs prevent unauthorized access
- Automatic expiration: Files cleaned up after 1 hour
- Reverse proxy support: Uses WORKSPACE_EXTERNAL_URL if configured
- Graceful degradation: Falls back to preview if storage fails

Benefits:
---------
- Avoids context window bloat: Large attachments don't consume LLM tokens
- Better performance: Clients can stream/download files directly
- More efficient: No need to decode base64 in client applications
- Works across network boundaries: URLs accessible from any client

The feature maintains backward compatibility - if file saving fails or stateless
mode is enabled, the function falls back to showing a base64 preview.
2025-12-04 16:37:10 +01:00
Josh Dzielak
470dcae813 Fix ruff errors: remove f-string prefix from strings without placeholders 2025-12-04 16:21:43 +01:00
Jan Hutar
77b2d1d694 feat: Get text from other shapes as well and address some other code review comments
Assisted-by: Gemini
2025-12-01 14:19:38 +01:00
Josh Dzielak
02c1f2ee01 Add pagination for search_gmail_messages tool 2025-11-29 14:45:05 +01:00
Taylor Wilsdon
0402b1a0b8 chore: release v1.6.0 2025-11-28 14:14:16 -05:00
Taylor Wilsdon
1ce2f068af Merge pull request #285 from taylorwilsdon/fix_require_multiple_services
fix: better approach for issues/244
2025-11-28 14:13:37 -05:00
Taylor Wilsdon
705cf20044 better approach 2025-11-28 13:53:34 -05:00
Jan Hutar
af75926b25 feat: Make get_presentation tool to also extract text in slides 2025-11-28 17:04:06 +01:00
Olivier Schiavo
7e2f9cdd96 feat: use colors in gdocs 2025-11-27 17:26:35 +01:00
Kevin Littlejohn
252ebe482e Remove extra_fields from resolve_drive_item call
Removed the extra_fields parameter from resolve_drive_item call.
2025-11-27 17:26:22 +01:00
Kevin Littlejohn
b43365df1d Fix formatting issue in drive_tools.py 2025-11-27 17:26:22 +01:00
Taylor Wilsdon
4a1eb2227a merge main 2025-11-27 17:26:22 +01:00
Kevin Littlejohn
2bd8dccaa6 Remove shortcut_resolution patch artifact 2025-11-27 17:26:22 +01:00
Kevin Littlejohn
dfd925ba45 Handle Drive shortcuts transparently 2025-11-27 17:26:22 +01:00
Taylor Wilsdon
5183aef08e Merge pull request #272 from silarsis/main
Issue #269 - supporting shortcuts
2025-11-25 17:14:19 -05:00
Kevin Littlejohn
c9d4cd803c Remove extra_fields from resolve_drive_item call
Removed the extra_fields parameter from resolve_drive_item call.
2025-11-25 13:43:48 +08:00
Kevin Littlejohn
6c06e90123 Fix formatting issue in drive_tools.py 2025-11-25 13:36:02 +08:00
Taylor Wilsdon
7936097b7b merge main 2025-11-16 14:22:06 -05:00
Taylor Wilsdon
d470fbdd13 Merge branch 'main' of github.com:taylorwilsdon/google_workspace_mcp into silarsis/main 2025-11-16 14:22:02 -05:00
Taylor Wilsdon
bf99eabe0b Merge pull request #275 from taylorwilsdon/issues/274
fix: fix media calls
2025-11-12 12:00:06 -05:00
Taylor Wilsdon
fd26e4037a fix media calls 2025-11-12 11:54:55 -05:00
Kevin Littlejohn
cbeabb36a1 Remove shortcut_resolution patch artifact 2025-11-11 16:44:39 +08:00
Kevin Littlejohn
55dfba3d83 Handle Drive shortcuts transparently 2025-11-11 16:43:00 +08:00
Taylor Wilsdon
973f921c32 chore: release v1.5.5 2025-11-10 11:17:44 -05:00
Taylor Wilsdon
78a458b226 dxt update 2025-11-10 11:17:37 -05:00
Taylor Wilsdon
d0faa593e9 Merge pull request #270 from yairwein/main
feat: Add support for file:// URLs in create_drive_file
2025-11-10 11:17:04 -05:00
Taylor Wilsdon
72dd6330b6 Merge branch 'main' of github.com:taylorwilsdon/google_workspace_mcp into yairwein/main 2025-11-10 11:14:53 -05:00
Taylor Wilsdon
f9fdb94529 add streamable http check 2025-11-10 11:13:47 -05:00
Taylor Wilsdon
9f969f05a5 ruff 2025-11-10 11:03:44 -05:00
Taylor Wilsdon
b3efc76399 address feedback 2025-11-10 11:03:38 -05:00
Taylor Wilsdon
4c92a542da Merge pull request #266 from benjaminjackson/fix/add-to-cc-metadata-fields
fix(gmail): add To and Cc fields to message metadata responses
2025-11-10 10:56:16 -05:00
Taylor Wilsdon
d8c0e719df Merge pull request #268 from cfdude/feat/update-drive-file-tool
feat(drive): add update_drive_file tool for comprehensive file metadata management
2025-11-10 10:55:49 -05:00
Taylor Wilsdon
902ca92bb6 address feedback 2025-11-10 10:54:38 -05:00
Yair Weinberger
12e2be0807 feat: Add support for file:// URLs in create_drive_file
Added ability to upload local files to Google Drive using file:// URL scheme
in the create_drive_file tool. This enables uploading files from /tmp and
other local paths without requiring HTTP/HTTPS hosting.

Changes:
- Added urllib.parse.urlparse and pathlib.Path imports
- Detect file:// URLs and read directly from local filesystem
- Validate file exists before attempting upload
- Updated docstring to reflect support for file://, http://, and https://
- Added error handling for unsupported URL schemes

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-09 17:12:26 +00:00
Rob Sherman
541677388b feat(drive): implement update_drive_file function with OAuth scope fix
- Added comprehensive update_drive_file function to modify Google Drive file metadata
- Fixed OAuth scope issue by using 'drive_file' instead of non-existent 'drive_write'
- Supports moving files, renaming, updating descriptions, managing sharing permissions
- Includes support for custom properties and file status (starred/trashed)
- Updated README.md and tool_tiers.yaml documentation
- Successfully tested with all parameters

Fixes #220 (OAuth stdio mode authentication issues)
2025-11-05 22:58:44 -08:00
Benjamin Jackson
ca61416acb fix(gmail): add To and Cc fields to message metadata responses
Previously, the metadataHeaders parameter only requested Subject and
From fields from the Gmail API, even though To and Cc are standard
metadata fields. This updates all metadata API calls to include To
and Cc in both single message and batch operations.

Changes:
- Updated metadataHeaders to include To, Cc in all API calls
- Extended _extract_headers() calls to request To, Cc
- Updated response formatting to display To, Cc fields
- Handles missing To/Cc gracefully with empty strings
- Updated docstrings to reflect new fields in responses

Affected functions:
- get_gmail_message_content() (gmail/gmail_tools.py:369-457)
- get_gmail_messages_content_batch() (gmail/gmail_tools.py:463-638)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-04 16:40:04 -05:00
Taylor Wilsdon
c7b1a633d1 Merge pull request #264 from taylorwilsdon/all_drive_support
enh: All Drive API operations now include supportsAllDrives=True
2025-11-04 11:20:35 -05:00
Taylor Wilsdon
332bc9c9ae Update README.md 2025-11-04 11:17:00 -05:00
Taylor Wilsdon
9b873092b2 remove alldrives from comments 2025-11-04 11:02:20 -05:00
Taylor Wilsdon
01a0de105a trailing comma 2025-11-04 10:39:53 -05:00
Taylor Wilsdon
8363ae1c06 add additional bits 2025-11-04 10:36:49 -05:00
Taylor Wilsdon
24d79ab470 All Drive API operations now include supportsAllDrives=True 2025-11-04 10:19:37 -05:00
Taylor Wilsdon
7ac9087939 Update README.md 2025-11-03 12:21:20 -05:00
Taylor Wilsdon
2fc133ec5a Update README.md 2025-11-03 12:20:42 -05:00
Taylor Wilsdon
a9625dd71a update dxt 2025-11-02 08:44:08 -05:00
Taylor Wilsdon
e9e8c40ab7 chore: release v1.5.4 2025-11-02 08:43:15 -05:00
Taylor Wilsdon
ee6242627b bump vers 2025-11-02 08:43:06 -05:00
Taylor Wilsdon
6691de4ccf chore: release v1.5.3 2025-11-02 08:42:57 -05:00