Commit Graph

262 Commits

Author SHA1 Message Date
github-actions[bot] 95120d6f26 style: auto-fix ruff lint and format 2026-03-03 15:12:33 +00:00
Taylor Wilsdon 5b5da3386c refac 2026-03-01 18:21:12 -05:00
Taylor Wilsdon c9facbff3d refac 2026-03-01 17:59:45 -05:00
Taylor Wilsdon 217d727a9d Merge branch 'main' of https://github.com/taylorwilsdon/google_workspace_mcp into claude/fix-cors-middleware-error-sPbo6 2026-03-01 17:47:02 -05:00
Taylor Wilsdon 5af66ee0d2 refac 2026-03-01 17:47:00 -05:00
Taylor Wilsdon d8567f2beb defusedxml 2026-03-01 17:22:34 -05:00
github-actions[bot] eaab19b1ca style: auto-fix ruff lint and format 2026-03-01 17:54:47 +00:00
Taylor Wilsdon 6753531e9d refactor tools to consolidate all modify actions 2026-03-01 12:36:09 -05:00
Claude cd326d0f2d Fix TypeError: CORSMiddleware.__call__() missing 2 required positional arguments
The _wrap_well_known_endpoint function assumed all route endpoints are regular
request handlers (async def handler(request) -> Response). However, the MCP
SDK's cors_middleware wraps handlers with CORSMiddleware, which is an ASGI app
expecting (scope, receive, send). When the wrapper called
`await endpoint(request)` on a CORSMiddleware instance, it passed only 1
argument instead of the required 3 ASGI args.

The fix detects whether the endpoint is a regular handler function or an ASGI
app (using the same inspect check as Starlette's Route constructor), and uses
the appropriate calling convention:
- Regular handlers: called as `await endpoint(request)` (existing behavior)
- ASGI apps: invoked via the ASGI interface `await endpoint(scope, receive, send)`
  with response capture to apply cache-busting headers

https://claude.ai/code/session_011S5zFTWRfKBJBUEanrhvQg
2026-03-01 04:56:33 +00:00
Taylor Wilsdon bbdd61d08d fix attachments + test 2026-02-28 17:12:30 -04:00
Taylor Wilsdon 34ada2c7ad better cachce management 2026-02-28 11:50:09 -04:00
Taylor Wilsdon edf9e94829 cachebusting for oauth endpoints, more tests, startup check for perms 2026-02-28 11:40:29 -04:00
Taylor Wilsdon aa520b72d3 fix all them tests 2026-02-24 21:09:14 -04:00
Taylor Wilsdon b9524a9090 review fixes 2026-02-24 11:20:27 -04:00
Taylor Wilsdon e1cf0d44da address pr feedback 2026-02-24 10:47:53 -04:00
Taylor Wilsdon 0c4a9708fe avoid early return in read only oauth 2 mode 2026-02-24 10:38:06 -04:00
github-actions[bot] 3f9821b525 style: auto-fix ruff lint and format 2026-02-24 14:29:22 +00:00
Taylor Wilsdon de1cd84730 Merge branch 'main' of https://github.com/taylorwilsdon/google_workspace_mcp into fastmcp_v3 2026-02-24 10:28:57 -04:00
Taylor Wilsdon 69f1a0e9bb remove direct _components usage, prep for v3 rollout 2026-02-24 10:26:52 -04:00
Taylor Wilsdon 1ebc758490 Merge branch 'main' of https://github.com/taylorwilsdon/google_workspace_mcp into fastmcp_v3
# Conflicts:
#	uv.lock
2026-02-24 10:13:14 -04:00
mickey-mikey ffeba1f2f3 fix: add O_BINARY flag to os.open for Windows attachment writes
Fixes #494 - Windows attachment corruption for PNG/PDF files.

On Windows, os.open() defaults to text mode, which translates LF (0x0a)
bytes to CRLF (0x0d 0x0a) during os.write(). This corrupts any binary
attachment containing 0x0a bytes (PNG headers, PDFs, etc.).

The fix adds os.O_BINARY to the os.open() flags using the standard
getattr(os, 'O_BINARY', 0) idiom, which returns the flag on Windows
and 0 (no-op) on platforms where it doesn't exist.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 11:45:37 +11:00
Taylor Wilsdon 4f5c65953c Merge branch 'main' of github.com:taylorwilsdon/google_workspace_mcp into feature/create-drive-folder 2026-02-19 09:55:07 -05:00
Taylor Wilsdon bdc815a723 fix missing readme and tool tier entry for previous addition 2026-02-19 09:46:51 -05:00
Taylor Wilsdon eaa13d3f7e Merge branch 'main' of github.com:taylorwilsdon/google_workspace_mcp into feat/chat-attachment-download 2026-02-19 09:41:06 -05:00
Taylor Wilsdon 6f2a88c105 Merge pull request #489 from MaxGhenis/feat/comment-anchor-text
feat: surface quotedFileContent (anchor text) in comment reading
2026-02-19 09:39:56 -05:00
Max Ghenis 08ad7ad308 feat(docs): add get_doc_as_markdown tool with comment context
Adds a new `get_doc_as_markdown` tool that converts Google Docs to clean
Markdown preserving formatting (headings, bold/italic/strikethrough, links,
code spans, ordered/unordered lists with nesting, and tables).

Optionally overlays comments with their anchor text (quotedFileContent) —
the specific text each comment is attached to — in two modes:
- inline: footnote-style references placed at the anchor text location
- appendix: all comments grouped at the bottom with blockquoted anchors

This gives AI agents full document context in a single tool call, unlike
get_doc_content which strips all formatting to plain text.

New files:
- gdocs/docs_markdown.py: Converter + comment formatting logic
- tests/gdocs/test_docs_markdown.py: 18 tests

Tool tier: extended (alongside search_docs, export_doc_to_pdf, etc.)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 19:15:56 -08:00
Max Ghenis d4070a209b feat: surface quotedFileContent (anchor text) in comment reading
When reading comments via read_document_comments / read_spreadsheet_comments /
read_presentation_comments, the Drive API's quotedFileContent.value field is
now requested and displayed as "Quoted text:" in the output. This shows which
specific text in the document each comment is anchored to.

Comments without anchor text (document-level comments) omit the line.

Relates to #210

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 19:12:21 -08:00
Drew Gillson 4f3eec459d Add chat attachment support: surface metadata and download images/files
Previously, get_messages and search_messages completely ignored the
attachment field on Chat API messages. This adds:

- Attachment metadata (filename, type) displayed inline in get_messages
  and search_messages output
- New download_chat_attachment tool that downloads attachments via the
  Chat API media endpoint and saves to local disk

The download uses httpx with a Bearer token against the
chat.googleapis.com/v1/media endpoint (with alt=media), which works
correctly in both OAuth 2.0 and OAuth 2.1 modes. The attachment's
downloadUri field is intentionally ignored as it points to
chat.google.com which requires browser session cookies.

Key details:
- Uses attachmentDataRef.resourceName for the media endpoint URL
- No new OAuth scopes required (existing chat_read is sufficient)
- Tool registered in the extended tier
- 10 unit tests covering metadata display, download, and edge cases
2026-02-18 17:02:18 -07:00
Taylor Wilsdon 5a784a2ea7 use os.write for short write loops 2026-02-15 16:54:37 -05:00
Taylor Wilsdon 9588396fcb ruff 2026-02-15 16:46:28 -05:00
Taylor Wilsdon 39fe339dc8 fixes 2026-02-15 16:46:19 -05:00
Taylor Wilsdon 7cfa10f457 readme and storage improvements 2026-02-15 16:28:34 -05:00
Taylor Wilsdon 0131f5472f fixes 2026-02-15 16:17:03 -05:00
Taylor Wilsdon bb87e6f9c8 main and ruff 2026-02-15 12:25:16 -05:00
Taylor Wilsdon 87b7889e5b Merge branch 'main' of https://github.com/taylorwilsdon/google_workspace_mcp into fix/attachment-storage-absolute-path 2026-02-15 12:25:08 -05:00
Taylor Wilsdon 3ea29dc14d Update core/utils.py
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2026-02-13 16:13:33 -05:00
Taylor Wilsdon dffdb7ffa7 pr feedback 2026-02-13 16:12:00 -05:00
Taylor Wilsdon 5280f3c634 refac 2026-02-13 16:05:56 -05:00
Taylor Wilsdon 59f8823c6b refac 2026-02-13 16:04:03 -05:00
Taylor Wilsdon 7f90073fb4 ruff 2026-02-13 15:26:37 -05:00
Taylor Wilsdon 71c054c664 harden security around attachment functionality and explicitly disallow reading sensitive files 2026-02-13 15:24:57 -05:00
Taylor Wilsdon 0be2776504 v3 auth middleware fix 2026-02-13 10:20:49 -05:00
Taylor Wilsdon 0075e8338f v3 auth middleware fix 2026-02-13 10:20:39 -05:00
Taylor Wilsdon a336131558 clean up bodyparams logic 2026-02-13 10:07:10 -05:00
Taylor Wilsdon 3b75ab11fb fix 448 2026-02-10 17:00:41 -05:00
Taylor Wilsdon dd248f5af6 garbage import fix 2026-02-10 16:41:21 -05:00
Taylor Wilsdon 487db5c849 sentinel safeguard 2026-02-10 14:25:25 -05:00
Taylor Wilsdon a4a3bdb5c9 pydantic 2026-02-10 14:20:49 -05:00
Taylor Wilsdon b0991018ff refac 2026-02-10 14:15:12 -05:00
Taylor Wilsdon 2bef6d0c0b fix cli mode 2026-02-10 14:05:56 -05:00