sf-preflight

Static impact analysis of Salesforce metadata changes, run over a git diff before you deploy

By Vishal Parashar (individual) TypeScript Local · stdio Developer toolsCRM and sales

26 popularity score ★ 12 ↓ 38/wk

Connect your client

Local (npm)

Add in one click

Opens the app, which asks before it adds the server.

Or add it by command or config

Claude CodeTerminal
claude mcp add sf-preflight -- npx -y sf-preflight mcp
Claude Desktopclaude_desktop_config.json
{
  "mcpServers": {
    "sf-preflight": {
      "command": "npx",
      "args": [
        "-y",
        "sf-preflight",
        "mcp"
      ]
    }
  }
}
Cursor~/.cursor/mcp.json
{
  "mcpServers": {
    "sf-preflight": {
      "command": "npx",
      "args": [
        "-y",
        "sf-preflight",
        "mcp"
      ]
    }
  }
}
VS Code.vscode/mcp.json
{
  "servers": {
    "sf-preflight": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "sf-preflight",
        "mcp"
      ]
    }
  }
}
Codex~/.codex/config.toml
[mcp_servers.sf-preflight]
command = "npx"
args = ["-y", "sf-preflight", "mcp"]
Gemini CLITerminal
gemini mcp add --scope user sf-preflight npx -- -y sf-preflight mcp

Settings 3

PREFLIGHT_CACHE_DIR Optional: Where parsed Apex results are cached (default ~/.cache/sf-preflight).
PREFLIGHT_NO_CACHE Optional: Set to 1 to turn the parse cache off.
PREFLIGHT_JOBS Optional: Set to 1 to parse on a single thread instead of worker threads.

What it does

sf-preflight is a command-line tool for Salesforce DX projects that also ships a stdio MCP server, started with `preflight mcp`. It takes a git diff of SFDX source and traces what the change would trigger in the org's order of execution: flows, Apex triggers, validation rules, roll-up summaries, sharing and permissions, Agentforce actions, OmniStudio components and more. A coding agent can call it after editing metadata to see collisions, recursion cycles and access changes before anything is committed or deployed.

The server works on the local project and git history. With no arguments, `analyze_change` compares the working tree, untracked files included, against `HEAD`. Other tools list what runs when a given object is saved, find every place a field is used, describe an Agentforce agent, draft a partial rollback plan for a commit, and return Apex test classes as code. Two tools that the README mentions but docs/MCP.md leaves out of its table, `suggest_fixes` and `check_fix`, return proposed diffs for findings and re-run the analysis on edits the agent proposes, without saving them.

The source of v0.13.0 (src/mcp.ts) registers eight tools, all marked read-only. It also sets caps the docs do not list: `analyze_change` follows the cascade 4 levels deep by default and at most 8 via `max_depth`; `generate_tests` uses 200 records per bulk test by default, up to 10000 via `bulk_size`; `check_fix` accepts 1 to 20 file edits per call. The project describes itself as early (0.x); org context is in beta.

What it needs

RuntimeNode.js 22+

Node.js 22.13 or newer (the docs launch it with npx), git on PATH, and a Salesforce DX project in a git repository. The server analyzes the directory the client starts it in, or the one given with `--root`. The optional `org` argument needs the Salesforce CLI (`sf`) installed and an org already authorized with `sf org login`.

Limits

Status is early (0.x), and org context is marked beta. It analyzes source files, so automation that exists only in the org is missed unless the beta `org` argument is used. `project_dir` must stay inside the server root; tool calls outside it are refused. Cascade depth is capped at 8 (default 4). Tools never write files: generated tests, fixes and rollback plans come back as text for the agent or user to apply. docs/MCP.md says the server never contacts an org, but at v0.13.0 `analyze_change` accepts an `org` alias and then queries that org read-only through the sf CLI.

Who it suits

Salesforce developers and admins who keep metadata in an SFDX git repository and let coding agents such as Claude Code, Cursor or Codex edit flows, Apex or permissions, and want the agent to check the knock-on effects before committing. It runs locally and needs no org credentials for its main analysis. It is not a tool for managing a live org: it cannot deploy, query records or change org data, so teams wanting that need a different server. Projects not kept in git get little from it, since its analysis is built on diffs.

Tools 8

analyze_change
Impact report for a git change: cascade of automation, findings, suggested tests and quality gate result
suggest_fixes
Proposes diffs for findings that have a mechanical fix, grouped as safe, undo or review; applies nothing
check_fix
Re-runs the analysis with proposed file contents in place and reports which findings go or appear
explain_save_order
Lists, in order, the automation that runs when an object is inserted, updated, deleted or undeleted
explain_agent
Describes an Agentforce agent's topics, actions, what they call and the access its user needs
find_field_references
Finds validation rules, flows, Apex, formulas, roll-ups and permission sets that use a field
generate_tests
Returns Apex test classes covering what a change touches, as code
plan_rollback
Drafts a partial rollback plan for a commit or merged pull request without changing anything

Similar servers