November 15, 2026
Shipping a CLI and MCP server inside a sandboxed Mac App Store app
Storeflight is a Mac app that reads App Store Connect and lists what blocks your next release. I also wanted the same checks in Terminal, in a CI job, and in AI agents like Claude Code and Cursor, so the app ships a storeflight command that doubles as an MCP server.
Apple doesn’t document much about putting a command-line tool inside a Mac App Store app. Here’s what it took, what I worried about that turned out fine, and the few things that surprised me.
The layout
Storeflight.app
└── Contents
├── MacOS/Storeflight the app
└── Helpers/storeflight the command-line tool and MCP server
The tool has its own Xcode target, and the app target embeds it with a Copy Files build phase: destination Wrapper, subpath Contents/Helpers, Code Sign On Copy checked. The app also depends on the tool’s target, so the tool is rebuilt whenever the app is.
Why Helpers and not MacOS: Mac disks are case-insensitive by default, so storeflight and Storeflight are the same file name. Putting both in Contents/MacOS makes one overwrite the other. For the same reason, the tool’s Xcode target is named StoreflightCLI, while its product is named storeflight.
The tool needs its own sandbox
Every executable in a Mac App Store app has to be sandboxed. The usual pattern for a helper is com.apple.security.inherit, which gives it the sandbox of the app that launched it. That doesn’t work here: nobody launches this tool from the app. People run it from Terminal, a CI script or an agent, and a tool that inherits a sandbox can’t start on its own.
So it gets its own entitlements:
<key>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.application-groups</key>
<array>
<string>TEAMID.com.example.tools</string>
</array>
<key>com.apple.security.network.client</key>
<true/>
A sandboxed executable also needs a bundle identifier. A bare tool has no bundle to put an Info.plist in, so it goes into the binary itself: set CREATE_INFOPLIST_SECTION_IN_BINARY = YES and give the target its own bundle ID (the app’s ID plus .cli). That embedded Info.plist also carries the version, which leads to the first surprise further down.
Sharing the API key: not the Keychain
The app keeps the App Store Connect API key in the Keychain. My plan was a shared Keychain access group, so the tool could read the same item. That needs a provisioning profile, and a bare command-line tool has nowhere to put one.
The App Group works instead. The app writes a copy of the key to the group container, in a folder with mode 700 and a file with mode 600, and the tool reads it from there. macOS only lets processes signed by the same team with the same App Group entitlement into that container, so other apps can’t open it, and neither can an unsandboxed Terminal command. Removing the key in the app deletes the copy.
On the Mac, App Group IDs prefixed with your team ID don’t need to be registered in the developer portal, and they work in development builds too. Get the ID right the first time, because it can’t change after release.
The same container carries two other small files:
| File | Written by | Read by | What |
|---|---|---|---|
Key/asc.json | App | Tool | The API key |
Pro/status.json | App, after every StoreKit entitlement refresh | Tool | Whether Pro is active, and when a yearly plan expires |
Agents/<client>.json | Tool, on each MCP handshake and tool call | App | Which agent connected, and what it last did |
The last one is what lets the app’s settings show “Claude Code, connected, last checked Simple Pool” with a green dot. It took a few lines of JSON, with no XPC or other inter-process communication.
Gating the tool behind the paid plan
The tool and the MCP server are part of Storeflight Pro. The tool doesn’t call StoreKit itself; it trusts the status file the app writes. Without an active plan, every command that touches a real account stops with exit code 6 and a message pointing to Upgrade to Pro. The MCP server still connects and returns that message as a tool error, so an agent can explain what’s going on instead of failing silently. A yearly plan stops working at its expiry date until the app sees the renewal, and the message then says to open the app.
--sample always works without a plan or a key, which turned out to matter for App Review (more below).
Every failure has its own exit code, so scripts can tell them apart: 2 for usage, 3 for credentials, 4 for an app that can’t be found, 5 for an API error or an incomplete check, 6 for Pro. A check that finds blockers exits 1, and --fail-on warning or --fail-on never moves the threshold, which is all a CI job needs.
The MCP server is under 250 lines
storeflight mcp speaks MCP over standard input and output: newline-delimited JSON-RPC, with initialize, tools/list and tools/call. It has four tools (list_apps, check_app, get_fix_prompt and get_listing) and accepts the three protocol versions clients sent at the time I wrote it. It’s hand-written, with no SDK, like the rest of the package, which has no third-party dependencies at all. Stdio servers are simple enough that a dependency would have been more code to audit than to write.
Installing it from a sandboxed app
For people to type storeflight, something has to put a link to the tool on their PATH, and a sandboxed app can’t write to ~/.local/bin. It can write wherever the user points it, though. So Settings has an Install Command… button that opens a folder dialog already aimed at ~/.local/bin, with hidden files shown and New Folder allowed. The app writes the link there and keeps a security-scoped bookmark to the folder, so the install can be removed or updated later. Install for Claude Code… and Add to Xcode… do the same for the agent skill and Xcode’s MCP config.
If the app moves (say from Downloads to Applications), the links would point at the old location, so on launch the app repoints whatever it installed and forgets installs the user deleted by hand. Each install also has a Remove button, and the same panels show the lines to copy and run yourself, for anyone who’d rather not click.
What I worried about, and what happened
A provisioning profile at upload. I’d read reports of distribution signing giving a nested tool an application identifier, and App Store Connect then asking for a provisioning profile that a bare tool can’t have. My fallback was to wrap the tool in a minimal LSUIElement app bundle inside Contents/Helpers. I didn’t need it: the first Xcode Cloud upload processed with no complaint about the tool.
The App Group under distribution signing. Development builds share the container fine, but would the App Store build? On the TestFlight build, the tool read the key and Pro status the app had written, before and after a sandbox purchase.
App Review and guideline 2.4.5, which says Mac App Store apps can’t install code or add functionality outside the app. The review notes explain where the tool is, that it’s sandboxed and signed with the app, that it only talks to the App Store Connect API, and that the install buttons only write a link or a config entry into a folder the user picks. They also give two commands a reviewer can paste without an API key:
/Applications/Storeflight.app/Contents/Helpers/storeflight list --sample
/Applications/Storeflight.app/Contents/Helpers/storeflight check Tidewater --sample
They also warn that the second command exits 1 on purpose, because the sample app has blockers, so a reviewer doesn’t read it as a crash. It helps to point to precedent too: Helm, also on the Mac App Store, installs its own CLI from Settings the same way. The tool has passed review on all three releases so far. (1.2 was rejected twice, but for its name and its listing text, not the tool.)
Things that surprised me
- Xcode Cloud’s build number doesn’t reach the tool. Xcode Cloud sets the build number in the app’s Info.plist when it exports, but not in the Info.plist embedded in the tool’s binary. So
storeflight --versionprints the project’s build number,(1), while the app shows Xcode Cloud’s. Set the version once at the project level so both targets inherit the marketing version, and accept that the build numbers differ. - The sandbox applies to paths typed in Terminal too.
--key-file ~/Downloads/AuthKey.p8fails, because the tool’s sandbox can’t see Downloads, even though the person typing it can. The tool says so, and the key added in the app is the way around it. - The tool can’t work on hosted CI. It reads the key and Pro status from the app’s App Group, so it only works on a Mac where the app is installed, such as your own build Mac or a self-hosted runner. GitHub’s hosted runners and Xcode Cloud are out. That’s the real cost of putting the tool inside the app, compared with distributing it separately.
Was it worth it?
For an app whose users live in Xcode and Terminal, yes. One download gets them the app, the CLI and an MCP server that agents can use to check a release, fix it with their own App Store Connect tools, and check again. There’s nothing to keep in sync between a separately distributed tool and the app, and App Review has been fine with it.
If you’re thinking of doing the same, the short version: put the tool in Contents/Helpers, give it its own sandbox, embed its Info.plist, share data through the App Group instead of the Keychain, and write the review notes before you need them.
Storeflight is free for one app on the Mac App Store. Pro adds every app, the CLI and the MCP server. Set it up for your agent.