Get the FREE Ultimate OpenClaw Setup Guide →

xraydb

MCP server prototype for the XrayDB database.

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio gnzng-xraydb-mcp-server python src/server.py

How to use

XrayDB MCP Server provides programmatic access to X-ray properties of elements via the XrayDB library. It exposes a collection of endpoints (MCP methods) that let clients query X-ray absorption edges, scattering factors, reflectivity calculations, and various material properties. Typical usage involves starting the Python-based MCP server and then issuing requests to the available endpoints through the MCP protocol to retrieve data for a given element (by atomic number or symbol) or energy values. The server aggregates functionality from XrayDB for both elemental data and photon-material interactions, making it suitable for workflows in spectroscopy, materials science, and instrumentation design.

To leverage the capabilities, connect to the MCP server using the MCP client tooling in your environment and call the implemented methods. Core endpoints include retrieving all X-ray edges for an element, obtaining data for a specific edge, guessing the element and edge from an energy, and computing various attenuation, reflectivity, and scattering quantities. Other useful operations cover line data, Chantler tables, Lambert-Beer transmission, and cross-sections from Elam tables, among many others. This enables comprehensive querying of X-ray properties directly from your scripts or interactive environment.

How to install

Prerequisites:

  • Python 3.8+ installed
  • pip available in PATH
  • Basic familiarity with running Python scripts

Step-by-step installation:

  1. Create and activate a virtual environment (optional but recommended):

    python -m venv venv

    Windows

    venv\Scripts\activate

    macOS/Linux

    source venv/bin/activate

  2. Install MCP and XrayDB dependencies listed in requirements.txt:

    pip install -r requirements.txt

  3. Run the MCP server using the provided script:

    python src/server.py

  4. (Optional) If you prefer using a startup script on UNIX or Windows, ensure the script has executable permissions and run it:

    chmod +x startup.sh ./startup.sh

Prerequisites recap:

  • Python interpreter
  • Network access if running in environments with restricted outbound connections
  • Access to the repository containing requirements.txt and the server script

Additional notes

Tips and reminders:

  • The MCP server is Python-based and uses XrayDB under the hood. If you update dependencies, re-run pip install -r requirements.txt to ensure compatibility.
  • The server exposes a wide range of endpoints (edges, line data, reflectivity, attenuation, etc.). Use the MCP client to discover available methods and their expected parameters.
  • If you encounter issues connecting to the server, verify that the process is running and listening on the expected port, and check firewall or network policies in your environment.
  • When deploying in production, consider pinning versions in requirements.txt to stable releases to avoid breaking changes.
  • Some endpoints may require specific input formats (e.g., element symbols or atomic numbers, energy values in keV). Refer to the MCP client documentation for input conventions.
  • If you need to run the server in a non-interactive environment, you may want to redirect logs to a file for easier troubleshooting.

Related MCP Servers

Sponsor this space

Reach thousands of developers