cesm-runner-mcp
This server drives the CESM case lifecycle (setup → build → submit → monitor) and manages crocontainer sessions for fast, queue-free iteration.
Inspect cases:
list_casesto find CESM cases under a directory,get_case_statusfor build/run/submit state,check_input_datato verify staged input files.Run the lifecycle:
case_setup,case_build, andcase_submit(withno_batchfor interactive runs), optionally inside a container session viacontainer=<name>.Edit/query XML config:
xmlquery,xmlchange, andpreview_runto see PE layout and batch script before submitting.Monitor runs:
tail_logfor recent component logs,get_job_statusfor PBS/slurm queue state,list_compsetsto browse available compsets.Manage containers:
build_sandbox(one-time sandbox build),start_container,run_case_in_container(fork/build/run a CrocoDash bundle),container_exec,stop_container,list_containers.Read resources:
cesm://case/{case_dir*}/env(all XML vars),/status(CaseStatus + key config),/logs(case, RUNDIR, and DOUT_S_ROOT logs).
Provides tools for managing container sessions using the Podman runtime, enabling CESM to run interactively inside containers on a laptop.
Click on "Deploy 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., "@cesm-runner-mcp check status of case ~/croc_cases/mycase"
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.
cesm-runner-mcp
MCP server for driving CESM case lifecycle: setup → build → submit → monitor.
Complements the CrocoDash MCP, which handles grid creation and forcing. This server picks up where that one leaves off — once a case directory exists, this server drives the CIME build/run pipeline.
Tools
Case inspection
Tool | Purpose |
| Find all CESM cases under a directory |
| Read CaseStatus log + key XML config |
| Verify all required input files are staged |
Case lifecycle
All three accept an optional container=<session_name> arg to run inside a crocontainer session instead of on the host,
but only for cases made for the container's CIME machine, ubuntu-latest (e.g. /workspace/case after run_case_in_container).
A host case (machine=derecho) is refused: bundle it with bundle_case (CrocoDash MCP) and use run_case_in_container.
Tool | Purpose |
| Run |
| Compile the model ( |
| Submit to PBS/slurm or run interactively |
XML config
Tool | Purpose |
| Query any CESM XML variable |
| Set a CESM XML variable |
| Show PE layout and batch script without submitting |
Monitoring
Tool | Purpose |
| Read recent run log output |
| Check PBS/slurm queue for this case's job |
| List available compsets in a CESM install |
Container management (crocontainer fast-iteration path)
Tool | Purpose |
| One-time: qsub a PBS job (~1hr) that builds the Apptainer sandbox; returns the job id and log path. |
| Start a persistent container session |
| Copy a |
| Run any command inside a running session |
| Stop and clean up the session |
| Show running sessions |
Related MCP server: openmc-validator-mcp
Resources
URI | Content |
| All XML config variables (same as |
| CaseStatus log + key config (same as |
| Log files in the case dir, its RUNDIR and |
{case_dir*} takes the case path as-is, slashes included, e.g.
cesm://case//glade/u/home/<user>/croc_cases/my_case/status.
Setup
pip install -e .
# or in the CrocoDash conda env:
conda run -n CrocoDash pip install -e .Running
cesm-runner-mcp
# or
python server.pyWire up to Claude Code by adding to .mcp.json:
{
"mcpServers": {
"cesm-runner": {
"command": "python",
"args": ["/path/to/MCP_cesm_runner/server.py"]
}
}
}Fast iteration with crocontainer
Instead of waiting in the PBS queue, run CESM interactively inside a container. On Derecho, the full GLADE filesystem is mounted transparently so all host paths work inside.
One-time setup (Derecho)
Call build_sandbox() via the MCP: it qsubs the build (Derecho develop queue, 3 h) and
returns the job id and log path. build_sandbox(rebuild=True) replaces a stale sandbox,
keeping the old one as <path>.old-<timestamp>. Or build it by hand:
# Build the writable sandbox (~1 hr on a compute node)
qcmd -l walltime=03:00:00 -- apptainer build --sandbox \
/glade/derecho/scratch/$USER/crocontainer_sandbox \
docker://ghcr.io/crocodile-cesm/crocontainer:latest-amd64Typical MCP session
The container only builds and runs cases for its own CIME machine (ubuntu-latest),
so a case made on Derecho goes in as a bundle, which run_case.sh forks for ubuntu-latest:
bundle_case("~/croc_cases/mycase", "~/scratch/croc_bundles") # CrocoDash MCP
start_container(scratch_dir="~/scratch/croc_scratch")
→ Apptainer instance starts; /glade mounted; inputdata at /glade/campaign/cesm/cesmdata/inputdata
run_case_in_container("croc_session", "~/scratch/croc_bundles/mycase_case_bundle")
→ forks the case to /workspace/case, builds and runs it; no queue
# Debugger MCP finds an error → fix → resubmit inside the container:
container_exec("croc_session", "/workspace/case", "./xmlchange STOP_N=3")
case_submit("/workspace/case", no_batch=True, container="croc_session")
stop_container("croc_session")Inputdata on Derecho
CESM inputdata is mounted directly from GLADE — no downloading required:
/glade/campaign/cesm/cesmdata/inputdata → /root/cesm/inputdata inside container
On a laptop (Podman)
start_container(
scratch_dir="./scratch",
sandbox_or_image="ghcr.io/crocodile-cesm/crocontainer:latest",
inputdata_dir="./cesm_nyf_inputdata", # pre-downloaded NYF data
runtime="podman"
)Design
Stateless: each tool reads from the filesystem; no in-memory state
Shells out to CIME scripts: uses
./xmlquery,./case.setup, etc. directly — version-safe and matches what users run manuallyWorks with any CESM install: not specific to CrocoDash or MOM6
Container-aware: lifecycle tools accept
container=to route viaapptainer exec instance://orpodman execinstead of running on the host
CESM install on Derecho
Default reference install: ~/work/installs/CESM_crocodash (CESM branch crocodash)
Cases live in: ~/croc_cases/
CESM inputdata: /glade/campaign/cesm/cesmdata/inputdata
Available Tools
17 toolsbuild_sandboxA
Build the Apptainer writable sandbox from the crocontainer registry image.
This is a one-time setup step required on Derecho before start_container can be used. Takes ~1 hour on a compute node. Submits via qcmd if queue_walltime is set.
sandbox_dir: where to create the sandbox (default: ~/scratch/crocontainer_sandbox). queue_walltime: PBS walltime for the build job (default 3h).
Inputs: sandbox_dir, queue_walltime. Returns: result
case_buildA
Compile a CESM case (./case.build).
Pass container=<session_name> to compile inside a crocontainer session — this is the recommended path for fast iteration since it avoids queue wait times and uses the pre-installed compilers and MPI in the container.
On Derecho without a container this can take 10–30 minutes in a batch job. Inside crocontainer it runs interactively and returns immediately on completion.
Inputs: case_dir (required), sharedlib_only, model_only, container. Returns: result
case_setupA
Run ./case.setup for a CESM case.
Generates namelists, batch scripts, and env_mach_specific.xml. Pass clean=True to run './case.setup --clean'. Pass container=<session_name> to run inside a crocontainer session (see start_container). Must be run before case_build.
Inputs: case_dir (required), clean, container. Returns: result
case_submitA
Submit a CESM case (./case.submit).
Pass container=<session_name> to run inside a crocontainer session. When using a container, also pass no_batch=True — the container runs interactively and does not have access to PBS/slurm, so batch submission will fail.
container + no_batch=True is the fast-iteration path: model runs synchronously inside the container and returns output to this session with no queue wait.
Inputs: case_dir (required), no_batch, resubmit, container. Returns: result
check_input_dataA
Verify that all required input data files are staged for this CESM case.
Runs ./check_input_data from the case directory and returns the output. This will report any missing files that need to be downloaded before the run.
Inputs: case_dir (required). Returns: result
container_execB
Run a CIME command inside a running container session.
name: session name from start_container. case_dir: absolute path to the CESM case directory on the host. On Derecho this path is identical inside the container (/glade is mounted). On Podman, this dir is passed as -v and mounted at the same path. command: shell command to run (e.g. './case.build', './case.submit --no-batch').
Returns the full stdout+stderr from the command.
Inputs: name (required), case_dir (required), command (required), runtime. Returns: result
get_case_statusB
Return the full build/run/submit status of a CESM case.
Reads the CaseStatus log and env_build.xml to report what steps are complete.
Inputs: case_dir (required). Returns: result
get_job_statusA
Check the PBS/slurm batch queue status for the most recent job submitted from this case.
Reads the CaseStatus log to extract the job ID, then queries the scheduler. Returns job state (R=running, Q=queued, C=complete, F=failed) and resource usage.
Inputs: case_dir (required). Returns: result
list_casesA
Walk a directory tree and return all CESM case directories found.
A directory is identified as a CESM case if it contains a CaseStatus file. Returns a newline-separated list of absolute paths.
Inputs: search_root (required), max_depth. Returns: result
list_compsetsA
List available compsets in a CESM installation.
cesmroot: path to the CESM installation (e.g. ~/work/installs/cesm3_maddd_new) filter: optional substring to filter compset names (e.g. 'MOM6', 'NYF', 'JRA')
Uses the CIME query_config script. Returns long-name compsets and their aliases.
Inputs: cesmroot (required), filter. Returns: result
list_containersB
List running crocontainer sessions.
Shows active Apptainer instances or Podman containers by name.
Inputs: runtime. Returns: result
preview_runA
Preview what a CESM run will look like without actually submitting.
Runs ./preview_run which shows the PE layout, estimated memory, wallclock, and the batch submission script that would be used. Useful for validating resource settings before committing to case_submit.
Inputs: case_dir (required). Returns: result
start_containerA
Start a persistent container session for interactive CESM runs.
On Derecho (Apptainer):
sandbox_or_image: path to the writable sandbox directory. Defaults to ~/scratch/crocontainer_sandbox. Build it first with build_sandbox().
inputdata_dir: defaults to /glade/campaign/cesm/cesmdata/inputdata.
/glade is bind-mounted transparently so all host paths work inside container.
On local (Podman):
sandbox_or_image: container image name (default: ghcr.io/... crocontainer).
inputdata_dir: required — path to pre-downloaded CESM inputdata.
scratch_dir: host directory for CESM output (bound to /root/cesm/scratch inside). name: name for this session (used in container_exec and stop_container).
Returns the session name on success.
Inputs: scratch_dir (required), sandbox_or_image, inputdata_dir, name, +1 more. Returns: result
stop_containerA
Stop and clean up a container session started with start_container.
name: session name passed to start_container.
Inputs: name (required), runtime. Returns: result
tail_logA
Return the most recent lines from a CESM run log.
Searches the case directory and its run/ subdirectory for log files. component: one of 'cesm', 'ocn', 'atm', 'ice', 'rof', or 'all' to show all logs found. Returns the last lines of the most recently modified matching log.
Inputs: case_dir (required), component, lines. Returns: result
xmlchangeA
Change a CESM XML configuration variable.
Runs ./xmlchange = from the case directory. Example: variable='STOP_N', value='5' sets the run length to 5 time units. Use xmlquery first to confirm the current value before changing.
Inputs: case_dir (required), variable (required), value (required). Returns: result
xmlqueryB
Query a CESM XML configuration variable.
Runs ./xmlquery from the case directory and returns the value. Variable names are case-sensitive (e.g., STOP_N, RUN_STARTDATE, NTASKS_OCN). Pass variable='--listall' to list every defined variable.
Inputs: case_dir (required), variable (required). Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 17 tools
All 17 tools have clearly distinct purposes, covering different stages of CESM case execution, container management, and configuration queries. No two tools appear to overlap in functionality, reducing the chance of misselection.
Tool names consistently use lowercase with underscores and combine verbs and nouns. However, there is a minor inconsistency in order: some are verb_noun (e.g., build_sandbox) while others are noun_verb (e.g., case_build). Still, the pattern is predictable and readable.
With 17 tools, the server is well-scoped for its purpose of running CESM cases. Each tool serves a distinct function without being excessive, covering setup, build, submit, monitoring, container management, and configuration.
The tool set covers the primary lifecycle of CESM case execution, including build, setup, submit, status checks, log tails, and XML modifications. Minor gaps like case creation or input data download are absent, but these are outside the stated 'runner' scope.
Related MCP Connectors
MCP server for the GDEX (Geoscience Data Exchange) data portal: datasets, files, metrics, subsetting
Hosted MCP server for task-first delegation to remote workstations and workers.
MCP server for CertScore.ai public website risk-signal workflows.
One MCP server for all your MCP servers: code mode, per-tool permissions, approvals and audit.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceA server implementing Model Coupling Protocol for HDF5 file operations, Slurm job management, hardware monitoring, and data compression.MIT
- AlicenseNot gradedqualityCmaintenanceAn MCP server that provides pre-flight validation and post-processing tools for OpenMC Monte Carlo transport simulations, catching common authoring mistakes before jobs hit the HPC queue.MIT
- FlicenseNot gradedqualityDmaintenanceMCP server for accessing SPEAR model output from various sources (AWS, STAC API, local) and integrating with AI assistants like Claude Desktop or a SPEAR Climate Chatbot.-
- FlicenseAqualityCmaintenanceMCP server for debugging regional ocean (MOM6 + CESM) model runs, combining log analysis tools with a searchable knowledge base of expert interview transcripts.11-