Skip to content

Send messages behind Allow writes and the shared confirmation - #383

Closed
oliverames wants to merge 5 commits into
mattt:mainfrom
oliverames:pr/messages-send
Closed

oliverames wants to merge 5 commits into
mattt:mainfrom
oliverames:pr/messages-send

Conversation

@oliverames

@oliverames oliverames commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on #377; merge that first; review the commits after 1014bee.

What and why

This adds messages_send, so a client can send an iMessage or SMS from the Messages app. It is #305 rebuilt on the Allow writes switch and the shared confirmation window from #377. Nothing is sent without the person clicking Send in iMCP.

What changed

  • messages_send takes a recipient (or a conversation @id), the text, and an optional service. It is off until Allow writes is turned on for Messages, and then every send shows the shared confirmation window with the client name, the exact recipients and the full text.
  • The recipient checks, the fixed script with typed Apple event parameters, and the recheck of the approved conversation right before sending are Add a messages_send tool that asks before each send #305's.
  • If the global approval gate from Add Allow writes per service and a shared send confirmation #377 has already asked about the same call, messages_send does not ask a second time.
  • NSAppleScript.execute can call a handler with typed arguments, so no value from a client is ever built into script source. A caller's check runs right before the script.
  • Adds the Apple events entitlement for Messages, the usage description, the README text and the tests.

Testing

  • swift format lint --strict -r . is clean.
  • Debug build of the iMCP scheme succeeds.
  • imcp-serverTests: 256 tests run, 1 skipped (pre-existing, in HomeProxyTests), 0 failures. MessagesTests covers arguments, recipient and conversation checks, decline, timeout and busy, the already-confirmed path, and the Allow writes default.
  • CI: both builds pass (macOS 26 with Xcode 26.0, macOS 27 with Xcode 27.0).
  • Live, on an earlier build of this same change (before it was rebuilt on Add Allow writes per service and a shared send confirmation #377): an approved send arrived once, a second approval sent, a 50 second timeout sent nothing, cancel returned "Nothing was done", and turning writes off hid the tool.

Not verified

Replaces #344.

Oliver Ames added 5 commits November 18, 2026 13:46
One switch per service hides its write tools from clients and refuses direct
calls to them. Deletes count as writes; read-only tools stay available.
Services that already write default to on, so existing setups don't change.
A reusable window shows the client, the recipient, and the full text, waits
50 seconds, shows one request at a time, and has no "always allow". It is for
tools that send something to another person. Also documents Allow writes and
adds the new files to the Xcode project.
A setting in General chooses whether iMCP asks before every tool call, only
before writes, or leaves approval to the client. One gate in CallTool enforces
it, concurrent confirmations wait their turn, and the two hands-off modes skip
iMCP's own pop-ups and per-service Allow writes blocks without changing the
stored choices.
NSAppleScript.execute can now call a handler of a fixed script with arguments
that reach it as Apple event descriptors, never as source text. A caller's
beforeSending check runs on the script queue right before the script.
Sends a message or a reply to a conversation through Messages. The tool is off
until Allow writes is turned on for Messages, validates the recipient or
conversation, shows the shared confirmation window with the client name, exact
handles and full text, and rechecks the approved conversation right before
sending. It skips its own window when the global approval gate already asked
about the same call, so a send never prompts twice. Adds the Messages Apple
events entitlement, the usage description, README text and tests.
@oliverames

Copy link
Copy Markdown
Contributor Author

Split the typed Apple Events helper and its tests into #390 per #364, so I'm closing this one.

@oliverames oliverames closed this Nov 20, 2026
@oliverames
oliverames deleted the pr/messages-send branch November 20, 2026 21:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant