opm-mcp
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@opm-mcpRun the SPE1 benchmark case and show the results"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
opm-mcp
A Model Context Protocol (MCP) server that gives Claude direct access to the Open Porous Media reservoir-simulation stack:
OPM Flow — black-oil and compositional reservoir simulator (ECLIPSE-compatible).
ResInsight — 3D viewer and post-processor.
OPM utility binaries —
opmpack,opmhash,summary,convertECL,compareECL.OPM upscaling (optional
opm-upscalingpackage).
The server runs on Windows so Claude Code / Claude Desktop can spawn it
natively, but it delegates every Linux-only binary to an Ubuntu distro under
WSL2. Result files (UNSMRY / UNRST / EGRID / INIT) are parsed natively on
Windows via resdata.
Architecture
+-------------------+ +----------------------+
| Windows | | WSL2 Ubuntu-24.04 |
| | | |
| Claude <-----> | wsl.exe | flow |
| opm-mcp (Py) | -----------> | ResInsight |
| resdata | | python3-opm-common |
| (UNSMRY etc.) | | convertECL/etc. |
+-------------------+ +----------------------+
^ |
| reads result files via UNC / |
+--- /mnt/c/... path translation -----+Prerequisites
On Windows:
Python 3.11+ (tested with 3.13).
WSL2 enabled, with an Ubuntu-24.04 distro available (
wsl -l -v).
In the WSL distro, install OPM:
sudo apt-get update
sudo apt-get install flow resinsight python3-opm-common python3-opm-simulators
# Optional, for the upscaling tools:
sudo apt-get install opm-upscaling
# Optional, for fully headless ResInsight rendering without WSLg:
sudo apt-get install xvfb mesa-utils libgl1-mesa-driInstall
git clone https://github.com/ojaogezi/opm-mcp.git
cd opm-mcp
py -m pip install -e .This installs the opm-mcp console script and pulls in mcp[cli], resdata,
pydantic and numpy.
For development:
py -m pip install -e ".[dev]"
pytestRegister with Claude Code
claude mcp add opm --scope user -- py -m opm_mcp.serverOr, if you prefer a JSON config (Claude Desktop / cursor / etc.), add this to
your mcpServers block:
{
"mcpServers": {
"opm": {
"command": "py",
"args": ["-m", "opm_mcp.server"],
"env": {
"OPM_MCP_WSL_DISTRO": "Ubuntu-24.04"
}
}
}
}Configuration (env vars)
Variable | Default | Purpose |
|
| Name of the WSL distro to run OPM in. |
|
| Binary name / absolute WSL path for Flow. |
|
| Binary name / absolute WSL path for ResInsight. |
|
| Where job logs and artefacts go. |
|
|
|
|
| How many recent jobs to remember in-memory. |
|
| Default line count for |
Tool reference
Environment & paths
Tool | Purpose |
| Probe |
| Translate |
| Reverse translation. |
Deck inspection (uses python3-opm-common in WSL)
Tool | Purpose |
| Parse a DATA deck, report keyword counts. |
| Phases, units, grid dims, well/group counts, schedule length. |
| Per-well info at schedule step 0. |
OPM Flow (background jobs)
Tool | Purpose |
| Start a Flow job; returns a |
| Current state + last progress line ( |
| Tail of combined stdout/stderr. |
| Cancel a running job. |
| List recent jobs (most recent first). |
Result readers (native Windows via resdata)
Tool | Purpose |
| All summary keys (FOPR, WBHP:, GOPR:, ...). |
| Time series for one or more keys, with per-vector units + elapsed days, downsampled. |
| Cumulative production/injection, FPR, final rates (with units). |
| Per-well WOPR/WGPR/WWPR/WBHP/WOPT/etc. min/max/last. |
| EGRID dims, active count, INIT property stats. |
| UNRST report step list + keywords. |
| Diff field totals between two cases. |
Native plotting (matplotlib — no ResInsight/OpenGL)
Tool | Purpose |
| Render summary vectors to a PNG, auto twin-axis by unit, date or days x-axis. The fast path for rate/pressure/cumulative plots. |
Reservoir-engineering analytics
Tool | Purpose |
| OOIP, recovery factor, exact oil mass-balance drift, surface VRR. |
| Parse INFOSTEP/INFOITER: wall time by stage, wasted (cut) steps, worst timesteps, residuals. |
| Per-layer stats (PV-weighted when INIT present) for PRESSURE/SWAT/SGAS/SOIL at a report step, plus histogram. |
For PVT, SCAL/relative-permeability fitting and deck-physics validation, this server defers to the pyrestoolbox MCP if you have it connected, rather than duplicating those calculators.
Deck editing (sensitivities / history matching)
Tool | Purpose |
| Write a NEW deck with safe overrides ( |
ResInsight automation (CLI command files)
Tool | Purpose |
| Open a case, render the default 3D view, save PNG. |
| Export an LAS well log for one well. |
| Launch interactive ResInsight (uses WSLg on Windows 11). |
If ResInsight fails with MESA: error: ZINK ..., pass
force_software_gl: true or install xvfb and libgl1-mesa-dri in WSL.
OPM utility binaries
Tool | Purpose |
| Toggle formatted/unformatted ECL output files. |
| Diff two result files within tolerances. |
| Flatten a deck + INCLUDEs into one file ( |
| Keyword-level deterministic hash ( |
| Text summary table via the OPM |
| Detect whether |
| Generic passthrough to |
Bigger test cases
This repo only ships the tiny examples/SPE1_MINI.DATA. For real benchmark
decks (Norne, SPE9, SPE10, Equinor gas-lift demos, etc.) use the upstream
OPM/opm-tests repository — they're
distributed under the Open Database License (ODbL 1.0) and shouldn't be
re-vendored here. Clone alongside:
git clone https://github.com/OPM/opm-tests.git C:\models\opm-testsThen point the MCP tools at any deck under that tree, e.g.
C:\models\opm-tests\norne\NORNE_ATW2013.DATA.
Smoke test
# 1. Validate a small example deck
py -c "from opm_mcp.tools import deck; import json; print(json.dumps(deck.summarize_deck(r'C:\Users\ogezi\RCI\opm-mcp\examples\SPE1_MINI.DATA'), indent=2))"
# 2. Run Flow on it (completes in a couple of seconds)
py -c "from opm_mcp.tools import flow; import time, json; j = flow.run_flow(r'C:\Users\ogezi\RCI\opm-mcp\examples\SPE1_MINI.DATA'); print(j['job_id']);
import time
time.sleep(5)
print(json.dumps(flow.flow_status(j['job_id']), indent=2))"
# 3. Read summary vectors
py -c "from opm_mcp.tools import results as r; import json; print(json.dumps(r.field_summary(r'C:\Users\ogezi\.opm-mcp\jobs\<JOB_ID>\out\SPE1_MINI'), indent=2))"Project layout
opm-mcp/
pyproject.toml
README.md
examples/
SPE1_MINI.DATA
src/opm_mcp/
__init__.py
config.py # env-var driven settings
wsl.py # WSL bridge + path translation (wslpath-aware)
jobs.py # background flow-job tracker (restart-safe)
server.py # FastMCP entry point (`opm-mcp` script)
tools/
deck.py # validate / summarise / wells
flow.py # run, status, log_tail, cancel, jobs
results.py # resdata-backed summary/grid/restart readers (units + cache)
plots.py # native matplotlib plot_summary
analysis.py # material balance, convergence report, restart property
edit.py # clone_deck with safe overrides
resinsight.py # snapshot, well log, interactive open
utils.py # opmpack, opmhash, summary, compareECL, upscaling
helpers/
deck_inspect.py # runs inside WSL — uses python3-opm-commonNotes
Path handling. Every path argument can be Windows-style (
C:\\foo) or WSL-style (/mnt/c/foo,/home/...); the server normalises both directions. Result-file tools accept either the bare case name (SPE1_MINI) or any of its known extensions (.DATA,.SMSPEC,.EGRID,.UNRST).Background simulations.
run_flowreturns immediately and writes its Linux PID + exit code underOPM_MCP_WORK_DIR/jobs/<id>/. Jobs are rehydrated on server restart, so you can still poll (and cancel, viawsl kill) a run that was started before Claude Desktop restarted. Runs also emit INFOSTEP/INFOITER by default forflow_convergence_report.Optional upscaling. The
opm-upscalingDebian package is not a dependency of Flow;upscaling_statustells Claude whether it's available and prints the install command if not.
License
MIT — see LICENSE for the full text.
Acknowledgements
Open Porous Media — the underlying reservoir-simulation stack.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/ojaogezi/opm-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server