Xraylib Mcp Server

io.github.tschoonjPublished by GitHub account tschoonjv0.1.6Updated Oct 24, 2026

MCP server providing X-ray interaction data via xraylib

VerifiedSTDIODesktop onlyData & AnalyticsAI & ML

Overview

AI-generated overview

Local MCP server exposing xraylib X-ray interaction data, letting an assistant compute cross-sections, fluorescence lines, edge energies and related physics…

What you can do
  • Convert between atomic numbers and element symbols, and look up atomic weights, densities, electron configurations and parsed chemical formulas
  • Compute fluorescence line and absorption edge energies, fluorescence yields, jump factors, radiative rates and atomic level widths
  • Calculate element and compound mass and atomic cross-sections, including fluorescence and Kissel photoionization variants
  • Compute differential cross-sections, Rayleigh and Compton scattering factors, anomalous scattering factors and Compton profiles
  • Look up Auger and Coster-Kronig rates and probabilities, refractive index parts, and built-in NIST compound and radionuclide data
  • List valid line, shell, transition, Auger…
When to use it
Useful when working on X-ray physics, spectroscopy, materials analysis or detector modelling and you want an assistant to look up or compute xraylib values instead of writing scripts. It suits desktop clients that can launch a local process.
Requirements
Runs as a local process on the user's machine (desktop only, no web executable). Install via uvx or pip from the PyPI package, or run the published Docker image; no authentication, environment variables or headers are declared.
Before you install
The server is read-only reference and calculation data with no declared credentials, so risk is low; it is desktop-only and cannot be used from a web client. Results depend on the bundled xraylib data and should be checked for scientific use.

Installation

In SourceWeft

  1. Open Xraylib Mcp Server in the dashboard and add it to a workspace.
  2. Enable the server for the chats that should use its tools.

Desktop only via STDIO. STDIO servers start a local process, so they need the SourceWeft desktop host.

Other MCP clients

Follow the launch instructions in the repository.

README

xraylib MCP Server

[CI] [Docker Image] [PyPI] [License: BSD-3-Clause]

A Model Context Protocol (MCP) server that provides access to xraylib X-ray interaction data through a standardized interface. Query cross-sections, fluorescence lines, edge energies, and more from any MCP-compatible client.

Table of Contents

Features

This server exposes 104 tools organized into the following categories:

Utility tools

  • AtomicNumberToSymbol / SymbolToAtomicNumber -- convert between atomic numbers and element symbols
  • AtomicWeight -- atomic weight (g/mol)
  • ElementDensity -- element density (g/cm3)
  • ElectronConfig -- electron configuration for a given shell
  • CompoundParser -- parse chemical formulas (e.g. SiO2, Ca5(PO4)3F)
  • Atomic_Factors -- atomic scattering factors f0, f', f''

Line, edge, and shell properties

  • LineEnergy / EdgeEnergy -- fluorescence line and absorption edge energies (keV)
  • FluorYield / JumpFactor / RadRate -- fluorescence yields, jump factors, radiative rates
  • AtomicLevelWidth -- natural widths of atomic levels (keV)

Cross-sections (element)

  • CS_Total, CS_Photo, CS_Rayl, CS_Compt, CS_Energy, CS_KN -- mass cross-sections (cm2/g)
  • CSb_Total, CSb_Photo, CSb_Rayl, CSb_Compt -- atomic cross-sections (barn/atom)

Fluorescence cross-sections

  • CS_FluorLine / CSb_FluorLine -- line fluorescence cross-sections
  • CS_FluorShell / CSb_FluorShell -- shell fluorescence cross-sections
  • Kissel photoionization variants with full, radiative, nonradiative, and no cascade options

Differential cross-sections

  • DCS_Rayl / DCS_Compt and barn/atom variants -- unpolarized differential cross-sections
  • DCSP_Rayl / DCSP_Compt and barn/atom variants -- polarized differential cross-sections

Scattering factors

  • FF_Rayl / SF_Compt -- Rayleigh form factor and Compton scattering function
  • MomentTransf / ComptonEnergy -- momentum transfer and Compton-scattered photon energy
  • Fi / Fii -- anomalous scattering factors
  • ComptonProfile / ComptonProfile_Partial -- Compton profiles (total and per-shell)

Auger and Coster-Kronig transitions

  • AugerRate / AugerYield -- Auger transition rates and yields
  • CosKronTransProb -- Coster-Kronig transition probabilities

Compound cross-sections

  • All CS/CSb, DCS/DCSb, and DCSP/DCSPb variants for compounds (by chemical formula)
  • Kissel photoionization variants for compounds

Refractive index

  • Refractive_Index_Re / Refractive_Index_Im -- real and imaginary parts of the refractive index

NIST compounds

  • GetCompoundDataNISTByName / GetCompoundDataNISTByIndex / GetCompoundDataNISTList -- access the built-in NIST compound database

Radionuclide data

  • GetRadioNuclideDataByName / GetRadioNuclideDataByIndex / GetRadioNuclideDataList -- access the built-in radionuclide database (X-ray lines, intensities, gamma energies)

Constant listings

  • ListLineConstants / ListShellConstants / ListTransitionConstants / ListAugerConstants / ListNISTCompoundConstants -- enumerate valid constant names

Installation

Using uv (recommended)

bash
uv tool install xraylib-mcp-server

Using pip

bash
pip install xraylib-mcp-server

Usage

As a standalone server

bash
# Run with stdio transport (for Claude Desktop, etc.)xraylib-mcp-server
# Run with HTTP transportxraylib-mcp-server --transport http --port 8000
# Run with SSE transportxraylib-mcp-server --transport sse --port 8000

With Claude Desktop

Add to your Claude Desktop configuration:

json
{  "mcpServers": {    "xraylib": {      "command": "uvx",      "args": ["xraylib-mcp-server"]    }  }}

Or using the pre-built Docker image:

json
{  "mcpServers": {    "xraylib": {      "command": "docker",      "args": ["run", "-i", "--rm", "ghcr.io/tschoonj/xraylib-mcp-server:latest"]    }  }}

With VS Code

Add to your VS Code settings (.vscode/settings.json or user settings):

json
{  "mcp.servers": {    "xraylib": {      "command": "uvx",      "args": ["xraylib-mcp-server"]    }  }}

Or using the pre-built Docker image:

json
{  "mcp.servers": {    "xraylib": {      "command": "docker",      "args": ["run", "-i", "--rm", "ghcr.io/tschoonj/xraylib-mcp-server:latest"]    }  }}

With Claude Code

Add the server using the CLI:

bash
claude mcp add xraylib -- uvx xraylib-mcp-server

Or using the pre-built Docker image:

bash
claude mcp add xraylib -- docker run -i --rm ghcr.io/tschoonj/xraylib-mcp-server:latest

As a development server

bash
# Run in development mode with MCP inspectoruv run mcp dev src/xraylib_mcp_server/server.py

Using Docker

Pre-built images from GitHub Container Registry
bash
# Pull the latest imagedocker pull ghcr.io/tschoonj/xraylib-mcp-server:latest
# Run with stdio transportdocker run -i --rm ghcr.io/tschoonj/xraylib-mcp-server:latest
# Run with HTTP transport on port 8000docker run --rm -p 8000:8000 ghcr.io/tschoonj/xraylib-mcp-server:latest xraylib-mcp-server --transport http --port 8000
# Use a specific versiondocker pull ghcr.io/tschoonj/xraylib-mcp-server:0.1.0docker run -i --rm ghcr.io/tschoonj/xraylib-mcp-server:0.1.0
Local development with Docker
bash
# Build the Docker image locallydocker build -t xraylib-mcp-server .
# Run with stdio transportdocker run -i --rm xraylib-mcp-server
# Run with HTTP transport on port 8000docker run --rm -p 8000:8000 xraylib-mcp-server xraylib-mcp-server --transport http --port 8000

Development

Setup

bash
# Clone the repositorygit clone https://github.com/tschoonj/xraylib-mcp-server.gitcd xraylib-mcp-server
# Install development dependenciesuv sync --dev

Running tests

bash
# Run all testsuv run pytest
# Run with coverageuv run pytest --cov=src/xraylib_mcp_server --cov-report=html

Code quality

bash
# Lintuv run ruff check .
# Formatuv run ruff format .
# Type checkuv run mypy src/ --ignore-missing-imports

License

BSD 3-Clause License -- see LICENSE for details.

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests for new functionality
  5. Run the test suite
  6. Submit a pull request

Source: README.md at commit caee27b

Tools

0
SourceWeft has not started this package in its sandbox yet, so its tools are not known.

Version history

1
  1. v0.1.6LatestSep 16, 2026

Score

50% of the applicable checks met

How complete this listing is, computed from the registry entry, the endpoint and public sources. Not a rating of the server and not a statement that it is safe or working today: reachability is a dated check, and no installs or reviews go into the score.

  • Reached in the last 30 days25 pts

    Keep the endpoint answering the MCP handshake; SourceWeft probes it every 30 days.

  • Auth declared10 pts

    Declare the credential headers in the registry entry, or keep the endpoint answering the probe so its auth can be classified.

  • Tools listed15 pts

    Answer tools/list without a credential, or ship a package that starts in a sandbox without one.

  • DescriptionRequired15 pts
  • Logo10 pts
  • Documentation15 pts
  • License10 pts