nrp-mcp

module
v0.6.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 6, 2026 License: MIT

README

nrp-mcp

CI Setup on Linux, macOS, Windows Release Go

Run your research on the National Research Platform's Nautilus cluster by talking to your AI assistant.

nrp-mcp is a small MCP server that runs on your own computer. Point it at your Nautilus sign-in and it turns "here is my code, run it on a GPU" into a reviewed plan and a running job. It knows the NRP's rules, so you don't have to learn Kubernetes first.

You:        Run train.py in ~/proj/leafnet on a GPU.
Assistant:  Plan: one Job using pytorch/pytorch, 1 standard GPU, 4 cores, 16 GiB, 24-hour
            limit. It installs requirements.txt and runs `python train.py`. A100s need a
            quota you don't have, so this asks for any free standard GPU. Run it?
You:        Yes.
Assistant:  Running on an RTX A4000... Finished in 41 minutes. Copy results/ back?

Built by UCR Research Computing. Works with Hermes Agent, Gemini CLI, OpenCode, Claude Code, Claude Desktop, VS Code, Cursor and any other MCP client.

Contents

What you can do

You say nrp-mcp does
"Is my laptop ready for Nautilus?" Checks kubectl, the sign-in plugin and your NRP config, and installs what's missing (with your yes)
"Where do I stand?" Your namespaces, GPU quotas, what's running, public URLs, and policy warnings
"Run this script on a GPU" Reads your project, picks an image and size, explains the plan, runs it after you agree
"Run it 200 times with different seeds" A parameter sweep (Indexed Job); your script reads its task number
"Move my Slurm job here" Translates #SBATCH lines and shows what has no equivalent
"Why did it fail?" / "Why is it stuck?" Plain-language diagnosis with a fix: out of memory, no free GPU, quota, image pull, crashes
"Give me a GPU notebook" A private Jupyter or VS Code session through port-forward
"Download this dataset to the cluster" A shared volume and an in-cluster download, so big files skip your laptop
"Put my lab's tool on the web" Deployment, Service and HTTPS address; suggests names; publishes only after you type the URL back
"Containerize this" A Dockerfile and a GitLab CI file that builds it on NRP GitLab
"Clean up" Lists what you made and deletes it after a second yes

Quick start

You need a Nautilus account and a namespace. Sign in at https://nrp.ai with your institution; students are added to a namespace by their PI, faculty can request one. UCR researchers: see Getting access.

1. Install nrp-mcp

Linux or macOS:

curl -fsSL https://raw.githubusercontent.com/UCR-Research-Computing/nrp-mcp/main/scripts/install.sh | sh

Windows: download nrp-mcp_<version>_windows_amd64.zip from Releases, unzip it and keep nrp-mcp.exe somewhere handy. With Go installed, go install github.com/UCR-Research-Computing/nrp-mcp/cmd/nrp-mcp@latest works everywhere.

2. Download your NRP config at https://nrp.ai/config (it lands in Downloads).

3. Get your computer ready

nrp-mcp setup

setup checks everything first and asks before changing anything. Then it installs kubectl and the kubelogin sign-in plugin (official releases, SHA256-checked, into your user folder, no admin rights), puts the NRP config in ~/.kube/config (backing up an existing one), and signs you in through your browser. It ends with "This computer is ready for Nautilus."

4. Add it to your AI client

Tested end to end (live cluster, Gemini API key) with each of these:

Client Add nrp
Hermes Agent hermes mcp add nrp --command nrp-mcp --args serve
Gemini CLI gemini mcp add nrp nrp-mcp serve
OpenCode add "mcp": {"nrp": {"type": "local", "command": ["nrp-mcp", "serve"]}} to opencode.json
Claude Code claude mcp add nrp -- nrp-mcp serve

Claude Desktop, Cursor, VS Code and others (mcpServers block):

{"mcpServers": {"nrp": {"command": "nrp-mcp", "args": ["serve"]}}}

Use the full path to nrp-mcp if your client doesn't see your shell's PATH, and add "--namespace", "<your-namespace>" to args to pick a default.

5. Ask: "Where do I stand on Nautilus?"

The tools

Nine tools, each named for what you want rather than for Kubernetes objects. Every result starts with a plain-language summary and, where useful, the kubectl equivalent so you learn as you go.

Tool Changes things? What it does
nrp_setup only with fix=true Laptop readiness: kubectl (version vs the cluster), kubelogin, NRP config, sign-in; installs or updates them with your yes
nrp_status no Identity, namespaces, GPU quotas, workloads and what they ask for, volumes, public URLs, warnings
nrp_plan no Inspects a project and a goal (job, sweep, web, session, llm-batch, volume, pull), applies every rule, returns a summary, decisions, refusals, manifests and a confirm token
nrp_run yes, with a token Runs an approved plan; web plans also need public_ack; writes a run card to <project>/.nrp/runs/
nrp_watch no Progress, logs (tail/grep), diagnosis with a fix, public URL check
nrp_cleanup yes, two steps Lists your runs, then deletes one after a second confirm
nrp_session no Readiness, port-forward command and local link for a notebook or VS Code session
nrp_data uploads only List, upload small non-sensitive files, download results from a volume
nrp_build no Suggests a Dockerfile and an NRP GitLab CI (kaniko) file

Also served: resources nrp://policy, nrp://gpus, nrp://storage, nrp://llm, nrp://kb, and prompts first_run, port_slurm_script, parameter_sweep, my_job_failed, host_web_tool, teach_workshop.

Safety

  • Runs as you, on your computer. It uses your kubeconfig and the NRP's own sign-in. It never reads or stores your token, and nothing leaves your computer except the Kubernetes calls you approve.

  • Nothing happens without a yes. Planning creates nothing. Running and cleanup need a single-use token bound to the exact plan, valid for 10 minutes.

  • Nothing goes public by accident. A web plan publishes only when you type its exact URL back.

  • The NRP rules are built in, each with a test and a link to its source:

    • non-sensitive data only
    • Jobs instead of sleep loops
    • limits within 20% of requests
    • quota-gated GPUs (A100/H100/H200/GH200)
    • no GPUs on long-running services
    • allowed priority classes only
    • secrets kept out of specs (other users can see specs)

    A plan that breaks a rule is refused, with the reason and the fix.

  • Shared namespaces are safe. Every object is labelled with its owner, and cleanup only sees your own runs unless you are the namespace admin and ask for everyone's.

  • Caps on pods, GPUs and hours per run.

  • Audit log of every change at ~/.local/state/nrp-mcp/audit.log.

  • Setup only touches your user folder. kubectl and kubelogin go into ~/.local/bin (Windows: %LOCALAPPDATA%\Programs\nrp-mcp\bin). They come only from dl.k8s.io and the kubelogin GitHub releases, and only when the published SHA256 matches.

See SECURITY.md for details and how to report a problem.

Configuration

All optional. nrp-mcp init writes an example to ~/.config/nrp-mcp/config.yaml:

kubeconfig: ~/.kube/config    # the NRP config from https://nrp.ai/config
context: nautilus
namespace: my-lab             # default namespace
kubectl: kubectl              # full path if kubectl is not on PATH
pods_per_run: 50              # plans over these caps are refused
gpus_per_run: 4
hours_per_run: 48
upload_gb_per_run: 50

Environment overrides: NRP_KUBECONFIG, NRP_CONTEXT, NRP_NAMESPACE, NRP_KUBECTL. Command-line flags for serve, setup and doctor: --kubeconfig, --context, --namespace, --config.

Command What it does
nrp-mcp serve The MCP server on stdio (what your AI client starts)
nrp-mcp setup Check and ready this computer (asks first; --yes to skip the question, --no-sign-in to stop before the browser)
nrp-mcp doctor Check kubectl, sign-in, namespaces and quotas
nrp-mcp init Write an example config (never overwrites)
nrp-mcp version Print the version

How it works

AI client (Hermes Agent, Gemini CLI, OpenCode, Claude Code, ...)
   | MCP over stdio
nrp-mcp serve                    on your computer
   |-- inspect   reads your project folder (language, GPU use, entry point, web app, Slurm script)
   |-- plan      builds manifests from facts + goal (pure, tested)
   |-- rules     checks every NRP policy (pure, tested)
   |-- store     plans, hashed confirm tokens, audit log
   `-- kube      runs kubectl as you (kubelogin handles the sign-in)
   |
Nautilus (Kubernetes): Jobs, Deployments, volumes, Ingress in your namespace

Small projects are copied into the pod as a ConfigMap and their requirements installed at start. Bigger ones get an image built on NRP GitLab (nrp_build). The full design, every rule and the test record are in SPEC.md.

Limits

  • Code is copied as text files under 200 KB each (900 KB total). Bigger projects need an image (nrp_build) or git.
  • nrp_build suggests files; it doesn't build. Builds run on NRP GitLab.
  • S3 uploads are guidance only; S3 keys come from the NRP portal.
  • Sessions are port-forwarded and never public. For zero install, the NRP runs a hosted JupyterHub at https://jupyterhub-west.nrp-nautilus.io.
  • nrp-mcp setup installs and checks kubectl and kubelogin on Linux, Windows and macOS (Intel and Apple Silicon) in CI on every change; the browser sign-in step can't run in CI and is tested by hand. Please report anything that goes wrong.

Development

bash scripts/gauntlet.sh                                 # gofmt, vet, tests, build (same as CI)
go build -o nrp-mcp ./cmd/nrp-mcp
go run ./scripts/e2e  -bin ./nrp-mcp -ns <namespace>     # live: job, sweep, web plan, cleanup
go run ./scripts/e2e2 -bin ./nrp-mcp -ns <namespace>     # live: volume, data, Jupyter, cleanup

The live tests create small, labelled, CPU-only workloads and clean them up; they never create GPU pods or public endpoints. See CONTRIBUTING.md and CHANGELOG.md. Example app: examples/leaf-area-explorer.

Help

Nautilus is operated by the National Research Platform (UC San Diego / SDSC). This is a community tool from UCR Research Computing, not an NRP product. Please follow the NRP policies.

License

MIT

Directories

Path Synopsis
cmd
nrp-mcp command
Command nrp-mcp is a local MCP server for running research work on the NRP Nautilus cluster as the signed-in researcher.
Command nrp-mcp is a local MCP server for running research work on the NRP Nautilus cluster as the signed-in researcher.
internal
config
Package config reads ~/.config/nrp-mcp/config.yaml (a tiny flat YAML subset) and env.
Package config reads ~/.config/nrp-mcp/config.yaml (a tiny flat YAML subset) and env.
diagnose
Package diagnose explains pod states and events in plain language with a fix.
Package diagnose explains pod states and events in plain language with a fix.
inspect
Package inspect reads a local project folder to work out what it is: language, GPU need, entry point, web app type, dependency files, a Slurm script.
Package inspect reads a local project folder to work out what it is: language, GPU need, entry point, web app type, dependency files, a Slurm script.
k8s
Package k8s holds the small, typed subset of Kubernetes objects nrp-mcp writes.
Package k8s holds the small, typed subset of Kubernetes objects nrp-mcp writes.
knowledge
Package knowledge serves the NRP rules and UCR guides as MCP resources, so an assistant reads them instead of guessing.
Package knowledge serves the NRP rules and UCR guides as MCP resources, so an assistant reads them instead of guessing.
kube
Package kube runs kubectl as the signed-in user.
Package kube runs kubectl as the signed-in user.
mcpserver
Package mcpserver exposes nrp-mcp's nine tools, resources and prompts over MCP.
Package mcpserver exposes nrp-mcp's nine tools, resources and prompts over MCP.
ops
Package ops does the cluster work behind the tools: status, watch, run, cleanup, session and data moves.
Package ops does the cluster work behind the tools: status, watch, run, cleanup, session and data moves.
plan
Package plan turns project facts and a goal into Kubernetes manifests for Nautilus, with the reasoning spelled out.
Package plan turns project facts and a goal into Kubernetes manifests for Nautilus, with the reasoning spelled out.
rules
Package rules checks manifests against the NRP Nautilus cluster policies.
Package rules checks manifests against the NRP Nautilus cluster policies.
setup
Package setup checks and readies a researcher's laptop for Nautilus: kubectl, the kubelogin plugin, the NRP kubeconfig and sign-in.
Package setup checks and readies a researcher's laptop for Nautilus: kubectl, the kubelogin plugin, the NRP kubeconfig and sign-in.
store
Package store keeps plans, single-use confirm tokens, run cards and the audit log on the user's disk.
Package store keeps plans, single-use confirm tokens, run cards and the audit log on the user's disk.
version
Package version holds the nrp-mcp version.
Package version holds the nrp-mcp version.
scripts
e2e command
Command e2e drives a real nrp-mcp over stdio against Nautilus: status, plan, run a tiny CPU job, watch until done, cleanup in two steps, confirm the namespace is clean.
Command e2e drives a real nrp-mcp over stdio against Nautilus: status, plan, run a tiny CPU job, watch until done, cleanup in two steps, confirm the namespace is clean.
e2e2 command
Command e2e2 live-tests the data and session tools against Nautilus: make a small volume, upload a file, list it, download it, start a CPU-only Jupyter session, reach it through port-forward, then clean everything up.
Command e2e2 live-tests the data and session tools against Nautilus: make a small volume, upload a file, list it, download it, start a CPU-only Jupyter session, reach it through port-forward, then clean everything up.
e2earray command
Command e2earray checks Slurm array translation live on Nautilus: it plans a folder that holds a Slurm script with --array, runs it as an Indexed Job (CPU only), and checks that every task printed a different SLURM_ARRAY_TASK_ID and a different result.
Command e2earray checks Slurm array translation live on Nautilus: it plans a folder that holds a Slurm script with --array, runs it as an Indexed Job (CPU only), and checks that every task printed a different SLURM_ARRAY_TASK_ID and a different result.
setupcheck command
Command setupcheck calls nrp_setup (check only) over a real stdio MCP session.
Command setupcheck calls nrp_setup (check only) over a real stdio MCP session.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL