iphone-opt-mcp
Reads local Apple Screen Time/Biome App.InFocus launch telemetry and applies optimized iPhone Home Screen layouts via Apple iPhone Mirroring and optional Lockdown/setIconState acceleration.
Optimizes the iOS Home Screen on the user's iPhone by analyzing launch friction and writing app, Dock, folder, Smart Stack, and page layouts.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@iphone-opt-mcp analyze my Screen Time data and design an optimized Home Screen layout"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
iphone-optimizer
Data-driven iPhone Home Screen optimizer for macOS. Reads your local synced Screen Time (Biome) launch-friction telemetry, designs an optimal Page 1 + Dock + Smart Stacks + folder layout, and applies it wirelessly without requiring a USB cable (with automatic Wi-Fi/USB setIconState acceleration when available).
Works both as a standalone CLI (iphone-opt) and as a standard MCP stdio server (iphone-opt-mcp) compatible with Devin, Claude Code, Claude Desktop, Codex, Cursor, Windsurf, VS Code Copilot, Zed, Cline, and any other MCP harness.
Why This Exists
Most iPhone layout tools either require plugging in a USB cable, only count page-to-page swipes for apps already on your Home Screen, or cannot create widgets/Smart Stacks and hide pages.
iphone-optimizer combines two complementary channels and automatically picks the best one available:
~/Library/Biome/.../App.InFocus (SEGB v2, synced locally on Mac)
│
▼
[Biome Telemetry Engine] ──► Launch-surface friction (transitionReason),
│ <15s glance scores, 45s co-usage pairs, drift audit
▼
[Optimizer Engine] ────────► Dock (4 core loop), Page 1 apps, semantic folders,
│ Smart Stacks, reserved grid gaps (fixedLocations),
│ App Library exclusions, hidden Original Page 1
▼
[Transport Negotiator] (zero USB cable required)
├── Wi-Fi/USB Lockdown + Mirroring ──► HYBRID
│ 1. Backup + atomic setIconState (<2s apps/Dock/folders/gaps)
│ 2. iPhone Mirroring ONLY for new Smart Stacks & hiding pages
├── iPhone Mirroring only (default) ─► MIRROR (100% wireless)
└── Lockdown only ───────────────────► LOCKDOWN + manual widget checklist
│
▼
[Checkpointed Executor] ───► Persists every step to ~/.iphone-optimizer/runs/
└─ Pauses cleanly on Touch ID / focus switch -> `iphone-opt resume <id>`Related MCP server: ios-icon-mcp
What Data Is Used (Apple Biome Explained)
What is Apple Biome?
Biome is Apple's on-device behavioral event store introduced in iOS 15 / macOS 12 (~/Library/Biome/streams/). When you turn on Screen Time -> Share Across Devices on both your iPhone and Mac, iCloud syncs your iPhone's App.InFocus focus stream to your Mac at:
~/Library/Biome/streams/restricted/App.InFocus/remote/<device-uuid>/These files use Apple's SEGB v2 binary segment format containing compact protobuf records (typically ~28–30 days of rolling history). iphone-optimizer includes a native, zero-external-dependency Python SEGB v2 parser.
Exact Fields Read (and What Is Never Read)
From each live App.InFocus record (state == 1), iphone-optimizer reads only 4 fields:
Field | Example | Why It Matters |
|
| Identifies which app was opened. |
|
| Pairs focus start and end timestamps to compute exact session duration. |
|
| Computes time-of-day patterns, weekday vs. weekend skew, and app-to-app switch intervals. |
|
| Reveals how you launched the app — Home Screen, Widget, App Switcher, Notification, Spotlight, App Library Category, or App Library Search. |
Privacy guarantees:
100% local on your Mac. Zero telemetry, analytics, or layout data is sent to any external server.
Never reads Messages, Photos, Contacts, Emails, Notifications content, keystrokes, or screen contents (other than local OCR during active iPhone Mirroring edits).
How Those Signals Optimize Your Home Screen
Launch-Surface Friction Score: Instead of treating every app open equally, each launch is weighted by effort:
Widget (
0.5) / Home Screen (1.0) < App Switcher (1.5) < App Library Suggested/Recents (2.5) < App Library Category (3.5) < Spotlight (4.0) < App Library Search (5.0).Apps you repeatedly swipe to App Library or type into Search to open bubble straight to the Dock and Page 1.
Core Loop Dock Selection (4 slots): Combines manual opens, high-friction opens, and co-usage transitions (app pairs switched within 45 seconds, e.g.,
Messages <-> Gmail <-> Slack <-> Chrome).Glance / Smart Stack Widget Candidates: Apps with high open frequency, median session duration
<= 15s, and>= 50%of opens under 15 seconds (e.g., Weather, Clock/Timer, WHOOP, Calendar, Gmail) are prime widget candidates so you can glance without launching.Intentional-Friction Exclusions: High-dwell apps (e.g., Reddit, Hinge, Instagram, TikTok, X) stay in the App Library by default so you don't accidentally put distractions on Page 1.
Focus Mode Skew Hints: Compares normalized weekday vs. weekend launch rates to surface Work Focus vs. Weekend Focus page candidates.
Before/After Drift Audit (
iphone-opt audit): Splits your Biome history into baseline vs. recent windows to verify your real-world drop in App Library/Search launches after changing your layout.
Requirements & Setup
Requirements
macOS 15+ (Apple Silicon or Intel) with Python 3.11+ (or
uv)An iPhone signed into the same Apple Account
No USB cable required (uses macOS iPhone Mirroring by default; optionally accelerates via Wi-Fi Sync / USB
setIconStateif paired)
1. Install
With uv (recommended):
uv tool install git+https://github.com/bhavey05/iphone-optimizerOr with pipx:
pipx install git+https://github.com/bhavey05/iphone-optimizerOr with optional Wi-Fi/USB Lockdown fast-path (pymobiledevice3):
uv tool install "iphone-optimizer[lockdown] @ git+https://github.com/bhavey05/iphone-optimizer"2. Guided Setup (iphone-opt setup)
Run the built-in onboarding checker:
iphone-opt setupTo jump directly to the macOS Privacy & Security toggles:
iphone-opt setup --open-settingsComplete these one-time macOS permissions:
Screen Time -> Share Across Devices: Enable on both iPhone (Settings -> Screen Time) and Mac (System Settings -> Screen Time).
Full Disk Access: Toggle on for your terminal (or the app running
iphone-opt) in System Settings -> Privacy & Security -> Full Disk Access, then restart the terminal.iPhone Mirroring driver (
mirroir-mcp):Install
mirroir-mcp(brew install jfarcand/tap/mirroir-mcpornpm install -g mirroir-mcp).Grant Screen Recording and Accessibility to your terminal.
Open macOS iPhone Mirroring, connect your iPhone, and verify with
mirroir doctor.
(Optional fast-path) Wi-Fi Lockdown (
setIconState): If you enable Finder -> Show this iPhone when on Wi-Fi (or runpymobiledevice3 lockdown wifi-connections ononce),iphone-optimizerautomatically upgrades bulk app/Dock/folder/grid-gap moves to<2satomic writes over Wi-Fi while still using iPhone Mirroring for Smart Stacks and hiding pages.
Verify everything is ready:
iphone-opt doctorUsing Standalone (No AI Harness Needed)
# 1. Inspect your last 30 days of launch-surface friction & widget candidates
iphone-opt analyze --days 30
# 2. Generate and preview a data-driven layout (with ASCII diagram + savings estimate)
iphone-opt plan --days 30 --exclude-dock com.apple.mobilephone
# 3. Preview exact execution steps (dry-run by default — touches nothing on your phone)
iphone-opt apply --days 30 --exclude-dock com.apple.mobilephone
# 4. Execute live (creates backup + checkpoints every step)
iphone-opt apply --days 30 --exclude-dock com.apple.mobilephone --confirm
# 5. If paused by Mac Touch ID or window focus, resume cleanly from the exact next step
iphone-opt resume <run-id>
# 6. Check backups, restore, or audit real before/after friction drift a week later
iphone-opt backups
iphone-opt restore <backup-id>
iphone-opt audit --recent-days 7Using With Any AI Harness (MCP)
iphone-opt-mcp speaks standard Model Context Protocol (stdio), so it works out of the box with any MCP-compatible coding or desktop agent. Generate the exact config for your client with:
iphone-opt setup --client claude-code # Claude Code CLI
iphone-opt setup --client claude-desktop # Claude Desktop
iphone-opt setup --client codex # OpenAI Codex CLI
iphone-opt setup --client devin # Devin CLI
iphone-opt setup --client cursor # Cursor
iphone-opt setup --client windsurf # Windsurf
iphone-opt setup --client vscode # VS Code Copilot
iphone-opt setup --client generic # Zed, Cline, Goose, or any stdio MCP clientExposed MCP Tools
Tool | Description |
| Checks Biome readability, Wi-Fi/USB Lockdown devices, |
| Returns launch surfaces, top friction apps, |
| Produces a full |
| Runs dry-run by default ( |
| Resumes a checkpointed run after Touch ID or window-focus pause without repeating completed steps. |
| Lists saved pre-apply backups under |
| Restores a Lockdown archive or returns the 10-second Edit Pages revert steps. |
| Compares recent |
Safety & 10-Second Revert
Dry-run by default: Neither
iphone-opt applynor the MCPapply_plantool touches your iPhone unless you explicitly pass--confirm/confirm=true.Backup before write: Every run saves a pre-change backup and plan manifest under
~/.iphone-optimizer/backups/<run-id>/.Preserved Original Page 1: When hiding pages, your original Page 1 stays intact (unchecked in iOS Edit Pages) rather than deleted. To revert manually anytime in ~10 seconds: long-press empty Home Screen space -> tap the page dots -> uncheck Optimized Page 1 and re-check your original Page 1.
App Library & Widget Protection (Lockdown mode): Writes SpringBoard's root-archive dict with an explicit
ignoredlist (so App Library apps never spill onto pages) and restores each widget'suniqueIdentifierfromuserSelectedElementIdentifier(so configured widgets keep their settings).
Development
git clone https://github.com/bhavey05/iphone-optimizer.git
cd iphone-optimizer
uv sync --extra dev --extra lockdown
uv run pytest -vAvailable Tools
8 toolsanalyze_usageC
Analyze synced iPhone Biome App.InFocus telemetry (launch surfaces, friction, glance widget candidates, co-usage).
Inputs: top, days. Returns: object
apply_planB
Execute (or dry-run when confirm=False) an OptimizationPlan via Hybrid / Mirror / Lockdown transport.
Inputs: days, mode, confirm, smart_stacks, +2 more. Returns: object
audit_driftC
Compare recent N days vs baseline window in Biome to measure real launch-friction improvement.
Inputs: recent_days. Returns: object
doctorB
Check Biome telemetry, Wi-Fi/USB Lockdown devices, iPhone Mirroring health, and auto transport.
Inputs: no named parameters. Returns: object
generate_planC
Generate a data-driven Home Screen OptimizationPlan with ASCII preview and estimated savings.
Inputs: days, smart_stacks, keep_in_library, exclude_from_dock. Returns: object
list_backupsB
List saved pre-apply Home Screen backups.
Inputs: no named parameters. Returns: result
restore_backupC
Restore a saved Home Screen backup (or return Mirroring Edit Pages revert steps).
Inputs: backup_id (required). Returns: object
resume_runA
Resume a checkpointed run that paused for Touch ID or Mirroring window focus.
Inputs: run_id (required). Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 8 tools
Each tool maps to a distinct stage of the workflow (diagnose, analyze, plan, apply, backup, restore, audit, resume), so misselection is unlikely. The only mild overlap is between analyze_usage and audit_drift, since both consume Biome telemetry, though their goals (exploratory analysis vs. before/after delta) are stated clearly enough to separate them.
Seven of eight names follow a clean verb_noun snake_case pattern (analyze_usage, generate_plan, apply_plan, list_backups, restore_backup, audit_drift, resume_run). The lone outlier, 'doctor', is a bare noun and breaks the verb-first convention, but it is a recognizable idiom that doesn't impede comprehension.
Eight tools is squarely in the sweet spot, and every tool corresponds to a real step in the optimize-measure-restore loop rather than being redundant filler. Nothing feels padded or conspicuously missing at the count level.
The surface covers the full loop: health check, telemetry analysis, plan generation, apply with dry-run, backup list/restore, drift auditing, and resuming interrupted runs — a genuinely complete lifecycle. Minor gaps remain: no explicit cancel/abort for an in-flight run, no retrieval or inspection of a previously generated plan, and no deletion/pruning of backups.
Maintenance
Related MCP Connectors
Encrypted iPhone & Apple Watch custom screens, approvals, diffs, and progress for AI agents.
Let your AI use a real iPhone: see the screen, tap, type, open apps, run saved workflows.
Your Apple Health data, food diary and lifts, for ChatGPT, Claude and Gemini. Approved on iPhone.
Let your AI agent control real iPhones: screenshots, tap, swipe, type and open apps.
Related MCP Servers
- AlicenseNot gradedqualityNot gradedmaintenanceEnables AI to read-only access Apple Health data (current stats, sleep details, and trends) via a Cloudflare-deployed MCP server, using iPhone shortcuts to sync data securely.MIT
- AlicenseNot gradedqualityBmaintenanceLets an AI client read and reorganize a connected iPhone's home screen — moving apps and web clips, creating folders, and rearranging pages — with automatic backups, previews, and validation before any change is written to the device.41 PyPI32MIT
- AlicenseBqualityBmaintenanceEnables an AI assistant to read, rearrange, sort, and explain an iPhone Home Screen layout through MCP tools, with phone writes disabled unless explicitly enabled.3015MIT
- AlicenseBqualityBmaintenanceEnables an MCP assistant to read, draft, sort, and rearrange iPhone or iPad Home Screen layouts from a Mac, then review differences and apply changes over USB with an additional write gate.301MIT