anthropics / anthropics/claude-ai-mcp
Apple Notes extension: three independent defects (stdout maxBuffer on notes with images, O(4n) Apple Events in list_notes, hardcoded English folder names)
- Ngôn ngữ chính
- Không có dữ liệu ngôn ngữ
- Star
- 471
- Fork
- 76
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
### What happened?
All three read paths of the bundled "Read and Write Apple Notes" extension fail on a normal Notes library. The three failures are independent of each other, and none are permission-related — AppleScript reaches Notes successfully throughout.
1. get_note_content fails with "stdout maxBuffer length exceeded" on any note containing embedded images. The script runs `return body of targetNote as string`, and Notes' `body` property returns full HTML with images inlined as base64 data URIs. Node's child_process.exec defaults to maxBuffer: 1 MB, so a single pasted screenshot makes the note unreadable.
2. list_notes never returns — it hits the 60-second MCP timeout on every call. The script materializes the entire notes collection before the `limit` parameter is applied, then reads four properties per note (name, id, creation date, modification date) as separate Apple Events. Over an iCloud-backed store that is roughly 4n round-trips at 50–200 ms each.
3. The `folder` parameter cannot resolve any folder. The tool's own documentation gives 'Notes' and 'Recently Deleted' as examples, but these are English-only strings — on a Swedish system the folders are "Anteckningar" and "Senast raderade". The correct localized name fails too, which points to a second cause: folder references are not account-qualified, and folders live under accounts in the Notes scripting model.
Net effect: the extension is usable only on a small, image-free, English-locale library.
### What did you expect to happen?
1. get_note_content should return the note's text regardless of whether it contains images.
2. list_notes should return within the timeout, and the `limit` parameter should bound the work performed, not just the size of the output.
3. The `folder` parameter should resolve folders on a non-English macOS, and there should be some way to discover valid folder names.
### Steps to reproduce
Environment: macOS (darwin, arm64), Swedish system localization, iCloud Notes account, Claude desktop 1.32885.1, Electron 42.9.2, Node 24.18.1.
1. call list_notes with limit 10, then 20, 50, 100 and 300
→ 60-second timeout at every value. Runtime is independent of `limit`, which is the diagnostic signal that the limit is applied after the expensive work.
2. call list_notes with folder "Recently Deleted"
→ AppleScript error -1728. English folder name does not exist on a localized system.
3. call list_notes with folder "Anteckningar" (the correct Swedish name)
→ AppleScript error -1728 as well. Suggests the reference also needs to be account-qualified.
4. call get_note_content with the exact name of a note containing embedded images
→ "stdout maxBuffer length exceeded"
5. NEGATIVE CONTROL: call get_note_content with a name that does not exist
→ AppleScript error -1719, returned immediately. Confirms that exact-name lookup is fast and correct, and that step 4 is not a lookup failure.
6. POSITIVE CONTROL: call get_note_content with an image-free note (~10 kB) in the same folder
→ Succeeds. Returns the full HTML body without incident.
Steps 5 and 6 together isolate defect 1: the same code path succeeds on a small note and fails on a large one. Payload size is the only variable.
### Area
MCP Connector (adding/managing servers)
### MCP Server (if applicable)
Read and Write Apple Notes (bundled Claude Desktop extension)
### Error messages or logs
```shell
=== Defect 1: get_note_content on a note with images ===
Failed to get note content: AppleScript error: stdout maxBuffer length exceeded
Script executed:
tell application "Notes"
set targetNote to first note whose name is ""
return body of targetNote as string
end tell
=== Negative control: get_note_content, nonexistent name ===
66:112: execution error: Notes drabbades av ett fel:
Kan inte hämta note 1 whose name = "zzz-finns-inte-2026". Ogiltigt index. (-1719)
=== Defect 2 + 3: list_notes ===
99:104: execution error: Notes drabbades av ett fel:
Kan inte hämta folder "Anteckningar". (-1728)
Script executed:
tell application "Notes"
set notesList to {}
set folderNotes to notes of folder ""
set noteCount to 0
repeat with aNote in folderNotes
if noteCount < 5 then
set noteInfo to "{\"name\":\"" & (name of aNote as string) & "\",\"id\":\"" & (id of aNote as string) & "\",\"creation_date\":\"" & (creation date of aNote as string) & "\",\"modification_date\":\"" & (modification date of aNote as string) & "\"}"
set end of notesList to noteInfo
set noteCount to noteCount + 1
else
exit repeat
end if
end repeat
return "[" & my joinList(notesList, ",") & "]"
end tell
```
### Additional context
RULING OUT PERMISSIONS
Worth stating explicitly, because it is the obvious first hypothesis and it is wrong. Before diagnosing this I had already tried: disabling and re-enabling the connector, uninstalling and reinstalling it, restarting the desktop app, toggling Automation permission for Claude under System Settings > Privacy & Security > Automation, and confirming no modal dialogs were open in Notes. None changed the behavior.
The error codes explain why. A missing Apple Events grant produces -1743 ("Not authorized to send Apple events") or a TCC consent prompt. What appears instead is -1719 and -1728 — Notes' own "can't get object" errors — returned in Swedish, meaning osascript connected successfully to a running, localized Notes process and Notes itself answered. The IPC channel is open end to end.
SUGGESTED FIXES
Defect 1 — use `plaintext` instead of `body`:
return plaintext of targetNote as string
`plaintext` is a documented Notes property returning text without HTML markup or embedded image data. This removes the problem at the source. Raising maxBuffer only moves the ceiling: a note with several images still breaks it, and megabytes of base64 are useless to a model consuming the output. If HTML fidelity is needed, expose it as an opt-in parameter with a raised buffer and default to plaintext.
Defect 2 — replace the per-note loop with bulk property reads:
tell application "Notes"
set theNames to name of every note
set theIds to id of every note
set theCreated to creation date of every note
set theModified to modification date of every note
end tell
Four Apple Events total instead of 4n, zipped in JavaScript. This is the standard idiom for bulk property reads and is typically two to three orders of magnitude faster. If `limit` is meant to bound cost rather than output size, apply it to the collection reference (e.g. `notes 1 thru 20`) rather than inside the loop.
Defect 3 — resolve folders by iterating accounts instead of assuming a flat English namespace:
tell application "Notes"
repeat with anAccount in accounts
repeat with aFolder in folders of anAccount
-- match on name of aFolder
end repeat
end repeat
end tell
Also remove the English folder names from the parameter description, or mark them as English-locale examples. A `list_folders` tool would help considerably: there is currently no way to discover valid folder names, and since list_notes is the only listing primitive and it times out, the extension offers no path to that information at all.
PRIORITY
1. Defect 1 — one-line change, restores content reads immediately.
2. Defect 2 — without it the extension cannot enumerate a real library at all.
3. Defect 3 — account-qualified resolution plus a list_folders tool.
Defects 1 and 2 are both contained and low-risk.
NOTE ON ERROR HANDLING
Errors currently return the full AppleScript source to the caller. That verbosity is what made this diagnosis possible, so it is genuinely useful — but it likely isn't intentional. If it gets cleaned up, please keep the underlying AppleScript error code and message (-1719, -1728) in the response. Those are what distinguish a permissions problem from an object-resolution problem, and preserving them would have saved several rounds of misdirected troubleshooting in System Settings.
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Đánh giá
Issue này chưa được đánh giá.