uxarray-mcp 0.1.0__tar.gz → 0.1.2__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.
Files changed (41) hide show
  1. {uxarray_mcp-0.1.0 → uxarray_mcp-0.1.2}/PKG-INFO +151 -177
  2. uxarray_mcp-0.1.2/README.md +206 -0
  3. {uxarray_mcp-0.1.0 → uxarray_mcp-0.1.2}/pyproject.toml +13 -7
  4. {uxarray_mcp-0.1.0 → uxarray_mcp-0.1.2}/src/uxarray_mcp/__init__.py +2 -3
  5. uxarray_mcp-0.1.2/src/uxarray_mcp/app.py +77 -0
  6. {uxarray_mcp-0.1.0 → uxarray_mcp-0.1.2}/src/uxarray_mcp/cli.py +62 -4
  7. {uxarray_mcp-0.1.0 → uxarray_mcp-0.1.2}/src/uxarray_mcp/domain/__init__.py +4 -2
  8. uxarray_mcp-0.1.2/src/uxarray_mcp/domain/mesh.py +63 -0
  9. {uxarray_mcp-0.1.0 → uxarray_mcp-0.1.2}/src/uxarray_mcp/domain/vector_calc.py +19 -5
  10. uxarray_mcp-0.1.2/src/uxarray_mcp/domain/zonal.py +155 -0
  11. uxarray_mcp-0.1.2/src/uxarray_mcp/registry.py +699 -0
  12. {uxarray_mcp-0.1.0 → uxarray_mcp-0.1.2}/src/uxarray_mcp/remote/agent.py +22 -4
  13. {uxarray_mcp-0.1.0 → uxarray_mcp-0.1.2}/src/uxarray_mcp/remote/compute_functions.py +279 -163
  14. {uxarray_mcp-0.1.0 → uxarray_mcp-0.1.2}/src/uxarray_mcp/remote/health.py +68 -8
  15. {uxarray_mcp-0.1.0 → uxarray_mcp-0.1.2}/src/uxarray_mcp/tools/__init__.py +18 -1
  16. {uxarray_mcp-0.1.0 → uxarray_mcp-0.1.2}/src/uxarray_mcp/tools/advanced.py +128 -7
  17. {uxarray_mcp-0.1.0 → uxarray_mcp-0.1.2}/src/uxarray_mcp/tools/capabilities.py +92 -265
  18. {uxarray_mcp-0.1.0 → uxarray_mcp-0.1.2}/src/uxarray_mcp/tools/execution_control.py +1 -1
  19. uxarray_mcp-0.1.2/src/uxarray_mcp/tools/frontdoor.py +531 -0
  20. {uxarray_mcp-0.1.0 → uxarray_mcp-0.1.2}/src/uxarray_mcp/tools/inspection.py +62 -5
  21. {uxarray_mcp-0.1.0 → uxarray_mcp-0.1.2}/src/uxarray_mcp/tools/plotting.py +4 -5
  22. {uxarray_mcp-0.1.0 → uxarray_mcp-0.1.2}/src/uxarray_mcp/tools/remote_tools.py +20 -5
  23. {uxarray_mcp-0.1.0 → uxarray_mcp-0.1.2}/src/uxarray_mcp/tools/stateful.py +1 -1
  24. {uxarray_mcp-0.1.0 → uxarray_mcp-0.1.2}/src/uxarray_mcp/tools/vector_calc.py +31 -12
  25. uxarray_mcp-0.1.0/README.md +0 -232
  26. uxarray_mcp-0.1.0/src/uxarray_mcp/domain/mesh.py +0 -26
  27. uxarray_mcp-0.1.0/src/uxarray_mcp/domain/zonal.py +0 -66
  28. uxarray_mcp-0.1.0/src/uxarray_mcp/server.py +0 -230
  29. {uxarray_mcp-0.1.0 → uxarray_mcp-0.1.2}/LICENSE +0 -0
  30. {uxarray_mcp-0.1.0 → uxarray_mcp-0.1.2}/src/uxarray_mcp/__main__.py +0 -0
  31. {uxarray_mcp-0.1.0 → uxarray_mcp-0.1.2}/src/uxarray_mcp/domain/area.py +0 -0
  32. {uxarray_mcp-0.1.0 → uxarray_mcp-0.1.2}/src/uxarray_mcp/domain/plotting.py +0 -0
  33. {uxarray_mcp-0.1.0 → uxarray_mcp-0.1.2}/src/uxarray_mcp/domain/variable.py +0 -0
  34. {uxarray_mcp-0.1.0 → uxarray_mcp-0.1.2}/src/uxarray_mcp/provenance.py +0 -0
  35. {uxarray_mcp-0.1.0 → uxarray_mcp-0.1.2}/src/uxarray_mcp/py.typed +0 -0
  36. {uxarray_mcp-0.1.0 → uxarray_mcp-0.1.2}/src/uxarray_mcp/remote/__init__.py +0 -0
  37. {uxarray_mcp-0.1.0 → uxarray_mcp-0.1.2}/src/uxarray_mcp/remote/config.py +0 -0
  38. {uxarray_mcp-0.1.0 → uxarray_mcp-0.1.2}/src/uxarray_mcp/state.py +0 -0
  39. {uxarray_mcp-0.1.0 → uxarray_mcp-0.1.2}/src/uxarray_mcp/tools/catalog.py +0 -0
  40. {uxarray_mcp-0.1.0 → uxarray_mcp-0.1.2}/src/uxarray_mcp/tools/orchestration.py +0 -0
  41. {uxarray_mcp-0.1.0 → uxarray_mcp-0.1.2}/src/uxarray_mcp/tools/scientific_agent.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: uxarray-mcp
3
- Version: 0.1.0
3
+ Version: 0.1.2
4
4
  Summary: MCP server for analyzing unstructured meshes with UXarray
5
5
  Keywords: uxarray,mcp,unstructured grids,scientific computing,globus compute
6
6
  Author: Rajeev Jain, Dayan Abdulla
@@ -212,257 +212,231 @@ Classifier: Intended Audience :: Science/Research
212
212
  Classifier: Topic :: Scientific/Engineering
213
213
  Classifier: Programming Language :: Python
214
214
  Classifier: Programming Language :: Python :: 3
215
- Classifier: Programming Language :: Python :: 3.11
216
215
  Classifier: Programming Language :: Python :: 3.12
217
- Classifier: Programming Language :: Python :: 3.13
218
216
  Classifier: License :: OSI Approved :: Apache Software License
219
- Requires-Dist: fastmcp>=3.4.0
217
+ Requires-Dist: toolregistry-server[mcp]>=0.4.0
220
218
  Requires-Dist: holoviews>=1.19.0
221
219
  Requires-Dist: matplotlib>=3.9.0
222
220
  Requires-Dist: pyyaml>=6.0
223
- Requires-Dist: uxarray>=2025.12.0
221
+ Requires-Dist: uxarray>=2026.6.0
224
222
  Requires-Dist: sphinx>=7.0 ; extra == 'docs'
225
223
  Requires-Dist: sphinx-book-theme>=1.1.0 ; extra == 'docs'
226
224
  Requires-Dist: myst-parser>=3.0 ; extra == 'docs'
227
225
  Requires-Dist: academy-py>=0.3.1 ; extra == 'hpc'
228
226
  Requires-Dist: globus-compute-sdk>=4.5.0 ; extra == 'hpc'
229
- Requires-Python: >=3.11
227
+ Requires-Dist: toolregistry-server[openapi]>=0.4.0 ; extra == 'openapi'
228
+ Requires-Python: >=3.12, <3.13
230
229
  Project-URL: Documentation, https://uxarray-mcp-server.readthedocs.io
231
230
  Project-URL: Source, https://github.com/UXARRAY/uxarray-mcp-server
232
231
  Project-URL: Tracker, https://github.com/UXARRAY/uxarray-mcp-server/issues
233
232
  Provides-Extra: docs
234
233
  Provides-Extra: hpc
234
+ Provides-Extra: openapi
235
235
  Description-Content-Type: text/markdown
236
236
 
237
237
  # UXarray MCP Server
238
238
 
239
- An MCP server that exposes [UXarray](https://uxarray.readthedocs.io/) tools to
240
- AI clients such as Claude. It supports:
239
+ An MCP server that lets an AI assistant (Claude Code, Claude Desktop, Cursor,
240
+ or any MCP client) analyze unstructured climate meshes with
241
+ [UXarray](https://uxarray.readthedocs.io/) — locally on your machine, or
242
+ remotely on an HPC system you have access to.
241
243
 
242
- - local execution for normal mesh analysis
243
- - optional remote execution on HPC systems through Globus Compute
244
- - diagnostics and provenance for scientific workflows
244
+ ```text
245
+ ┌─────────────┐ stdio ┌──────────────┐ ┌─────────────────┐
246
+ │ AI client │ ◀─────▶ │ uxarray-mcp │ ◀── Globus ──────▶ │ HPC endpoint │
247
+ │ (Claude…) │ pipe │ (your laptop)│ Compute (opt) │ (Slurm/PBS node)│
248
+ └─────────────┘ └──────────────┘ └─────────────────┘
249
+ ```
245
250
 
246
- ## How it runs
251
+ > **What the AI can do.** Open meshes and datasets, compute area / zonal mean
252
+ > / vorticity / divergence, subset, remap, plot, and run multi-step workflows.
253
+ > All as natural-language prompts.
247
254
 
248
- The server runs as a subprocess of the MCP client (Claude Code, Claude Desktop,
249
- or any FastMCP transport) and dispatches tool calls either locally or to a
250
- configured Globus Compute endpoint on an HPC cluster. Same MCP tool, same
251
- schema `use_remote: bool` on every tool decides which path runs.
255
+ > **Local by default; HPC is opt-in.** Everything runs on your machine unless
256
+ > you configure a [Globus Compute](https://www.globus.org/compute) endpoint.
257
+ > The remote option only becomes available once such an endpoint exists —
258
+ > running one requires an account and allocation on that HPC system, though a
259
+ > shared/service-account endpoint can let authorized users submit without their
260
+ > own login.
252
261
 
253
- **Local mode** analysis on your machine, files on your disk:
262
+ > **⚠️ What the AI can access.** Any file you (or your HPC account) can read.
263
+ > Any compute the configured endpoint can submit. Outputs are written to your
264
+ > disk. **See [SECURITY.md](SECURITY.md) before connecting any remote endpoint.**
254
265
 
255
- ```
256
- ┌────────────────┐ ┌─────────────────────────────┐
257
- │ Claude Code │ stdio │ uv run python -m │ reads
258
- │ / Desktop │ ◀─────▶ │ uxarray_mcp │ ───▶ local
259
- │ │ pipe │ (subprocess on your box) │ mesh files
260
- └────────────────┘ └─────────────────────────────┘
261
- ```
266
+ ---
262
267
 
263
- **HPC mode** analysis on facility hardware, files stay on facility storage:
268
+ ## Pick your path
264
269
 
265
- ```
266
- ┌────────────────┐ stdio ┌─────────────────────────┐ Globus ┌─────────────────────────┐
267
- │ Claude Code │ ◀─────▶ │ uxarray_mcp on laptop ◀──────▶ │ Worker on HPC endpoint │ reads
268
- │ / Desktop │ pipe │ (dispatches when │ Compute │ (uxarray reads file │ ───▶ facility
269
- │ │ │ use_remote=True) │ RPC │ from facility GPFS) │ mesh files
270
- └────────────────┘ └─────────────────────────┘ └─────────────────────────┘ (never copied)
271
- ```
270
+ You are most likely one of:
271
+
272
+ 1. **Local user** laptop only, no HPC. [Local install](#local-install).
273
+ 2. **HPC user, endpoint already exists** someone at your lab gave you a
274
+ Globus Compute endpoint UUID. → [Local install](#local-install), then
275
+ [docs/remote-hpc.md](docs/remote-hpc.md).
276
+ 3. **HPC user, your own personal endpoint** — you have a Globus identity and
277
+ shell access to an HPC machine, and want to stand up an endpoint just for
278
+ yourself. → [Local install](#local-install), then
279
+ [docs/operating-an-endpoint.md](docs/operating-an-endpoint.md#solo-personal-endpoint-quickstart).
280
+ 4. **Group / shared endpoint operator** — you're standing one up for a team,
281
+ project, or lab. → [Local install](#local-install), then the full
282
+ [docs/operating-an-endpoint.md](docs/operating-an-endpoint.md) including
283
+ service-account migration and the MEP allowlist.
284
+
285
+ ---
286
+
287
+ ## Local install
288
+
289
+ Five steps. Each is one command unless noted.
272
290
 
273
- The dispatcher falls back to local execution if a remote call is requested
274
- but the endpoint is missing or unhealthy.
291
+ ### Step 1 Install the package
275
292
 
276
- ## Install
293
+ Pick one. `uv` is the easiest; `pip` works too.
277
294
 
278
295
  ```bash
279
- # Stable user path (after the package is published)
280
- uv tool install uxarray-mcp
281
- uxarray-mcp setup
282
- uxarray-mcp install-claude --print-only # prints the Claude Desktop block
296
+ # Recommended
297
+ uv tool install --python 3.12 uxarray-mcp
298
+
299
+ # Or from a fresh clone (developer path)
300
+ git clone https://github.com/UXARRAY/uxarray-mcp-server.git
301
+ cd uxarray-mcp-server && uv sync --python 3.12
283
302
  ```
284
303
 
304
+ > **Why `--python 3.12`?** The server uses Globus Compute to submit work to
305
+ > HPC endpoints, and Globus Compute's serializer is fragile across Python
306
+ > minor versions — a 3.13 submitter against a 3.12 endpoint worker raises
307
+ > `WorkerLost` on non-trivial payloads. HPC sites broadly ship 3.12 conda
308
+ > stacks today, so we pin the install to match. Tracking removal of this pin
309
+ > at [globus/globus-compute#2139](https://github.com/globus/globus-compute/issues/2139).
310
+ > `uv` downloads 3.12 automatically if your system doesn't have it.
311
+
312
+ ### Step 2 — Write a starter config
313
+
285
314
  ```bash
286
- # Stable user path with HPC support
287
- uv tool install "uxarray-mcp[hpc]"
288
315
  uxarray-mcp setup
289
- uxarray-mcp endpoints add improv <your-endpoint-uuid> --set-default
290
- uxarray-mcp doctor --endpoint improv --timeout-seconds 180
291
316
  ```
292
317
 
318
+ Creates `~/.config/uxarray-mcp/config.yaml` with sensible defaults. Local mode
319
+ needs nothing more.
320
+
321
+ ### Step 3 — Connect your AI client
322
+
323
+ **Claude Desktop**
324
+
293
325
  ```bash
294
- # Developer / contributor path, and best path when using repo scripts/docs
295
- git clone https://github.com/UXARRAY/uxarray-mcp-server.git
296
- cd uxarray-mcp-server
297
- uv sync # core local install
298
- uv sync --extra hpc # add Globus Compute deps
326
+ uxarray-mcp install-claude # merges the mcpServers block into your config
327
+ # or
328
+ uxarray-mcp install-claude --print-only # prints the JSON to paste manually
299
329
  ```
300
330
 
331
+ Restart Claude Desktop. The `uxarray` server should appear in Settings →
332
+ Developer.
333
+
334
+ **Claude Code**
335
+
301
336
  ```bash
302
- # User install directly from GitHub before a PyPI release exists
303
- uv tool install "git+https://github.com/UXARRAY/uxarray-mcp-server.git"
304
- uxarray-mcp setup
305
- uxarray-mcp endpoints add improv <your-endpoint-uuid>
306
- uxarray-mcp install-claude --print-only # prints the Claude Desktop block
337
+ claude mcp add uxarray --transport stdio -- uxarray-mcp serve
307
338
  ```
308
339
 
309
- The ``uxarray-mcp`` CLI exposes:
340
+ Then `/mcp` in Claude Code; pick `uxarray`.
310
341
 
311
- | subcommand | what it does |
312
- | ------------------- | -------------------------------------------------------- |
313
- | ``serve`` | run the MCP server on stdio (Claude / FastMCP transport) |
314
- | ``setup`` | write a starter config to ``~/.config/uxarray-mcp/`` |
315
- | ``endpoints add`` | register a named Globus Compute endpoint |
316
- | ``endpoints list`` | show configured endpoints + discovery path |
317
- | ``doctor`` | validate auth, endpoint health, optional remote probes |
318
- | ``install-claude`` | print or merge the Claude Desktop ``mcpServers`` block |
342
+ **Cursor / other MCP clients**
319
343
 
320
- Config is discovered in this order: ``$UXARRAY_MCP_CONFIG``
321
- ``~/.config/uxarray-mcp/config.yaml`` ``./config.yaml`` (repo root).
344
+ Add an MCP server entry pointing at `uxarray-mcp serve` over stdio. See your
345
+ client's MCP docs.
322
346
 
323
- ## Most Users Should Read These in Order
347
+ ### Step 4 Sanity check
324
348
 
325
- 1. [GETTING_STARTED.md](GETTING_STARTED.md) for the short setup path
326
- 2. [docs/getting-started.md](docs/getting-started.md) for the full walkthrough
327
- 3. [docs/globus-compute.md](docs/globus-compute.md) if you are new to Globus Compute
328
- 4. [docs/hpc.md](docs/hpc.md) for generic cluster bring-up
329
- 5. [docs/improv.md](docs/improv.md) if you are on Argonne Improv
330
- 6. [docs/ucar.md](docs/ucar.md) if you are on NCAR Casper
331
- 7. [docs/chrysalis.md](docs/chrysalis.md) if you are on Argonne Chrysalis
332
- 6. [docs/workflows.md](docs/workflows.md) for sequential remote workflows
349
+ ```bash
350
+ uxarray-mcp doctor
351
+ ```
333
352
 
334
- ## Main Tools
353
+ Should print `local execution: ok` and (if no endpoints configured) skip the
354
+ remote checks.
335
355
 
336
- Analysis:
356
+ ### Step 5 — Ask the AI to do something
337
357
 
338
- - `inspect_mesh` — topology, format detection, face/node/edge counts
339
- - `inspect_variable` — variable metadata, location, and statistics
340
- - `calculate_area` — face area statistics
341
- - `calculate_zonal_mean` — latitude-band averaging (conservative or standard)
342
- - `validate_dataset` — NaN, Inf, and fill value checks
343
- - `run_scientific_agent` — autonomous Analyze → Plan → Execute → Verify pipeline
344
- - `subset_bbox` / `subset_polygon` / `extract_cross_section` — spatial queries and regional reductions
345
- - `calculate_gradient`, `calculate_curl`, `calculate_divergence`, `calculate_azimuthal_mean` — vector calculus and radial summaries
346
- - `compare_fields`, `calculate_bias`, `calculate_rmse`, `calculate_pattern_correlation` — same-grid comparison metrics
347
- - `remap_variable` / `regrid_dataset` — UXarray-backed remapping to a target grid
348
- - `calculate_temporal_mean`, `calculate_anomaly`, `calculate_ensemble_mean`, `calculate_ensemble_spread` — temporal and ensemble summaries
349
- - `export_to_netcdf`, `export_to_csv`, `write_result` — persist derived results to downstream formats
358
+ In your client, try:
350
359
 
351
- Stateful workflows:
360
+ > "Open `<path to a UGRID/MPAS/SCRIP grid file>` and plot the mesh."
352
361
 
353
- - `create_session`, `register_dataset`, `get_session_state`, `reset_session_state`
354
- - `run_workflow`, `resume_workflow`, `get_workflow_status`
355
- - `get_result_handle`, `get_operation_status`, `list_operations`
362
+ That's it for local use.
356
363
 
357
- Visualization (returns inline PNG):
364
+ ---
358
365
 
359
- - `plot_mesh` mesh wireframe
360
- - `plot_mesh_geo` — geographic mesh plot with boundary-aware rendering
361
- - `plot_variable` — face-centered variable as filled polygon map; supports `cmap`, `vmin`, `vmax`, `title`
362
- - `plot_zonal_mean` — latitude vs. value line chart; supports `line_color`, `title`
366
+ ## Going beyond your laptop
363
367
 
364
- HPC diagnostics:
368
+ If you have an HPC account at a national lab or university cluster with
369
+ [Globus Compute](https://www.globus.org/compute) available:
365
370
 
366
- - `get_execution_mode` / `set_execution_mode`
367
- - `endpoint_status`
368
- - `validate_hpc_setup`
369
- - `probe_path_access`
371
+ | You want to … | Read this |
372
+ |---|---|
373
+ | Connect to an endpoint someone else set up | **[docs/remote-hpc.md](docs/remote-hpc.md)** |
374
+ | Stand up your own endpoint | **[docs/operating-an-endpoint.md](docs/operating-an-endpoint.md)** |
375
+ | Understand the security model first | **[SECURITY.md](SECURITY.md)** |
370
376
 
371
- All inspection, computation, and plotting tools accept ``use_remote: bool``
372
- and ``endpoint: str | None``. When ``use_remote=True`` the dispatcher submits
373
- to the configured (or named) Globus Compute endpoint and falls back to local
374
- execution if the endpoint is missing or unhealthy. There are no separate
375
- ``*_hpc`` tool names on the MCP surface — the same tool runs locally or
376
- remotely based on the flag.
377
+ Both paths assume you've finished local install above.
377
378
 
378
- Full parameter and return details live in [docs/tools.md](docs/tools.md).
379
+ ---
379
380
 
380
- ## Helper Scripts
381
+ ## What the MCP exposes
381
382
 
382
- - `scripts/hpc_doctor.py`
383
- First-pass CLI doctor for local auth, endpoint status, remote no-op
384
- execution, and optional real-path probing.
385
- - `scripts/improv_endpoint.sh`
386
- Writes Improv endpoint templates for single-host validation or PBS debug.
387
- - `scripts/agentic_hpc_loop.py`
388
- Example submit/poll/branch workflow using Globus Compute futures directly.
383
+ Intent-shaped tools, not raw UXarray bindings:
389
384
 
390
- ## HPC in One Paragraph
385
+ - `get_capabilities` what can I do with this mesh?
386
+ - `analyze_dataset` — deterministic first-look: inspect, validate, area, zonal mean, plots.
387
+ - `run_analysis` — one operation at a time (gradient, curl, subset, remap, …).
388
+ - `plot_dataset` — mesh, geographic, variable, or zonal-mean plots.
389
+ - `diagnose_endpoint`, `probe_path_access` — endpoint health + file readability.
390
+ - `run_workflow`, `resume_workflow`, `get_status`, `get_result`, `manage_session` —
391
+ persisted sessions and multi-step workflows.
391
392
 
392
- Remote execution has three separate layers:
393
+ Tools that can run remotely take `use_remote: bool` and optional `endpoint: str`.
394
+ The dispatcher falls back to local if the endpoint is unhealthy.
393
395
 
394
- 1. the local machine running this repository
395
- 2. the endpoint running on the HPC machine
396
- 3. the remote worker environment that must also have `uxarray`, `xarray`,
397
- `netCDF4`, and `h5netcdf`
396
+ Full schema: [docs/tools.md](docs/tools.md).
398
397
 
399
- Most confusing failures happen because only one or two of those layers are set
400
- up. Start with [docs/globus-compute.md](docs/globus-compute.md) and use
401
- `validate_hpc_setup()` before real remote jobs.
398
+ ---
402
399
 
403
- ## Configuration
400
+ ## CLI reference
404
401
 
405
- Use the CLI for the common case:
402
+ | Command | Purpose |
403
+ |---|---|
404
+ | `uxarray-mcp serve` | Run the MCP server (used by your AI client) |
405
+ | `uxarray-mcp setup` | Write a starter config |
406
+ | `uxarray-mcp endpoints add NAME UUID` | Register a Globus Compute endpoint |
407
+ | `uxarray-mcp endpoints list` | Show configured endpoints |
408
+ | `uxarray-mcp doctor` | Validate local + (optionally) remote setup |
409
+ | `uxarray-mcp install-claude` | Merge or print the Claude Desktop config block |
406
410
 
407
- ```bash
408
- uxarray-mcp setup
409
- uxarray-mcp endpoints add improv <your-endpoint-uuid> --path-prefix /lus/ --set-default
410
- ```
411
+ ---
411
412
 
412
- This writes ``~/.config/uxarray-mcp/config.yaml`` with the canonical
413
- multi-endpoint schema. For dev clones, ``./config.yaml`` at the repo root
414
- still works (and is gitignored). The full schema:
415
-
416
- ```yaml
417
- hpc:
418
- default_endpoint: "ucar"
419
- endpoints:
420
- ucar:
421
- endpoint_id: "your-ucar-endpoint-uuid"
422
- path_prefixes: ["/glade/"]
423
- improv:
424
- endpoint_id: "your-improv-endpoint-uuid"
425
- path_prefixes: ["/gpfs/fs1/", "/home/jain/"]
426
- execution_mode: "auto"
427
- timeout_seconds: 300
428
- ```
413
+ ## Risks (read before relying on output)
429
414
 
430
- Remote tools accept `endpoint="ucar"` or `endpoint="improv"`; when omitted,
431
- the server routes by path prefix before falling back to `default_endpoint`.
415
+ AI agents can misread prompts, pick the wrong file, get units wrong (e.g.,
416
+ sphere-radius scaling on derivatives), or run long jobs on your HPC
417
+ allocation. uxarray-mcp does **not** guarantee correctness of agent-driven
418
+ analysis. You are responsible for:
432
419
 
433
- ## Development Checks
420
+ - Verifying numerical results before publishing.
421
+ - Reviewing what files the agent opens.
422
+ - Monitoring HPC job submissions against your allocation.
434
423
 
435
- ```bash
436
- uv run pre-commit run --all-files
437
- uv run pytest tests/ --ignore=tests/test_remote_agent.py
438
- uv sync --extra docs --dev
439
- uv run sphinx-build -b html docs docs/_build/html
440
- ```
424
+ For the security model (what the agent and the endpoint operator can access),
425
+ see **[SECURITY.md](SECURITY.md)**.
441
426
 
442
- ## Publishing
427
+ ---
443
428
 
444
- Releases follow the UXarray pattern: publish a GitHub Release from a version tag
445
- such as `v0.1.0`; the release workflow builds and publishes to PyPI with trusted
446
- publishing. Conda packages are handled through a separate conda-forge feedstock;
447
- `conda/recipe/meta.yaml` is a seed recipe for `uxarray-mcp-feedstock`.
429
+ ## Development
448
430
 
449
431
  ```bash
450
- uv build
451
- uv tool install dist/uxarray_mcp-*.whl --force
452
- uxarray-mcp --help
432
+ uv sync --extra hpc --extra docs --dev
433
+ uv run pre-commit run --all-files
434
+ uv run pytest tests/ --ignore=tests/test_remote_agent.py
435
+ uv run sphinx-build -b html docs docs/_build/html
453
436
  ```
454
437
 
455
- See [docs/release.md](docs/release.md) for the full PyPI and Conda workflow.
438
+ Release process: [docs/release.md](docs/release.md).
456
439
 
457
- ## Documentation Index
440
+ ## License
458
441
 
459
- - [GETTING_STARTED.md](GETTING_STARTED.md)
460
- - [docs/getting-started.md](docs/getting-started.md)
461
- - [docs/globus-compute.md](docs/globus-compute.md)
462
- - [docs/hpc.md](docs/hpc.md)
463
- - [docs/improv.md](docs/improv.md)
464
- - [docs/ucar.md](docs/ucar.md)
465
- - [docs/chrysalis.md](docs/chrysalis.md)
466
- - [docs/tools.md](docs/tools.md)
467
- - [docs/workflows.md](docs/workflows.md)
468
- - [docs/scientific-agent.md](docs/scientific-agent.md)
442
+ See [LICENSE](LICENSE).
@@ -0,0 +1,206 @@
1
+ # UXarray MCP Server
2
+
3
+ An MCP server that lets an AI assistant (Claude Code, Claude Desktop, Cursor,
4
+ or any MCP client) analyze unstructured climate meshes with
5
+ [UXarray](https://uxarray.readthedocs.io/) — locally on your machine, or
6
+ remotely on an HPC system you have access to.
7
+
8
+ ```text
9
+ ┌─────────────┐ stdio ┌──────────────┐ ┌─────────────────┐
10
+ │ AI client │ ◀─────▶ │ uxarray-mcp │ ◀── Globus ──────▶ │ HPC endpoint │
11
+ │ (Claude…) │ pipe │ (your laptop)│ Compute (opt) │ (Slurm/PBS node)│
12
+ └─────────────┘ └──────────────┘ └─────────────────┘
13
+ ```
14
+
15
+ > **What the AI can do.** Open meshes and datasets, compute area / zonal mean
16
+ > / vorticity / divergence, subset, remap, plot, and run multi-step workflows.
17
+ > All as natural-language prompts.
18
+
19
+ > **Local by default; HPC is opt-in.** Everything runs on your machine unless
20
+ > you configure a [Globus Compute](https://www.globus.org/compute) endpoint.
21
+ > The remote option only becomes available once such an endpoint exists —
22
+ > running one requires an account and allocation on that HPC system, though a
23
+ > shared/service-account endpoint can let authorized users submit without their
24
+ > own login.
25
+
26
+ > **⚠️ What the AI can access.** Any file you (or your HPC account) can read.
27
+ > Any compute the configured endpoint can submit. Outputs are written to your
28
+ > disk. **See [SECURITY.md](SECURITY.md) before connecting any remote endpoint.**
29
+
30
+ ---
31
+
32
+ ## Pick your path
33
+
34
+ You are most likely one of:
35
+
36
+ 1. **Local user** — laptop only, no HPC. → [Local install](#local-install).
37
+ 2. **HPC user, endpoint already exists** — someone at your lab gave you a
38
+ Globus Compute endpoint UUID. → [Local install](#local-install), then
39
+ [docs/remote-hpc.md](docs/remote-hpc.md).
40
+ 3. **HPC user, your own personal endpoint** — you have a Globus identity and
41
+ shell access to an HPC machine, and want to stand up an endpoint just for
42
+ yourself. → [Local install](#local-install), then
43
+ [docs/operating-an-endpoint.md](docs/operating-an-endpoint.md#solo-personal-endpoint-quickstart).
44
+ 4. **Group / shared endpoint operator** — you're standing one up for a team,
45
+ project, or lab. → [Local install](#local-install), then the full
46
+ [docs/operating-an-endpoint.md](docs/operating-an-endpoint.md) including
47
+ service-account migration and the MEP allowlist.
48
+
49
+ ---
50
+
51
+ ## Local install
52
+
53
+ Five steps. Each is one command unless noted.
54
+
55
+ ### Step 1 — Install the package
56
+
57
+ Pick one. `uv` is the easiest; `pip` works too.
58
+
59
+ ```bash
60
+ # Recommended
61
+ uv tool install --python 3.12 uxarray-mcp
62
+
63
+ # Or from a fresh clone (developer path)
64
+ git clone https://github.com/UXARRAY/uxarray-mcp-server.git
65
+ cd uxarray-mcp-server && uv sync --python 3.12
66
+ ```
67
+
68
+ > **Why `--python 3.12`?** The server uses Globus Compute to submit work to
69
+ > HPC endpoints, and Globus Compute's serializer is fragile across Python
70
+ > minor versions — a 3.13 submitter against a 3.12 endpoint worker raises
71
+ > `WorkerLost` on non-trivial payloads. HPC sites broadly ship 3.12 conda
72
+ > stacks today, so we pin the install to match. Tracking removal of this pin
73
+ > at [globus/globus-compute#2139](https://github.com/globus/globus-compute/issues/2139).
74
+ > `uv` downloads 3.12 automatically if your system doesn't have it.
75
+
76
+ ### Step 2 — Write a starter config
77
+
78
+ ```bash
79
+ uxarray-mcp setup
80
+ ```
81
+
82
+ Creates `~/.config/uxarray-mcp/config.yaml` with sensible defaults. Local mode
83
+ needs nothing more.
84
+
85
+ ### Step 3 — Connect your AI client
86
+
87
+ **Claude Desktop**
88
+
89
+ ```bash
90
+ uxarray-mcp install-claude # merges the mcpServers block into your config
91
+ # or
92
+ uxarray-mcp install-claude --print-only # prints the JSON to paste manually
93
+ ```
94
+
95
+ Restart Claude Desktop. The `uxarray` server should appear in Settings →
96
+ Developer.
97
+
98
+ **Claude Code**
99
+
100
+ ```bash
101
+ claude mcp add uxarray --transport stdio -- uxarray-mcp serve
102
+ ```
103
+
104
+ Then `/mcp` in Claude Code; pick `uxarray`.
105
+
106
+ **Cursor / other MCP clients**
107
+
108
+ Add an MCP server entry pointing at `uxarray-mcp serve` over stdio. See your
109
+ client's MCP docs.
110
+
111
+ ### Step 4 — Sanity check
112
+
113
+ ```bash
114
+ uxarray-mcp doctor
115
+ ```
116
+
117
+ Should print `local execution: ok` and (if no endpoints configured) skip the
118
+ remote checks.
119
+
120
+ ### Step 5 — Ask the AI to do something
121
+
122
+ In your client, try:
123
+
124
+ > "Open `<path to a UGRID/MPAS/SCRIP grid file>` and plot the mesh."
125
+
126
+ That's it for local use.
127
+
128
+ ---
129
+
130
+ ## Going beyond your laptop
131
+
132
+ If you have an HPC account at a national lab or university cluster with
133
+ [Globus Compute](https://www.globus.org/compute) available:
134
+
135
+ | You want to … | Read this |
136
+ |---|---|
137
+ | Connect to an endpoint someone else set up | **[docs/remote-hpc.md](docs/remote-hpc.md)** |
138
+ | Stand up your own endpoint | **[docs/operating-an-endpoint.md](docs/operating-an-endpoint.md)** |
139
+ | Understand the security model first | **[SECURITY.md](SECURITY.md)** |
140
+
141
+ Both paths assume you've finished local install above.
142
+
143
+ ---
144
+
145
+ ## What the MCP exposes
146
+
147
+ Intent-shaped tools, not raw UXarray bindings:
148
+
149
+ - `get_capabilities` — what can I do with this mesh?
150
+ - `analyze_dataset` — deterministic first-look: inspect, validate, area, zonal mean, plots.
151
+ - `run_analysis` — one operation at a time (gradient, curl, subset, remap, …).
152
+ - `plot_dataset` — mesh, geographic, variable, or zonal-mean plots.
153
+ - `diagnose_endpoint`, `probe_path_access` — endpoint health + file readability.
154
+ - `run_workflow`, `resume_workflow`, `get_status`, `get_result`, `manage_session` —
155
+ persisted sessions and multi-step workflows.
156
+
157
+ Tools that can run remotely take `use_remote: bool` and optional `endpoint: str`.
158
+ The dispatcher falls back to local if the endpoint is unhealthy.
159
+
160
+ Full schema: [docs/tools.md](docs/tools.md).
161
+
162
+ ---
163
+
164
+ ## CLI reference
165
+
166
+ | Command | Purpose |
167
+ |---|---|
168
+ | `uxarray-mcp serve` | Run the MCP server (used by your AI client) |
169
+ | `uxarray-mcp setup` | Write a starter config |
170
+ | `uxarray-mcp endpoints add NAME UUID` | Register a Globus Compute endpoint |
171
+ | `uxarray-mcp endpoints list` | Show configured endpoints |
172
+ | `uxarray-mcp doctor` | Validate local + (optionally) remote setup |
173
+ | `uxarray-mcp install-claude` | Merge or print the Claude Desktop config block |
174
+
175
+ ---
176
+
177
+ ## Risks (read before relying on output)
178
+
179
+ AI agents can misread prompts, pick the wrong file, get units wrong (e.g.,
180
+ sphere-radius scaling on derivatives), or run long jobs on your HPC
181
+ allocation. uxarray-mcp does **not** guarantee correctness of agent-driven
182
+ analysis. You are responsible for:
183
+
184
+ - Verifying numerical results before publishing.
185
+ - Reviewing what files the agent opens.
186
+ - Monitoring HPC job submissions against your allocation.
187
+
188
+ For the security model (what the agent and the endpoint operator can access),
189
+ see **[SECURITY.md](SECURITY.md)**.
190
+
191
+ ---
192
+
193
+ ## Development
194
+
195
+ ```bash
196
+ uv sync --extra hpc --extra docs --dev
197
+ uv run pre-commit run --all-files
198
+ uv run pytest tests/ --ignore=tests/test_remote_agent.py
199
+ uv run sphinx-build -b html docs docs/_build/html
200
+ ```
201
+
202
+ Release process: [docs/release.md](docs/release.md).
203
+
204
+ ## License
205
+
206
+ See [LICENSE](LICENSE).