Skip to content

Reworked Setup Assistant with modern design and new flows for additional features, Remote Access checklists and Dock presence - #387

Open
oliverames wants to merge 58 commits into
mattt:mainfrom
oliverames:feat/setup-assistant

Conversation

@oliverames

@oliverames oliverames commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on #374, #376, #377 and #381; merge those first; review the commits after 2ec88e1. The earlier commits are those four branches merged, with the conflicts between them resolved by hand, so this branch builds on its own. They will drop out as the four merge.

This adds a Setup Assistant for first launch, with the Remote Access checklists, a Cloudflare API token check and a way to let Tailscale allow public addresses. It also puts iMCP in the Dock while Setup or any other titled window is open.

Why

A new install has a lot to decide: which services to turn on, whether anything outside the Mac may reach iMCP, how to connect an AI app, and whether to pair a phone. The Remote Access choices are the hardest part, because Tailscale public addresses and Cloudflare Tunnel each need several steps in another service. The Setup Assistant takes them in order and says what is still missing.

What changed

Setup Assistant (App/Views/Onboarding*.swift, App/OnboardingGate.swift, App/Models/OnboardingFlow.swift)

  • Seven screens: welcome, services, how AI apps reach the Mac, setting that up, connecting an AI app, pairing an iPhone or iPad, and a summary. The remote access setup screen is skipped when Local only is chosen.
  • It opens by itself on a first launch and can be run again from the last screen. The services are the same switches as in Settings, and macOS still asks for each permission as a service turns on.
  • Connecting an app can add iMCP to Claude Desktop and Claude Code on this Mac, or copy the connector address for Claude Web, Claude Duet, Muse and Gemini. Those four need a public address from the earlier step.
  • The iPhone screen shows a pairing code and moves on by itself when a device pairs.
  • The step logic is Foundation-only in OnboardingFlow, so it is unit tested without AppKit.

Remote Access checklists (App/Models/RemoteAccessChecklist.swift, App/Views/RemoteAccessChecklistViews.swift)

  • Tailscale, the public Tailscale address and Cloudflare Tunnel each turn the current state into the steps still to do, with the finished ones folded away. The same checklists are meant to be reused by the Settings window.

Cloudflare API token (App/Controllers/CloudflareTokenCheck.swift, CloudflareTunnel.swift)

  • A pasted token is checked with Cloudflare before it is used. A refusal from the user token check falls back to listing zones, so an account-owned token is not rejected. Signing in with a token goes through the same path as any other credential, and the screen can remove it again.

Tailscale public addresses (App/Controllers/TailscalePolicyAccess.swift)

  • With an API token, iMCP can ask the tailnet policy to allow public addresses for this Mac, instead of sending the person to the admin console. It adds one nodeAttrs entry, shows the change before it writes, saves only if nobody else changed the policy since it was read, and refuses a policy that has comments (HuJSON) rather than rewriting it.

Dock presence (App/App.swift)

  • While a Settings, Setup or other titled window is open, iMCP shows in the Dock with a menu bar, and it goes back to the menu bar alone when the last one closes. The menu bar panel and alerts do not count.

Shared rows (App/Views/SettingsComponents.swift, App/Models/KnownClient.swift)

  • SettingsIcon, RowLabel, ExpandableRow and ClientLogo, and a list of the AI apps iMCP knows by name with their logos (Claude Desktop, Claude Code, Claude Web, Claude Duet, Muse, Gemini). They are here because Setup uses them; the Settings redesign reuses them.

Debug-only snapshot renderer (App/Debug/OnboardingSnapshot.swift)

  • --snapshot-onboarding=<directory> draws each screen to a PNG and exits. It is compiled only into Debug builds.

ServerController gets one small public method, refreshRemoteAccess(), which applies the remote access settings again after Tailscale allows public addresses.

Testing

  • swift format lint --strict -r . is clean.
  • Debug build of the iMCP scheme succeeds.
  • imcp-serverTests: 571 tests run, 1 skipped, 0 failures. New tests: OnboardingFlowTests, RemoteAccessChecklistTests, CloudflareTokenCheckTests, TailscalePolicyAccessTests and KnownClientTests.
  • The screenshots below come from the Debug snapshot renderer, run on a copy of the Debug build with remote access, Cloudflare Tunnel and the phone link forced off for that run.
  • The Setup Assistant code was in my integration build, which is installed as a signed Release build and in daily use. I walked its screens through the snapshot renderer. I did not run it on a clean install.
  • CI: see the checks on this PR.

Not verified

  • The Setup Assistant on a clean install, including the first-launch trigger and the Dock behavior with a real Settings window.
  • The Cloudflare API token flow and the Tailscale API token flow, end to end against the real services. The checks and the policy edit are tested against fake transports only.
  • Adding iMCP to Claude Desktop and Claude Code from the connect screen.
  • Pairing a device from the iPhone screen.
  • The transparent strip that used to show on the Services step when the window grew. The offscreen render of that step in light mode came out blank, so I cannot show it.
  • The glass buttons on macOS 26 and later.
  • The snapshots draw offscreen. Button text is the wrong color in the dark captures, which is a capture artifact and not how the window looks.

Screenshots

Rendered by the Debug snapshot renderer. The services step is shown in dark appearance, and its switches show the settings of the review copy.

Welcome

Services

How AI apps reach the Mac

Connect an AI agent

Pair an iPhone or iPad

Setup finished

mattt added 30 commits October 26, 2026 11:21
Clients on another device in the owner's tailnet can now use iMCP
while the Mac keeps the data, permissions, and tool settings.
iMCP listens on the Mac's tailnet address, accepts only untagged devices
that belong to the Mac's Tailscale user, and requires a named access token
on every request. Settings creates, edits, re-rolls, and deletes tokens,
and a token can never use a service or tool that is off in iMCP.
Remote sessions pass a pre-approved ConnectionApprovalGate, because a valid access token takes the place of the approval dialog. The remote access test file moves to Tests/imcp-serverTests with the other tests.
Link TailscaleKit 0.2.0-imcp.1 from mattt/libtailscale into the app target, which embeds it like Sparkle. The framework is arm64-only and requires macOS 15.6, so the app target now builds only for arm64 with a deployment target of 15.6, and the app no longer runs on Intel Macs. The CLI, the helper, and the tests don't link the framework and keep their settings.
A sandboxed iMCP can't run the Tailscale command-line tool, and a listener on the Mac's shared tailnet address can be taken over by another local process. iMCP now runs an embedded Tailscale node with its own identity and address, and listens only on that address.

The node keeps its state in the app's container and runs only while remote access is on. Settings shows the login link, the node's state, MagicDNS name, and tailnet address, and lets the owner log in with an auth key, rename the device, and log out.

For each connection, the server asks the node who the peer is, and accepts only untagged devices of the node's own user. Access tokens, their permissions, and their binding to one device stay the same. The HTTP server reads and writes TailscaleKit connections, and runs their blocking calls on their own threads.

The node is behind a small protocol, so the tests use a fake node to check authorization, Host and Origin validation, and the login states.
The README no longer asks for the Tailscale app on the Mac. It describes the login, auth keys, and logout, and says that WireGuard encrypts the plain HTTP traffic and that the node's address belongs only to iMCP. The download requirements now say macOS 15.6 on Apple silicon.
Link TailscaleKit 0.2.0-imcp.2 from mattt/libtailscale, which is universal (arm64 and x86_64) and requires macOS 15.1. The app target builds for the default architectures again, with a deployment target of macOS 15.1, as on main, and the README's download requirement is macOS 15.3 again. A later TailscaleKit release will drop the x86_64 slice.
TailscaleKit contains only a Swift interface that Swift 6.4 generated, so the app needs Xcode 27.1 or later. Of the GitHub-hosted images, only xcode-27 has Xcode 27.1; macos-26 stops at Xcode 26.6. CI now builds with Xcode 27.1 on xcode-27 and drops the Xcode 26.0 and 27.0 entries, which can't build the framework. The release workflow also moves from Xcode 26.0 on macos-26 to Xcode 27.1 on xcode-27.
…ailscalekit

# Conflicts:
#	App/Controllers/ServerController.swift
#	iMCP.xcodeproj/project.pbxproj
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.
mattt and others added 21 commits November 10, 2026 02:49
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.
Trusting a client used to mean copying a credential into its MCP settings.

iMCP now finds the app responsible for the connecting imcp-server, validates
its code signature, and shows that app's name, icon, and developer in the
approval window. Always Allow stores trust keyed to the app's designated
requirement, so there is nothing to copy.

Terminals and unsigned, ad hoc, or non-bundle clients are never trusted by
signature, since that would trust everything running inside them. For those,
imcp-server persists a credential at
~/Library/Application Support/iMCP/client-credential when
IMCP_CLIENT_CREDENTIAL is not set. Every client gets a single-step Allow Once
or Always Allow prompt on first connection. Settings lists trusted apps and
credentials with a Remove button.

The responsible-app lookup uses the private
responsibility_get_pid_responsible_for_pid symbol.
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.
Cloud apps such as claude.ai can't join a tailnet, so iMCP can now serve
its MCP endpoint at a public HTTPS address and authorize apps with OAuth 2.1.

- OAuth 2.1 authority and endpoints (RFC 9728 and RFC 8414 metadata, RFC 7591
  dynamic registration, Client ID Metadata Documents, PKCE S256, refresh token
  rotation), a native approval window bound to the starting browser, and a
  list of connected apps with revocation in Settings.
- Tailscale Funnel through the embedded node, with stricter request limits
  for public traffic and guidance for the missing funnel ACL capability.
- Cloudflare Tunnel: sign in, find the zone, create or reuse a named tunnel,
  set the ingress and DNS record, and supervise cloudflared.
- The tunnel restarts with backoff when cloudflared exits, reconnects after
  wake and when the network returns, and retries after a discovery or
  provisioning failure.
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.
… crash

The Mac keeps a live link when the same device connects twice, and the phone
shares one in-flight dial and bounds pull to refresh to 8 seconds.
The Mac records each tool call in an activity history that syncs to the
phone, which shows it under Activity. Syncs run under a background task
assertion and the outbox moves out of the App Group container, which ended
the app with 0xdead10cc when it suspended holding a SQLite lock.
Adds the transport modes, an encrypted WebSocket channel, candidate dialing
with per-route and total time budgets, the Connection Mode screen on the
phone, and route settings in the Mac's iPhone & iPad pane.
The Mac numbers its route list with a revision, sends it in the welcome and
with config_apply when its settings change, and shows the revision each
phone has applied. The phone follows the Mac's route order.
The Mac offers each connection request to the paired phone as well as showing
its own dialog, and the first answer wins. Approving on the phone allows one
connection and never trusts the client. The Mac withdraws the request when it
answers, expires an unanswered one as a denial, and ignores answers from
devices that aren't paired. The phone lists waiting requests and can answer
from a notification after device authentication.
SettingsIcon, RowLabel, ExpandableRow and ClientLogo are the rows that the Setup Assistant uses, and that the Settings window will reuse. KnownClient matches an app by the name it reports and carries its logo.
…Tailscale public address access

The checklists turn the state of Tailscale and Cloudflare into the steps a person still has to take. A Cloudflare API token can be checked and used to sign in. A Tailscale API token lets iMCP ask the tailnet to allow public addresses.
…re open

The Setup Assistant walks through a welcome, the services, remote access, connecting an AI app, the iPhone and a finish screen. While Setup or another titled window is open, iMCP shows in the Dock. A Debug-only renderer draws each screen to a PNG.
@oliverames oliverames changed the title Add a Setup Assistant, Remote Access checklists and Dock presence Reworked Setup Assistant with modern design and new flows for additional features, Remote Access checklists and Dock presence Nov 18, 2026
@mattt

mattt commented Nov 20, 2026

Copy link
Copy Markdown
Owner

Hi @oliverames. I'm building on this flow for setup, on a branch of my own that picks up your commits. Six of the files open with a copyright line, an MIT notice, and "Adapted from Ping Warden's onboarding". None of iMCP's other files have per-file headers, so I'd like to drop them from these. Are you OK with that?

@oliverames

oliverames commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor Author

@mattt Yes, totally fine to drop those headers. Thanks for picking this up.

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.

2 participants