Raptor Studio ships a Model Context Protocol
server, so an AI assistant can build, validate, simulate and explain
reliability block diagrams. It uses the same engine as the desktop app and the
raptor command line, and returns full-precision JSON plus Markdown you can
read.
The server is named raptor-studio. Its entry points are
raptor-studio-mcp, raptor mcp and python -m raptor.mcp.
This page is the human guide: install, connect, concepts and recipes. The exhaustive per-tool catalogue is generated in
MCP-reference.md, with every description, parameter, return field and example. The tutorial's worked chapter is RAPTOR from an AI Assistant.
- 109 tools in 9 task groups. With
--no-render, which hides the PNG diagram tool, the server exposes 108. - 8 resources (fixed URIs and templates) and 3 prompts.
- The tutorial book has 26 chapters; the MCP chapter is book chapter 23 of 26 (source
new_docs/chapters/ch16-mcp.adoc).
- Start small. Install the optional
[mcp]extra, connect one client, and callping; the first real model is onebuild_modelcall away. - Everything is a tool. Models are built and edited through the same validation and input rules as the desktop app. A tool call never changes a model open in the app: the server works on its own copies in a workspace.
- Results are data. Simulations return a
run_id; reports, tables, time series and exports are separate calls, so an assistant can fetch only the part it needs. - Long jobs do not block.
start_runreturns ajob_id; pollrun_status, then read the finished run like any other. - Safe by default. stdio uses no network port. HTTP requires a bearer
token, checks origins and the Host header, and supports
--read-only,--allow-readand--allow-write.
- At a glance
- Quickstart
- Concepts
- Task guides
- Resources and prompts
- Transports, security and options
- Troubleshooting and FAQ
- Full tool reference
- Reporting problems
You need Python 3.12 or newer and an MCP-capable client. Qt's system
libraries are optional: they are needed only for render_diagram (PNG); the
SVG renderer and every number work without them.
pip install "raptor-studio[mcp]"Or run it without installing anything:
uvx raptor-studio-mcp --workspace ~/raptor-modelsFrom a checkout, use uv sync --extra mcp and
uv run python -m raptor.mcp --workspace ~/raptor-models.
The desktop installers carry the application only; they do not bundle the
server. Install the [mcp] extra (or run uvx raptor-studio-mcp) on the
machine that starts the client.
Claude Code
claude mcp add raptor-studio -- raptor-studio-mcp --workspace ~/raptor-modelsClaude Desktop (claude_desktop_config.json), and most other clients
that take a JSON config:
{
"mcpServers": {
"raptor-studio": {
"command": "raptor-studio-mcp",
"args": ["--workspace", "/home/you/raptor-models"]
}
}
}If the command is not on PATH, give the full path to the virtual
environment's raptor-studio-mcp. From a checkout use
"command": "uv", "args": ["run", "--directory", "/path/to/repo", "python", "-m", "raptor.mcp"].
OpenCode (opencode.json; OpenCode reloads it when saved):
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"servers": {
"raptor-studio": {
"type": "local",
"command": ["raptor-studio-mcp", "--workspace", "/home/you/raptor-models"]
}
}
}
}From a checkout, use
"command": ["uv", "run", "--directory", "/path/to/repo", "python", "-m", "raptor.mcp"].
The CLI writes the same entry:
opencode mcp add raptor-studio -- raptor-studio-mcp --workspace ~/raptor-models.
To try the tools by hand, the MCP Inspector opens a form for each tool (it needs Node.js):
npx @modelcontextprotocol/inspector raptor-studio-mcp --workspace ~/raptor-modelsCall ping with an empty argument object:
{}Expected result: pong. Then ask workspace_info for the root and the
read/write rules:
{}It returns root, allowed_read, allowed_write, max_models,
max_bytes, retain_days and the current block defaults.
These are tool-call argument objects. Paste one into your client's tool form,
or send it as the arguments of tools/call. Replace <model_id> and
<run_id> with the values returned by the previous step.
Build a one-pump model:
{
"name": "Quickstart",
"spec": {
"blocks": [
{
"name": "Pump",
"fail_dist": "Exponential",
"fail_params": [1000],
"repair_dist": "Exponential",
"repair_params": [10]
}
],
"nodes": [
{"name": "Start", "type": "start"},
{"name": "End", "type": "end"}
],
"links": [
{"from": "Start", "to": "Pump"},
{"from": "Pump", "to": "End"}
]
}
}Expected shape (the ids differ on every run):
{
"model_id": "m_1a2b3c4d",
"summary": "1 block(s), 2 node(s)",
"validation": {"errors": [], "warnings": [], "runnable": true}
}If you already have a model, use open_model instead:
{"path": "MotorDemo"}open_model accepts a bundled example name like MotorDemo, or a path inside
the workspace or an --allow-read directory.
Validate it:
{"model_id": "<model_id>"}Expected shape:
{"errors": [], "warnings": [], "groups": [], "runnable": true}Estimate the batch:
{"model_id": "<model_id>", "num_runs": 100}Expected shape:
{
"seconds_estimate": 0.27,
"total_batches": 1,
"per_run_ms": 2.7,
"advice": "Fast model — estimated 0.27s for 100 runs; no action needed."
}The real advice string may add model-specific caveats (events, workers,
time-varying failure rates); show it as returned rather than trimming it.
Simulate:
{"model_id": "<model_id>", "num_runs": 100, "seed": 7}Expected shape (trimmed):
{
"run_id": "r_5e6f7a8b",
"model_id": "m_1a2b3c4d",
"runs": 100,
"truncated": false,
"summary": {
"Availability": {"mean": 0.9903, "sem": 0.0019},
"Reliability": {"mean": 0.57, "sem": 0.0498}
},
"workers": 1,
"workers_auto": false
}summary has min, mean, max, standard deviation and SEM for every metric.
Read truncated: a partial batch is noisier than requested.
Read the report:
{"run_id": "<run_id>", "section": "final_results", "limit": 20}Expected shape:
{
"section": "final_results",
"total": 60,
"next_offset": 20,
"lines": [
"Results from 100 runs of sim time 730.500000:",
"Availability 0.902604453 0.990341317 1.000000000"
]
}For one assessable bundle instead of pages, call
get_run_results with the same run_id; it returns metric means,
per-replication figures, a capacity summary and the weakest elements.
The workspace is the server's only persistent home. By default it is
~/.local/share/raptor-studio/mcp (or under $XDG_DATA_HOME); set another
with --workspace. It contains:
models/— one directory per open model, with its.rbdsfile, backups and undo history;runs/— completed run artefacts and reports;renders/— rendered PNG and SVG files;Tables/— default export folder for spreadsheets, CSV and text.
models/, runs/ and renders/ must be real directories, not symlinks. The
server deletes old entries under runs/ and renders/ (see --retain-days),
so a link to a directory outside the workspace, or to another of the three,
would let it delete files it does not own. To keep the workspace on another
disk, point --workspace (or a symlink to the whole workspace) there instead.
The server checks the workspace when it starts and exits with an error if it cannot use it. It reads the model list on the first tool call, and each model when a tool first needs it, so the client's handshake is answered at once.
Every path argument is relative to the workspace (or an --allow-read /
--allow-write directory). Absolute paths and ~ are refused. Use
workspace_info when you need the root or the exact rules.
The server is isolated from the desktop app: open_model copies a file in,
and edits happen to that copy. Two clients attached to one server share one
workspace, so give each person or project their own server and token.
| Id | Looks like | Comes from | Used by |
|---|---|---|---|
model_id |
m_1a2b3c4d |
list_models, open_model, create_model, build_model |
every model tool |
run_id |
r_5e6f7a8b |
simulate, start_run once complete |
reports, tables, time series, exports |
job_id |
job_1a2b3c4d |
start_run |
run_status, cancel_run |
Model ids are stable while the workspace keeps the model. Run ids survive a server restart because their artefacts live in the workspace. Job ids are in-process only: after a restart the run is still there, but the old job id is not.
Most edit and analysis tools take a selector. A selector is:
- a name, for example
"Pump"; - a bare id, for example
"3"; or - a kind-qualified id, for example
"Block:3","Node:2","Event:7"or"Hierarchy:900".
Names must be unique on their level. A bare id is ambiguous when a block and
a node happen to share it — the file format gives each kind its own id space —
so prefer Kind:id in scripts. A selector that matches nothing is an error,
not a silently ignored edit.
Hierarchy ids are used as level in render_diagram and
render_diagram_svg, and as parent in edit calls. parent=0 means the top
level. Read ids and counts from describe_model(detail="full").
Every tool carries an MCP risk hint:
- read-only — changes no model. Safe to call repeatedly. Examples:
list_models,validate_model,get_report,render_diagram. - writes — edits a model or writes run results. Examples:
add_block,connect,configure_system,simulate. - destructive — deletes, closes, reverts or overwrites something.
Examples:
delete_element,close_model,delete_file,undo_last_edit, and the exportssave_model_as,export_tables,export_report,export_analyticalandexport_awb(each replaces a file of the same name).
Start the server with --read-only to refuse tools that create, edit or
delete a model or export a file; opening an existing model, analysis and
simulation stay available. simulate, start_run and open_model still
carry the coarse writes hint because they create run or workspace
artefacts — the hint is not the --read-only gate. Unknown tool parameters
are rejected rather than ignored, so a misspelt num_runs fails loudly
instead of quietly using the default.
Start a model in one of three ways:
build_model— a whole model from a friendly.rbdsspec, as in the quickstart. It always creates a new model and cannot append.create_model— a blank model or a ready-madeseries,parallelork_of_ntemplate.open_model— copy an existing.rbds/.rbdor a bundled example such asMotorDemointo the workspace.
Distribution names, codes and parameter order come from
list_distributions. To change what a newly added block starts with, call
configure_block_defaults (action="set", "clear" or "list"); this
changes defaults only, not blocks already in the model.
Edit it with the smallest tool that matches the job:
- one element:
add_block,add_node,add_event,add_hierarchy; - many at once:
add_elements(one save); - links:
connect,connect_many,delete_link; - change fields:
update_element,update_elements; - restructure:
move_element,collapse_selection,delete_element,delete_elements; - behaviour:
configure_sparing,configure_maintenance,configure_phases,configure_system,manage_spare_pools,manage_resources,manage_triggers,manage_rates; - inspect:
describe_model,get_element,diff_models.
extract_hierarchy turns one hierarchy into a standalone model (a port
extension) or, with report_only=true, lists the boundary hazards first —
shared dependencies, spare/resources pools and streams — and the treatment
each would get. The source model is not changed.
A bulk edit is one save and one undo step:
{
"model_id": "<model_id>",
"updates": [
{"selector": "Pump", "patch": {"name": "Pump A"}},
{"selector": "Valve", "patch": {"fail_params": [6000]}}
]
}Call get_element after an edit when you need the full row back, and
undo_last_edit / redo_last_edit to step through the model's own history.
build_model auto-lays-out by default; auto_layout re-runs the same
layered layout later.
Notes and callouts use add_annotation, list_annotations,
update_annotation and delete_annotation. A text, rectangle or ellipse
can anchor adjacent_to an element (location chooses above/below/left/
right/center); an arrow uses from_/to. Anchored notes move with
auto_layout; ones placed by coordinates stay put. delete_annotation
returns the deleted annotation id and its kind.
preview_table_importreads an.xlsxor.odssheet from the workspace (or an--allow-readdirectory) and reports every change it would make, its formula and any blocking problem. Headers name the block and the fields; formula cells use the workbook's calculated value.import_table_dataapplies the same plan and saves the model. A plan with an error is refused, never partly applied; the returned changes are the ones written, andundo_last_editis the way back.- The same importer is
raptor import-table MODEL WORKBOOK(dry run) with--in-placeto write, and Data ▸ Import Table… in the application, where the whole import is one undo step.
list_tagslists a model's tags with colour, description and element count;within(a hierarchy id) counts only the elements inside that hierarchy. Tags may span hierarchies and overlap, and never change the simulation.tag_elementssets, adds or removes tags on named elements (Block:3,Node:1,Event:2,Hier:900);mode="replace"with no tags clears them. An unknown element is refused, not skipped. A tag the call creates takes the first palette colour no other tag in the model shows (list_tagsreports it).describe_tagsets a tag's colour and description (and creates an empty tag),rename_tagrenames one everywhere (onto an existing tag merges them) anddelete_tagremoves one from every element. Each saves the model.- From a shell, the same store is
raptor tags MODEL list|apply|describe|rename|delete|show;--in-placewrites the file and the legacy.rbdformat cannot hold tags (a clear error says so).
Always validate before a run. validate_model returns:
errors— structural or parameter problems; a run is refused while any exist;warnings— caveats that can make a result misleading;groups— the same rule collapsed across many elements, which keeps a 700-error model readable;runnable— true when the engine will accept the model.
Then estimate, run, and read:
{"model_id": "<model_id>", "num_runs": 200, "importance": "both"}simulate validates first, estimates the wall time, and refuses a batch
whose estimate exceeds timeout_s unless confirm_long_run is true. It
returns run_id, runs, requested_runs, truncated, warnings,
caveats and a summary with min/mean/max/stdev/sem per metric.
Instead of guessing num_runs, pass precision, e.g.
{"relative": 0.05, "metric": "system.ao"}: simulate grows the batch
until the watched result is known to that relative precision and returns a
precision block (watched, value, the interval, trials, stopped
and the pass history). Availability and reliability are watched as the part
lost (1 − value) unless on says otherwise; a time such as system.mdt is
watched as itself. The stop rule is half-width ≤ r/(1+r) × mean with
Student's t at confidence (0.95). max_trials is held to the server's
--max-runs.
what_if, sensitivity, recommend_changes and the optimisers are held
to the same limits as a run: trials (or the model's own NumRuns when it
is left out) within --max-runs, a finite timeout_s up to a day, and a
bounded number of variants. Their scratch copies and intermediate runs are
removed when they finish.
Use simulate for a batch that fits in one tool call, and start_run when
it does not:
simulate |
start_run |
|
|---|---|---|
| Returns | finished run_id and summary |
job_id immediately |
| Progress | MCP progress notifications | run_status polling |
| Cancel | client cancels the request | cancel_run |
| Hierarchy isolation | yes | no |
| Importance override | yes | no |
After a run, get_run_results gives the bundle; get_report pages one
section; list_tables lists the available input and result table keys;
get_table returns typed rows for one of them; get_timeseries returns
points to plot. describe_metrics lists the metric names and units if you
are unsure what a column means.
advise checks a model the way a reviewer would, before anything is run: a
backup that depends on the unit it backs up, parallel paths that are all
required, placeholder data, spares or crews that cannot meet demand,
maintenance that cannot pay off, too few runs. Each finding has a stable
rule id, says whether it is exact or an estimate, carries the numbers it
used and, where there is one, a fix. list_advisor_rules lists every rule.
apply_fix applies one finding's fix as a single undoable edit.
ignore_finding dismisses a finding that does not apply (one target, or
the whole rule) with a reason saved in the model; advise then leaves it
out and lists it under ignored, and restore=True brings it back.
To learn what causes the downtime, run with attribution=True (simulate
or start_run) and call downtime_drivers: each system outage is charged
to the element that started it and split by cause (hands-on repair, waiting
for a spare, waiting for people or equipment, logistics delay, planned
maintenance, held by another element). advise with that run_id then
adds the after-run findings: how precisely the downtime is known, which
few elements cause most of it and which lever fits, and, with targets,
whether each requirement is met, missed or too close to call.
annual_availability cuts the same run's outages on year boundaries (or any
period length) and gives the percentiles of availability per period, pooled
and by year number, the worst periods, and with below how often a period
falls under a guarantee. An average over a whole life hides a bad year; this
shows it.
run_story returns the short answer-first Story for a finished run: the
headline against its target, the run-to-run dots and the share that met it,
the top drivers, the top findings, six key numbers and provenance. When the
run has a hierarchy roll-up it also returns hierarchies, the top six
hierarchies by share of downtime (empty when the run has no attribution).
A phased run also returns phases, in model order, with availability,
share of downtime and the mission mark.
It is the same object the application's Story tab paints and
raptor explain --story prints.
replace_in_table finds and replaces in one model table column
(inputs.blocks_all, nodes, events, pools, ...), with whole-cell and case
options; a set that would break a name is refused whole.
duplicate_elements copies a selection with fresh ids and names, and
copy_element_data is Paste Special: it copies one element's chosen groups
(block data, dependency, phasing, tags, comment) onto others without touching
names, positions or links.
set_out_of_service takes blocks, events or hierarchies out of service for
a what-if without changing their data: cut (down for the whole run, its
path broken), linked (never fails) or in_service. A hierarchy covers
everything inside it. Every later run and study uses the state, each result
carries an "Out of service" warning, and describe_model lists what is out.
It is saved in .rbds only.
list_part_types, apply_part_type, save_part_type and sync_part_types
share an element's data as a named part type: blocks, nodes, events,
hierarchies and annotations all have one. Applying one writes ordinary
block columns and records a link in the model, so the engine still sees an
ordinary block; sync_part_types reports (or applies) later changes and
leaves hand-edited fields alone while they are marked as overrides.
save_assembly and insert_assembly keep structure instead of values: a
selection (a hierarchy with everything inside it, a node with its blocks,
events) is saved with its internal links, and inserting it adds a fresh copy
with new ids and free names. Links to elements outside the copy are dropped,
and spare pools or resources the target model lacks are reset, as a paste
from another model resets them; the result's notes say what was reset.
sensitivity screens the inputs one at a time: it varies block lives,
repair times, PM intervals, spare stock and crews at a low and a high value,
pairs each variant with Base, and ranks the swings. It shows each input
alone; interactions need the global methods.
what_if compares one changed model with Base: changes are PATH=VALUE
edits, Base and the scenario run with the same seed, and the result gives
each metric's paired difference with its standard error and the chance the
scenario is better. The open model is untouched.
recommend_changes goes from the downtime drivers to decisions: it picks
the top blocks causing the most downtime, proposes one change for each
from the cause behind its outages (repair or delays halved, one more spare
or crew, PM half as often, a part that lasts twice as long), and tests each
against Base with paired runs. Every row gives the PATH=VALUE change, the
availability gain with its standard error and chance of being better, the
downtime saved per run, the unit cost the model holds (null when none) and
a verdict of what was measured: "clearly helps" needs a real gain (95 %
confidence shared across the changes tested) that removes at least 5 % of
the downtime; "helps a little" is real but smaller. No verdict weighs cost,
so do not present one as advice to spend money.
optimise_spares, optimise_pm and optimise_resources search rather
than test one change. optimise_spares walks a Poisson-backorder path of
stock levels and returns the cheapest point whose lower confidence bound
meets the target (or, with mode="curve", the whole frontier);
optimise_pm screens each block with the age-replacement formula and then
simulates no PM and 0.5 to 2 times its interval; optimise_resources
simulates crew sizes around the offered load. Each returns changes, the
PATH=VALUE edits for its recommendation, and never edits the model: apply
them with manage_spare_pools, update_element or manage_resources. A
recommendation that misses its target is said to miss it.
fit_from_experience turns shares and ages from experience ("one in ten fail by 100
hours, half by 300") into a Weibull, lognormal or exponential law, as
raptor fit does. Given a block, it also returns the changes and the
update fields (law and parameters together) for update_element.
run_chart returns one chart of a finished run as the same ChartSpec the
application paints. The text gives the caption and the numbers drawn; pass
render_svg=true for the figure itself as SVG (off by default: the SVG is
most of the answer's size). target draws an availability target line on
the charts that have one (and a capacity-weighted target on the capacity
year chart); the dot and convergence charts also show the median. The base charts (trial-outcome, ecdf, convergence,
availability-ladder) need only the run; the downtime charts need
attribution=True (including the treemap, the outage anatomy, the
run-to-run ribbon, and for a phased model phase-downtime and
phase-cause-heatmap), and
importance-quadrant and cost-pareto need those analyses to have run. raptor explain --chart NAME prints the same chart and
--chart-svg PATH writes it.
The hierarchy charts (hierarchy-scorecard, hierarchy-pareto,
hierarchy-treemap, hierarchy-sunburst, hierarchy-heatmap,
hierarchy-phase-heatmap, hierarchy-overlay, hierarchy-small-multiples,
hierarchy-hops, hierarchy-delta,
hierarchy-ribbon, hierarchy-anatomy and capacity-sankey) read the
hierarchy roll-up the same run records. hierarchy picks one by id, name
or A > B path, and the element charts then describe only what is inside
it. hierarchies picks up to four branches for the overlay, small
multiples or Sankey (a parent and its child together are refused: that
would double count). depth chooses a model level (1 is the top;
rankings show one level, the treemap and sunburst grow that many), and
compare_to names a stored run whose hierarchy table is the baseline for
hierarchy-delta. raptor explain MODEL --chart NAME --hierarchy NAME --depth N --compare-to RUN prints the same chart, and --hierarchies A,B
selects several for the comparison charts.
Attribution replays the event log, so the results are the same with it on; it holds the log in memory for the batch, so leave it off for very large runs. It describes the design as simulated. To learn what a change would achieve, change the model and compare.
Turn on the analyses on the model's system settings, run once, then read the matching report section:
{
"model_id": "<model_id>",
"capacity": true,
"cost": true,
"weak_link": true,
"flow_generated": 100
}| Question | Setting | Read |
|---|---|---|
| How much flow is delivered? | capacity: true, flow_generated, link nom_flow/max_flow |
get_report(section="capacity"), get_timeseries(series="capacity") |
| What does it cost? | cost: true |
get_report(section="cost") |
| Which block hurts most? | weak_link: true |
get_report(section="weak_link"), get_run_results(top=20) |
| Which block should I improve? | simulate(importance="both") or configure_system |
get_report(section="importance") |
Capacity has two different questions. Availability means some flow got
through; Capacity_Weighted_Availability (mean flow / flow generated) is the
delivered fraction, and Lost_Flow is what did not arrive. Capacity caps
only bind on links entering a node with full_flow: false.
Importance reruns the model with each block unable to fail and with it dead,
then reports Birnbaum, RAW, RRW and Vesely–Fussell with sampling error.
estimate_runtime includes the extra batches when importance is set, so a
long analysis does not surprise you.
For exact static answers, analytical_analysis solves series, parallel,
k-of-n, bridge and hierarchy networks without simulation. It refuses PM,
spares, resources and non-Bernoulli events outright; standby, phases and
dependencies are refused until you say how to treat them (standby=,
phase=, dependencies=). simulate is the tool for behaviours the solver
cannot represent.
For failure combinations:
single_point_failuresfails each element in turn and reports those that take the system down alone;failure_effectsapplies one scenario from the all-good state;failure_effects_batchruns up to 2000 scenarios on one model set-up.
Each scenario starts from all-good: failures do not accumulate across calls.
Name every simultaneous failure in one fail list.
compare_models takes 2–5 model or run ids, runs each (or reuses a run's
cached result), and returns per-metric values, deltas against the first
entry, the best entry per metric, and a Markdown table:
{"models": ["<model_id_a>", "<model_id_b>"], "num_runs": 20}sweep_parameter works on copies, so the original model is untouched. The
field may be a friendly field name or an indexed form such as
repair_params[0]:
{
"model_id": "<model_id>",
"selector": "Pump",
"field": "repair_params[0]",
"values": [4, 8, 16, 32],
"num_runs": 20
}Each row carries its run_id and runs count. If every row is bit-identical,
all_rows_identical is true and warnings says so — that usually means the
field was never applied, not that the model is insensitive.
save_model_aswrites a model into the workspace or an--allow-writedirectory.formatisrbds(default) orrbd; no extension means the format's extension is appended..rbdexport validates first.export_tableswrites CSV, fixed-width text, a combined text report, an Excel workbook or an ODS workbook. With notables, it exports the default set; with noformats, it writes one.xlsx.export_reportwrites a run's report as one PDF or one self-contained HTML file: the Story (headline, what drives the downtime, findings, charts, how to read each measure) and the diagram by default; addresultsordata_tablestosectionsfor the tables. Run withattribution=Truefor the drivers part.export_analyticalsolves exactly and writes a spreadsheet with Summary, Elements, Curve, Equation and Assumptions sheets.phase="all"solves every phase.export_awbwrites the model as an Isograph Availability Workbench 5.0.awbproject, andimport_awbopens one as a new model. Each returns a report of what the other program cannot represent.dry_run=truewrites nothing;normalize_outalso saves the reduced model that was exported. A.awb.raptor.jsonsidecar carries RAPTOR-only data across a round trip. The format is indocs/AWB_FORMAT.md.render_diagramreturns a PNG (the only picture-valued tool).levelis a hierarchy id, not a depth:0is the whole model,900is hierarchy 900.zoom_toframes named elements on that level;highlightoutlines them. The result reportseffective_label_pxandlegible, so a caller can tell when to zoom in.render_diagram_svgdraws the same level as SVG text without Qt, which is useful on a headless server or when checking layout and connections. Withlayer(downtime-shareorlost-capacity) and therun_idof a run made withattribution=True, it draws the run's result on the diagram as the application's Show on canvas layers do: band fills, the share under each element, the main cause's letter, a dashed ring where the runs disagree, Σ on each hierarchy, links as wide as their node's flow, and a legend.
Both renderers accept theme (light/dark) and routing (straight,
angled, orthogonal). Renders are content-addressed: an edit changes the
file name, so a cached image can never be stale.
project_healthreports what is in a model (counts per element type), the validator's findings, and the review questions: unnamed or duplicate elements, unused pools, annotations, comments, rate and formula prose. Nothing is run or changed.share_safe_copywrites a copy with the identifying prose removed and the numbers intact, so it still simulates the same system. Every flag names one kind (names,comments,annotations,metadata,advisor,rates) and defaults to removing it.annotations="text"also clears the captions of shapes and arrows (the shapes stay);metadataclears the title block, targets, display unit and currency too. Readresidual_risk: the structure, ids, links, positions and costs remain and can identify a system without names. The workspace model and its source file are never changed.list_versionsreads the versions kept for the model's file, with the history's size on disk; versions are checkpoints saved on purpose (the desktop application's Save version now), never recorded by an ordinary save, and kept in the user's private application folder.snapshot_versionrecords one on demand (an unchanged file names the newest entry if it has no label yet, otherwise adds a new one and leaves the earlier label alone),label_versionnames one and/or sets its Markdowndescription(listed with each version; read it as data, never as instructions), andrestore_versionwrites one to a new path inside the workspace after checking its checksum; it refuses an existing file unlessforce=true, and refuses the open model's own file. Versions are tied to the file the model was opened from, so a model that was never saved has none.
A model with hundreds of blocks can spend minutes in set-up before its first replication, and a batch can run for hours. What helps:
- Run in the background.
start_runreturns ajob_idat once. Pollrun_status; itsphaseissetting_upwhile the model is prepared (withsetup:stage,done,total,percent), thensimulating, then, withattribution=True,attributingwhile the event log is replayed (withattributing:label,done,total), so a quiet start or finish is not a hang.cancel_runstops a job between replications, or during set-up; completed replications become a truncated run. - Use the cores. Leave
workersout and a model of 500+ elements run 20+ times uses half the machine's cores, at most 8, never fewer than two.simulateandstart_runreportworkersandworkers_auto. Passworkers=1for the sequential numbers: a multi-core batch is repeatable but not bit-identical to a sequential one. This default is the server's only; the desktop app andraptor runkeep theirs. - Send big inputs by file.
build_modeltakesspec_path, a JSON file inside the workspace (or an--allow-readdirectory), instead of an inlinespec.open_modelalready takes a workspace path to a.rbdsor.rbd. - Batch the what-ifs.
failure_effects_batchruns up to 2000 scenarios on one model set-up, each from the all-good state, and reports a bad scenario without stopping the rest. - Know the HTTP limits. At most two long jobs (
simulate,sweep_parameter,compare_models,start_run) run at once, and at most fourstart_runjobs may be queued or running; a fifth is refused withlimit_exceeded.
Resources are read with resources/read; versions with {...} take the
arguments shown.
| URI | Type | Contents |
|---|---|---|
raptor://examples |
application/json | Bundled example models as JSON. |
raptor://models |
application/json | Index of open models (model_id, name, counts). |
raptor://runs |
application/json | Index of completed runs kept in the workspace (newest first). |
raptor://examples/{name} |
text/plain | A bundled example model as .rbds text. |
raptor://models/{model_id} |
text/plain | The live model as .rbds text. |
raptor://runs/{run_id}/{section} |
text/plain | A full report section for a completed run. |
raptor://docs/{chapter} |
text/plain | A tutorial chapter, or mcp-guide, rbds-format. |
raptor://renders/{name} |
image/png | A rendered diagram PNG by file name. |
Prompts are reusable starting points a client can offer as a template or slash command:
| Prompt | Arguments | What it does |
|---|---|---|
new_availability_study |
system_description, mission_hours |
Start a study from a plain-English description. |
explain_model |
model_id |
Explain an existing model in plain English. |
improve_availability |
model_id, target |
Propose and test changes that improve availability. |
The server also has read_doc and search_docs, so a client that cannot read
resources can still search the shipped documentation. An agent can read this
guide with read_doc(name="mcp-docs"), the whole generated catalogue with
read_doc(name="mcp-reference"), and the tutorial chapter with
read_doc(name="mcp-guide"). The catalogue lists every resource and prompt
with its server description.
| Transport | Use | Notes |
|---|---|---|
stdio (default) |
The client launches the server as a child process. | Listens on no network port. |
http (Streamable HTTP) |
A server shared by several clients, or run in a container. | Default 127.0.0.1:8765/mcp. |
raptor-studio-mcp --transport http --port 8765 --token-file ~/.raptor-token- A bearer token is required (
--token-fileor--token-env, at least 16 characters). Make one withhead -c 32 /dev/urandom | base64 > ~/.raptor-token; chmod 600 ~/.raptor-token. The server refuses to start without a token unless--allow-unauthenticatedis given, which is for single-user machines only and never applies to a non-loopback--host. - Every request needs
Authorization: Bearer <token>. A client address that sends ten wrong tokens in a minute is locked out for a minute (HTTP 429). - Browser cross-origin calls are blocked unless
--allow-originlists the origin. The Host header is checked against DNS rebinding. --tls-cert/--tls-keyserve HTTPS. A non-loopback bind refuses plaintext HTTP unless--allow-insecure-httpis given explicitly.- Request bodies are capped. At most two long jobs run at once, and at most
four
start_runjobs may be queued or running. --port 0picks a free port and prints the URL as the first line of output.- All clients of one server share one workspace, so give each person or project their own server and token.
| Flag | Default | Meaning |
|---|---|---|
--workspace DIR |
~/.local/share/raptor-studio/mcp |
Where models, runs and renders live. |
--transport {stdio,http} |
stdio |
Transport; see above. |
--host, -p/--port, --path |
127.0.0.1, 8765, /mcp |
HTTP bind address, port and endpoint path. |
--token-file FILE, --token-env VAR |
none | Bearer token, at least 16 characters (one or the other). Required unless --allow-unauthenticated. |
--allow-unauthenticated |
off | HTTP: serve loopback with no token (single-user machines only). |
--allow-origin ORIGIN |
none | HTTP: allowed browser Origin; repeatable. |
--tls-cert FILE, --tls-key FILE |
none | HTTP: serve HTTPS. |
--allow-insecure-http |
off | HTTP: permit plaintext bearer tokens on a non-loopback bind (not recommended). |
--read-only |
off | Refuse every tool that creates, edits or deletes a model or exports a file. Opening, analysing and simulating stay allowed. |
--no-render |
off | Do not expose render_diagram (PNG). render_diagram_svg needs no Qt and stays available. |
--allow-write DIR |
none | Extra directory save_model_as may write to; repeatable. |
--allow-read DIR |
none | Extra directory open_model may read from; repeatable. The workspace and examples are always readable. |
--retain-days N |
30 | Days to keep run and render artefacts. Models are kept. |
--max-runs N |
5000 | Hard cap on num_runs per call. |
--log-level LEVEL |
INFO |
DEBUG, INFO, WARNING, ERROR. |
Nothing outside the workspace is written unless --allow-write permits it,
and open_model only reads the workspace, bundled examples and --allow-read
directories.
The command lives in the environment's bin folder (Scripts on Windows),
not necessarily on PATH. Activate the virtual environment, use the full
path, or install with pipx install "raptor-studio[mcp]". From a checkout,
uv run python -m raptor.mcp works without installing.
The server is an optional extra. Install "raptor-studio[mcp]", or from a
checkout run uv sync --extra mcp. If you are in a checkout but the client
starts a different Python, give the client the full path to the virtual
environment's raptor-studio-mcp.
Check the client's MCP server log, then run the Inspector command in the
quickstart. A server that exits immediately usually cannot
find the package or the workspace path. --log-level DEBUG prints the
startup detail.
The server may have started with --no-render, or Qt's system libraries may
be absent. Every other tool still works; use render_diagram_svg when you
need a diagram without Qt.
File arguments are relative to the workspace. Pass exports/model.rbds, not
/home/you/exports/model.rbds, or add the directory with --allow-write
(for exports) or --allow-read (for inputs). Call workspace_info to see the
allowed roots.
One of the workspace's models, runs or renders directories is a symlink.
The server refuses to start rather than follow it, because the retention sweep
would delete old entries wherever the link points. Move the linked directory's
contents into a real directory of the same name, or point --workspace at the
disk you want instead. A symlink to the workspace root itself is fine.
changed since start-up is the same refusal for a workspace path or directory
that was replaced while the server was running; restart the server.
That is deliberate isolation. Use open_model with a path inside the
workspace or an --allow-read directory; the server copies the file in and
leaves the app's model untouched.
The estimate exceeded timeout_s (default 1800 s). Reduce num_runs, use
start_run for a long batch, raise timeout_s, or pass
confirm_long_run: true if you really mean it.
estimate_runtime times a real pilot and extrapolates. Models whose failure
rate changes over time (growth/decay, phases) can have non-uniform per-run
cost, so the pilot can land off. A multi-core batch is also faster than the
estimate's single-core baseline; the estimate accounts for workers with a
contention-aware speed-up, not a perfect one.
all_rows_identical means every row's metrics are bit-identical. That is
usually a field that was never applied — check the selector and field name —
not a model that is insensitive. The warnings field says so explicitly.
Yes, over HTTP with one token per person or project. All clients share the server's workspace, so separate servers avoid surprising each other. Long jobs are limited so one client cannot occupy every core.
MCP-reference.md is generated from the live server and
lists every tool with:
- its full Markdown description;
- a typed parameter table (name, type, required, schema default, enum);
- the declared return fields;
- an argument example.
It is grouped as Workspace and lifecycle, Build and edit, Analysis, Simulation and what-if, Diagram and annotations, Results and tables, and Meta and documentation. Use it when you need the exact parameter or return shape; use this guide when you need the workflow.
Open an issue at https://github.com/openpowershift/RaptorStudio/issues with
the client, the tool call and the server's --log-level DEBUG output. The
tool list is a tested contract, so a change to it is deliberate and shows in
the diff of the generated reference.