Repository navigation
Conversation
mattt
force-pushed
the
mattt/ios-app
branch
2 times, most recently
from
October 23, 2026 16:17
8e6d994 to
4c1627d
Compare
Define the Health, Finance, and Alarms tools once in Shared/Companion, store what the iPhone sends in an encrypted SQLite cache, and answer read-only calls from that cache with synced_at and stale. Generalize HomeInput into ToolInput so both services validate arguments.
The iPhone app dials the Mac over TLS with pre-shared keys, pairs with a one-time code from a QR code in Settings > Companion, and serves the companion tools as an MCP server on that connection. The Mac calls tools live when the phone is connected, retries a lost read or an alarm change that carries its ID, and pulls queued changes from the phone's outbox into its cache. Scripts/install-companion.sh builds and installs the app with your team.
Answer the Health tools live from HealthKit, let the user allow each group of types from the app, and queue anchored changes for the Mac: daily statistics for quantity types and full records for sleep, workouts, and health records. When HealthKit is locked, the Mac answers reads from its cache.
Create one-time, weekly, and countdown alarms with the ID the Mac sends, so a retried call returns the existing alarm instead of a second one. A widget extension shows a running timer as a Live Activity with a stop button, the app lists the alarms that AI apps created and cancels them, and the phone sends its alarm list to the Mac whenever AlarmKit reports a change.
Answer the Finance tools live and queue account, balance, and transaction changes for the Mac with FinanceKit history tokens. A background delivery extension queues changes while the app isn't running. The code stays inactive until a build carries the FinanceKit entitlement, which Scripts/install-companion.sh --finance requests; without it, the Finance tools say why they're unavailable.
Add Alarms, Finance, and Health to the README and its hero image, describe how to install, pair, and use the companion, add Scripts/check-companion.py for read-only checks through imcp-server, and build the companion unsigned in CI.
When the iPhone drops a connection, disconnect the Mac's MCP client, so pending calls fail over to the cache and syncing resumes on the next connection. Keep lines that arrive before MCP reads them, end a closed channel's stream with an error, and enforce read and open time limits. Reject outbox writes from a sync that a cache reset overtook, run each service's sync one at a time, and give the FinanceKit reason in cached answers.
The Mac used to send the device key inside the pairing session, so anyone with the QR secret who recorded that session could recover it. Now each side sends a one-time X25519 public key, both derive the device key from the shared secret salted with the pairing key, and each side's proof covers the public keys so neither can be swapped.
The iOS app is now iMCP on the device and builds for iPhone and iPad. Targets, folders, and shared code use iOS and Mobile names, the Mac's Settings pane is iPhone & iPad, and the Bonjour type, pairing link, and status tool drop the companion name. The name no longer collides with the separate Companion debugging app that the README describes.
The macOS 26 runner's Xcode 26.0 has no iOS platform, so the iOS app's build couldn't find a destination. Download the platform when it's missing and allow time for the download.
AlarmKit shows its own stop control on the alarm alert, so the app doesn't need an App Intent for it. The timer Live Activity now shows the countdown without a stop button.
This was referenced Nov 18, 2026
This was referenced Nov 18, 2026
Closed
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.
HealthKit and AlarmKit have no Mac API, so iMCP can't answer questions about health data or set alarms and timers. This PR adds iMCP for iOS, an iPhone and iPad app that serves Health and Alarms tools to iMCP on the Mac. Finance moved to #284, stacked on this PR.
The Mac and the device pair with a one-time QR code that works for ten minutes. During pairing, the two devices derive a device key from an X25519 key exchange salted with the pairing secret, so the device key never crosses the network. The device then dials the Mac over the local network, and the Mac serves the device's tools as an MCP client on that connection. The connection uses TLS 1.2 with the pre-shared key and the
TLS_ECDHE_PSK_WITH_CHACHA20_POLY1305_SHA256suite, so each connection has forward secrecy; both sides close a connection that negotiates any other suite, because Apple's TLS stack doesn't support external pre-shared keys in TLS 1.3. The Mac listens and advertises_imcp-mobile._tcponly while a pairing code is on screen, or while a device is paired and Health or Alarms is on.The Mac keeps a copy of what the device sends, so read-only tools can answer while the device is locked or away. Every answer reports its
source,synced_at, andstalestate. Record contents are encrypted with AES-GCM under a Keychain key, with the record kind and identifier as authenticated data. Record kinds, identifiers, query keys, dates, and the device's last status report stay unencrypted so that queries can filter on them. Removing the last paired device deletes the copy, and Delete Cached Data deletes it while staying paired. The README now describes this copy instead of saying that iMCP stores no data.Health syncs daily statistics for quantity types and full sleep, workout, and health-record data with saved anchors, and reads raw samples live. Alarm and timer creation carries an ID so that a retry after a lost connection can't create a second alarm, a lost call is retried only on the device it was sent to, and writes fail instead of answering from the cache while the device is away.
Scripts/install-ios.shbuilds and installs the app with the developer's own Apple Developer account. CI builds the iOS app unsigned; it can't exercise HealthKit, AlarmKit, pairing, or background delivery, so this PR stays in draft until it has been tested on a device.