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.
Dieser Inhalt ist noch nicht in deiner Sprache verfügbar.
What it is
Section titled “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 thirty tools, the diagrams of the open folders as resources, and two prompts. It reads BPMN diagrams, DMN decision files and Camunda forms. An assistant that edits a diagram can check straight away that it still runs to its end.
Connect an AI assistant
Section titled “Connect an AI assistant”The CLI needs Node.js 22.22.2 or later in the 22 line, 24.15.0 or later in the 24 line, or 26 and later on the PATH of your assistant. The tools that read, check, search, compare, analyse for Camunda 8 and draw are free, with no time limit: list_diagrams, show_diagram, element_context, check_diagram, search_elements, diff_diagrams, migrate_analyze, export_image, connections, agents, drift (for one environment), import_diagram, refactor_rename, test_dmn (up to 3 cases per decision) and the previews of migrate_agents and incident_to_scenario. The other tools, and the writes behind the free ones, 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. The entry names the exact version of the command line that printed it, as npx --yes @kern0x1b/penstock-cli@<version> mcp, so the assistant runs the version you have. A development build of the command line has no published version, and prints penstock mcp instead. The entries below, written by hand, run whatever version npm serves; paste the printed one to pin it. With the command line installed (npm install -g @kern0x1b/penstock-cli), claude mcp add penstock -- penstock mcp adds it to Claude Code.
Two other ways to give an agent the tools need no entry in its settings. penstock agent claude, codex, gemini or opencode starts that agent in your terminal with the server set up for that one run and nothing written to the agent's configuration. See agent. And the AI chat in the Penstock editors starts your agent with the same server, so it reads diagrams, rules, scenarios and code links as the command line does.
penstock mcp --project <dir> fixes the project: every tool works on that folder, the assistant does not have to name it, and nothing outside it is read.
Claude Code
Section titled “Claude Code”Run this command in your terminal:
claude mcp add penstock -- npx --yes @kern0x1b/penstock-cli mcp
Claude Desktop
Section titled “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
Section titled “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
Section titled “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
Section titled “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
Section titled “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 tool | How you point it at a project |
|---|---|
Tools that read any kind of file: show_diagram, element_context, check_diagram, diff_diagrams |
The assistant passes the absolute path of a .bpmn, .dmn or .form file, in file. diff_diagrams also takes a second file of the same kind in other. |
BPMN-only tools: analyze_flow, list_scenarios, edit_diagram, layout_diagram, export_image |
The assistant passes the absolute path of a .bpmn or .bpmn20.xml file, in file. |
Whole-project tools: list_diagrams, search_elements, check_code_links, run_scenarios, migrate_analyze |
The assistant passes an absolute folder in the optional project. Without it, the tool uses the folders the AI client has open. run_scenarios and migrate_analyze also take a single file in file; migrate_analyze takes either file or project, not both. |
The tool that makes a file: create_diagram |
The assistant passes the absolute path of the new .bpmn, .dmn or .form file, in file. The path must not exist yet. |
The folders the client has open (MCP roots)
Section titled “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:
- uses those folders as the default projects for the whole-project tools,
- updates the list when the client says the folders changed,
- refuses any file or folder outside them, so the assistant cannot read outside the workspace it was given.
When the client sends no roots, the whole-project tools need an explicit absolute project. The file tools then accept any valid diagram whose path resolves to a project.
The tools
Section titled “The tools”| Tool | What it does | Needs |
|---|---|---|
list_diagrams | List the BPMN diagrams in a project, returning absolute paths. Each entry has the file and its kind (process, decision or form): DMN decision files and Camunda forms are listed too. | Free |
show_diagram | Describe a diagram: every element and flow with its id, type, name, connections and engine properties. Read this before editing; operations refer to these ids. For a DMN file it gives each decision with its hit policy, inputs, outputs, rules and the decisions, input data and knowledge it requires; for a Camunda form, its components with type, key and label. | Free |
element_context | Say what surrounds one element of a diagram, as the editor's suggestions see it: the variables that reach it and which element writes each, what the element itself reads and writes, its job types, and the job types, processes and decisions the project already uses. Read it before naming a variable, a job type or a mapping, so that an existing name is reused instead of a new one invented. It is worked out from the diagrams alone, not from the code behind them. For a DMN file the element is a decision id, and the answer is its table, the decisions that need it and the process elements that call it; for a form it is a component key or id, with the process elements that open the form. | Free |
check_diagram | Report what is wrong with a diagram, as the editor's check does: the drawing, the project's bpmnlint rules and, with a licence, how the process runs. A DMN file or a form is checked too: a DMN file that cannot be read and the form checks (duplicate or missing keys, repeated options) are free; gaps and overlaps between the rules of a decision table need a licence. | Free |
analyze_flow | Find what is wrong with how a diagram runs: deadlocks, branches that run twice, elements that can never run and loops with no way out, each with the path of element ids that leads there. Run it after edit_diagram. | Pro Team in a pipeline |
list_scenarios | List every distinct way through a diagram: the decisions each takes, their conditions, the steps it runs and where it ends. Use it to write tests or to explain the process. | Pro Team in a pipeline |
check_code_links | Check every diagram in the project against the code: job types, external task topics, classes and beans with nothing to run them, called processes no diagram defines, and workers no diagram uses, with file and line. | Pro Team in a pipeline |
edit_diagram | Change a diagram through the editor's own modelling: new elements are placed and connected the way the editor does it, and ids follow the project's conventions. The operations apply together or not at all. An edit that would break the drawing (overlapping shapes, a flow through a shape, a detached flow) is refused; crossings and the like are reported but allowed. Use dryRun to see the result without writing. | Pro Team in a pipeline |
search_elements | Find where a name is used across the project: elements, processes, messages, decisions and their outputs, variables with the elements that write and read them, and form fields. It matches the id or the name, ignoring case, exact matches first. Use it before inventing a name, and to see what a rename would touch. | Free |
diff_diagrams | Say what changed between two diagrams of the same kind (BPMN, DMN or form), or between a file and its committed version (HEAD, unless ref names another): the elements added, removed and changed, and the ids of the elements that only moved on the canvas (or, in a form, were reordered or moved to another group). A decision table changes by rule id, a form by component id. | Free |
export_image | Draw a BPMN diagram as SVG (returned as text) or PNG (returned as an image; needs puppeteer installed). Pass out, a folder, to write the file there instead of returning it. | Free |
layout_diagram | Run the editor's auto layout on a diagram and write the result back in one atomic step. The elements and flows stay the same; only their positions change. Use dryRun to see which elements would move without writing. | Pro Team in a pipeline |
run_scenarios | Run the project's saved test cases against a local Camunda engine that is marked for tests, and return which passed, failed or were skipped. Give a diagram as file, or a project folder. Each run deploys its own copy of the diagrams to the engine, removes it afterwards and keeps the trace under .penstock/runs. | Pro Team in a pipeline |
test_task | Run one element of a diagram on the local Camunda engine the project marks for tests: the process is deployed as a test build, an instance is started with the variables, the path to the element is completed or mocked, then the element is completed, made to throw a BPMN error or left waiting. Returns the element's state, what it received and sent, the variables, the incidents and the instance state, and removes the build afterwards. | Pro Team in a pipeline |
migrate_analyze | Analyse what moving Camunda 7 diagrams, decisions and forms to Camunda 8 would take, as penstock migrate does: for each file its status and findings (rule, severity, where, what to do, whether the conversion is automatic, to review or manual), then the effort and the blockers. Give a file or a project folder. Nothing is written. | Free |
migrate_apply | Apply the Camunda 7 to Camunda 8 migration to a project: rewrite BPMN, DMN and forms in place, translate the expressions it can and list the ones it cannot, write a job worker skeleton for each job type and MIGRATION.md, then check the result as Camunda 8. By default it is a dry run that returns the diff and writes nothing; pass write true to write. It never deletes a file and never follows a symbolic link out of the project. | Pro Team in a pipeline |
migrate_verify | Run the project’s scenarios against the original Camunda 7 diagram on one test engine and the converted Camunda 8 diagram on another, and report per scenario whether the observable behaviour is equivalent, differs or cannot be compared. Both engines must be marked for tests; it refuses anything else, and refuses when the conversion adds executable content. Runs locally, never sends anything elsewhere. Part of Penstock Pro. | Pro Team in a pipeline |
test_dmn | Run the saved test cases of the decision tables in a DMN file, or in every DMN file of the project: each case's inputs go to the decision, the outputs are compared with the expected ones, and the rules that matched are named. The answer also lists the rules no case covers, counted for each table's hit policy. Up to 3 cases per decision run for free; more are part of Penstock Pro. With case, the tool saves a new case next to the file (Penstock Pro), which changes a file. | Free |
connections | Show the secrets and MCP clients the diagrams and element templates of a project name, where the project's own files define them (connector-secrets, .env, Docker Compose, Helm values, Spring Boot properties, MCP client configuration), what is missing, and the Camunda 8.7 property names that 8.8 renamed. Reads only; the answer holds names and places, never values. With environment it looks at one environment; with against it also lists what the other environment defines and this one lacks, which is a Pro feature. | Free |
drift | Compare the project's diagrams and decisions with what an environment has deployed, after the same normalisation, and say per resource whether it is in sync, ahead locally, ahead on the engine, only local, only on the engine, or changed on both sides. Reads only: nothing is deployed or written, and only environments penstock.yaml declares are asked. With against it also compares two environments with each other, which is a Pro feature. | Free |
evidence_build | Build an audit evidence pack of the project: the diagrams as SVG, the Check results, the recorded test results, the AI receipts (names and hashes only), what changed since a git ref, and a manifest with the SHA-256 of every file. It writes a zip or a folder inside the project and never holds a secret value. The seal is an integrity checksum, not a signature. Writes a file, so it needs Pro (Team in a pipeline). | Pro Team in a pipeline |
refactor_rename | Preview or apply the rename of a process variable, message, signal, error code, escalation, job type, topic, decision id, form key or process id across the BPMN, DMN, forms, element templates, configuration, tests and code of the project. Without apply it only returns the plan: every edit, and every place it refuses to touch with the reason. Applying needs the planId of that preview and refuses when the git tree has uncommitted changes unless force is true. | Free |
refactor_bulk | Preview or apply the renames of a mapping file in order, with the same plan, refusals and limits as refactor_rename. | Pro Team in a pipeline |
refactor_extract | Preview or apply moving a subprocess, or elements with one way in and one way out, into a new process file and replacing them with a call activity wired through variable mappings. It refuses, with the reason, when the selection is not safe to move. | Pro Team in a pipeline |
agents | List the Camunda 8 AI agents of a project: for each, the model and provider, the prompts, the tools with the parameters the model fills in (fromAi), the limits, the memory, the MCP clients it uses with whether their configuration is found, the tool filters, and what the agents rules found. Only names are returned, never secret values. | Free |
migrate_agents | Move the AI agent elements of a project from the Camunda 8.9 and earlier template versions to the 8.10 agent task and agent sub-process templates, using the migration rules the new templates declare. An element whose mapping cannot be proven is left untouched and listed with the reason. By default it is a dry run that previews the first 3 elements and writes nothing; pass write true to write, which is part of Penstock Pro. Files are replaced atomically and a symbolic link is never followed out of the project. | Free |
incident_to_scenario | Turn an incident of the project's engine into a scenario that reproduces it. Give the key of the incident or of its instance. The scenario starts the process with the instance's variables (anything that looks secret is replaced by a placeholder, and the names are listed), drives the path the instance took and ends on an incident of the same type at the same element. Reading and previewing is free and writes nothing. With write it saves the scenario next to the diagram's other scenarios; with run it also runs it on the engine of the project, which has to be marked for tests, and says whether it reproduced the incident; both are Pro. Writing never leaves the project or follows a symbolic link. | Free |
generate_templates | Make one REST connector element template per operation from an OpenAPI 3, Swagger 2.0 or Postman collection file: typed inputs from the parameters and request body, authentication from the security schemes as secrets placeholders, a result expression and error handling. Writes nothing unless write is true; the answer lists every template and whether it would be created or replaced. Writing never leaves the project or follows a symbolic link. | Pro Team in a pipeline |
create_diagram | Create a new BPMN diagram, DMN decision or Camunda form at a path that does not exist yet, in one atomic step; an existing file is never overwritten. The extension (.bpmn, .dmn, .form) says which. Without spec the file is empty. With spec it is built from a description of its content and checked before it is written: a file that fails the check with an error is refused. BPMN: spec has steps (elements in a line after the start event, each with element, name and optionally event, id and properties) or operations (as in edit_diagram). DMN: spec has hitPolicy, inputs (label, expression, typeRef), outputs (name, label, typeRef) and rules (when and then, one text for each input and output). Form: spec has fields (type, key, label, options, required). | Pro Team in a pipeline |
import_diagram | Import a diagram from another tool as BPMN 2.0: a draw.io, Visio, Signavio, Bizagi or Flowable file, or with from=modeler a Camunda Modeler project folder (a report of its templates, lint rules, settings, plugins and keymap). By default it only previews: it returns what was converted, kept and could not be mapped, and writes nothing. It writes only with write=true, a new file inside the project; an existing file is never replaced without force. Nothing in the imported file is ever run. | Free |
edit_diagram takes file, operations and the optional dryRun. The operations are the same contract as penstock edit --ops: add, connect, set, remove and move, which shifts an element by dx and dy. A business rule task names its decision with decisionRef on Camunda 7, Operaton and CIB seven, and with decisionId on Camunda 8. penstock edit <file> --schema prints the contract for the file's engine. The whole-project tools take project. The others take file.
Receipts and the scenarios argument
Section titled “Receipts and the scenarios argument”Whenever an agent changes project files through one of the writing tools (edit_diagram, layout_diagram, create_diagram, migrate_apply, migrate_agents, refactor_*, generate_templates, incident_to_scenario and the saving of a case by test_dmn), Penstock records what changed and returns it in the receipt field of the result: each file with a SHA-256 before and after, the diff in the diagram's own terms, the Check result before and after with the new findings named by rule and element id, and a verdict (verified, has new findings, or not verified with the reason). It holds names, hashes and ids, never file contents or secret values. With Penstock Pro, new Check errors are handed back to the agent in the tool result, up to ai.verify.attempts times (3 by default, 0 turns it off). The saved scenarios of a change run only with scenarios: true, and only on an engine marked deployment.forTests. See AI receipt and auto-repair.
The spec of create_diagram
Section titled “The spec of create_diagram”Without spec the file is empty, for the engine in penstock.yaml. name is the name of the diagram, the file name by default. description is the documentation of a BPMN process, or the description of a DMN decision; a form has none, and a description for one is refused. A spec that has an unknown key, or a value of the wrong kind, is refused with the place named, and nothing is written.
| File | The spec |
|---|---|
.bpmn |
Exactly one of two keys. steps is a list of elements in a line, each after the one before and the first after the start event. A step has element (one of task, user-task, service-task, script-task, send-task, receive-task, business-rule-task, manual-task, call-activity, sub-process, end-event, intermediate-catch-event, intermediate-throw-event, exclusive-gateway, parallel-gateway, inclusive-gateway or event-based-gateway) and the optional name, event (message, timer, signal, error, escalation, conditional or terminate), id (Step_<n> by default) and properties. operations is a list of the operations of edit_diagram, applied to the empty diagram. |
.dmn |
inputs, a list with expression and the optional label and typeRef; outputs, a list with name and the optional label and typeRef; the optional hitPolicy (UNIQUE by default, FIRST, PRIORITY, ANY, COLLECT, RULE ORDER or OUTPUT ORDER); and the optional rules, each with when (one text for each input, in order), then (one text for each output) and an optional description. typeRef is string (the default), number, boolean, integer, long, double, date, time or dateTime. |
.form |
fields, a list. A field has type: textfield, textarea, number, checkbox, checklist, radio, select, taglist, datetime, text or button. An input field has a key, unique in the form, and the optional label and required. A checklist, radio, select or taglist also has options, each with label and value. A text field has text. A button has label and submits the form. |
{
"file": "/work/shop/src/main/resources/ship-order.bpmn",
"spec": {
"steps": [
{ "element": "service-task", "name": "Reserve stock" },
{ "element": "user-task", "name": "Pack the order" },
{ "element": "end-event", "name": "Order shipped" }
]
}
}
Resources and prompts
Section titled “Resources and prompts”Besides tools, the server lists the diagrams, decision files and forms of the folders the client has open as MCP resources, each with its kind, and returns the text of one when the client reads it. Clients that show resources let you attach a diagram to a conversation without a tool call. Paths outside the open folders are refused, as for the tools. Without roots nothing is listed.
Two prompts are offered, both taking file: review_diagram asks the assistant to read a file, run the checks and list what to fix, most serious first, without editing; explain_process asks it to explain a process in plain language from its scenarios. Resources and prompts are free.
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.
A result is bounded. When it is longer than 100,000 characters it is cut and says The result was cut at 100000 of … characters. Ask for less: one process, or a smaller diagram.
Safety
Section titled “Safety”- The server runs on your machine. Nothing is sent anywhere by it. See Security and privacy.
- When the client gives roots, paths outside them are refused. Files that are not
.bpmn,.bpmn20.xml,.dmnor.formfiles are refused too, and so is a new file made through a link. - An assistant can change a diagram only with
edit_diagram,layout_diagram,migrate_apply,migrate_agentsand therefactor_*tools, make a new file only withcreate_diagram,import_diagram,generate_templates,incident_to_scenarioorevidence_build, none of which replaces a file without being told to, and write an image only withexport_imagewhen it passesout. The refactoring tools write only the plan they have just returned: applying needs itsplanId.run_scenarioswrites its traces under.penstock/runsand runs only on an engine marked for tests. Ask the assistant to usedryRunfirst, and keep your diagrams in Git so you can review the diff. A diagram that changed on disk while an edit was being made is never overwritten: the tool answers The diagram changed while the edit was being made, so it was not written over.
What you see
Section titled “What you see”- The assistant lists the tools. Paid tools show a note on what they need.
- A tool call returns JSON, or a plain error message that says what is wrong.
Common problems
Section titled “Common problems”- The assistant does not see the tools.
- Check the
commandandargsin the entry. Node.js 22.22.2 or later in the 22 line, 24.15.0 or later in the 24 line, or 26 and later must be on the PATH of the assistant. Runpenstock mcpby 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_diagramsprints 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.yamland no repository root above it. Runpenstock initthere. - A paid tool says it needs a licence.
- Sign in on the machine that runs the server:
penstock license login.