Skip to content
MCP server
Registry

Prefire MCP Server

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

Prefire scores 72 (Good), licensed Apache-2.0 and written in Swift. It installs as a local process. It does not declare tools yet. Filed under Knowledge. GitHub shows 535 stars. Install configs are generated for 10 clients. Being listed in the registry is not the same as being vendor-official.

by barredeweApache-2.0Swift535 stars
Trust score
72Good
Trust score 72 of 100, Good

Good trust

72 of 100 from six public signals. Nobody can buy a point.

  • Listed in the official MCP registry.
  • OSI-style license: apache-2.0.
How we score trust
Scorecard

License, quality and maintenance

How grades work
Trust breakdown

Where the 72 comes from

22 + 20 + 9 + 10 + 4 + 7 = 72. Each factor is capped, so no single signal can carry a listing.

Registry22 / 30

Active in the official MCP registry, plus a known vendor namespace.

Registry: 22 of 30 points.
Maintenance20 / 20

How recently the repository saw a commit or release.

Maintenance: 20 of 20 points.
Popularity9 / 20

GitHub stars and weekly downloads, on a log scale.

Popularity: 9 of 20 points.
License10 / 10

A clear, OSI-style open-source license.

License: 10 of 10 points.
Security4 / 10

Not archived, a secure install path, a pinned version.

Security: 4 of 10 points.
Docs7 / 10

A real summary, a README with depth, listed tools.

Docs: 7 of 10 points.

Install

Pick your client, copy the config, paste it in.

Needs Cursor or VS Code installed on this device. The button opens the app and asks you to confirm before it adds the server.

~/Library/Application Support/Claude/claude_desktop_config.json
{  "mcpServers": {    "barredewe-prefire": {      "command": "npx",      "args": [        "-y",        "https://github.com/BarredEwe/Prefire/releases/download/6.6.2/prefire-mcp-6.6.2.mcpb"      ]    }  }}

Environment variables

This server does not declare environment variables.

Tools show up when the registry metadata or the repository README lists them. Public READMEs are read directly. A GitHub token is used only when one is already configured.

About

๐Ÿ”ฅ 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.

๐Ÿค– 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

MethodHow
SPM PluginPrefireTestsPlugin / PrefirePlaybookPlugin in Package.swift
Xcode Build Tool PluginAdd PrefireTestsPlugin to the test target's build phases
CLIbrew install barredewe/prefire/prefire
Mint (Beta)mint install BarredEwe/Prefire
GitHub Actions / CIAny 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

FeatureModifier
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:

AgentInstall
Claude Codeclaude mcp add prefire -- prefire mcp, or the plugin with a skill: /plugin marketplace add BarredEwe/Prefire then /plugin install prefire@prefire
CursorAdd to Cursor
Codexcodex mcp add prefire -- prefire mcp
VS Codecode --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

ProblemFix
NavigationView in a preview doesn't work in PlaybookUse other views or layouts for your Playbook needs
Plugins don't run on CIdefaults write com.apple.dt.Xcode IDESkipPackagePluginFingerprintValidatation -bool YES
Xcode can't generate tests in a custom pathDisable 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.

Frequently asked questions

What is Prefire MCP Server?

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

How do I install Prefire MCP Server in Claude Desktop, Cursor, or VS Code?

Pick your client in the Install section on this page and copy the generated config into the client's config file. Step-by-step guides: Claude Desktop, Cursor, and VS Code. Prefire MCP Server runs locally from the MCP bundle https://github.com/BarredEwe/Prefire/releases/download/6.6.2/prefire-mcp-6.6.2.mcpb with the command npx -y https://github.com/BarredEwe/Prefire/releases/download/6.6.2/prefire-mcp-6.6.2.mcpb.

Is Prefire MCP Server free and open source?

Yes. Prefire MCP Server is released under the Apache-2.0 license, an OSI-approved open-source license, so you can use, modify, and self-host it under those terms.

Does Prefire MCP Server support remote (HTTP) connections?

No remote endpoint is listed for Prefire MCP Server. It runs locally on your machine over stdio, started by your MCP client.

How is Prefire MCP Server's trust score calculated?

Prefire MCP Server scores 72 out of 100 (Good). The score adds six capped public signals: registry status, maintenance, popularity, license, documentation, and security. Nobody can pay for points. Read the methodology for the full formula.

Reviews

No reviews yet

โ€”Be the first to review

5 star0 reviews at 5 stars
4 star0 reviews at 4 stars
3 star0 reviews at 3 stars
2 star0 reviews at 2 stars
1 star0 reviews at 1 stars

No published reviews yet. Used it? Tell the next person how it went.

Add badge to your README

Paste either snippet into the repository README. The image links to this listing.

Listed on MCPpedia

Top 5 MCP servers

Daily or weekly. Confirm by email, unsubscribe any time.

How often

Manage this listing

Claim this server