xraylib MCP Server
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.
README
xraylib MCP Server
<!-- mcp-name: io.github.tschoonj/xraylib-mcp-server -->
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)
uv tool install xraylib-mcp-server
Using pip
pip install xraylib-mcp-server
Usage
As a standalone server
# Run with stdio transport (for Claude Desktop, etc.)
xraylib-mcp-server
# Run with HTTP transport
xraylib-mcp-server --transport http --port 8000
# Run with SSE transport
xraylib-mcp-server --transport sse --port 8000
With Claude Desktop
Add to your Claude Desktop configuration:
{
"mcpServers": {
"xraylib": {
"command": "uvx",
"args": ["xraylib-mcp-server"]
}
}
}
Or using the pre-built Docker image:
{
"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):
{
"mcp.servers": {
"xraylib": {
"command": "uvx",
"args": ["xraylib-mcp-server"]
}
}
}
Or using the pre-built Docker image:
{
"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:
claude mcp add xraylib -- uvx xraylib-mcp-server
Or using the pre-built Docker image:
claude mcp add xraylib -- docker run -i --rm ghcr.io/tschoonj/xraylib-mcp-server:latest
As a development server
# Run in development mode with MCP inspector
uv run mcp dev src/xraylib_mcp_server/server.py
Using Docker
Pre-built images from GitHub Container Registry
# Pull the latest image
docker pull ghcr.io/tschoonj/xraylib-mcp-server:latest
# Run with stdio transport
docker run -i --rm ghcr.io/tschoonj/xraylib-mcp-server:latest
# Run with HTTP transport on port 8000
docker run --rm -p 8000:8000 ghcr.io/tschoonj/xraylib-mcp-server:latest xraylib-mcp-server --transport http --port 8000
# Use a specific version
docker pull ghcr.io/tschoonj/xraylib-mcp-server:0.1.0
docker run -i --rm ghcr.io/tschoonj/xraylib-mcp-server:0.1.0
Local development with Docker
# Build the Docker image locally
docker build -t xraylib-mcp-server .
# Run with stdio transport
docker run -i --rm xraylib-mcp-server
# Run with HTTP transport on port 8000
docker run --rm -p 8000:8000 xraylib-mcp-server xraylib-mcp-server --transport http --port 8000
Development
Setup
# Clone the repository
git clone https://github.com/tschoonj/xraylib-mcp-server.git
cd xraylib-mcp-server
# Install development dependencies
uv sync --dev
Running tests
# Run all tests
uv run pytest
# Run with coverage
uv run pytest --cov=src/xraylib_mcp_server --cov-report=html
Code quality
# Lint
uv run ruff check .
# Format
uv run ruff format .
# Type check
uv run mypy src/ --ignore-missing-imports
License
BSD 3-Clause License -- see LICENSE for details.
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests for new functionality
- Run the test suite
- Submit a pull request
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.