Skip to main content
Glama
klone-mcp

klone-mcp

by aurasoph

klone-mcp

A minimal MCP server for UW Hyak (klone). Exposes two tools — klone_run (any shell command) and klone_compute (run commands on a named, reusable compute allocation) — plus documentation resources covering klone's filesystem layout, SLURM conventions, and curated shell commands.

Agents already know how to use squeue, sacct, sbatch, du, etc., and they know bash (heredocs to write files, pipes, etc). This MCP doesn't wrap any of it. It just gives the agent a convenient way to run commands on klone and find out what klone-specific utilities exist.

The SSH host can be overridden via the KLONE_SSH_HOST env var (default: klone). Useful for alternate aliases, a test cluster, or parallel configs.

If you want pre-typed wrappers around SLURM (klone_squeue, klone_log, klone_submit, …) checkout the structured-tools branch.

Prerequisites

  • Python 3.10+

  • A working SSH alias klone on your machine. Add this block to ~/.ssh/config if you don't have it (replace YOUR_UWNETID):

    Host klone
        HostName klone.hyak.uw.edu
        User YOUR_UWNETID
        ControlMaster auto
        ControlPath ~/.ssh/cm-%r@%h:%p
        ControlPersist 10h
        ServerAliveInterval 60

    Then run ssh klone once, complete the Duo push, and leave the terminal open. The persistent connection means ssh klone <cmd> from any other terminal won't re-prompt for the next 10 hours. The MCP reuses this same connection.

Related MCP server: Developer Toolbox MCP

Install

cd ~/klone/klone-mcp
pip install -e .

Or with uv:

cd ~/klone/klone-mcp
uv venv && source .venv/bin/activate && uv pip install -e .

Verify it runs

ssh klone whoami        # must return your NetID — seed the SSH session first

Register with Claude Code

claude mcp add klone -- python -m klone_mcp.server

The -- is required because claude mcp add would otherwise try to parse -m as its own flag.

If you installed into a venv, point at that venv's Python:

claude mcp add klone -- /path/to/.venv/bin/python -m klone_mcp.server

Or edit ~/.claude/settings.json directly:

{
  "mcpServers": {
    "klone": {
      "command": "python",
      "args": ["-m", "klone_mcp.server"]
    }
  }
}

Use it

claude

Inside the session:

"Run klone_run with whoami."

Should return your NetID. If Duo expired, you'll get a structured re-auth prompt — open a terminal, do ssh klone, complete Duo, leave that terminal open, and ask the agent to retry.

Tools

Tool

Purpose

klone_run(cmd, timeout=60, stdin=None)

Run any shell command on klone. Returns stdout + (on success) stderr, capped at 1 MB per stream. Pipe large content via stdin=.

klone_compute(name, cmd, salloc_args=..., timeout=120)

Run cmd on a named, reusable salloc allocation. First call allocates; subsequent calls with the same name reuse the same node and share it via srun --overlap. Release with klone_run("scancel -n <name>") or let walltime expire.

Things like df, du, sinfo, hyakalloc, scontrol, squeue, sacct, sbatch are not separate tools — invoke them via klone_run. See the klone://docs/commands resource for a curated list. To write a file, use a heredoc or stdin=: klone_run("cat > /tmp/x", stdin=body).

Available Tools

2 tools
klone_put_fileA

Create or overwrite a file on klone with the given content.

Content is piped via SSH stdin, so size is unlimited (no ARG_MAX boundary) and shell metacharacters in content are not interpreted.

Use this for writing SLURM scripts, config files, small data files — anything where you want exact bytes written verbatim. For very large data files, use rsync or scp from the calling machine instead.

If you're writing a SLURM script, read klone://help/jobs first for the partition catalog and klone://help/checkpoint if you're planning to use ckpt-all (preemption handling is required).

Inputs: path (required), content (required). Returns: result

klone_runA

Run a shell command on klone and return its stdout.

cmd is run by the remote shell, so pipes, redirects, and && chains work. For everything beyond simple commands — SLURM job submission, job inspection, log tailing, disk queries, etc. — invoke the appropriate shell tool here. See klone://docs/commands for a list of klone-specific utilities (hyakalloc, hyakstorage, squeue, sacct, sbatch, scontrol, scancel, sinfo, apptainer, ...).

For long-running work (compilation, training), submit a SLURM job via sbatch rather than running it directly.

timeout (seconds) controls how long to wait for the remote command. Default 60. Bump for expensive queries like du -sh /gscratch/....

First-time orientation: if you haven't already, read klone://docs/quickstart — it covers the storage/quota layout, the SSD-staging performance pattern, and indexes all other klone://help/* topics (SLURM, GPUs, containers, MATLAB, R, Jupyter, etc). Reading it once saves repeated trial-and-error.

Inputs: cmd (required), timeout. Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4.7/5.0

    Scored across 2 tools

    Disambiguation5/5

    The two tools serve completely distinct purposes: one writes files verbatim, the other executes shell commands. There is no ambiguity or overlap.

    Naming Consistency5/5

    Both tools follow the same 'klone_verb_noun' pattern using snake_case, making the naming predictable and consistent.

    Tool Count5/5

    With only two tools, the server is minimal but effective. The 'run' tool can execute arbitrary shell commands, covering a wide range of operations, so the count is well-scoped for the domain.

    Completeness5/5

    The tool surface covers the core needs for cluster interaction: file writing and command execution. Missing operations like file reading or deletion are easily accomplished via the run tool, making the set complete for the inferred domain.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers