Repository navigation
fix: make --read-only block delivery instead of the compose tools - #119
Merged
Merged
Conversation
Two problems, one cause: the flag was applied by deleting tools rather than by gating the sending path. 1. The guard in manage_drafts(action="send") never fired. compose.py did `from apple_mail_mcp.server import READ_ONLY`, binding the value False at import, while __main__ assigns server.READ_ONLY afterwards. The module now reads the flag through the server module at call time. 2. --read-only removed compose_email and reply_to_email outright, even though their "draft" and "open" modes never deliver anything. Those two are also the only tools in the compose surface that accept attachments, so read-only mode left no supported way to attach a file to a draft. They now stay registered and refuse mode="send" themselves. forward_email has no non-sending mode and is still removed. Adds regression coverage for both, including one test that fails if the flag is ever bound at import time again.
…the compose tools Rebased onto current main; CHANGELOG.md taken from main (entry consolidated at release). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nder read-only - test_reply_still_drafts now also patches compose.subprocess.run (returncode 0, stdout b"DRAFT SAVED"): reply_to_email runs its main script through osascript directly, so the test failed on Linux CI with FileNotFoundError and drove the real Mail.app on macOS. - forward_email refuses with an error when server.READ_ONLY is set, as defense in depth in case the --read-only tool removal ever fails. Test covers both the plain and the message (direct osascript) paths. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Opened by Claude (AI assistant) on Patrick's behalf.
Carries over #95 by @herbeckrobin (original commits preserved), rebased onto current main.
Fixes #102
Follow-up edits (separate commit)
test_reply_still_draftsnow also patchesapple_mail_mcp.tools.compose.subprocess.run(returncode 0, stdoutb"DRAFT SAVED").reply_to_emailruns its main script throughosascriptdirectly, so the test failed on Linux CI withFileNotFoundErrorand drove the real Mail.app on macOS. It now also asserts the draft result.forward_emailrefuses withError: Forwarding is disabled in read-only mode.whenserver.READ_ONLYis set, as defense in depth in case the--read-onlytool removal ever fails. Test covers both the plain and themessage(direct osascript) paths.python -m pytest -q: 136 passed.Proposed CHANGELOG entry
🤖 Generated with Claude Code