Prefire MCP
MCP server and CLI that renders SwiftUI previews to PNG on chosen devices, so an agent can check a screen after editing it
- 535 ★ on the repository
- Last commit
- Apache-2.0
Extended access
Why this level
- A render runs `xcodebuild` and the project's tests on your Mac
- The agent receives screenshots of app screens, which can show test account data
Install
- Works in
Manual install
brew install barredewe/prefire/prefireThe CLI goes in first, then the server is added with the next command from the project folder holding .prefire.yml. Xcode 16 and Swift 6 are required.
Access and checks
How we reviewExtended accessThe tool runs code or makes network calls and only reads external data.
- A render runs `xcodebuild` and the project's tests on your Mac
- The agent receives screenshots of app screens, which can show test account data
This is third-party code. Review the repository files before installing.
What it does
Prefire turns SwiftUI #Preview blocks into snapshot tests, a Playbook component catalog and images an AI agent can see. The `prefire render` command builds the app and saves every preview as a PNG with a JSON record: device, size, user story, state and an error if the preview failed to render. The `prefire mcp` command serves the same thing over MCP. The agent lists previews, renders the ones it needs on chosen iPhones or iPads, in light or dark mode, with large type, and gets the images back in the conversation. The swiftui-preview skill from the Claude Code plugin tells it when and how to render. `prefire board` lays the last render out by `previewUserStory` as an HTML board. Rendering runs the generated snapshot tests in write mode: reference images are neither compared nor changed. The tests, Playbook and Stencil templates also work without an agent.
Who it is for. iOS developers on SwiftUI who hand screen edits to an agent and want it to see the result itself. Designers and testers get a Playbook with every state.
Good fit when
- The agent changed padding and you need to confirm nothing is clipped on a small iPhone SE
- Dark mode and large Dynamic Type get checked without launching a simulator by hand
- The team wants the build, not the release, to fail on a padding change: snapshot tests come from #Preview blocks already written
- A designer needs a catalog of every component and flow in the app with its states
- A review needs an HTML board of screens grouped by user story
Not a fit when
- You need scenario runs with taps in a running app: Prefire only draws previews; mobile-mcp in the catalog drives a simulator
- The task is building and launching the whole project: XcodeBuildMCP covers that
- The project has no SwiftUI previews or an old Xcode: rendering relies on generated snapshot tests, so Swift 6 and Xcode 16 or newer are required
- There is no Mac: rendering calls `xcodebuild`
Example request
Render the Sign in preview on iPhone SE and iPad in dark mode and tell me what shifted after the padding changeMCP
- Transport
- stdio
- Authentication
- not required
Limitations
Rendering builds the project and runs snapshot tests, so it takes as long as a test run; ask the agent for only the previews it touched. Swift 6.0, Xcode 16 and iOS 14 or newer are required, and on macOS only snapshot tests work. `.prefire.yml` needs a `render_configuration` with a scheme, and the project adds the Prefire package with the `PrefireTestsPlugin` plugin on a test target. One render writes to a directory at a time and another waits its turn. Tests generated by an older Prefire make a render fail with an error.
How to disable. Remove the server with `claude mcp remove prefire` and the plugin with `/plugin uninstall prefire@prefire`. The Prefire package and test plugin come out of `Package.swift`, the CLI via `brew uninstall prefire`.
FAQ
How do I connect Prefire to Claude Code?
Install the CLI with `brew install barredewe/prefire/prefire`, then run `claude mcp add prefire -- prefire mcp` in the project folder. For the skill that tells the agent when to render, add the plugin: `/plugin marketplace add BarredEwe/Prefire`, then `/plugin install prefire@prefire`.
Do I write the tests by hand?
No. Prefire generates snapshot tests from your #Preview blocks when the test target builds. The project adds the Prefire library with the `PrefireTestsPlugin` plugin and swift-snapshot-testing.
What does the agent get from a render?
A PNG of every preview and JSON with its name, device, size, scale, user story, state and error text. Up to six images are attached per call; the rest sit at the paths in the reply.
Which devices and modes are available?
The devices from the project's `snapshot_devices`: `--device` takes iPhones and iPads. `--color-scheme` takes light or dark and `--dynamic-type` runs from xSmall to accessibility5. On macOS devices are ignored.
Does it work with Cursor and Codex?
Yes. The docs have an add button for Cursor, `codex mcp add prefire -- prefire mcp` for Codex and `code --add-mcp` for VS Code. Each release also ships as an `.mcpb` bundle for clients like Claude Desktop, and the server is listed in the MCP Registry.
How does rendering differ from Xcode Previews?
A render rebuilds the app and shows current code on the chosen devices as plain PNGs, while the Xcode Previews canvas can hold a stale or crashed version. The price is time: a render runs like a test pass.
Discussion
No questions or reviews yet.
Related
MCP serversAn MCP server that drives a real iPhone through macOS iPhone Mirroring: the agent sees the screen, taps, swipes and types
A plugin that shows the agent and you Compose Previews in a browser, redrawn a second after each save, with no Android Studio.
A skill and MCP server with a library of ready SwiftUI components and recipes so the agent builds iOS screens from tested code instead of writing them from scra
A CLI that checks SwiftUI screens and runs iOS tests with no Simulator: agents read an accessibility tree and reload views in 2 s.
A skill that builds in-app screen and element capture for a SwiftUI app and loops it across every locale for the App Store
Lets an agent render Jetpack Compose previews to PNG and see its UI edits: plugin, CLI, VS Code extension and MCP.
Comparison with similar tools
Cards that share the main search query, and how they differ.
| Tool | Official | Authentication | Repository stars | Main difference |
|---|---|---|---|---|
| Prefire (this card) | no | not required | 535 | |
| XcodeBuildMCP (now MobileBuildMCP) | yes | not required | 6,565 | builds, runs and tests whole Xcode projects without drawing screen previews |
| Mobile MCP | no | not required | 10,529 | drives simulators and devices and taps through a running app |
| SwiftUI Expert Skill | no | 3,893 | guidance for writing SwiftUI code without rendering the result |
README in short
The description opens with three features: snapshot tests, Playbook and renders for AI agents. Next come a Swift package quick start, a table of install methods (SPM plugin, Xcode build tool plugin, CLI via brew, Mint in beta) and sections on picking previews, user stories and states. A separate AI document covers `render_configuration`, the `prefire render` command and MCP setup.