ClaudeCodeMod

All shelves / MCP servers

Shaderous

io.github.guillochon/shaderous · 15 stars · TypeScript · MIT

MCP server GPU gas dynamics on WebGPU (hydro, MHD, gravity, AMR): load, run, measure and look at simulations

Install

The repo has no one-line install. Follow its README.

Published as

  • npmshaderousstdio

From the server's entry in the official MCP Registry.

Open the repo

Files

README.md

Shaderous

Kelvin-Helmholtz instability: density of a dense slab sliding through lighter gas (2D, 1024² cells) Tidal disruption of a magnetized star by a black hole: density with magnetic field lines (3D, adaptive mesh) Rayleigh-Taylor instability: density of heavy gas falling through light gas (2D, 1024² cells) Taylor-Green vortex breaking down: isosurfaces of vorticity (3D, 128³ cells) A shock passing over a helium bubble: density gradient (2D, 2048² cells) Sub-Chandrasekhar Type Ia supernova, a helium shell detonating around a white dwarf: isosurfaces of temperature (3D, adaptive mesh) Orszag-Tang vortex: density in decaying magnetized turbulence (2D, 1024² cells) Driven isothermal turbulence: isosurfaces of density (3D, 128³ cells) Thermal instability of the interstellar medium: cold clouds condensing along filaments, log density (2D, 1024² cells) Partial tidal disruption of a star grazing a black hole: density (3D, adaptive mesh) Vortex street behind a cylinder: vorticity (2D, 1024² cells) Magnetorotational instability in a shearing box: isosurfaces of magnetic field strength (3D, 64³ cells) Cellular detonation front: temperature (2D, 1024² cells) Two white dwarfs colliding head-on and detonating: temperature (3D, adaptive mesh) Kelvin-Helmholtz instability with a magnetic field: field strength wound up by the eddies (2D, 1024² cells) Isothermal turbulent gas collapsing under its own gravity: isosurfaces of density (3D, 128³ cells) A binary accreting from a circumbinary disk: log density (2D, 1024² cells) Colliding Alfvén wave packets: isosurfaces of vorticity (3D, 128³ cells) Mach 3 wind tunnel with a step: density gradient, showing the bow shock and its reflections (2D, 2048 cells across) Magnetized accretion disk turned turbulent by the magnetorotational instability: magnetic field strength (3D, adaptive mesh) MHD rotor: Mach number of a spinning dense disk launching Alfvén waves (2D, 1024² cells) A star torn apart by a black hole: isosurfaces of density (3D, adaptive mesh) Kelvin-Helmholtz instability of helium in hydrogen: helium mass fraction (2D, 1024² cells) Driven MHD turbulence: magnetic field strength (3D, 128³ cells) Two magnetic islands merging: density (2D, 1024² cells) Two white dwarfs colliding: isosurfaces of density (3D, 128³ cells) Double shear layer rolling up: vorticity (2D, 1024² cells) A star with a dipole magnetic field: density with field lines (3D, 128³ cells) Blast wave in a magnetized medium: log pressure (2D, 1024² cells) Counter-propagating Alfvén wave packets: isosurfaces of magnetic field strength (3D, 128³ cells) Pulsating detonation front: pressure (2D, 1024² cells) A centrally concentrated (γ = 4/3) star torn apart by a black hole: density (3D, adaptive mesh, 512³ finest) A dense clump casting a shadow in a beam of radiation: radiation energy (2D, 1024² cells) Sedov-Taylor blast wave: isosurfaces of density (3D, 128³ cells) Magnetic X-point collapse: pressure (2D, 1024² cells) Axisymmetric blast wave in (R, z) coordinates: density gradient (2D, 1024² cells)

Compressible gas dynamics, ideal MHD and radiation transport, with shocks, gravity, nearly incompressible liquids and adaptive mesh refinement, running entirely on your GPU inside a web browser. For physics research and teaching.

▶ Open it: https://guillochon.github.io/shaderous/ · Validation suite: validate.html · Requires a browser with WebGPU (current Chrome, Edge, Firefox or Safari).

Quick start

In the browser (no install). Open the live site. It starts with a 2D Kelvin-Helmholtz instability. Choose another problem from the left panel: shock tubes, blasts, instabilities, a supersonic wind tunnel, liquids at low Mach number (a vortex street behind a cylinder, a lid-driven cavity), detonations, radiation (a clump's shadow, radiative shocks), magnetized flows, and astrophysical flows such as stars, white dwarf collisions, tidal disruptions, accreting binaries, Roche lobe overflow, a common envelope, and planets and the Moon-forming impact. Drag in the view to rotate it, and use the brushes to stir, heat or add gas, or, in a magnetized run, to strengthen or drag the field. The address bar always describes the current setup, so copying it (or pressing Share) gives someone else the same run. Record saves the run as an MP4 movie with a color bar, axes and the simulation time drawn on it, Screenshot (under Movie and screenshot) saves a slice, a projection or a 2D run as a PNG at the grid's own resolution, one pixel per cell, Export state saves an .athdf file, and checkpoints (under Time) save one at regular intervals. Setup… opens every setting of the simulation in one dialog, where a run can be assembled from parts (point masses, stars, disks, gas regions, obstacles, a magnetic field) and saved as a file: each preset is such a file (docs/setups.md). Some examples:

From an AI agent, or the command line. The npm package runs the simulator in headless Chrome on your GPU (it needs Node 20+ and Chrome). npx -y shaderous mcp is an MCP server that gives an agent tools to load a setup, run it, read numbers back and look at it. For Claude Code, install the plugin, which adds the server and a skill that teaches Claude to build setups from a description in words:

claude plugin marketplace add guillochon/shaderous
claude plugin install shaderous@shaderous

Or add only the server: claude mcp add shaderous -- npx -y shaderous mcp.

Other clients (Claude Desktop, Cursor, VS Code, Codex, Gemini CLI) take the same command:

{ "mcpServers": { "shaderous": { "command": "npx", "args": ["-y", "shaderous", "mcp"] } } }

npx shaderous run --problem sedov --dim 2 --n 512 --png runs a setup to the end and writes its outputs to a folder (docs/headless.md).

Locally. Running it yourself needs Node 20+.

git clone https://github.com/guillochon/shaderous.git
cd shaderous && npm install
npm run dev

Then open http://localhost:5183 (the validation suite is at http://localhost:5183/validate.html). npm test runs the unit tests in Node, npm run test:gpu runs the validation suite and the scripting tests on your GPU through Playwright, and npm run test:headless checks the command-line runner and the MCP server.

What it is

Shaderous is a three-dimensional finite-volume code for compressible gas dynamics, ideal magnetohydrodynamics and radiation hydrodynamics, which also runs nearly incompressible liquids. Every fluid and gravity computation runs in WGSL compute shaders through WebGPU, so it runs on GPUs from any vendor, from a phone to a workstation, with nothing to install. Nothing in the scheme is specific to astrophysics: it solves the compressible Euler equations, or the ideal MHD equations, with optional gravity, diffusion, heating, cooling, radiation transport and nuclear burning, and fits a fluid dynamics course as well as an astrophysics one. The problems that ship with it are mostly astrophysical because they test every part of the code at once: strong shocks, self-gravity, stars that must stay in hydrostatic balance, accreting point masses, cooling, and matter as far from an ideal gas as degenerate electrons. It uses the methods of production simulation codes:

  • an unsplit MUSCL-Hancock scheme with third-order reconstruction and HLLC fluxes;
  • a multigrid Poisson solver with periodic or isolated boundaries;
  • block-structured adaptive mesh refinement with per-block timesteps;
  • ideal MHD by van Leer integration with constrained transport and HLLD or HLLE fluxes, on the uniform grid and the adaptive mesh alike, keeping div B at round-off through refinement and per-block timesteps, with field lines drawn in 2D and 3D;
  • point masses with sinks, which can also be the cores of giant stars;
  • equations of state from an ideal gas to degenerate electrons and ionizing hydrogen, and for burning white dwarf matter a tabulated electron-positron gas at any degeneracy and temperature, in the manner of the Helmholtz equation of state, and for gas from molecular clouds to stellar envelopes a tabulated mixture of hydrogen and helium with H₂, its dissociation and the ionization of both;
  • rock, iron alloy and water from their published ANEOS models, with melting and vaporization, one material or two in a cell: planets with iron cores under rock mantles, and their collisions;
  • nearly incompressible flow: a weakly compressible liquid on the same explicit scheme, and for it an implicit pressure solve (multigrid) that takes the timestep from the flow speed instead of the sound speed, on the uniform grid and the adaptive mesh;
  • gray radiation transport with the M1 closure, in the gas's frame and with a reduced speed of light: radiation that diffuses through opaque gas, streams through thin gas and casts shadows, heats and pushes the gas, on the uniform grid and the adaptive mesh;
  • optically thin cooling, viscosity, thermal conduction, and species carried with the gas, whose composition (and each species' own gamma) sets the equation of state cell by cell;
  • nuclear burning from fuel to ash by a single-step Arrhenius reaction, with steady (ZND) detonations as initial conditions and as references, and of the 13-isotope alpha chain (aprox13's reactions) by a small neural network trained on the reference network's burns (tools/burn), for carbon-oxygen detonations, burning white dwarf collisions and the double detonation of a sub-Chandrasekhar white dwarf.

WebGPU is a graphics interface, and fitting a conservative scheme into it shaped the design. No face flux is ever stored: the two cells that share a face compute bit-identical fluxes, so mass, momentum and energy are conserved to round-off even across refinement and time-step boundaries. Ghost cells are computed as they are loaded, never exchanged. The timestep and the scheduling of blocks happen on the GPU, so a step never waits for the CPU. Everything is single precision, as WGSL requires. A well-balanced reconstruction and initial states settled against the grid's own potential still hold stars and atmospheres in hydrostatic balance.

Shaderous is meant for teaching, for exploring a problem before committing to a production run, and for sharing a reproducible setup as a link. It is not a replacement for codes such as Athena++, FLASH or RAMSES: it runs on one GPU, within the memory the browser allows, and its radiation transport is gray (M1), and on the adaptive mesh takes one timestep for all blocks. On a 24 GB card that memory goes a long way: the largest run so far, a magnetized accretion disk at 512^3 with three levels of refinement, held 16.8 GB of GPU memory (about 24 million cells) on an RTX 4090 and ran an orbit in 14 minutes (details). The state can be exported as Athena++-style HDF5 that yt reads directly, and a run can be recorded as an MP4 movie. A suite of 180 validation tests runs on your own GPU, in the browser or from the command line. Scripts and AI agents can drive the simulator too: through a JavaScript API in the page, a command-line runner for single runs and parameter sweeps, or an MCP server.

Documentation

Teaching guide Using Shaderous in the classroom: activities, links and discussion questions for non-major undergraduates, physics and astronomy majors, and graduate students.
Numerics Every part of the solver in detail: equations, discretization, Riemann solvers, reconstruction, gravity, AMR, local timesteps, equations of state, cooling, diffusion, species. With references.
Architecture How the code maps onto WebGPU: constraints, data layout, shader assembly, gathered fluxes, ghost cells on load, the AMR atlas, GPU scheduling, rendering, memory, I/O and testing.
Scripting API Driving the simulator from a script or an AI agent, headless or not: window.shaderous loads setups, steps to exact times, reads the gas back, takes screenshots, records movies, saves and loads .athdf files, uses the editing tools, and logs and replays sessions step for step.
Headless runs The command-line runner (single runs and parameter sweeps, writing diagnostics, images, slices, movies and .athdf files) and the MCP server that gives AI agents the simulator as tools.

What changed in each release is in the changelog, which is also the notes of the GitHub releases.

The method paper is in progress in paper/. Design plans for proposed work are in plans/.

Acknowledgments

The turbulence driving and the driven-turbulence setups, the Alfvén-wave collision, the Elsasser packets, the magnetized Kelvin-Helmholtz setup and the reconnection setups (the tearing mode, island coalescence and X-point collapse, with resistivity) follow the WebGPU reduced-MHD solver of Alfred Mallet and Esrom Abraham (taranis).

License

MIT; see LICENSE.

Facts

Kind
MCP server
Repo
guillochon/shaderous
Group
Uncategorized
Stars
15
License
MIT
Language
TypeScript
Last push
2026-11-23
Forks
2
MCP Registry
io.github.guillochon/shaderous
Homepage
guillochon.github.io/shaderous

Also new this week

  1. 73rust-anythingio.github.erkamyaman/rust-anythingRewrite an app in Rust one piece at a time, checked against the original's recorded behavior.8.1k
  2. 144obsidian-wikiio.github.Ar9av/obsidian-wikiMemory for agents in a markdown vault you own: search, read, write, recap, context packs.3.8k
  3. 150Z-Libraryio.github.heartleo/zlibSearch and download Z-Library books, fix e-book metadata, and send books to Kindle or WeRead.3.5k
  4. 178LearnHouseapp.learnhouse/learnhouseBuild, edit and run courses, learning paths and communities in your LearnHouse academy.2.5k
  5. 183MR Officeai.mroffice/officeCreate, open and edit documents, spreadsheets and PDFs in MR Office's editor, inline in chat.2.4k
  6. 227Seal Open Datafr.sealopendata/open-dataFrench public open data (data.gouv.fr) cross-referenced by commune, EPCI and department.1.7k