# Pflow

Petri net tools for Claude: validate, simulate, analyze, generate code, compose nets, seal models, and generate full-stack apps from natural language. 18 MCP tools for Petri net workflows.

## Quick Start

```bash
# Connect this server (installs CLI if needed)
npx -y @smithery/cli@latest mcp add stackdump/pflow-pilot

# Browse available tools
npx -y @smithery/cli@latest tool list stackdump/pflow-pilot

# Get full schema for a tool
npx -y @smithery/cli@latest tool get stackdump/pflow-pilot petri_analyze

# Call a tool
npx -y @smithery/cli@latest tool call stackdump/pflow-pilot petri_analyze '{}'
```

## Direct MCP Connection

Endpoint: `https://pflow-pilot--stackdump.run.tools`

## Tools (22)

- `petri_analyze` — Analyze a Petri net model for behavioral properties including reachability, deadlocks, liveness, boundedness, and eleme…
- `petri_application` — Generate a complete full-stack application from an Application specification. This accepts the high-level Application D…
- `petri_code_to_flow` — Convert source code into a formal Petri net model. Analyzes code structure (control flow, state machines, resource mana…
- `petri_codegen` — Generate executable code from a validated Petri net model. Produces event-sourced application code with state machine, …
- `petri_compose` — Compose multiple Petri net models into a CompositeNet with typed links between them. Validates that link endpoints refe…
- `petri_diff` — Compare two Petri net models and show structural differences. Reports added, removed, and modified places, transitions,…
- `petri_docs` — Generate markdown documentation from a Petri net model with mermaid diagrams for visualization. Useful for exploring an…
- `petri_extend` — Modify an existing Petri net model by applying operations. Operations: add_place, add_transition, add_arc, add_event, a…
- `petri_frontend` — Generate a vanilla JavaScript ES modules frontend application from a Petri net model. Produces a Vite + ES modules proj…
- `petri_help` — Returns a recommended CLAUDE.md snippet for working with pflow Petri net models. Paste this into your project's CLAUDE.…
- `petri_jssdk` — Generate a typed JS SDK (ES modules) from a Petri net model. Produces workflow.js, events.js, aggregate.js, permissions…
- `petri_migrate` — Migrate a Petri net model from v1 (flat) to v2 (nested) schema format. V2 format separates the net definition from exte…
- `petri_preview` — Preview a single generated file without full code generation. Use this to check specific files before committing to ful…
- `petri_seal` — Create a tamper-evident PetriNetSeal for a Petri net model. Computes a canonical SHA-256 hash and optionally verifies d…
- `petri_simulate` — Simulate firing transitions and see state changes. Returns detailed step-by-step state trace. Use this to verify workfl…
- `petri_submit` — Submit a Petri net model to the public catalog. Only core Petri net structure is accepted (places, transitions, arcs) —…
- `petri_validate` — Validate a Petri net model for structural correctness. Checks for empty models, unconnected elements, and invalid arc r…
- `petri_verify` — Verify a PetriNetSeal: recompute the model hash, check it matches the sealed CID, and re-verify all declared invariants…
- `petri_visualize` — Generate an SVG visualization of a Petri net model showing places, transitions, and arcs.
- `pflow_validate` — Validate a Petri net model.json for common issues including dead workflows, missing initial tokens, invalid arcs, and e…
- `seal_list` — List sealed Petri net models from the catalog. Returns catalog entries with metadata (name, type, CID, invariant summar…
- `seal_search` — Get the full PetriNetSeal document for a model by its @id or modelCID. Returns the complete seal with model, hash, inva…

```bash
# Get full input/output schema for a tool
npx -y @smithery/cli@latest tool get stackdump/pflow-pilot <tool-name>
```

## Resources

- `petri://services` — List of available example Petri net models. Each example demonstrates different model features.
- `petri://schema` — JSON Schema (Draft 2020-12) for validating Petri net model definitions. Use this to validate models before calling petr…
- `petri://services/coffeeshop` — Example Petri net model: coffeeshop
- `petri://services/dining-philosophers` — Example Petri net model: dining-philosophers
- `petri://services/enzyme-kinetics` — Example Petri net model: enzyme-kinetics
- `petri://services/galton-board` — Example Petri net model: galton-board
- `petri://services/hiring-pipeline` — Example Petri net model: hiring-pipeline
- `petri://services/knapsack` — Example Petri net model: knapsack
- `petri://services/loan-approval` — Example Petri net model: loan-approval
- `petri://services/predator-prey` — Example Petri net model: predator-prey
- `petri://services/producer-consumer` — Example Petri net model: producer-consumer
- `petri://services/stoplight` — Example Petri net model: stoplight
- `petri://services/tcp-handshake` — Example Petri net model: tcp-handshake
- `petri://services/texas-holdem` — Example Petri net model: texas-holdem
- `petri://services/thermostat` — Example Petri net model: thermostat
- `petri://services/tic-tac-toe` — Example Petri net model: tic-tac-toe

## Prompts (4)

- `add-access-control` (model) — Guide adding roles and permissions to an existing model
- `add-views` (model) — Guide designing UI views for a model
- `code-to-flow` (language) — Guide through converting source code into a Petri net model
- `design-workflow` (description) — Guide through designing a new workflow from requirements
