MCP server bridging Claude to OPM Flow, OPM Upscaling and ResInsight (Linux binaries under WSL, server on Windows).
18 tools with consistent naming (verb_noun pattern), good descriptions (avg 180 chars), and complete input schemas. All parameters typed and described. Error handling via _safe wrapper returns structured {ok, error, error_type}. Strengths: domain-specific clarity (deck_grep, flow_convergence_report), pagination support (list_cases, list_summary_vectors), actionable parameter descriptions. Weaknesses: output schemas not formally documented in code; no enum constraints on string parameters (e.g., keyword in restart_property accepts 'PRESSURE|SWAT|SGAS|SOIL' but not declared as enum); no explicit idempotency or dry-run patterns for destructive ops (run_flow, flow_cancel); error messages generic ('str(exc)') rather than recovery-guided.
Regex search across a deck AND its resolved INCLUDE tree (PATHS-aware). The deck-QC workhorse: ``deck_grep(deck, "^WCONPROD|^LIFTOPT", context=8)`` returns file, line number, and context for every keyword hit — including keywords that live in include files referenced via $ALIAS paths. Files larger than ~8 MB (bulk GRDECL arrays) are skipped and reported.
Numbered text slice of a deck (or one of its include files) — no WSL needed. Decks are plain ASCII; use this instead of host-shell head/sed when a client misdetects .DATA as binary. ``file`` selects an include file by path or bare name (matched against the resolved INCLUDE tree).
Cancel a running Flow job.
Summarise solver performance from Flow's INFOSTEP / INFOITER files. Requires the run to have been launched with ``--output-extra-convergence-info=steps[,iterations]`` (the default for :func:`opm_mcp.tools.flow.run_flow`). Reports total wall time by stage, Newton/linear iteration counts, time wasted on non-converged steps, and the worst timesteps by iteration count.
List recent Flow jobs known to this server.
Output schemas not formally documented. Tool descriptions state what is returned (e.g., 'returns case names, deck paths, whether results exist') but JSON Schema output definitions are absent from code. LLMs cannot plan downstream tool calls without knowing response field names and types.
String parameters lack enum constraints. restart_property 'keyword' accepts 'PRESSURE|SWAT|SGAS|SOIL' but is typed as plain string, not enum. convergence_info accepts 'steps,iterations' but not declared as enum. LLMs may hallucinate invalid values.
| Scored | Grade | Overall | Spec posture | Rubric |
|---|---|---|---|---|
| 2026-09-23 | C | 62 | 2026-07-28+ | v2 |
Return the tail of a Flow job's combined stdout/stderr log. ``grep`` (case-insensitive regex) filters the WHOLE log first and returns the last ``lines`` matching lines with line numbers — e.g. ``grep="will be shut|Problem:|Error:"`` extracts well-shut and solver events from a long run.
Check whether a Flow job is still running, with the latest progress line.
Scan a directory tree for simulation cases (.DATA decks and .SMSPEC results). The session opener: returns case names, deck paths, whether results exist, and modification times (newest first).
List summary vector keys in a case. Optional glob pattern (case-insensitive).
List wells declared in the deck at the first schedule step.
Field material-balance QC from summary totals. Returns OOIP/OGIP (initial in-place), cumulative production/injection, recovery factor, an **exact** oil mass-balance drift ``(FOIP0 - FOIPn - FOPT) / FOIP0`` (should be ~0), and a **surface** voidage replacement ratio (labelled as such — a true reservoir-condition VRR needs PVT FVFs, which this does not apply).
Report which OPM binaries and Python bindings the server can reach. Use this first when troubleshooting — it tells you whether ``wsl.exe`` is reachable, whether ``flow`` and ``ResInsight`` respond, and whether the ``python3-opm-common`` bindings import successfully inside the distro.
Per-layer statistics for a dynamic property at a UNRST report step. Parameters ---------- keyword : str ``PRESSURE``, ``SWAT``, ``SGAS``, or the derived ``SOIL`` (= 1 - SWAT - SGAS). report_step : int | None SEQNUM value to read. ``None`` = last available step. Returns overall stats, a per-K-layer table (pore-volume-weighted mean when INIT/PORV is available, else cell-count mean), and a coarse histogram.
Start an OPM Flow simulation in the background; returns a job id immediately. ``extra_args`` is a JSON array of flow flags, e.g. ``["--enable-tuning=true"]`` — a plain string is also accepted and split shell-style. At most OPM_MCP_MAX_PARALLEL jobs run at once — extra submissions are state="queued" and launch automatically as slots free. By default writes INFOSTEP/INFOITER diagnostics so ``flow_convergence_report`` works (``convergence_info="none"`` to skip). ``mpi_processes=N`` runs ``mpirun -np N`` for distributed solves.
High-level deck summary: phases, units, grid dimensions, wells, schedule length.
Translate a WSL path back to its Windows form.
Translate a Windows path to its WSL equivalent (``C:\\x`` → ``/mnt/c/x``).
Parse an ECLIPSE/Flow DATA deck and report keyword counts + parser issues.
Error handling returns generic exception strings. _safe wrapper catches all exceptions and returns {ok: false, error: str(exc), error_type: type(exc).__name__}. No recovery guidance (e.g., 'Try search_users() first' or 'Check path format'). LLMs cannot self-correct.
Destructive operations (run_flow, flow_cancel) lack confirmation or dry-run patterns. No explicit idempotency guarantees. Agents may accidentally launch duplicate simulations or cancel wrong jobs without a safety gate.
Parameter descriptions lack format/constraint details. run_flow 'extra_args' accepts 'JSON array or plain string' but no example format shown. restart_property 'report_step' accepts None for 'last available' but type is integer, not optional. Ambiguity invites invalid input.