Penstock

Command line / Automation

The MCP server

Let an AI assistant read, check and, if you allow it, edit the diagrams in your project, with the same checks a person gets.

Free Reading and checking are free. Flow analysis, scenarios, code links and editing need Pro, and Team in a pipeline.

What it is

MCP (Model Context Protocol) is a way for an AI assistant to use a program's tools. penstock mcp starts a small server on your machine that talks to the assistant over standard input and output. It offers a few tools. An assistant that edits a diagram can check straight away that it still runs to its end.

Connect an AI assistant

The CLI needs Node.js. Node.js 22.22 or later must be on the PATH of your assistant. list_diagrams, show_diagram and check_diagram are free. The other tools are part of Penstock Pro, and Team in a pipeline, as penstock mcp --help states.

Running penstock mcp --config prints the standard client configuration. There is no project folder in the entry: you configure it once, and the server finds each project from the files the assistant asks about.

Claude Code

Run this command in your terminal:

claude mcp add penstock -- npx --yes @kern0x1b/penstock-cli mcp

Claude Desktop

In claude_desktop_config.json (under ~/Library/Application Support/Claude/ on macOS or %APPDATA%\Claude\ on Windows), add penstock under mcpServers:

{
  "mcpServers": {
    "penstock": {
      "command": "npx",
      "args": ["--yes", "@kern0x1b/penstock-cli", "mcp"]
    }
  }
}

Cursor

In .cursor/mcp.json in your project, or in ~/.cursor/mcp.json for all projects, add the server under mcpServers:

{
  "mcpServers": {
    "penstock": {
      "command": "npx",
      "args": ["--yes", "@kern0x1b/penstock-cli", "mcp"]
    }
  }
}

VS Code

In VS Code 1.101 or later with GitHub Copilot agent mode, the Penstock extension registers the MCP server automatically in trusted workspaces when Node.js and npm are on the PATH. The extension launches ./penstockw mcp if the project has the wrapper, or npx @kern0x1b/penstock-cli mcp if not.

For manual setup in .vscode/mcp.json, VS Code uses the servers key and requires type: "stdio" rather than mcpServers:

{
  "servers": {
    "penstock": {
      "type": "stdio",
      "command": "npx",
      "args": ["--yes", "@kern0x1b/penstock-cli", "mcp"]
    }
  }
}

JetBrains AI Assistant and Junie

For JetBrains AI Assistant, go to Settings | Tools | AI Assistant | Model Context Protocol (MCP), click Add, choose STDIO, and supply this JSON configuration:

{
  "mcpServers": {
    "penstock": {
      "command": "npx",
      "args": ["--yes", "@kern0x1b/penstock-cli", "mcp"]
    }
  }
}

For JetBrains Junie, add the entry under mcpServers in ~/.junie/mcp/mcp.json (global) or .junie/mcp/mcp.json (project root), or configure it in Settings | Tools | Junie | MCP Settings.

How the server finds your project

The server serves diagrams across projects. For each request it starts from the file or folder the assistant names, walks up to the nearest penstock.yaml (or the repository root), and uses that project's engine, settings and conventions.

Kind of toolHow you point it at a project
Diagram tools: show_diagram, check_diagram, analyze_flow, list_scenarios, edit_diagramThe assistant passes the absolute path of a .bpmn or .bpmn20.xml file, in file.
Whole-project tools: list_diagrams, check_code_linksThe assistant passes an absolute folder in the optional project. Without it, the tool uses the folders the AI client has open.

The folders the client has open (MCP roots)

Many AI clients tell the server which folders are open in their workspace. MCP calls these roots. When the client does, the server:

When the client sends no roots, the whole-project tools need an explicit absolute project. The diagram tools then accept any valid BPMN diagram whose path resolves to a project.

The tools

ToolWhat it doesNeeds
list_diagramsLists the BPMN diagrams of a project, as absolute paths.Free
show_diagramDescribes a diagram: every element and flow with id, type, name, connections and engine properties. Read this before editing. Edits refer to these ids.Free
check_diagramReports what is wrong, as the editor's check does: the drawing, your bpmnlint rules and, with a licence, how the process runs.Free
analyze_flowFinds deadlocks, branches that run twice, elements that never run and loops with no way out, with the path of ids that leads there. Run it after edit_diagram.Pro, Team in a pipeline
list_scenariosLists every distinct way through a diagram: the decisions taken, their conditions, the steps and where it ends.Pro, Team in a pipeline
check_code_linksChecks every diagram against the code, with file and line.Pro, Team in a pipeline
edit_diagramChanges a diagram through the editor's own modelling. Operations apply together or not at all. An edit that would break the drawing is refused. dryRun shows the result without writing.Pro, Team in a pipeline

edit_diagram takes file, operations and the optional dryRun. The operations are the same contract as penstock edit --ops, and penstock edit <file> --schema prints it for the file's engine. The whole-project tools take project. The others take file.

A tool that needs a licence you do not have appears in the tool list with a note on what it needs. Called without the licence, it says so in its error result, with how to buy or sign in. In a pipeline the paid tools need Team. See Plans and licence.

Safety

What you see

Common problems

The assistant does not see the tools.
Check the command and args in the entry. Node.js 22.22 or later must be on the PATH of the assistant. Run penstock mcp by hand: it should wait silently for input.
"must be an absolute path to a diagram" or "\"project\" must be an absolute path".
The tools take absolute paths. Ask the assistant to pass the full path, as list_diagrams prints it.
"is outside the workspace roots".
The path is not inside a folder the client has open. Open the project in the client, or give a path inside an open folder.
"is not a Penstock project".
The folder has no penstock.yaml and no repository root above it. Run penstock init there.
A paid tool says it needs a licence.
Sign in on the machine that runs the server: penstock license login.