Metadata-Version: 2.4
Name: preflight-review-mcp
Version: 0.2.0
Summary: Launch-readiness reviews for AI agents and automations: blocker-first checks, recorded evidence, human sign-off and a client brief, over MCP
Author: Muhammad Q Farooqi
License-Expression: MIT
Project-URL: Homepage, https://github.com/mqfarooqi1/Preflight-MCP
Project-URL: Repository, https://github.com/mqfarooqi1/Preflight-MCP
Project-URL: Issues, https://github.com/mqfarooqi1/Preflight-MCP/issues
Project-URL: Changelog, https://github.com/mqfarooqi1/Preflight-MCP/blob/main/CHANGELOG.md
Keywords: mcp,model-context-protocol,mcp-server,ai-agents,ai-governance,launch-review,production-readiness,risk-assessment,human-in-the-loop,audit-trail
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Information Technology
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: 3.15
Classifier: Topic :: Software Development :: Quality Assurance
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Typing :: Typed
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: mcp<3,>=2.3
Requires-Dist: pydantic<3,>=2.12
Provides-Extra: dev
Requires-Dist: pytest>=8.0; extra == "dev"
Requires-Dist: pytest-asyncio>=0.24; extra == "dev"
Requires-Dist: ruff>=0.6; extra == "dev"
Requires-Dist: build>=1.2; extra == "dev"
Requires-Dist: twine>=6.1; extra == "dev"
Dynamic: license-file

<!-- mcp-name: io.github.mqfarooqi1/preflight-review -->

# Preflight Review

[![CI](https://github.com/mqfarooqi1/Preflight-MCP/actions/workflows/ci.yml/badge.svg)](https://github.com/mqfarooqi1/Preflight-MCP/actions/workflows/ci.yml)
![Python 3.11 to 3.15](https://img.shields.io/badge/python-3.11%E2%80%933.15-blue.svg)
![MCP](https://img.shields.io/badge/MCP-2.3-7C3AED.svg)
![MIT licence](https://img.shields.io/badge/License-MIT-blue.svg)

**Launch-readiness reviews for AI agents and automations, as an MCP server.**

Before a workflow that drafts customer replies, searches internal documents or
moves data goes live, ask who approves its riskiest action, who can stop it,
and what happens when it receives an unexpected input.
Preflight asks those questions one at a time, blockers first, records the
evidence for each answer, keeps the human sign-off separate from the checks,
and exports a brief you can hand to a client.

- **Blocker-first checklist.** Approval boundary, rollback, scope and silent
  failure on every review, plus checks for the kind of workflow it is.
- **Evidence and retests.** Each test result needs a named owner and a control.
  The recommendation comes from the current results, and the brief retains
  earlier attempts.
- **A human decides.** The decision is recorded separately and freezes the
  review. The brief captures the findings that were open at sign-off.
- **Linked revisions.** A changed workflow starts a review that shows the old
  and new values and asks for fresh evidence.
- **Plain-text evidence in the brief.** Preflight escapes recorded text before
  inserting it into Markdown, so pasted evidence cannot add sections or links.
- **Two storage modes.** Local mode stores reviews in SQLite. In stateless mode,
  the client carries signed review records between calls.

## Quick start

Preflight supports Python 3.11 to 3.15. Check the package version
with [uv](https://docs.astral.sh/uv/).

```sh
uvx preflight-review-mcp --version
```

Add it to Claude Code with this command.

```sh
claude mcp add preflight -- uvx preflight-review-mcp
```

For Claude Desktop, add the server to `claude_desktop_config.json`.

```json
{
  "mcpServers": {
    "preflight": { "command": "uvx", "args": ["preflight-review-mcp"] }
  }
}
```

To use pip, run `python -m pip install preflight-review-mcp`, then configure
your stdio-capable client to run `preflight-review-mcp`. To install directly from
GitHub, use `python -m pip install git+https://github.com/mqfarooqi1/Preflight-MCP`.
If the client cannot find the command, use the full path of the executable or
of the Python you installed it into with the arguments `-m preflight_mcp`.

Try this request in your MCP client.

> Start a customer-support launch review for a workflow that drafts refund
> replies from our support policy. An agent reviews each draft. Our support lead
> can disable the workflow. Ask one question at a time. Use synthetic evidence
> for this demo and label it as such.

## Try the demo

From the repository root, install Preflight and run the synthetic refund review
through a real stdio MCP session in both storage modes.

```sh
python -m pip install .
python examples/demo.py
```

The demo records an approval failure, updates the control, records a passing
retest, and links a follow-up review. It uses a temporary database for local
mode. [Read the sample client brief](examples/sample-client-brief.md) or
[see what changed in 0.2.0](CHANGELOG.md).

## Use Preflight in Codex

In a trusted project, add this to `.codex/config.toml` and replace the example
paths. The database setting is optional. See the
[Codex MCP configuration guide](https://developers.openai.com/codex/mcp).

```toml
[mcp_servers.preflight]
command = "/absolute/path/to/python"
args = ["-m", "preflight_mcp"]

[mcp_servers.preflight.env]
PREFLIGHT_DB = "/absolute/path/to/client-reviews.sqlite3"
```

For a virtual environment named `.venv`, the Python executable is
`.venv/bin/python` on macOS and Linux and `.venv/Scripts/python.exe` on Windows.
TOML accepts forward slashes in Windows paths or backslashes in single quotes.

## Start from a skill

Copy the six folders in [`skills/`](skills/) into `.agents/skills/` in the
project you want to review. Keep each folder with its `SKILL.md`. Open the
project in Codex and invoke `$preflight` to start, resume, or compare a review.
In another Agent Skills client, import the folders according to its skill setup.
[Codex skills guide](https://developers.openai.com/codex/skills)

| Skill | Use it to |
| --- | --- |
| [`preflight`](skills/preflight/SKILL.md) | Choose where to begin or pick up an existing review. |
| [`preflight-scope`](skills/preflight-scope/SKILL.md) | Define the workflow and pick a template. |
| [`preflight-challenge`](skills/preflight-challenge/SKILL.md) | Identify risks and define checks. |
| [`preflight-verify`](skills/preflight-verify/SKILL.md) | Record observed outcomes and follow up on failed or inconclusive checks. |
| [`preflight-handoff`](skills/preflight-handoff/SKILL.md) | Export a brief and capture an explicit human decision. |
| [`preflight-compare`](skills/preflight-compare/SKILL.md) | Review what changed and identify the evidence the revision needs. |

The skills also guide an unsaved draft in the conversation when the MCP server
is unavailable.

## Start from an MCP prompt

In local mode, clients that expose MCP prompts can use any of these entry points.
You can also call the tools from a plain-language request. In stateless mode,
use the tools with the current signed record.

| Prompt | Arguments | Use it to |
| --- | --- | --- |
| `launch_review` | `template` (default `customer_support`) | Start scoping a workflow. |
| `continue_review` | `review_id` | Resume the next open check from saved state. |
| `client_handoff` | `review_id` | Draft a private brief with findings and any recorded decision. |

## How a review runs

1. **Start** with what triggers the workflow, the data it reads, the actions it
   can take, who approves them, and how it is stopped and undone. Pick from
   `customer_support`, `document_search` or `internal_operations`.
2. **Answer the next question.** `next_question` returns one open check at a
   time, blockers first. Name an owner and the control. Add a custom check if
   the template misses a risk.
3. **Test the control** in your test environment and record what happened,
   with a ticket, log or run reference. Update a failed control before retesting.
   Pass the tested `control_version` as `expected_control_version` to reject
   results for a control that changed since the test. If evidence is pending,
   pass the check ID in `deferred_check_ids` to skip the question for this session
   while keeping the finding open. `blocked_by_deferral` means the remaining
   checks were deferred.
4. **Decide.** Record a named reviewer's explicit decision and reason. `approve`
   requires every check to pass. With findings open, the reviewer can choose
   `approve with conditions` or `hold`, and the decision records the open
   findings. Recording the decision freezes the review.
5. **Hand over the brief.** `client_brief` exports the decision, the workflow
   and every check with its evidence and test history, in Markdown.
6. **Start a linked revision.** Use `revise_workflow` when the workflow changes
   or provide a `revision_reason` to start a fresh evidence cycle after a recorded
   decision on the same workflow. If a custom check no longer applies, give
   the reason and pass its ID in `omit_custom_check_ids`. The original finding
   stays in the earlier review.

| Recommendation | When |
|---|---|
| **blocked** | a blocker check is open |
| **ready with conditions** | every blocker passed, other checks are open |
| **ready for review** | every check passed |

The recommendation is advice. The decision belongs to the named reviewer.

## Tools

| Tool | What it does |
|---|---|
| `list_templates` | the templates and the checks each one asks |
| `start_review` | start a review and return its checklist |
| `next_question` | the next open check and what to ask about it |
| `add_review_check` | add a custom check to an open review |
| `record_control` | name the owner and the control for a check |
| `record_test` | record a test outcome and its evidence |
| `record_decision` | store a named reviewer's decision and freeze the review |
| `revise_workflow` | start a linked review with a fresh evidence cycle |
| `review_record` | the whole review with its recommendation |
| `client_brief` | the review as a Markdown brief |
| `list_reviews` | saved reviews, newest first (local mode) |

Every tool returns typed structured output. The server supplies read-only
annotations for clients that use them. An unknown check error lists the valid
checks, and an early `approve` names the checks still open.

## Storage modes

**Local (default).** Reviews are kept in SQLite at
`~/.preflight-review/reviews.sqlite3`. Set `PREFLIGHT_DB` to an absolute path to
keep a separate file per client. Reuse that database when resuming a review.
Tools refer to reviews by `review_id`.

**Stateless, for hosting.** Start the server as
`preflight-review-mcp --mode stateless` (or set `PREFLIGHT_MODE=stateless`), and
set `PREFLIGHT_SIGNING_KEY` to a secret of at least 32 characters, the same for
every copy of the server. Generate a signing key with this command.

```sh
python -c "import secrets; print(secrets.token_hex(32))"
```

In stateless mode, tools that load a review take the full signed object in the
`review` argument. After a tool changes a review, keep the new `review` from its
structured output and pass it back exactly as returned, signature included.
Keep both records when creating a linked revision so you can compare them later.
Preflight verifies the HMAC-SHA256 signature and rejects edited records. The
client can still load any older signed version it holds. The brief prints the
record's signature and last-updated time.

## Reviewer responsibilities

Your team runs the workflow tests, verifies the evidence, confirms the
reviewer's identity, and controls deployment. Preflight records the reported
observations, references and decision. Keep customer records and secrets in
their source systems.

## Development

```sh
pip install -e ".[dev]"
pytest
ruff check src tests examples
python examples/demo.py
```

CI runs the tests and the demo on Linux, Windows and macOS with Python 3.11 to
3.15.

## Licence

MIT
