Repository navigation
Messages: list attachments in messages_fetch and add messages_attachment_read - #244
Merged
Merged
Conversation
- attachments: true on messages_fetch returns each message's attachments
({@id, name, encodingFormat, contentSize, sticker}, hidden ones excluded)
and keeps attachment-only messages (U+FFFC / at_<n>_<UUID> placeholders
stripped from the text)
- messages_attachment_read {id, maxBytes}: base64 bytes of one attachment,
only from under the granted Messages folder
- RawDatabase: read-only sqlite3 access for the attachment join
This was referenced Sep 24, 2026
mattt
added a commit
that referenced
this pull request
Sep 26, 2026
The attachments added in #244 are listed through a second SQLite connection, which assumed that the default database path and folder grants always open `chat.db` with its write-ahead log. When the log is unreadable, Madrid falls back to `immutable=1`, but the second connection still opened with `mode=ro`. macOS refused it, so `messages_fetch` with `attachments: true` failed with `attachmentsQueryFailed("authorization denied")`. This PR makes `DatabaseAccess.immutable` follow the database's `accessMode`, so both connections open the file the same way.
mattt
added a commit
that referenced
this pull request
Sep 26, 2026
…247) This PR removes the `messages_attachment_read` tool added in #244, so it does not ship in 1.6.0. In a signed, sandboxed build of `main`, iMCP reads `chat.db` through the Messages folder grant, but opening any file under `~/Library/Messages/Attachments` fails with "Operation not permitted". That includes a screenshot sent seconds earlier. It fails with the folder grant's security scope active and after adding the app to Full Disk Access, and no sandbox or TCC denial is logged. So the tool reported every attachment as missing. `messages_fetch` with `attachments: true` still lists each attachment's name, type, size, and `@id` from `chat.db`. Reading the files can come back once we know what grants access to them.
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.
This PR brings @patp's #214 onto the current
main. The #214 branch still carried the original commit from #198, which was squash-merged, so it conflicted. This is its attachments commit cherry-picked ontomain, with @patp as the author, plus a formatting pass for the lint check.