Skip to main content
Glama
Supernova Cosmology MCP Server

Supernova Cosmology MCP Server

sn-mcp-server - Supernova Cosmology MCP Server

MCP server for Type Ia supernova cosmology on public Hubble diagrams: Pantheon+, DES-SN5YR, Union3/UNITY1.5 (+ optional DES-Dovekie). It fetches tidy Hubble diagrams with their full stat+sys covariance, plots them, bins them, fits flat LCDM / wCDM / w0waCDM with the absolute-magnitude/H0 offset marginalised analytically, draws 68/95% contours and compares samples. Part of the cosmo-*-mcp-server family (see docs/CONVENTIONS.md).

Pantheon+ Hubble diagram wCDM contours residual comparison

Data products

Catalogs

Summary statistics

Published results

what

per-SN SALT2/SALT3 light-curve fit parameters (x1, c, mB, HOST_LOGMASS, errors, covariances), photometric light curves

Hubble diagrams mu(z) + full stat+sys covariance

posterior chains (for comparison only)

this server

Pantheon+, DES-SN5YR

Pantheon+, DES-SN5YR, Union3, DES-Dovekie

— (comparison via reference_values)

Analyses are built from catalogs and summary statistics; published results are for comparison only.

Related MCP server: galaxy-surveys-mcp-server

Install / run

uv venv --python 3.12 .venv && uv pip install --python .venv/bin/python -e ".[dev]"
.venv/bin/python -m mcp_server --transport stdio
.venv/bin/python -m mcp_server --transport streamable-http --port 8010   # family default port for sn

Tools

Summary statistics (Hubble diagrams + covariance)

tool

what

fetch_sn_sample

Hubble diagram CSV + matching covariance .npy, z cuts, calibrators include/exclude/only

compute_distance_modulus

theory mu(z) for (Om, w0, wa, H0, Ok)

bin_hubble_diagram

full-covariance (GLS) binned residuals vs a fiducial + bin covariance

plot_hubble_diagram

mu(z) + residual panel vs fiducial LCDM, binned points, calibrators marked

plot_sn_covariance

stat+sys correlation matrix image + positive-definiteness check

compute_sn_chi2

offset-marginalised chi2 of one cosmology

fit_sn_cosmology (heavy, dispatchable)

grid + Nelder-Mead fit of lcdm / wcdm / w0wacdm; best fit, 1D summaries, 1D/2D posterior + profile-chi2 CSVs with 68/95% flags

plot_sn_contours

68/95% HPD contours from one or more 2D CSVs

compare_sn_samples (heavy in contours mode)

overlay binned residuals, or fit each sample and overlay contours + pairwise tension

Catalogs (per-SN light-curve fits and photometry)

tool

what

fetch_sn_salt2_params

per-SN SALT2/SALT3 fit parameters (x1, c, mB, HOST_LOGMASS, errors, covariances, bias corrections)

standardize_sn_salt2 (heavy, dispatchable)

Tripp standardisation: fits alpha, beta, gamma, sigma_int → builds a Hubble diagram from per-SN light-curve fit parameters (from catalog to Hubble diagram)

fetch_sn_lightcurve

per-SN photometric light curve (SNANA format for Pantheon+, LCPLOT for DES-SN5YR)

plot_sn_lightcurve

multi-band light-curve plot

Meta

tool

what

list_sn_datasets / describe_sn_dataset

datasets, URLs, citations, conventions, reference values, filter by kind of data

list_sn_skills / load_sn_skill

server-side recipes

set_dispatch / get_dispatch / auth_status / export_dispatch_pack

IRI HPC dispatch (hep-genesis)

Likelihood

chi2 = r^T C^-1 r - (1^T C^-1 r)^2 / (1^T C^-1 1), r = mu_obs - mu_th(z_HD, z_hel), with C the full stat+sys covariance (the Pantheon+/DES/cobaya convention for marginalising M over a flat prior). D_L = (1 + z_hel) D_M(z_HD); distances by numerical integration (radiation neglected, < 1e-4 mag; tested against astropy.cosmology).

Sanity checks (flat LCDM, SN only)

sample

this server

published

Pantheon+ (z > 0.01, 1590)

0.332 +- 0.018

0.334 +- 0.018 (Brout+22)

DES-SN5YR (1829)

0.353 +- 0.017

0.352 +- 0.017 (DES 2024)

Union3 (22 nodes)

0.358 +- 0.027

0.356 +0.028/-0.026 (Rubin+23)

wCDM: Pantheon+ w = -0.91 +- 0.15 (pub. -0.90 +- 0.14); DES-SN5YR w = -0.81 +- 0.15 (pub. -0.80 +0.14/-0.16).

Tripp standardisation (from catalog to Hubble diagram)

sample

alpha

beta

gamma

sigma_int

Pantheon+

0.148

2.97

0.043

0.10

Published (Brout+22)

~0.15

~3.0

~0.05

—

Skills

sn-tour, hpc-dispatch-handoff, reproduce-pantheon-plus-om, sn-dark-energy-w0wa, salt2-standardization.

Data

Small Hubble-diagram tables + LC index are bundled (~1 MB, provenance in data/README.md); covariances (6-33 MB), DES-SN5YR metadata (662 kB), DES LCPLOT (7.4 MB), and Pantheon+ per-SN light curves download on first use into ~/.cache/cosmo-mcp/sn-mcp-server.

Tests

MPLBACKEND=Agg .venv/bin/python -m pytest -q (network tests download the covariances once; deselect with -m "not network"), .venv/bin/python tests/smoke_server.py.

Available Tools

21 tools
auth_statusA

Report the facility sign-in state THIS server sees for its own HPC dispatch (ALCF and NERSC).

Call this before set_dispatch to a remote site, or when one of this
server's remote calls fails with an auth error. It says nothing about
the facility servers' own tokens - ask those servers directly. Sign-in
happens outside this server (hep-genesis auth CLIs or the desktop app's
HPC panel); tokens are re-read on every call.

Inputs: no named parameters. Returns: result

bin_hubble_diagramA

Compress a Hubble diagram into redshift bins of mu residuals vs a fiducial cosmology.

Use to see trends (e.g. the low-z vs high-z offset that drives Om/w differences between
samples) and to make compact, correlated data vectors. Residuals are mu - mu_fid with the
best-fit offset removed; binning is a full-covariance GLS compression, so the bin
covariance (written as .npy) keeps systematic correlations. Union3 is already binned:
bins with one node are passed through.

Inputs: output_dir (required), zmax, zmin, fid_Om, +5 more. Returns: Uniform result contract returned by every tool.

compare_sn_samplesA

Compare SN samples: binned residual Hubble diagrams, or cosmology contours + tension.

Use to see whether Pantheon+, DES-SN5YR and Union3 agree. `residuals` overlays each
sample's full-covariance binned mu residuals vs the SAME flat LCDM fiducial (each sample's
offset removed separately - only shapes are comparable). `contours` runs fit_sn_cosmology
per sample, overlays the 2D contours (Om-w for wcdm, w0-wa for w0wacdm, 1D for lcdm) and
reports pairwise Gaussian tensions. CAUTION: the samples share SNe (low-z CfA/CSP/Foundation;
Union3 contains much of Pantheon+), so they are NOT independent. The quoted tension uses
Cov(diff) = C1 + C2, ignoring the positive cross-correlation, so it UNDER-states the
significance of a real difference - treat it as indicative, not a formal test.

Inputs: output_dir (required), mode, model, fid_Om, +3 more. Returns: Uniform result contract returned by every tool.

compute_distance_modulusA

Theory distance modulus mu(z) = 5 log10(D_L/10pc) for a given cosmology (w0waCDM, curvature).

Use for theory curves to overlay on a Hubble diagram, or to quantify how much two
cosmologies differ in mu (the CSV includes mu minus flat LCDM Om=0.3, offset-free at
low z). Radiation is neglected (< 1e-4 mag for z < 3). Cross-checked against
astropy.cosmology in the tests.

Inputs: output_dir (required), H0, Ok, Om, +5 more. Returns: Uniform result contract returned by every tool.

compute_sn_chi2A

Offset-marginalised chi2 of ONE cosmology against a sample (full covariance). Fast.

Use to test a specific model (e.g. Planck LCDM Om=0.315, or DESI DR2 w0waCDM) against a SN sample, or to compute Delta-chi2 between two models without a full fit.

Inputs: Om, w0, wa, zmax, +3 more. Returns: Uniform result contract returned by every tool.

describe_sn_datasetA

Full description of one dataset: products, units, conventions, URLs, citation.

Inputs: name (required). Returns: Uniform result contract returned by every tool.

export_dispatch_packA

Hand THIS server's compute kernels to the client for HPC runs.

Returns the ``tools/`` package as in-band text files plus a manifest of
kernel entry points (dotted function path, args shape, node-side
pip_deps, walltime hint). The CLIENT - which holds the facility tokens,
Globus endpoint, project and workdir - stages and submits the kernels
with ITS OWN credentials (e.g. the hep-genesis facility servers'
run_pack_kernel tool). Nothing credential-shaped or project-shaped is
needed on, or returned by, this server.

Clients that recognise the ``dispatch_pack`` key should save the files
locally and NOT echo their contents into the conversation.

Inputs: no named parameters.

fetch_sn_lightcurveA

Download and parse raw photometric light-curve data for one SN Ia.

Pantheon+ light curves are individual SNANA .dat files from PantheonPlusSH0ES/DataRelease
(downloaded on demand). DES-SN5YR light curves come from the SALT3 fit LCPLOT file (data +
model columns; 7.4 MB download on first use). Returns a CSV with mjd, band, flux, flux_err
(and mag where available). Use plot_sn_lightcurve to visualise.

Inputs: cid (required), output_dir (required), dataset. Returns: Uniform result contract returned by every tool.

fetch_sn_salt2_paramsA

Fetch per-SN SALT2/SALT3 light-curve fit parameters: x1, c, mB and their errors and covariances, HOST_LOGMASS and bias corrections.

Use this to get the per-SN catalog data needed for Tripp standardisation via
standardize_sn_salt2. Pantheon+ uses SALT2 fits (Brout+22); DES-SN5YR uses SALT3 (Kenworthy+21).
The output CSV has one row per SN and includes the released distance modulus for comparison.

Inputs: output_dir (required), zmax, zmin, dataset. Returns: Uniform result contract returned by every tool.

fetch_sn_sampleA

Download (first use) and tidy one SN Ia Hubble diagram with its FULL stat+sys covariance.

Use this first: it writes `<dataset>_hd.csv` (cid, survey, z, zhel, mu, mu_err_diag,
is_calibrator) and `<dataset>_cov.npy` (the matching sub-covariance in mag^2, same row
order). Every other tool can take the dataset name directly, but the CSV is what you
hand to plotting or external codes. Union3 is a 22-node binned (compressed) Hubble
diagram - there is no public per-SN Union3 table.

Inputs: output_dir (required), zmax, zmin, dataset, +1 more. Returns: Uniform result contract returned by every tool.

fit_sn_cosmologyA

Fit flat LCDM / wCDM / w0waCDM to one SN sample on a grid (+ Nelder-Mead refinement).

Use for SN-only cosmology: full stat+sys covariance, offset M/H0 marginalised
analytically, flat priors over the grid. Writes `<tag>_summary.json` (best fit, chi2,
1D marginal mean/sd/68/95%), `<tag>_1d_<p>.csv` and `<tag>_2d_<a>_<b>.csv` (posterior,
profile chi2 and in_68/in_95 HPD flags) for plot_sn_contours. Heavy: w0wacdm with
the default 41^3 grid on Pantheon+ takes a few minutes locally. When set_dispatch
points at an HPC site it runs as one facility job (kernel sn.kernels.fit_sn_cosmology).
SN alone barely constrain w0wa; expect posteriors hitting prior edges (flagged).
Sanity: Pantheon+ lcdm Om = 0.334 +- 0.018 (Brout+22); DES-SN5YR 0.352 +- 0.017.

Inputs: output_dir (required), zmax, zmin, model, +7 more. Returns: Uniform result contract returned by every tool.

get_dispatchA

Report where THIS server's heavy tools currently execute.

Inputs: no named parameters. Returns: result

list_sn_datasetsA

List the public datasets this server exposes. Call this first.

Products are grouped as catalogs (object-level data), summary statistics (measurements with covariance) and published results (chains / parameter constraints, for comparison only). Build analyses on catalogs and summary statistics. Each entry also gives access (bundled vs downloaded on first use) and which tools read it.

Inputs: kind. Returns: Uniform result contract returned by every tool.

list_sn_skillsA

List this server's skills: named multi-tool recipes.

A skill is procedural know-how - which tools to chain, in which order,
with what parameters, and how to sanity-check and report. When a task
matches one, load it with the load-skill tool and follow it.

Inputs: no named parameters. Returns: Uniform result contract returned by every tool.

load_sn_skillA

Load the full instructions of one of this server's skills and follow them.

Inputs: name (required). Returns: Uniform result contract returned by every tool.

plot_hubble_diagramA

Publication-style Hubble diagram: mu(z) with the fiducial curve and a residual panel.

Use to show a sample (cf. Brout+22 Fig. 4, DES 2024 Fig. 1): per-SN points with
diagonal errors (grey), full-covariance binned residuals (colour), the fiducial
model and Pantheon+ calibrators highlighted. Residuals have the best-fit offset removed
(M/H0 are degenerate), so only the SHAPE of mu(z) is meaningful.

Inputs: output_dir (required), zmax, zmin, fid_Om, +5 more. Returns: Uniform result contract returned by every tool.

plot_sn_contoursA

Plot 68%/95% credible contours (HPD of the gridded marginal posterior) for one parameter pair.

Use after fit_sn_cosmology (wcdm: Om-w; w0wacdm: w0-wa or Om-w0) to reproduce the
familiar SN contour figures (Brout+22 Fig. 9, DES 2024 Fig. 4, Rubin+23 Fig. 9);
pass several CSVs to overlay samples.

Inputs: output_dir (required), contour_csvs (required), labels, show_lcdm. Returns: Uniform result contract returned by every tool.

plot_sn_covarianceA

Image of the stat+sys correlation matrix (rows sorted by redshift).

Use to show how strongly SNe are correlated by calibration/systematics (off-diagonal structure is what makes diagonal-error fits wrong) and to sanity-check the matrix.

Inputs: output_dir (required), zmin, dataset. Returns: Uniform result contract returned by every tool.

plot_sn_lightcurveA

Plot a SN Ia multi-band light curve (per-SN photometry).

Downloads the light curve on demand (same as fetch_sn_lightcurve) and makes a publication-style
plot with one colour per band. Flux space (default) shows the SALT2 flux calibration; magnitude
space inverts the y-axis and uses mag where available.

Inputs: cid (required), output_dir (required), dataset, flux_space. Returns: Uniform result contract returned by every tool.

set_dispatchA

Set where THIS server's heavy tools execute: 'local' (this machine), 'polaris' (ALCF) or 'perlmutter' (NERSC).

Affects only this server's heavy (dispatchable) tools - never other
servers' dispatch state. Remote sites run each heavy call as one facility
job (staging + queue + walltime: minutes, not seconds) and need facility
sign-in - check with auth_status first. Light tools (listing, plotting,
small reads) always run locally. Optional artifact_dir sets where
produced files are fetched back to. Returns the active configuration.

Inputs: site (required), artifact_dir. Returns: result

standardize_sn_salt2A

Tripp standardisation: build a Hubble diagram from per-SN SALT2 fits (from catalog to Hubble diagram).

Fits alpha (stretch), beta (colour), gamma (host-mass step at 10^10 Msun) and sigma_int
by maximum likelihood: mu = mB - M + alpha*x1 - beta*c ± gamma/2 - biasCor.
Literature: Pantheon+ alpha~0.15, beta~3.0, gamma~0.05; DES-SN5YR alpha=0.161, beta=3.12, gamma=0.038.
The tool compares the resulting mu with the released Hubble diagram (rms_vs_released_mu should be
~few mmag for Pantheon+ and ~20 mmag for DES, since we use a diagonal approximation).
Uses ONLY per-SN light-curve fit parameters; never published posteriors.

Inputs: output_dir (required), Om, zmax, zmin, +2 more. Returns: Uniform result contract returned by every tool.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.9/5.0

    Scored across 21 tools

    Disambiguation4/5

    Tools are largely distinct and well-separated by verb (fetch/compute/plot/fit/compare). The only mild overlaps are bin_hubble_diagram vs plot_hubble_diagram (both produce binned residuals) and the two light-curve tools, but descriptions clearly distinguish data-writing from plotting.

    Naming Consistency4/5

    Mostly consistent verb_noun with a sn_ namespace (fetch_sn_sample, compute_sn_chi2, plot_sn_contours). The dispatch tools deviate slightly (auth_status uses noun_verb order; get/set/export_dispatch lack the sn_ prefix) but remain snake_case and readable.

    Tool Count4/5

    21 tools is on the heavy side but each targets a distinct scientific operation (data discovery, fetch, fit, plot, compare, dispatch) that earns its place. Slightly over a comfortable count but well-scoped for a rich cosmology workflow.

    Completeness4/5

    Covers the full lifecycle: dataset discovery, fetching, SALT2 standardisation, chi2/fit, plotting, sample comparison, skills, and HPC dispatch. Minor gaps like retrieving dispatched job results are handled indirectly via artifact_dir but not as an explicit tool.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      B
      maintenance
      Enables users to query bundled and live pulsar-wind-nebula, SNR, H II region, and planetary-nebula catalogs; render CGPS and multi-wavelength survey cutouts, maps, and population plots; and compare nebular spectra under CIE 1931 2-degree and CIE 1964 10-degree colorimetry.
      20
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      Enables users to fetch, plot, and analyze public weak-lensing data vectors, redshift distributions, covariances, and published chains across DES, KiDS, and HSC surveys. Supports signal-to-noise calculations, S8 constraint comparisons, contour plots, and reproducible survey-analysis workflows.
      24
      1
      MIT