xraylib-mcp-server 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,258 @@
1
+ Metadata-Version: 2.3
2
+ Name: xraylib-mcp-server
3
+ Version: 0.1.0
4
+ Summary: Model Context Protocol server for xraylib X-ray interaction data
5
+ Keywords: mcp,xraylib,xray,spectroscopy,fluorescence,api
6
+ Author: Tom Schoonjans
7
+ Author-email: Tom Schoonjans <Tom.Schoonjans@genomics.com>
8
+ License: BSD-3-Clause
9
+ Classifier: Development Status :: 3 - Alpha
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: Intended Audience :: Science/Research
12
+ Classifier: License :: OSI Approved :: BSD License
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: 3.13
17
+ Classifier: Programming Language :: Python :: 3.14
18
+ Classifier: Topic :: Scientific/Engineering :: Physics
19
+ Requires-Dist: mcp[cli]>=1.0.0
20
+ Requires-Dist: xraylib>=4.1.0
21
+ Requires-Python: >=3.11
22
+ Description-Content-Type: text/markdown
23
+
24
+ # xraylib MCP Server
25
+
26
+ [![CI](https://github.com/tschoonj/xraylib-mcp/actions/workflows/ci.yml/badge.svg)](https://github.com/tschoonj/xraylib-mcp/actions/workflows/ci.yml)
27
+ [![Docker](https://github.com/tschoonj/xraylib-mcp/actions/workflows/docker.yml/badge.svg)](https://github.com/tschoonj/xraylib-mcp/actions/workflows/docker.yml)
28
+ [![Docker Image](https://img.shields.io/badge/docker-ghcr.io%2Ftschoonj%2Fxraylib--mcp-blue)](https://github.com/tschoonj/xraylib-mcp/pkgs/container/xraylib-mcp)
29
+ [![PyPI](https://img.shields.io/pypi/v/xraylib-mcp-server)](https://pypi.org/project/xraylib-mcp-server/)
30
+ [![License: BSD-3-Clause](https://img.shields.io/badge/License-BSD--3--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause)
31
+
32
+ A [Model Context Protocol](https://modelcontextprotocol.io) (MCP) server that provides access to [xraylib](https://github.com/tschoonj/xraylib) X-ray interaction data through a standardized interface. Query cross-sections, fluorescence lines, edge energies, and more from any MCP-compatible client.
33
+
34
+ ## Features
35
+
36
+ This server exposes 101 tools organized into the following categories:
37
+
38
+ ### Utility tools
39
+ - **AtomicNumberToSymbol** / **SymbolToAtomicNumber** -- convert between atomic numbers and element symbols
40
+ - **AtomicWeight** -- atomic weight (g/mol)
41
+ - **ElementDensity** -- element density (g/cm3)
42
+ - **ElectronConfig** -- electron configuration for a given shell
43
+ - **CompoundParser** -- parse chemical formulas (e.g. `SiO2`, `Ca5(PO4)3F`)
44
+ - **Atomic_Factors** -- atomic scattering factors f0, f', f''
45
+
46
+ ### Line, edge, and shell properties
47
+ - **LineEnergy** / **EdgeEnergy** -- fluorescence line and absorption edge energies (keV)
48
+ - **FluorYield** / **JumpFactor** / **RadRate** -- fluorescence yields, jump factors, radiative rates
49
+ - **AtomicLevelWidth** -- natural widths of atomic levels (keV)
50
+
51
+ ### Cross-sections (element)
52
+ - **CS_Total**, **CS_Photo**, **CS_Rayl**, **CS_Compt**, **CS_Energy**, **CS_KN** -- mass cross-sections (cm2/g)
53
+ - **CSb_Total**, **CSb_Photo**, **CSb_Rayl**, **CSb_Compt** -- atomic cross-sections (barn/atom)
54
+
55
+ ### Fluorescence cross-sections
56
+ - **CS_FluorLine** / **CSb_FluorLine** -- line fluorescence cross-sections
57
+ - **CS_FluorShell** / **CSb_FluorShell** -- shell fluorescence cross-sections
58
+ - Kissel photoionization variants with full, radiative, nonradiative, and no cascade options
59
+
60
+ ### Differential cross-sections
61
+ - **DCS_Rayl** / **DCS_Compt** and barn/atom variants -- unpolarized differential cross-sections
62
+ - **DCSP_Rayl** / **DCSP_Compt** and barn/atom variants -- polarized differential cross-sections
63
+
64
+ ### Scattering factors
65
+ - **FF_Rayl** / **SF_Compt** -- Rayleigh form factor and Compton scattering function
66
+ - **MomentTransf** / **ComptonEnergy** -- momentum transfer and Compton-scattered photon energy
67
+ - **Fi** / **Fii** -- anomalous scattering factors
68
+ - **ComptonProfile** / **ComptonProfile_Partial** -- Compton profiles (total and per-shell)
69
+
70
+ ### Auger and Coster-Kronig transitions
71
+ - **AugerRate** / **AugerYield** -- Auger transition rates and yields
72
+ - **CosKronTransProb** -- Coster-Kronig transition probabilities
73
+
74
+ ### Compound cross-sections
75
+ - All CS/CSb, DCS/DCSb, and DCSP/DCSPb variants for compounds (by chemical formula)
76
+ - Kissel photoionization variants for compounds
77
+
78
+ ### Refractive index
79
+ - **Refractive_Index_Re** / **Refractive_Index_Im** -- real and imaginary parts of the refractive index
80
+
81
+ ### NIST compounds
82
+ - **GetCompoundDataNISTByName** / **GetCompoundDataNISTByIndex** / **GetCompoundDataNISTList** -- access the built-in NIST compound database
83
+
84
+ ### Constant listings
85
+ - **ListLineConstants** / **ListShellConstants** / **ListTransitionConstants** / **ListAugerConstants** / **ListNISTCompoundConstants** -- enumerate valid constant names
86
+
87
+ ## Installation
88
+
89
+ ### Using uv (recommended)
90
+
91
+ ```bash
92
+ uv tool install xraylib-mcp-server
93
+ ```
94
+
95
+ ### Using pip
96
+
97
+ ```bash
98
+ pip install xraylib-mcp-server
99
+ ```
100
+
101
+ ## Usage
102
+
103
+ ### As a standalone server
104
+
105
+ ```bash
106
+ # Run with stdio transport (for Claude Desktop, etc.)
107
+ xraylib-mcp-server
108
+
109
+ # Run with HTTP transport
110
+ xraylib-mcp-server --transport http --port 8000
111
+
112
+ # Run with SSE transport
113
+ xraylib-mcp-server --transport sse --port 8000
114
+ ```
115
+
116
+ ### With Claude Desktop
117
+
118
+ Add to your Claude Desktop configuration:
119
+
120
+ ```json
121
+ {
122
+ "mcpServers": {
123
+ "xraylib": {
124
+ "command": "uvx",
125
+ "args": ["xraylib-mcp-server"]
126
+ }
127
+ }
128
+ }
129
+ ```
130
+
131
+ Or using the pre-built Docker image:
132
+
133
+ ```json
134
+ {
135
+ "mcpServers": {
136
+ "xraylib": {
137
+ "command": "docker",
138
+ "args": ["run", "-i", "--rm", "ghcr.io/tschoonj/xraylib-mcp:latest"]
139
+ }
140
+ }
141
+ }
142
+ ```
143
+
144
+ ### With VS Code
145
+
146
+ Add to your VS Code settings (`.vscode/settings.json` or user settings):
147
+
148
+ ```json
149
+ {
150
+ "mcp.servers": {
151
+ "xraylib": {
152
+ "command": "uvx",
153
+ "args": ["xraylib-mcp-server"]
154
+ }
155
+ }
156
+ }
157
+ ```
158
+
159
+ Or using the pre-built Docker image:
160
+
161
+ ```json
162
+ {
163
+ "mcp.servers": {
164
+ "xraylib": {
165
+ "command": "docker",
166
+ "args": ["run", "-i", "--rm", "ghcr.io/tschoonj/xraylib-mcp:latest"]
167
+ }
168
+ }
169
+ }
170
+ ```
171
+
172
+ ### As a development server
173
+
174
+ ```bash
175
+ # Run in development mode with MCP inspector
176
+ uv run mcp dev src/xraylib_mcp_server/server.py
177
+ ```
178
+
179
+ ### Using Docker
180
+
181
+ #### Pre-built images from GitHub Container Registry
182
+
183
+ ```bash
184
+ # Pull the latest image
185
+ docker pull ghcr.io/tschoonj/xraylib-mcp:latest
186
+
187
+ # Run with stdio transport
188
+ docker run -i --rm ghcr.io/tschoonj/xraylib-mcp:latest
189
+
190
+ # Run with HTTP transport on port 8000
191
+ docker run --rm -p 8000:8000 ghcr.io/tschoonj/xraylib-mcp:latest xraylib-mcp-server --transport http --port 8000
192
+
193
+ # Use a specific version
194
+ docker pull ghcr.io/tschoonj/xraylib-mcp:0.1.0
195
+ docker run -i --rm ghcr.io/tschoonj/xraylib-mcp:0.1.0
196
+ ```
197
+
198
+ #### Local development with Docker
199
+
200
+ ```bash
201
+ # Build the Docker image locally
202
+ docker build -t xraylib-mcp-server .
203
+
204
+ # Run with stdio transport
205
+ docker run -i --rm xraylib-mcp-server
206
+
207
+ # Run with HTTP transport on port 8000
208
+ docker run --rm -p 8000:8000 xraylib-mcp-server xraylib-mcp-server --transport http --port 8000
209
+ ```
210
+
211
+ ## Development
212
+
213
+ ### Setup
214
+
215
+ ```bash
216
+ # Clone the repository
217
+ git clone https://github.com/tschoonj/xraylib-mcp.git
218
+ cd xraylib-mcp
219
+
220
+ # Install development dependencies
221
+ uv sync --dev
222
+ ```
223
+
224
+ ### Running tests
225
+
226
+ ```bash
227
+ # Run all tests
228
+ uv run pytest
229
+
230
+ # Run with coverage
231
+ uv run pytest --cov=src/xraylib_mcp_server --cov-report=html
232
+ ```
233
+
234
+ ### Code quality
235
+
236
+ ```bash
237
+ # Lint
238
+ uv run ruff check .
239
+
240
+ # Format
241
+ uv run ruff format .
242
+
243
+ # Type check
244
+ uv run mypy src/ --ignore-missing-imports
245
+ ```
246
+
247
+ ## License
248
+
249
+ BSD 3-Clause License -- see [LICENSE](LICENSE) for details.
250
+
251
+ ## Contributing
252
+
253
+ 1. Fork the repository
254
+ 2. Create a feature branch
255
+ 3. Make your changes
256
+ 4. Add tests for new functionality
257
+ 5. Run the test suite
258
+ 6. Submit a pull request
@@ -0,0 +1,235 @@
1
+ # xraylib MCP Server
2
+
3
+ [![CI](https://github.com/tschoonj/xraylib-mcp/actions/workflows/ci.yml/badge.svg)](https://github.com/tschoonj/xraylib-mcp/actions/workflows/ci.yml)
4
+ [![Docker](https://github.com/tschoonj/xraylib-mcp/actions/workflows/docker.yml/badge.svg)](https://github.com/tschoonj/xraylib-mcp/actions/workflows/docker.yml)
5
+ [![Docker Image](https://img.shields.io/badge/docker-ghcr.io%2Ftschoonj%2Fxraylib--mcp-blue)](https://github.com/tschoonj/xraylib-mcp/pkgs/container/xraylib-mcp)
6
+ [![PyPI](https://img.shields.io/pypi/v/xraylib-mcp-server)](https://pypi.org/project/xraylib-mcp-server/)
7
+ [![License: BSD-3-Clause](https://img.shields.io/badge/License-BSD--3--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause)
8
+
9
+ A [Model Context Protocol](https://modelcontextprotocol.io) (MCP) server that provides access to [xraylib](https://github.com/tschoonj/xraylib) X-ray interaction data through a standardized interface. Query cross-sections, fluorescence lines, edge energies, and more from any MCP-compatible client.
10
+
11
+ ## Features
12
+
13
+ This server exposes 101 tools organized into the following categories:
14
+
15
+ ### Utility tools
16
+ - **AtomicNumberToSymbol** / **SymbolToAtomicNumber** -- convert between atomic numbers and element symbols
17
+ - **AtomicWeight** -- atomic weight (g/mol)
18
+ - **ElementDensity** -- element density (g/cm3)
19
+ - **ElectronConfig** -- electron configuration for a given shell
20
+ - **CompoundParser** -- parse chemical formulas (e.g. `SiO2`, `Ca5(PO4)3F`)
21
+ - **Atomic_Factors** -- atomic scattering factors f0, f', f''
22
+
23
+ ### Line, edge, and shell properties
24
+ - **LineEnergy** / **EdgeEnergy** -- fluorescence line and absorption edge energies (keV)
25
+ - **FluorYield** / **JumpFactor** / **RadRate** -- fluorescence yields, jump factors, radiative rates
26
+ - **AtomicLevelWidth** -- natural widths of atomic levels (keV)
27
+
28
+ ### Cross-sections (element)
29
+ - **CS_Total**, **CS_Photo**, **CS_Rayl**, **CS_Compt**, **CS_Energy**, **CS_KN** -- mass cross-sections (cm2/g)
30
+ - **CSb_Total**, **CSb_Photo**, **CSb_Rayl**, **CSb_Compt** -- atomic cross-sections (barn/atom)
31
+
32
+ ### Fluorescence cross-sections
33
+ - **CS_FluorLine** / **CSb_FluorLine** -- line fluorescence cross-sections
34
+ - **CS_FluorShell** / **CSb_FluorShell** -- shell fluorescence cross-sections
35
+ - Kissel photoionization variants with full, radiative, nonradiative, and no cascade options
36
+
37
+ ### Differential cross-sections
38
+ - **DCS_Rayl** / **DCS_Compt** and barn/atom variants -- unpolarized differential cross-sections
39
+ - **DCSP_Rayl** / **DCSP_Compt** and barn/atom variants -- polarized differential cross-sections
40
+
41
+ ### Scattering factors
42
+ - **FF_Rayl** / **SF_Compt** -- Rayleigh form factor and Compton scattering function
43
+ - **MomentTransf** / **ComptonEnergy** -- momentum transfer and Compton-scattered photon energy
44
+ - **Fi** / **Fii** -- anomalous scattering factors
45
+ - **ComptonProfile** / **ComptonProfile_Partial** -- Compton profiles (total and per-shell)
46
+
47
+ ### Auger and Coster-Kronig transitions
48
+ - **AugerRate** / **AugerYield** -- Auger transition rates and yields
49
+ - **CosKronTransProb** -- Coster-Kronig transition probabilities
50
+
51
+ ### Compound cross-sections
52
+ - All CS/CSb, DCS/DCSb, and DCSP/DCSPb variants for compounds (by chemical formula)
53
+ - Kissel photoionization variants for compounds
54
+
55
+ ### Refractive index
56
+ - **Refractive_Index_Re** / **Refractive_Index_Im** -- real and imaginary parts of the refractive index
57
+
58
+ ### NIST compounds
59
+ - **GetCompoundDataNISTByName** / **GetCompoundDataNISTByIndex** / **GetCompoundDataNISTList** -- access the built-in NIST compound database
60
+
61
+ ### Constant listings
62
+ - **ListLineConstants** / **ListShellConstants** / **ListTransitionConstants** / **ListAugerConstants** / **ListNISTCompoundConstants** -- enumerate valid constant names
63
+
64
+ ## Installation
65
+
66
+ ### Using uv (recommended)
67
+
68
+ ```bash
69
+ uv tool install xraylib-mcp-server
70
+ ```
71
+
72
+ ### Using pip
73
+
74
+ ```bash
75
+ pip install xraylib-mcp-server
76
+ ```
77
+
78
+ ## Usage
79
+
80
+ ### As a standalone server
81
+
82
+ ```bash
83
+ # Run with stdio transport (for Claude Desktop, etc.)
84
+ xraylib-mcp-server
85
+
86
+ # Run with HTTP transport
87
+ xraylib-mcp-server --transport http --port 8000
88
+
89
+ # Run with SSE transport
90
+ xraylib-mcp-server --transport sse --port 8000
91
+ ```
92
+
93
+ ### With Claude Desktop
94
+
95
+ Add to your Claude Desktop configuration:
96
+
97
+ ```json
98
+ {
99
+ "mcpServers": {
100
+ "xraylib": {
101
+ "command": "uvx",
102
+ "args": ["xraylib-mcp-server"]
103
+ }
104
+ }
105
+ }
106
+ ```
107
+
108
+ Or using the pre-built Docker image:
109
+
110
+ ```json
111
+ {
112
+ "mcpServers": {
113
+ "xraylib": {
114
+ "command": "docker",
115
+ "args": ["run", "-i", "--rm", "ghcr.io/tschoonj/xraylib-mcp:latest"]
116
+ }
117
+ }
118
+ }
119
+ ```
120
+
121
+ ### With VS Code
122
+
123
+ Add to your VS Code settings (`.vscode/settings.json` or user settings):
124
+
125
+ ```json
126
+ {
127
+ "mcp.servers": {
128
+ "xraylib": {
129
+ "command": "uvx",
130
+ "args": ["xraylib-mcp-server"]
131
+ }
132
+ }
133
+ }
134
+ ```
135
+
136
+ Or using the pre-built Docker image:
137
+
138
+ ```json
139
+ {
140
+ "mcp.servers": {
141
+ "xraylib": {
142
+ "command": "docker",
143
+ "args": ["run", "-i", "--rm", "ghcr.io/tschoonj/xraylib-mcp:latest"]
144
+ }
145
+ }
146
+ }
147
+ ```
148
+
149
+ ### As a development server
150
+
151
+ ```bash
152
+ # Run in development mode with MCP inspector
153
+ uv run mcp dev src/xraylib_mcp_server/server.py
154
+ ```
155
+
156
+ ### Using Docker
157
+
158
+ #### Pre-built images from GitHub Container Registry
159
+
160
+ ```bash
161
+ # Pull the latest image
162
+ docker pull ghcr.io/tschoonj/xraylib-mcp:latest
163
+
164
+ # Run with stdio transport
165
+ docker run -i --rm ghcr.io/tschoonj/xraylib-mcp:latest
166
+
167
+ # Run with HTTP transport on port 8000
168
+ docker run --rm -p 8000:8000 ghcr.io/tschoonj/xraylib-mcp:latest xraylib-mcp-server --transport http --port 8000
169
+
170
+ # Use a specific version
171
+ docker pull ghcr.io/tschoonj/xraylib-mcp:0.1.0
172
+ docker run -i --rm ghcr.io/tschoonj/xraylib-mcp:0.1.0
173
+ ```
174
+
175
+ #### Local development with Docker
176
+
177
+ ```bash
178
+ # Build the Docker image locally
179
+ docker build -t xraylib-mcp-server .
180
+
181
+ # Run with stdio transport
182
+ docker run -i --rm xraylib-mcp-server
183
+
184
+ # Run with HTTP transport on port 8000
185
+ docker run --rm -p 8000:8000 xraylib-mcp-server xraylib-mcp-server --transport http --port 8000
186
+ ```
187
+
188
+ ## Development
189
+
190
+ ### Setup
191
+
192
+ ```bash
193
+ # Clone the repository
194
+ git clone https://github.com/tschoonj/xraylib-mcp.git
195
+ cd xraylib-mcp
196
+
197
+ # Install development dependencies
198
+ uv sync --dev
199
+ ```
200
+
201
+ ### Running tests
202
+
203
+ ```bash
204
+ # Run all tests
205
+ uv run pytest
206
+
207
+ # Run with coverage
208
+ uv run pytest --cov=src/xraylib_mcp_server --cov-report=html
209
+ ```
210
+
211
+ ### Code quality
212
+
213
+ ```bash
214
+ # Lint
215
+ uv run ruff check .
216
+
217
+ # Format
218
+ uv run ruff format .
219
+
220
+ # Type check
221
+ uv run mypy src/ --ignore-missing-imports
222
+ ```
223
+
224
+ ## License
225
+
226
+ BSD 3-Clause License -- see [LICENSE](LICENSE) for details.
227
+
228
+ ## Contributing
229
+
230
+ 1. Fork the repository
231
+ 2. Create a feature branch
232
+ 3. Make your changes
233
+ 4. Add tests for new functionality
234
+ 5. Run the test suite
235
+ 6. Submit a pull request
@@ -0,0 +1,58 @@
1
+ [project]
2
+ name = "xraylib-mcp-server"
3
+ version = "0.1.0"
4
+ description = "Model Context Protocol server for xraylib X-ray interaction data"
5
+ readme = "README.md"
6
+ requires-python = ">=3.11"
7
+ authors = [
8
+ { name = "Tom Schoonjans", email = "Tom.Schoonjans@genomics.com" }
9
+ ]
10
+ license = { text = "BSD-3-Clause" }
11
+ keywords = ["mcp", "xraylib", "xray", "spectroscopy", "fluorescence", "api"]
12
+ classifiers = [
13
+ "Development Status :: 3 - Alpha",
14
+ "Intended Audience :: Developers",
15
+ "Intended Audience :: Science/Research",
16
+ "License :: OSI Approved :: BSD License",
17
+ "Programming Language :: Python :: 3",
18
+ "Programming Language :: Python :: 3.11",
19
+ "Programming Language :: Python :: 3.12",
20
+ "Programming Language :: Python :: 3.13",
21
+ "Programming Language :: Python :: 3.14",
22
+ "Topic :: Scientific/Engineering :: Physics",
23
+ ]
24
+
25
+ dependencies = [
26
+ "mcp[cli]>=1.0.0",
27
+ "xraylib>=4.1.0",
28
+ ]
29
+
30
+ [project.scripts]
31
+ xraylib-mcp-server = "xraylib_mcp_server.server:main"
32
+
33
+ [build-system]
34
+ requires = ["uv_build>=0.11.3,<0.12"]
35
+ build-backend = "uv_build"
36
+
37
+ [tool.pytest.ini_options]
38
+ testpaths = ["tests"]
39
+ asyncio_mode = "auto"
40
+ addopts = "-v --cov=src/xraylib_mcp_server --cov-report=term-missing"
41
+ markers = [
42
+ "integration: marks tests as integration tests requiring xraylib installed (deselect with '-m \"not integration\"')"
43
+ ]
44
+
45
+ [tool.mypy]
46
+ python_version = "3.11"
47
+ warn_return_any = true
48
+ warn_unused_configs = true
49
+ disallow_untyped_defs = true
50
+
51
+ [dependency-groups]
52
+ dev = [
53
+ "mypy>=1.18.1",
54
+ "pytest>=8.4.2",
55
+ "pytest-asyncio>=1.2.0",
56
+ "pytest-cov>=7.0.0",
57
+ "ruff>=0.13.0",
58
+ ]
@@ -0,0 +1,5 @@
1
+ """xraylib MCP Server - X-ray interaction data via Model Context Protocol."""
2
+
3
+ from importlib.metadata import version
4
+
5
+ __version__ = version("xraylib-mcp-server")