slurm-mcp
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@slurm-mcp check the queue and show me my running jobs"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
slurm-mcp
Use Claude Code (or any MCP client) to work on a SLURM HPC cluster over SSH: browse and edit files, write and submit batch jobs, watch the queue, read logs and debug failed jobs. You do all of this in plain language, from your laptop.
> Look at /scratch/me/rnaseq/fastq, write a job that runs fastqc on every sample with 8 cores,
and submit it.
● hpc_find_files(base_path="/scratch/me/rnaseq/fastq", name_pattern="*.fastq.gz")
● hpc_generate_sbatch(job_name="fastqc", cpus=8, memory_gb=16, walltime="02:00:00", ...)
Here is the script. Shall I save and submit it?
> yes
● hpc_write_file(path="/scratch/me/rnaseq/jobs/fastqc.sbatch", ...)
● hpc_submit_job(script_path="/scratch/me/rnaseq/jobs/fastqc.sbatch")
Submitted as job 481516. I'll check the log when it's running.The server works with any cluster. Site details such as storage paths, partitions, limits,
QoS, environment setup and local rules live in a small cluster.toml profile plus a folder
of Markdown notes that Claude reads before it suggests resources.
Contents
Related MCP server: tacc-mcp-bio
How it works
your laptop the cluster
┌──────────────────────────────────────────┐ ┌───────────────────────────┐
│ Claude Code │ │ login node │
│ │ MCP over stdio │ SSH │ squeue, sbatch, sacct, │
│ ▼ │ ─────────► │ ls, cat, grep, … │
│ slurm-mcp (Docker container or uv) │ (optional │ │
│ reads .env + cluster/cluster.toml │ jump host) │ compute nodes ◄── SLURM │
└──────────────────────────────────────────┘ └───────────────────────────┘Claude Code starts the server on demand. It keeps one persistent SSH connection to the login node and reconnects automatically if the connection drops.
Only lightweight commands run on the login node. Real work always goes through
sbatch.Nothing needs to be installed on the cluster. The server only needs the standard tools found on any Linux login node (
ls,stat,grep,find,realpath) plus the SLURM client commands.
What Claude can do
Area | Tools |
Cluster docs |
|
Files (read) |
|
Files (write) |
|
SLURM (read) |
|
SLURM (act) |
|
Script generation |
|
Projects |
|
Workspaces |
|
Safety model
The server lets Claude act on a shared machine with your account, so the guardrails are built into the tools rather than left to the model's judgement:
There is no general shell tool. Every tool runs one fixed command. All arguments are shell-quoted, and job IDs, sizes, names and
#SBATCHvalues are validated.No delete, move, copy or chmod. Those tools simply don't exist.
Path policy:
Writes are allowed only under
[paths].write.Reads are allowed only under
write+read.[paths].forbiddenalways wins..ssh,.gnupg,.netrc,.aws,.kubeand.dockerdirectories are blocked everywhere.Paths are checked again after the server resolves symlinks, so a symlink inside scratch can't be used to reach
/etcor another user's data.
Large and binary files never enter the conversation. Claude gets a preview or metadata instead.
Only your own jobs can be cancelled, held or released.
Mutating tools are marked as such for the client. Claude Code asks you before every call that is not on your allow-list (see step 6).
Credentials stay local. The SSH key and
known_hostsare mounted read-only into the container and are never baked into the image. The host key is verified by default.
Setup
You need:
An account on the cluster with SSH access (key-based).
Either Docker (Docker Desktop on macOS/Windows) or uv if you'd rather not use Docker.
On Windows, run everything inside WSL2.
1. SSH access to the cluster
The server logs in with an SSH key, the same way you do. If you can already run
ssh you@login.cluster.org without typing a password, skip to the last bullet.
# Create a key (press Enter to accept the default path; a passphrase is optional)
ssh-keygen -t ed25519 -C "you@laptop"
# Install it on the cluster (asks for your cluster password one last time)
ssh-copy-id -i ~/.ssh/id_ed25519.pub you@login.cluster.org
# Test it. This also records the server's host key in ~/.ssh/known_hosts,
# which slurm-mcp uses to verify that it's talking to the real server.
ssh you@login.cluster.org hostnameThe login node is only reachable through a gateway? Test with
ssh -J you@gateway.org you@login-node, then fill inHPC_JUMP_HOSTin.env(step 2). Connect to the gateway directly once as well, so its host key is recorded too.The login node is only reachable over the institute VPN? Connect the VPN first. Docker Desktop routes container traffic through your laptop's network, VPN included.
You use a host alias from
~/.ssh/config(e.g.ssh mycluster)? slurm-mcp does not read~/.ssh/config. Use the realHostName,UserandPortvalues in.env.
2. Get the code and create .env
git clone https://github.com/romelllo/slurm-mcp.git
cd slurm-mcp
cp .env.example .envEdit .env. The minimum is:
HPC_HOST=login.cluster.org # the login node
HPC_USER=you # your cluster username
HPC_KEY_PATH=~/.ssh/id_ed25519 # private key from step 1See all variables for the jump host, key passphrase, project aliases, and more.
.env is gitignored. Never commit it.
3. Describe your cluster
cp -r cluster.example clustercluster/ is gitignored, so your site details stay private. Edit cluster/cluster.toml:
[cluster]
name = "My University HPC"
description = """
Login node is for editing/submitting only. Home has a 50 GB quota; keep data in /scratch/{user}.
"""
[paths]
write = ["/scratch/{user}/"] # where Claude may create/edit files
read = ["/home/{user}/", "/shared/data/"] # extra read-only locations
forbidden = ["/etc/"]
[slurm]
default_partition = "cpu"
qos = [] # allowed --qos values, if your site uses them
preamble = ["module load python/3.11"] # added to every generated job script
[[slurm.partitions]]
name = "cpu"
max_time = "7-00:00:00"
max_cpus = 64
max_mem_gb = 500
max_gpus = 0{user} is replaced with HPC_USER. Every limit is optional; leave it out if you don't
know it. The reference lists all options.
Next, put your cluster's rules into cluster/docs/*.md: storage and quotas, partitions
and QoS, the module system or conda, who to contact, and so on. Copying the relevant parts
of your cluster's wiki works well. Claude reads these through hpc_read_doc and
hpc_search_docs. Short, factual bullet points work best.
Tip: the most important rules (e.g. "never compute on the login node", quotas) belong in
[cluster].descriptiontoo. Claude sees that text at the start of every session.
4. Build and test
With Docker:
docker compose build
docker compose run --rm -T slurm-mcp --checkWithout Docker:
uv sync
uv run slurm-mcp --check--check prints the effective configuration, logs in, and checks that your paths exist:
Cluster profile : /app/cluster/cluster.toml
Cluster name : My University HPC
SSH target : you@login.cluster.org:22
Host key check : on (/run/secrets/known_hosts)
Writable paths : /scratch/you/
...
Connecting ... OK — logged in to login01, slurm 23.11.4
✓ /scratch/you/ (writable)
✓ /home/you/
All good.If anything fails, see Troubleshooting.
5. Connect Claude Code
Register the server once. Use the absolute path to your clone:
# With Docker
claude mcp add --scope user hpc -- \
docker compose -f /ABSOLUTE/PATH/TO/slurm-mcp/docker-compose.yml run --rm -T slurm-mcp
# Without Docker
claude mcp add --scope user hpc -- \
uv --directory /ABSOLUTE/PATH/TO/slurm-mcp run slurm-mcp--scope usermakes the cluster available in every project.Use
--scope projectto register it only for the current repository (this writes.mcp.json, which you can commit for your team, since it contains no secrets).The server name
hpcbecomes the tool prefix:mcp__hpc__hpc_queue, etc.
Start Claude Code and run /mcp. hpc should show as connected with about 27 tools.
Each Claude Code session starts its own short-lived container, which exits when the
session ends.
6. Optional: skip prompts for read-only tools
By default Claude Code asks before every tool call. To let Claude browse files and the
queue freely while still asking before anything that changes the cluster, allow the
read-only tools in ~/.claude/settings.json (all projects) or .claude/settings.json (one
project). The same block is in
examples/claude-settings.json:
{
"permissions": {
"allow": [
"mcp__hpc__hpc_list_docs",
"mcp__hpc__hpc_read_doc",
"mcp__hpc__hpc_search_docs",
"mcp__hpc__hpc_list_directory",
"mcp__hpc__hpc_get_file_info",
"mcp__hpc__hpc_read_file",
"mcp__hpc__hpc_head_file",
"mcp__hpc__hpc_tail_file",
"mcp__hpc__hpc_search_in_file",
"mcp__hpc__hpc_find_files",
"mcp__hpc__hpc_storage_usage",
"mcp__hpc__hpc_resolve_project",
"mcp__hpc__hpc_queue",
"mcp__hpc__hpc_cluster_info",
"mcp__hpc__hpc_job_details",
"mcp__hpc__hpc_job_efficiency",
"mcp__hpc__hpc_job_history",
"mcp__hpc__hpc_list_reservations",
"mcp__hpc__hpc_generate_sbatch",
"mcp__hpc__hpc_generate_rmd",
"mcp__hpc__hpc_generate_rmd_render_job"
]
}
}Writing files, submitting, cancelling, holding and releasing jobs, and workspace changes will still ask every time.
Using it
Just talk about the cluster. Some prompts that work well:
"What partitions are there and how busy are they? Which GPU nodes are free?"
"Show me what's in /scratch/me/project and summarise the sample sheet."
"Peek at the first reads of sample1_R1.fastq.gz."
"Write an sbatch script that aligns all samples with bwa-mem2 as a job array, 16 cores each, then submit it."
"Job 123456 failed. Find out why and fix the script."
"How efficient were my jobs this week? Am I requesting too much memory?"
"Which of my jobs from the last 3 days hit TIMEOUT or OUT_OF_MEMORY?"
"Create an R Markdown QC notebook for these count tables and a job that renders it."
It helps to add a line to your analysis project's CLAUDE.md:
Data and compute for this project live on the HPC cluster. Use the `hpc` MCP tools for
anything on the cluster (never local shell/ssh). Project directory: /scratch/me/project.Configuration reference
.env
Variable | Default | Description |
| — | Login node hostname or IP (required) |
| — | Cluster username (required) |
|
| SSH port |
| — | Private key on your machine. With Docker it's mounted at |
| — | Key passphrase, if the key has one |
| — | Only for servers that demand a password/second prompt in addition to the key |
| — | Gateway host, like |
|
| Username on the gateway |
|
| Gateway SSH port |
|
| File with the cluster's host key(s) |
|
|
|
|
| Cluster profile path (relative to the repo root) |
|
| Override the docs directory |
| — |
|
| — | Alias shown as the default project |
|
| Seconds before a remote command is abandoned |
cluster.toml
Key | Description |
| Display name |
| Short paragraph Claude always sees. Put the key rules here. |
| Docs folder relative to the profile (default |
|
|
| Directories Claude may create/edit files in. Globs allowed per component: |
| Additional read-only directories |
| Always denied, even inside the above |
| Used when the request doesn't name one (default: first partition) |
| Allowed |
| Default |
| Lines inserted into every generated job script (module loads, conda activation, …) |
| Per-user limits without a QoS. Exceeding them gives a warning that suggests a QoS |
| One block per partition. Limits are optional. |
| Turn on the hpc-workspace ( |
| Lines run before |
Other MCP clients
Any MCP client that can launch a stdio server works.
Claude Desktop: add this to claude_desktop_config.json:
{
"mcpServers": {
"hpc": {
"command": "docker",
"args": ["compose", "-f", "/ABSOLUTE/PATH/TO/slurm-mcp/docker-compose.yml",
"run", "--rm", "-T", "slurm-mcp"]
}
}
}On macOS, Claude Desktop may not see Docker on its PATH. If so, use the full path
/usr/local/bin/docker.
Troubleshooting
Run --check first (step 4). It pinpoints most problems.
Symptom | Fix |
| SSH to the cluster once with plain |
|
|
| Check |
| Login node not reachable: connect the VPN, or configure |
Docker: | The key or |
Docker on Linux: permission denied reading the key | The container runs as UID 1000. Add |
| SLURM is only on |
| Run the exact command from step 5 in a terminal. It should wait silently for input (Ctrl-C to quit). Any error printed there is the cause. Build the image first so startup is fast |
Claude uses | Add the |
Job stays | Over the per-user limit. Use a higher QoS or a smaller request (see your cluster docs) |
Development
uv sync # install with dev tools
uv run pytest # tests (no cluster needed — SSH is mocked)
uv run ruff check src/ tests/ && uv run ruff format src/ tests/
uv run ty check src/Code layout:
src/slurm_mcp/
├── server.py tool registry, dispatcher, server instructions, --check
├── config.py .env + cluster.toml → Settings
├── ssh.py persistent asyncssh connection (jump host, host-key check, stdin upload)
├── paths.py path policy + symlink resolution
├── builtin_docs/ generic SLURM primer served alongside the cluster docs
└── tools/ docs, filesystem, slurm, workspaces, scriptsTo add a tool:
Write an
asyncfunction intools/that returns adictand never raises.Register it in
build_tools()and_HANDLERSinserver.py.If it changes anything on the cluster, add it to
MUTATING_TOOLS.
License
Available Tools
27 toolshpc_cancel_jobBDestructive
Cancel one of your own jobs (scancel).
Inputs: job_id (required).
hpc_cluster_infoARead-only
Partitions and node availability (sinfo). per_node=true shows CPUs, memory and GPUs for every node.
Inputs: per_node.
hpc_edit_fileA
Replace an exact string in a file in a writable location. Fails if old_string is not unique unless replace_all=true.
Inputs: path (required), new_string (required), old_string (required), replace_all.
hpc_find_filesBRead-only
Find files by name/type/size under a directory. Returns paths only.
Inputs: base_path (required), file_type, max_depth, size_filter, +1 more.
hpc_generate_rmdCRead-only
Generate an R Markdown notebook template that references data paths on the cluster.
Inputs: title (required), author (required), data_paths (required), output_dir (required), +2 more.
hpc_generate_rmd_render_jobCRead-only
Generate an sbatch script that renders an R Markdown file on a compute node.
Inputs: rmd_path (required), output_dir (required), cpus, email, +3 more.
hpc_generate_sbatchARead-only
Generate an sbatch script, validated against the cluster's partition/QoS limits. Returns text only — save with hpc_write_file.
Inputs: cpus (required), commands (required), job_name (required), walltime (required), +11 more.
hpc_get_file_infoBRead-only
File metadata (size, type, permissions, mtime) without reading content.
Inputs: path (required).
hpc_head_fileARead-only
First N lines of a file. Transparently decompresses .gz files (FASTQ, VCF, BED, …).
Inputs: path (required), lines.
hpc_hold_jobA
Hold one of your own pending jobs.
Inputs: job_id (required).
hpc_job_detailsBRead-only
Full details of one job (scontrol + sacct).
Inputs: job_id (required).
hpc_job_efficiencyARead-only
CPU and memory efficiency of a finished job (seff/sacct). Use it to right-size future requests.
Inputs: job_id (required).
hpc_job_historyARead-only
Your jobs from the last N days (sacct), optionally filtered by state.
Inputs: days, state.
hpc_list_directoryARead-only
List a directory on the cluster (ls -lh). Does not fetch file content.
Inputs: path (required), pattern.
hpc_list_docsARead-only
List the cluster documentation (site rules + SLURM basics).
Inputs: no named parameters.
hpc_list_reservationsBRead-only
List SLURM reservations.
Inputs: no named parameters.
hpc_queueBRead-only
Show the SLURM queue (your jobs by default).
Inputs: user_only.
hpc_read_docARead-only
Read one documentation file. Partial names work, e.g. 'slurm', 'storage'.
Inputs: filename (required).
hpc_read_fileARead-only
Read a text file into context (≤1 MB). Larger files return a head/tail preview; binary files are refused.
Inputs: path (required).
hpc_release_jobA
Release one of your own held jobs.
Inputs: job_id (required).
hpc_resolve_projectARead-only
Resolve a project alias to its directory. With no alias, lists projects and the readable/writable roots.
Inputs: alias.
hpc_search_docsBRead-only
Search all cluster documentation for a keyword or phrase.
Inputs: query (required).
hpc_search_in_fileARead-only
grep a file for a pattern (basic regex). Streams, so safe for huge files.
Inputs: path (required), pattern (required), context_lines.
hpc_storage_usageBRead-only
Free space (df) on the configured filesystems and the user's quota.
Inputs: no named parameters.
hpc_submit_jobA
Submit an existing batch script with sbatch (runs from the script's directory). The script must be in a writable location.
Inputs: script_path (required).
hpc_tail_fileARead-only
Last N lines of a file. Ideal for checking live SLURM job logs.
Inputs: path (required), lines.
hpc_write_fileCDestructive
Create or overwrite a file in a writable location (none configured). Parent dirs are created.
Inputs: path (required), content (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 27 tools
Tools are mostly distinct by resource and action, but a few overlap: read_file vs head/tail file, queue vs job_history, job_details vs job_efficiency, and generate_rmd vs generate_rmd_render_job. Descriptions clarify current vs past, full details vs efficiency, and template vs render job, so misselection risk is moderate rather than severe.
All tools use the hpc_ prefix and snake_case, which is highly predictable. The main deviation is that many names are noun-first (hpc_queue, hpc_cluster_info, hpc_job_details) rather than strict verb_noun, but the convention remains consistent and readable.
With 27 tools, the set is heavy, above the ideal 3-15 range and just over the 25+ 'too many' threshold. The broad HPC domain justifies many tools, but some file and job-query functions could likely be consolidated without losing capability.
The surface covers docs, filesystem browsing/reading, storage, project resolution, queue/partition info, job details/efficiency/history, reservations, submit/cancel/hold/release, and script generation. Minor gaps remain: no delete/move/copy for files, no job update or array-specific submission, and write/edit/submit depend on a writable location that the description says is not configured.
Related MCP Connectors
Use your own Windows, Mac or Linux computer from ChatGPT, Claude, Cursor or Gemini CLI: run commands, read, write and search files, run long processes. Your computer only makes an outgoing connection (no open ports or VPN). Read-only mode, allowed folders, blocked commands and an action log keep you in control. Free plan available.
Use your Mac, Windows or Linux computer from ChatGPT, Claude or Codex: files, commands, documents.
Operate Linux, macOS and Windows from your LLM. Every action runs through an auditable allowlist.
Give your AI hands on every computer you own. Remote control of your Windows, Mac and Linux machines from one ChatGPT, Claude or Cursor chat — even from your phone. Ask it to find out why the office server is crawling, update every PC in the house, sort out your mom's laptop from another city, or ship the site from your work machine while you're on a train. It runs commands and reads and writes files; screenshots are a beta you can request. You decide what each computer allows, and you can cut any of them off in a second.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables interaction with Slurm HPC clusters via SSH, allowing job submission, monitoring, and error diagnosis through MCP clients like Claude Desktop.6MIT
- FlicenseNot gradedqualityDmaintenanceEnables Claude Code to interact with a TACC or SLURM HPC cluster for bioinformatics pipelines, allowing job management, log reading, file browsing, remote script execution, and job submission through natural language.-
- FlicenseNot gradedqualityDmaintenanceEnables AI assistants to manage SLURM HPC clusters via SSH. Supports job submission, resource monitoring, queue management, and file operations.4-
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to manage SLURM cluster jobs with safety guardrails, including file transfer, job submission, log reading, and remote command execution.1MIT