apple-tools-mcp 2.0.5 → 2.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -465,9 +465,9 @@ Two arguments are available on **every** write tool:
465
465
 
466
466
  **Compose is not quoted.** `mail_send` / `mail_draft` (plain and html) call `make new outgoing message` **without** AppleScript `content:` so `newMessage` is a real Mail object, then paste the body into the compose window (System Events). Mail's `mailto` command was shipped in 2.0.4 and **fails on Mini/MacBook Mail**: it does not return an outgoing message (`newMessage` undefined, AppleScript **-2753**). On current Mail (Ventura+, FB11734014) `content` / `html content` store the body as a citation: every plain-text line prefixed with `>`, plus a `multipart/alternative` HTML part wrapped in `<blockquote type="cite">`. Desktop Mail often hides the bar with inline styles; iOS Mail paints the whole body purple with a left quote bar — even when the subject is not `Re:`/`Fwd:` and there is no `In-Reply-To`. Reply and forward still quote the original, which is expected.
467
467
 
468
- Paste uses System Events, so **node needs Accessibility** (Privacy & Security → Accessibility) in addition to Automation → Mail. That Accessibility deny is not a Mail Automation deny (`-1743` / `-10004`).
468
+ Paste uses System Events, so **node needs Accessibility** (Privacy & Security → Accessibility) in addition to Automation → Mail. That Accessibility deny is not a Mail Automation deny (`-1743` / `-10004`). Body focus uses `text area` / `scroll area` and `UI element whose role is "AXWebArea"` — never the System Events class `web area`, which does not compile on macOS 26.x (**-2741**, “Expected class name but found identifier”).
469
469
 
470
- **Manual prove (2.0.5 on the Mac host):** `mail_send` a short plain message and a short `body_format: "html"` message whose body looks like ordinary paragraphs (for example `<p>Quick note</p>`), neither with a `Re:`/`Fwd:` subject. Inspect each Sent `.emlx`: the text/plain part must not prefix every body line with `>`, and any HTML alternative must not wrap the whole body in `<blockquote type="cite">`. Compose must succeed (no `-2753` / undefined `newMessage`).
470
+ **Manual prove (2.0.6 on the Mac host):** `mail_send` a short plain message and a short `body_format: "html"` message whose body looks like ordinary paragraphs (for example `<p>Quick note</p>`), neither with a `Re:`/`Fwd:` subject. Inspect each Sent `.emlx`: the text/plain part must not prefix every body line with `>`, and any HTML alternative must not wrap the whole body in `<blockquote type="cite">`. Compose must succeed (no `-2753` / undefined `newMessage`, no **-2741** on body focus).
471
471
 
472
472
  Emails are addressed by their RFC822 **Message-ID**. Pass `message_id`, or pass the `file_path` from `mail_search` / `mail_recent` and the server reads the Message-ID out of the `.emlx` headers for you. `mail_archive` moves the message to its account's Archive (or All Mail) mailbox; `mail_trash` moves it to that account's Trash.
473
473
 
package/lib/mailWrite.js CHANGED
@@ -171,6 +171,10 @@ export function composeNativeBody(body, { html = false } = {}) {
171
171
  /**
172
172
  * AppleScript handlers: focus the compose body (not To) and paste.
173
173
  * System Events needs Accessibility; Mail make/send still needs Automation.
174
+ *
175
+ * macOS 26.x System Events has no `web area` class (compile -2741,
176
+ * "Expected class name but found identifier"). Hosts compile
177
+ * `text area` / `scroll area` and `UI element whose role is "AXWebArea"`.
174
178
  */
175
179
  export function buildMailBodyPasteHandler() {
176
180
  return `on atmFocusMailBody()
@@ -184,21 +188,58 @@ export function buildMailBodyPasteHandler() {
184
188
  return
185
189
  end try
186
190
  try
187
- click (first web area of w)
191
+ set focused of text area 1 of w to true
192
+ return
193
+ end try
194
+ try
195
+ set focused of (first UI element of w whose role is "AXTextArea") to true
188
196
  return
189
197
  end try
190
198
  try
191
- click (first web area of scroll area 1 of w)
199
+ click (first UI element of w whose role is "AXWebArea")
192
200
  return
193
201
  end try
194
202
  try
195
- click (first web area of scroll area 1 of splitter group 1 of w)
203
+ click (first UI element of scroll area 1 of w whose role is "AXWebArea")
196
204
  return
197
205
  end try
198
206
  try
199
- click (first web area of scroll area 1 of group 1 of splitter group 1 of w)
207
+ click (first UI element of scroll area 1 of splitter group 1 of w whose role is "AXWebArea")
200
208
  return
201
209
  end try
210
+ try
211
+ click (first UI element of scroll area 1 of group 1 of splitter group 1 of w whose role is "AXWebArea")
212
+ return
213
+ end try
214
+ set atmQueue to UI elements of w
215
+ set atmWalked to 0
216
+ repeat while (count of atmQueue) > 0 and atmWalked < 80
217
+ set atmWalked to atmWalked + 1
218
+ set atmElem to item 1 of atmQueue
219
+ if (count of atmQueue) is 1 then
220
+ set atmQueue to {}
221
+ else
222
+ set atmQueue to items 2 thru -1 of atmQueue
223
+ end if
224
+ try
225
+ if (role of atmElem as string) is "AXWebArea" then
226
+ click atmElem
227
+ return
228
+ end if
229
+ end try
230
+ try
231
+ if (role of atmElem as string) is "AXTextArea" then
232
+ set focused of atmElem to true
233
+ return
234
+ end if
235
+ end try
236
+ try
237
+ set atmKids to UI elements of atmElem
238
+ repeat with i from 1 to (count of atmKids)
239
+ set end of atmQueue to item i of atmKids
240
+ end repeat
241
+ end try
242
+ end repeat
202
243
  set {wx, wy} to position of w
203
244
  set {ww, wh} to size of w
204
245
  click at {(wx + (ww div 2)) as integer, (wy + ((wh * 2) div 3)) as integer}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apple-tools-mcp",
3
- "version": "2.0.5",
3
+ "version": "2.0.6",
4
4
  "description": "MCP server for semantic search and write actions across Apple Mail, Messages, Calendar, and Contacts",
5
5
  "type": "module",
6
6
  "main": "index.js",