Skip to main content

Agentic MCP tools for Flux Framework and HPC

Project description

flux-mcp

🌀 Agentic MCP tools for Flux Framework

PyPI version

img/flux-mcp-small.png

Usage

These Flux MCP tools can be used via a standalone server, or combined with other tools. Note that along with flux-python (comes packaged with Flux, or pip install flux-python==<version> you can optionally install flux-sched-py for flux-sched functionality.

Server

We provide examples for fastmcp and a vanilla mcp (stdio) setup. Neither requirements are added to the install directly, so it's up to the user (you) to install. Tests are performed with fastmcp.

fastmcp

You will need fastapi and fastmcp installed.

# fastmcp
pip install fastmcp fastapi

To start the demo server:

# Vanilla MCP (with cli)
echo '{"jsonrpc": "2.0", "id": 1, "method": "initialize", "params": {"protocolVersion": "2024-11-05", "capabilities": {}, "clientInfo": {"name": "test", "version": "1.0"}}}' | python3 -m flux_mcp.server | jq

# Initialize and list tools
(echo '{"jsonrpc": "2.0", "id": 1, "method": "initialize", "params": {"protocolVersion": "2024-11-05", "capabilities": {}, "clientInfo": {"name": "manual-test", "version": "1.0"}}}';
 echo '{"jsonrpc": "2.0", "method": "notifications/initialized"}';
 echo '{"jsonrpc": "2.0", "id": 2, "method": "tools/list"}') | python3 -m flux_mcp.server | jq

# FastMCP
python3 -m flux_mcp.server.fastmcp

Testing

I will add tools to git as I write tests for them. To test, start the fastmcp server in one terminal:

python3 -m flux_mcp.server.fastmcp

To test flux-sched, ensure libreapi_cli.so is on the LD_LIBRARY_PATH of the server:

export LD_LIBRARY_PATH=/usr/lib/flux/
python3 -m flux_mcp.server.fastmcp

In another terminal, run the test. You'll need to pip install pytest pytest-asyncio

pytest -xs tests/test_flux_validate.py
pytest -xs tests/test_flux_counts.py
pytest -xs tests/test_flux_job_delegation.py
pytest -xs tests/test_flux_job_core.py
pytest -xs tests/test_transformers.py

# Requires libreapi_cli.so
pytest -xs tests/test_flux_sched.py

# or
pytest -xs tests/test_*.py

Tools

Tools to add:

  • flux
    • flux-sched
    • grow
    • shrink
    • create resource graph
    • match allocate
    • cancel
    • partial-cancel
    • satisfy
    • flux-core
    • submit jobs
    • job info
    • cancel job
    • validator
      • counter
      • batch jobs
      • canonical jobspec
      • json jobspec
    • topology?
    • delegation
    • local flux URI
    • translation (the transformers?)

Belongs in fractale-mcp

  • kubernetes submit (apply)

TODO

  • Add annotated descriptions to all functions for LLM.

License

HPCIC DevTools is distributed under the terms of the MIT license. All new contributions must be made under this license.

See LICENSE, COPYRIGHT, and NOTICE for details.

SPDX-License-Identifier: (MIT)

LLNL-CODE- 842614

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flux_mcp-0.0.1.tar.gz (50.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

flux_mcp-0.0.1-py3-none-any.whl (57.9 kB view details)

Uploaded Python 3

File details

Details for the file flux_mcp-0.0.1.tar.gz.

File metadata

  • Download URL: flux_mcp-0.0.1.tar.gz
  • Upload date:
  • Size: 50.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.2

File hashes

Hashes for flux_mcp-0.0.1.tar.gz
Algorithm Hash digest
SHA256 b1a3cfdf31c128f46d1392679c6630085af44fbe306b7e44ee9dddabd3fabd86
MD5 6ffb0479425cb783978e773554278d1d
BLAKE2b-256 7690c538b665a88185bf45d79304538f63090bc31b83f6d7ba346be99d65d3e2

See more details on using hashes here.

File details

Details for the file flux_mcp-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: flux_mcp-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 57.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.2

File hashes

Hashes for flux_mcp-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 40371879ee3e5e11d04b7e14ef7c28c1d600648a049a51f670a0467e2fbdefd7
MD5 5d99d9096727586b9b347877de0fb885
BLAKE2b-256 fb98845c80f1a8baf3314a324d51cf3b9f849c4db9d40c07eadcf0e039a8fc81

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page