xraylarch-mcp
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., "@xraylarch-mcpLoad fe_foil.xdi and show normalized XANES"
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.
xraylarch-mcp
MCP (Model Context Protocol) server that wraps xraylarch for X-ray spectroscopy analysis. Load, process, analyze, and plot XAS/XAFS spectra through Claude Desktop or Claude Code with natural language tool calls. Supports XANES normalization, EXAFS extraction, Fourier transforms, linear combination fitting, PCA, FEFFIT shell fitting, and publication-quality plotting.
Installation
pip install xraylarch-mcpRelated MCP server: mhlabs-mcp-tools
Configuration
Claude Desktop
Add to your Claude Desktop configuration (claude_desktop_config.json):
{
"mcpServers": {
"xraylarch": {
"command": "python",
"args": ["-m", "xraylarch_mcp"]
}
}
}Claude Code
claude mcp add xraylarch -- python -m xraylarch_mcpQuick Start
Ask Claude:
"Load the spectrum at ~/data/fe_foil.xdi and show me the normalized XANES"
Claude will:
Call
larch_load_spectrumto read your dataCall
larch_normalizeto perform pre-edge subtraction and normalizationCall
larch_plotwithplot_type="norm"to generate a publication-quality plot
Tool Reference
I/O Tools
Tool | Description |
| Load a spectrum from file (.xdi, .dat, .csv, .prj, etc.) |
| Read/inspect Athena project files |
| List all loaded spectrum groups |
| Detailed view of a group's arrays and scalars |
| Remove a group to free memory |
XAFS Analysis Tools
Tool | Description |
| Pre-edge subtraction and normalization (wraps |
| EXAFS background removal (AUTOBK algorithm) |
| Forward Fourier transform: chi(k) -> chi(R) |
| Back Fourier transform: chi(R) -> chi(q) |
| Fluorescence self-absorption correction |
| MBACK normalization (alternative for problematic data) |
| Noise estimation in chi(k) and chi(R) |
| Cauchy wavelet transform for simultaneous k- and R-resolution |
| Rebin to standard 3-region XAFS energy grid |
Plot Tools
Tool | Description |
| Publication-quality plots (mu, norm, flat, dmude, chi_k, chi_r, chi_q, cauchy_wavelet) |
Math Tools
Tool | Description |
| Smooth arrays with Lorentzian/Gaussian/Voigt kernel |
| Numerical derivative |
| Interpolate onto new energy grid |
| Merge/average multiple spectra |
| Remove glitch points |
Fitting Tools
Tool | Description |
| Linear combination fitting against standards |
| Principal Component Analysis |
| FEFFIT EXAFS shell fitting |
| Peak fitting (Gaussian, Voigt, etc.) |
Interactive Tools
Tool | Description |
| Open an interactive HTML page to tune normalization parameters |
| Apply normalization parameters from a saved JSON file |
Interactive normalization workflow
Ask Claude to interactively normalize your spectrum
An HTML page opens in your browser with Plotly.js plots and sliders
Adjust E0, pre-edge range, post-edge range, and polynomial degree — plots update in real time
Click Save Parameters to download a JSON file, or Copy to Clipboard
Tell Claude to apply the saved parameters
"Load Pdfoil.prj and let me interactively choose the normalization parameters"
Advanced
Tool | Description |
| Execute arbitrary Python code in the larch session |
Resources
The server exposes documentation resources that Claude can read on demand:
larch://docs/xafs— XAFS analysis referencelarch://docs/io— I/O functions referencelarch://docs/fitting— Fitting referencelarch://docs/feff— FEFF interface referencelarch://docs/interactive— Interactive tools referencelarch://docs/examples/xanes— XANES workflow examplelarch://docs/examples/exafs— EXAFS workflow example
Links
License
BSD-3-Clause (matching xraylarch)
This server cannot be deployed
Maintenance
Related MCP Connectors
MCP server for AI dialogue using various LLM models via AceDataCloud
Personal assistant MCP server with search, execute, packages, jobs, secrets, and integrations.
This MCP server enables users to perform scientific computations regarding linear algebra and vect…
MCP server for generating rough-draft project plans from natural-language prompts.
Related MCP Servers
- AlicenseDqualityDmaintenanceAn MCP server that enables users to generate structured XMind mind maps with hierarchical topics, notes, and labels through natural language. It features automatic file saving to the local Documents folder and can automatically open generated maps in the XMind application.151 npm1MIT
- AlicenseNot gradedqualityDmaintenanceModular MCP server providing text preprocessing and NLP tools for AI agent ecosystems.18 PyPIMIT
- AlicenseBqualityDmaintenanceAn MCP server that lets AI assistants read and visually analyze local documents — PDFs, Excel spreadsheets, CSV files, Word documents, PowerPoint presentations, and images.442 npm53 PyPIMIT
- AlicenseNot gradedqualityDmaintenanceMCP server for creating, modifying, and analyzing KiCAD schematic files using natural language.20MIT