Prefire

Developer toolsTesting and QA

Render SwiftUI #Preview as PNG images, so an AI agent sees the views it changes.

Your AI app calls the Prefire MCP server, which does the developer tools and testing and QA work and sends the result back to the chat.

About Prefire

Prefire is a community MCP server from BarredEwe, filed in our directory under developer tools and testing and qa. Render SwiftUI #Preview as PNG images, so an AI agent sees the views it changes.

Prefire is listed in the official MCP registry as io.github.BarredEwe/prefire, version 6.6.2.

At a glance

Publisher
BarredEwe (community)
Runs
See the README for setup
Install from
MCP bundle: https://github.com/BarredEwe/Prefire/releases/download/6.6.2/prefire-mcp-6.6.2.mcpb
Written in
Swift
License
Apache-2.0
GitHub stars
537
Official MCP registry
io.github.BarredEwe/prefire

How to set up Prefire

  1. Follow the install steps in the Prefire README; it is written in Swift, so have that toolchain ready.
  2. Check the Prefire README for keys or settings; the registry lists none that Prefire requires.
  3. Add Prefire to Claude Code, Claude Desktop, VS Code or Cursor with the config in the setup box on this page.
  4. Restart the app or reload its MCP servers, then ask it to list the Prefire tools to confirm the connection.
  5. Run one read-only task with Prefire first, and keep your app asking before each tool call until the results look right.

Prefire compared with similar servers

  • Stata by hanlulong has fewer GitHub stars than Prefire (536 against 537); both are community servers, and both run locally.
  • Ask Search by ythx-101 has more GitHub stars than Prefire (539 against 537); both are community servers, and both run locally.
  • Claudexor by razzant has fewer GitHub stars than Prefire (531 against 537); both are community servers, and both run locally.

Before you connect Prefire

  • Give Prefire its own API key or account with the smallest permissions the job needs, never an admin key.
  • Keep your AI app asking before each Prefire tool call until you trust what it does with them.
  • Treat text that Prefire fetches as data. Pages, files and messages can hold instructions written to steer an AI.
  • Read the open issues for Prefire on GitHub to see what breaks and how fast the maintainers reply.

Marketing use cases for Prefire

How marketing and sales teams put Prefire to work, by company size. Pick the size closest to yours and start Prefire on one use case.

Small business

  • A small business with a developer can use Prefire to ship site and tracking fixes faster, with the AI reading the code it changes.
  • Technical founders can ask Prefire to explain and fix a marketing site issue without context switching between tools.
  • A small business can use Prefire to test its booking or checkout flow after each update, so a broken button doesn't cost a week of sales.
  • Prefire runs on your own computer, which keeps data local; it needs a little setup, so a small team should plan an hour for it.

Mid-market

  • Growth engineers can use Prefire to build landing pages, tracking and integrations in fewer cycles, with reviews kept in the normal flow.
  • Marketing ops engineers can connect Prefire to keep scripts and automations documented and versioned as they change.
  • Marketing teams can run Prefire on every landing page release, checking forms, tracking and copy before ads point at it.
  • Start Prefire on one workflow with one owner, measure the time it saves, then roll it out to the wider team.

Enterprise

  • Enterprise engineering teams can roll out Prefire with repo scopes and audit logs, so agents work only where they are allowed.
  • Platform teams can standardize on Prefire so web and marketing engineering share one reviewed way of working with AI.
  • Enterprises can plug Prefire into release gates, so marketing pages meet the same quality bar as the product.
  • Prefire is a community server, so have security review the code and pin a version before Prefire touches company data.

Need help becoming an AI-forward company?

We connect MCP servers and AI agents to your CRM, content and data, with the guardrails your team needs.

Contact us

Prefire README

From BarredEwe/Prefire on GitHub, shared under its Apache-2.0 license. Images are left out; the original has them.

README.md

Quick Start · Installation · Usage · AI agents · Configuration · Docs (github.com/BarredEwe/Prefire/blob/main/Documentation) · Website

🔥 What is Prefire?

Your previews are already tests. Prefire turns the #Preview blocks you write anyway into snapshot tests, a Playbook catalog and images your AI agent can see. You don't write a line of test code.

📸 Snapshot tests

Every preview becomes a snapshot test on the devices you pick. A changed padding fails the build, not the release.

How it works →

📚 Playbook

A catalog of every component and user story inside your app, with their states and render times.

See Playbook →

🤖 Renders for AI agents

Claude Code, Cursor and Codex render your previews through an MCP server and see the UI they just changed.

Set up →

🤖 Using an AI agent? brew install barredewe/prefire/prefire, then claude mcp add prefire -- prefire mcp in your project. The agent renders SwiftUI previews on any iPhone or iPad, light or dark, without Xcode Previews. Setup →

🚀 Key Features

  • 🧠 Smart Preview Parsing, including #Preview, @Previewable
  • 📸 Snapshot Testing, automatic test generation from previews (iOS, tvOS, macOS)
  • 📚 Playbook View, auto-generated interactive component catalog (iOS)
  • 🏃 Flow-aware, build user stories from multiple preview steps
  • 🤖 AI-ready, render previews to PNG for agents with prefire render and an MCP server
  • 🧩 UIKit + AppKit Support, support for UIView/UIViewController and NSView/NSViewController
  • ⚙️ SPM + Xcode Plugins, works in CLI, Xcode build phases, or CI
  • 🧠 Fast Caching, fingerprint-based AST and body caching avoids redundant work
  • ✍️ Stencil Templates, customize output with your own templates

Why Prefire?

  • 🔥 No second set of UI states. Tests come from the previews you already keep up to date.
  • 🔥 Regressions fail CI. Snapshots are compared on every run, on every device you list.
  • 🔥 Designers and QA see every state. Playbook shows components and user stories on a device.
  • 🔥 Agents check their own UI work. They render the previews they changed before calling a task done.

⚡ Quick Start

📦 Example project available at: Prefire Example

1. Add Prefire to Your Project

// Package.swift
dependencies: [
    .package(url: "https://github.com/BarredEwe/Prefire.git", from: "6.3.0"),
    .package(url: "https://github.com/pointfreeco/swift-snapshot-testing", from: "1.18.0"),
],
.testTarget(
    dependencies: [
      .product(name: "Prefire", package: "Prefire"),
      .product(name: "SnapshotTesting", package: "swift-snapshot-testing"),
    ],
    plugins: [
        .plugin(name: "PrefireTestsPlugin", package: "Prefire")
    ]
)

2. Write #Preview

#Preview {
    Button("Submit")
}

3. Run tests

Just run the test target 🚀, Prefire will auto-generate snapshots based on your previews.

💡 If your test target is empty, Prefire will still generate files and snapshot code during build.

📦 Installation

Method How
SPM Plugin PrefireTestsPlugin / PrefirePlaybookPlugin in Package.swift
Xcode Build Tool Plugin Add PrefireTestsPlugin to the test target's build phases
CLI brew install barredewe/prefire/prefire
Mint (Beta) mint install BarredEwe/Prefire
GitHub Actions / CI Any of the above, see Troubleshooting

Step-by-step setup is in the Installation guide.

Requirements

  • Swift 6.0 or higher
  • Xcode 16.0 or higher
  • iOS 14 or higher; macOS 13 or higher (macOS: snapshot tests only, see Configuration)

🛠 Usage

Choose previews

Prefire finds every #Preview automatically. For PreviewProvider, add the PrefireProvider protocol:

struct Text_Previews: PreviewProvider, PrefireProvider {
    static var previews: some View { ... }
}

Exclude a preview with .prefireIgnored():

#Preview {
    Text("")
        .prefireIgnored()
}

To opt in instead of opting out, set preview_default_enabled: false in .prefire.yml and mark the previews you want with .prefireEnabled():

#Preview {
    Text("")
        .prefireEnabled()
}

Snapshot tests

PrefireTestsPlugin generates the tests into the DerivedData folder when the test target builds. Run the test target as usual.

Tune the timing and precision of a single snapshot:

#Preview {
    TestView()
        .snapshot(delay: 0.3, precision: 0.95, perceptualPrecision: 0.98)
}

For previews that load or animate, wait instead of guessing a delay:

.snapshot(waitForIdle: true)                     // until nothing changes on screen
.snapshot(waitUntil: { viewModel.isLoaded })     // until a condition is true

How waiting works, its limits and how the modifiers combine: Snapshot timing and precision.

Snapshots are compared with swift-snapshot-testing.

Playbook (Demo) View

Show all previews as an interactive catalog with PlaybookView:

  • isComponent: true lists all the Views
  • isComponent: false groups them by UserStory
import Prefire 

struct ContentView: View {
    var body: some View {
        PlaybookView(isComponent: true, previewModels: PreviewModels.models)
    }
}

To keep previews and PreviewModels out of release builds, see Excluding previews from release builds.

Flows

Connect previews into one Flow with .previewUserStory. Playbook shows them together, in order:

static var previews: some View {
    PrefireView()
        .previewUserStory(.auth)
}

static var previews: some View {
    AuthView()
        .previewUserStory(.auth)
}

States

If a preview contains more than one View, mark the State of each:

static var previews: some View {
    TestView("Default")

    TestView("Loading")
        .previewState(.loading)
}

Parameterized previews

Prefire expands each argument of a native SwiftUI parameterized preview into its own snapshot and Playbook preview:

#Preview("TextView", traits: .sizeThatFitsLayout, arguments: ["- A", "- B", "- C"]) { suffix in
    Text("1 \(suffix)")
}

🧰 API

Feature Modifier
Include in snapshot .prefireEnabled()
Exclude from snapshot .prefireIgnored()
Group in a flow .previewUserStory(.auth)
Mark a UI state .previewState(.error)
Customize snapshot .snapshot(delay: 0.3, precision: 0.95)
Wait until the preview settles .snapshot(waitForIdle: true, timeout: 2.0)
Wait for a condition .snapshot(waitUntil: { viewModel.isLoaded })
Parameterized preview #Preview(..., arguments: values)

💡 CLI Usage

# Generate snapshot tests
prefire tests

# Generate playbook models
prefire playbook

Run prefire tests --help or prefire playbook --help for more options.

🤖 Let AI agents see SwiftUI

Prefire renders previews in its snapshot tests, built anew and on the devices you choose, so it can show them to an AI agent as images, which Xcode Previews can't do reliably outside Xcode.

# Render previews to PNG + JSON
prefire render "Sign in" --device "iPhone 16 Pro" --color-scheme dark

# An HTML board of the last render, grouped by user story
prefire board

Add the MCP server to your agent, from the folder with .prefire.yml:

Agent Install
Claude Code claude mcp add prefire -- prefire mcp, or the plugin with a skill: /plugin marketplace add BarredEwe/Prefire then /plugin install prefire@prefire
Cursor
Codex codex mcp add prefire -- prefire mcp
VS Code code --add-mcp '{"name":"prefire","command":"prefire","args":["mcp"]}'

An agent then calls list_previews, render_previews and build_board. Set the scheme to build in render_configuration of .prefire.yml; see the AI guide. Why not Xcode's own RenderPreview? Prefire needs no running Xcode, renders many previews in one build, on the devices, color scheme and Dynamic Type you ask for, and works in CI.

🗂 Configuration: .prefire.yml

test_configuration:
  target: MyApp

playbook_configuration:
  preview_default_enabled: true

All options are in the Configuration guide. To change the generated code, see Templates.

🧠 How It Works

  1. 🔍 Parses all source files, finds #Preview and PreviewProvider blocks and the .prefireEnabled() / .prefireIgnored() modifiers
  2. 📂 Caches Types and PreviewBodies, keyed by file modification date + SHA-256 of inputs, so nothing is re-parsed if nothing changed
  3. 🔢 Generates snapshot tests, from Stencil templates, respecting .prefire.yml
  4. 📘 Generates Playbook models, groups by UserStory and State into PreviewModels.generated.swift

🩺 Troubleshooting

Problem Fix
NavigationView in a preview doesn't work in Playbook Use other views or layouts for your Playbook needs
Plugins don't run on CI defaults write com.apple.dt.Xcode IDESkipPackagePluginFingerprintValidatation -bool YES
Xcode can't generate tests in a custom path Disable the plugin sandbox: defaults write com.apple.dt.Xcode IDEPackageSupportDisablePluginExecutionSandbox -bool YES

🐱 Also by the author

Mewmori is a pixel cat that lives on your Mac desktop. He reads what's on screen, says something about it, and remembers you between sessions. A 2B model runs on the machine through llama.cpp, so screen text, chats and memory stay on your Mac.

Swift, AppKit + SwiftUI, 29 MB. Free; only skins are paid.


🤝 Contributing

We welcome contributions! Development setup, tests and the internal architecture are described in CONTRIBUTING.md.

Logo, colors and templates for talks and posts about Prefire are in the brand kit.

⭐ Star history

If Prefire saves you time, give it a star: it helps other iOS developers find it.

📄 License

Prefire is released under the Apache License 2.0. See LICENSE for details.

Questions about Prefire

What is the Prefire MCP server?

Render SwiftUI #Preview as PNG images, so an AI agent sees the views it changes. Prefire is maintained by BarredEwe on GitHub at BarredEwe/Prefire, and works with AI apps that support the Model Context Protocol, such as Claude, Cursor and VS Code.

How do I install the Prefire MCP server?

Prefire doesn't publish a one-line install in the MCP registry, so follow the setup steps in its README on GitHub (BarredEwe/Prefire). Like most servers, Prefire ends with a command or URL you paste into your AI app's MCP config.

Does Prefire need an API key?

The registry lists no required keys for Prefire. Check the Prefire README for optional settings, and expect a remote server to ask you to sign in the first time you connect.

Is Prefire an official MCP server?

No. Prefire is a community server maintained by BarredEwe. Community servers can be excellent; read the code and the open issues before you give Prefire access to company data.

What license is Prefire under?

Prefire is released under the Apache-2.0 license, according to its GitHub repository. The license covers the code of Prefire; the service it connects to has its own terms.