kaggle-shell-mcp (kgsh)
Turn free 12h Kaggle GPUs into multi-slot live remote terminals, dual-panel file workbenches, and offline competition runners for AI Agents via MCP.
Tiếng Việt (Vietnamese Guide) · Architecture · Changelog · Contributing
Live Screenshots (Native Rust 60-FPS TUI — kgsh ui)
F1 Cockpit — Real-Time Shell, Live Script Output, MCP Activity & Job Logs
Watch every [mcp] tool call from your AI Agent alongside your own [tui] commands, live GPU/VRAM/RAM/Disk telemetry, running foreground loop tailing, and live training logs side by side.
F2 Dual-Panel File Manager & Code Preview Drawer
Browse local files (Left) and Kaggle /kaggle/working, /kaggle/input, /tmp (Right) with Yazi-style ← / → navigation, DU% disk micro-bars, multi-select, cross-panel clipboard (c/x/p), t push/pull transfers, and v syntax preview drawer.
More screenshots: Remote File Editor & Clean Selection · Multi-Slot Workers & Weekly Quota
Remote File Editor (Enter / → 2x) — Clean Shift / Ctrl+Shift & Drag Selection
Drag with the mouse or hold Shift / Ctrl+Shift + arrow keys to select and copy only clean code — never capturing the Path : header or 1 │ line-number gutters.
Workers, Cluster & Quota (Ctrl+W / F5)
Inspect weekly GPU (30h) & TPU (20h) quota, switch or stop parallel slots (slot="1", "2"), and boot from saved profiles (~/.kaggle_mcp/profiles.json).
Why kaggle-shell-mcp?
- Zero-Black-Box MCP + 60-FPS Rust TUI (
kgsh ui): Watch every command your AI Agent sends in real time, interrupt hung loops (Ctrl+C) on an isolated TUI shell without killing Agent sessions, browse/edit/preview remote files safely (256 KBcap with automatic Read-Only lock on truncated/binary files & unsaved-edit guard), inspect.parquet/.csv/.safetensors/.pt/.zipfiles, and monitor Multi-GPU VRAM &°Ctelemetry (GPU0,GPU1, ...). - Zero-Setup Prebuilt Binary Auto-Download (
x86_64&ARM64): Runningkgsh uiafterpip install kaggle-shell-mcpautomatically downloads the matching prebuiltkgsh-tuibinary for Windows (x86_64), Linux (x86_64&aarch64staticmusl), or macOS (arm64&x86_64) from GitHub Releases with Fail-ClosedSHA256SUMS.txtverification into~/.kaggle_mcp/bin/— no Rust toolchain required. - SSH-Ready Clipboard (
OSC 52+ Internal Yank Buffer):Ctrl+C,Ctrl+X,Ctrl+V, mouse drag, and Bracketed Paste work seamlessly even over headless SSH servers without X11/Wayland. - One-Line Credentials & Secret-Safe Sync: Works out of the box with
KAGGLE_USERNAMEandKAGGLE_KEY(KGAT_...token, legacy key, or~/.kaggle/kaggle.json, requiringkaggle>=2.2.0).fs_syncand TUI Push automatically exclude.env*(keeping.env.example),kaggle.json, SSH/TLS keys, and local pull directories. - Dual Concurrent GPU VMs (
4 × Tesla T4 = 60 GB VRAM) & Verified Shutdown: Run up to 2 parallel live Kaggle GPU VMs (slot="1,2"), pin individual background jobs (gpu_ids="0"/"1"), and stop slots via 3-tier verified shutdown (kgsh down [-f]) that never wipessessions.jsonwhile a GPU VM is still running. - Full Hardware & Kaggle Hub Support: Target
NvidiaTeslaT4(2×15 GB),NvidiaL4,NvidiaL4x4(96 GB),NvidiaRtxPro6000(96 GB),NvidiaH100,TpuV5E8/TpuV6E8, orcpu, with nativecompetition_sourcesand Kaggle Hubmodel_sourcesmounts. - Offline Competition Mode + Auto-Harvest + Host SSE Live Logs: When
L4x4/RTX Pro 6000enforcesenable_internet=False,kaggle_wheelhouse+kaggle_batch_runuse isolated per-run slugs (kgsh-batch-<slot>-<run>), automatically harvest relative outputs (submission.csv,checkpoints/) from/tmpinto/kaggle/workingon exit, and stream live stdout via Kaggle's Host SSE endpoint (kaggle_batch_logs). - 11h40m (
8h40mTPU) Safe-Drain Watchdog: SendsSIGTERMat11h35m(8h35mon TPU) to flush checkpoints and exits cleanly (exit 0) at11h40mso/kaggle/working(19.5 GB) snapshots persist.
Quickstart (30 Seconds)
Option A: Zero-Install MCP Server for AI Agents (uvx)
Add directly to Claude Desktop / Cursor / Windsurf / Antigravity (mcp_config.json):
{
"mcpServers": {
"kgsh": {
"command": "uvx",
"args": ["--from", "kaggle-shell-mcp", "kgsh"],
"env": {
"KAGGLE_USERNAME": "your_kaggle_username",
"KAGGLE_KEY": "KGAT_your_api_token_here"
}
}
}
}
Or add to Claude Code CLI in one line:
claude mcp add kgsh -e KAGGLE_USERNAME=your_user -e KAGGLE_KEY=KGAT_your_token -- uvx --from kaggle-shell-mcp kgsh
Option B: Install kgsh CLI + Native TUI (pip / uv)
pip install kaggle-shell-mcp
# or isolated CLI install:
uv tool install kaggle-shell-mcp
Configure credentials via any of:
KAGGLE_USERNAME+KAGGLE_KEYenvironment variables,.envin your project directory or~/.kaggle_mcp/.env, or- Existing
~/.kaggle/kaggle.json.
Then launch the TUI or CLI:
# Launch Dual-Panel Rust TUI (auto-downloads prebuilt kgsh-tui binary on first run)
kgsh ui
# Or manage workers directly from CLI
kgsh quota
kgsh up -s 1
kgsh shell -s 1
Option C: Install from Source (Developers)
git clone https://github.com/NguyenQuocDat06-AI/kaggle-shell-mcp.git
cd kaggle-shell-mcp
python -m venv .venv
.\.venv\Scripts\pip install -e ".[dev]" # Linux/macOS: ./.venv/bin/pip install -e ".[dev]"
cargo build --release --manifest-path tui/Cargo.toml
.\.venv\Scripts\kgsh ui
MCP Tools Reference (13 Tools)
| Tool | Purpose |
|---|---|
kaggle_quota |
Check remaining weekly Kaggle GPU (30h) & TPU (20h) quota hours and reset timestamp |
kaggle_up |
Boot 1 or 2 parallel headless workers (slot="1", "2", or "1,2", accelerator, competition, mount_datasets, mount_models, opt-in idle_timeout_min) |
kaggle_status |
Inspect live GPU/VRAM telemetry, RAM, disk, and kernel states across slot="all" or a specific slot (auto-cleans stale sessions) |
kaggle_down |
Verified 3-tier shutdown for slot="1", "2", or "all" (waits for COMPLETE before pulling outputs; force=True cancels unreachable/queued ephemeral runners) |
term_exec |
Run bash commands in a persistent stateful PTY on slot (cwd, exports, and virtualenvs persist across calls) |
job_spawn |
Launch detached background jobs on slot with optional gpu_ids (CUDA_VISIBLE_DEVICES="0" or "1") |
job_list |
List active and finished background jobs on slot with PID, GPU assignment, runtime, and log size |
job_logs |
Read tail lines of a background job log on slot (with regex grep and automatic tqdm \r cleanup) |
job_kill |
Send SIGTERM or SIGKILL to a background job's process group on slot and release VRAM |
fs_sync |
push local folders (auto-blocking .env*, kaggle.json, private keys & caches) or pull remote checkpoints/logs on slot |
kaggle_wheelhouse |
Download Linux manylinux_x86_64 binary .whl packages and publish a private Dataset for offline runs |
kaggle_batch_run |
Submit an isolated run-scoped offline competition batch job (NvidiaL4x4, NvidiaRtxPro6000, TpuV5E8, enable_internet=False) with automatic /tmp -> /kaggle/working artifact harvesting |
kaggle_batch_logs |
Stream live or completed logs via Kaggle's Host SSE endpoint—even when container internet is disabled |
TUI Keyboard & Mouse Cheatsheet (kgsh ui)
| Context | Keys / Mouse | Action |
|---|---|---|
| Global | F1 / F2 / F3 / F4 |
Switch Presets: Cockpit · Dual Files · Jobs & GPU · Kaggle Hub |
Tab / Alt+← Alt+→ |
Switch active panel LEFT <-> RIGHT |
|
Ctrl+W / F5 / Ctrl+K / ? |
Workers & Quota modal / Boot Profiles / Command Palette / Help | |
z / m / a / T |
Zoom active panel 100% / Swap panel content / Context actions / Telemetry | |
F8 |
Toggle TUI MouseCapture vs. native terminal selection anytime | |
| Selection & Copy | Shift / Ctrl+Shift + ↑↓←→ |
Select clean text in FileEditor, Shell, Logs, PreviewDrawer, Inspect & inputs |
| Mouse Drag | Drag inside any content area to auto-copy (auto-strips borders, headers & line gutters) | |
Ctrl+A / Ctrl+C / Ctrl+X / y |
Select all / Copy selection (or interrupt live command) / Cut / Copy | |
Shell (F1) |
i / Enter · :run <cmd> · Alt+Enter |
Enter INPUT mode · Stream long for/training loops live |
Dual Files (F2) |
← / → (h / l) · Enter · v |
Parent dir (restores cursor) / Enter dir or Preview (2× opens Editor) / Drawer |
Space / Shift+A / t / c x p |
Mark / Mark all / Transfer opposite panel / Cross-panel Clipboard | |
n / N / R / d / / / u / Shift+X |
New file / New dir / Rename / Delete (2×) / Find / DU% / Run script with Live Logs |
CLI Workflows (kgsh)
1. Parallel Multi-Slot Interactive GPUs (4 × T4 = 60 GB VRAM)
kgsh up -s 1,2 # Boot 2 Dual-T4 VMs in parallel
kgsh push ./my_project /kaggle/working -s 1
kgsh push ./my_project /kaggle/working -s 2
kgsh spawn -s 1 --gpus 0 "python my_project/train.py --lr 1e-4" --name exp1
kgsh spawn -s 1 --gpus 1 "python my_project/train.py --lr 3e-4" --name exp2
kgsh spawn -s 2 --gpus 0 "python my_project/train.py --lr 5e-4" --name exp3
kgsh spawn -s 2 --gpus 1 "python my_project/train.py --lr 1e-3" --name exp4
kgsh logs <job_id> -s 1 -f # Live tail -f log follower
kgsh down -s all # Clean shutdown when done
2. Offline Competition Batch Runner (L4x4 / RTX Pro 6000)
kgsh wheels peft accelerate bitsandbytes --slug lora-deps --py 312
kgsh batch-run "torchrun --nproc_per_node=4 solve.py" \
--path ./comp_solution -a l4x4 --comp arc-prize-2026 \
--wheels your_username/kgsh-wheels-lora-deps \
--model qwen-lm/qwen2.5/transformers/7b-instruct/1
kgsh batch-logs -s batch-1 --tail 80
Architecture & Responsible Use
See ARCHITECTURE.md for system internals (multi-slot file locking, echo-immune PTY sentinel framing, Host SSE log streaming, and prebuilt TUI binary distribution).
kaggle-shell-mcp is built for legitimate ML experimentation, model training, and competition workflows on your own Kaggle account. Respect Kaggle's Terms of Service and shut down active slots (kgsh down -s all) when finished.
Released under the MIT License.
Metadata
Release files for kaggle-shell-mcp 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| kaggle_shell_mcp-1.0.1.tar.gz | 94.9 kB | With provenance | Details for kaggle_shell_mcp-1.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| kaggle_shell_mcp-1.0.1-py3-none-any.whl | Python 3 | none | any | Details for kaggle_shell_mcp-1.0.1-py3-none-any.whl |
Total release size: 178.0 kB
Release files / kaggle_shell_mcp-1.0.1.tar.gz
| Download URL | kaggle_shell_mcp-1.0.1.tar.gz |
|---|---|
| Size | 94.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
71035b3b23c113ab92f0c560059e7bec90a3ed752c231c947115b6143f61f1b6
|
|
BLAKE2b-256 checksum How to use checksums |
375af5a8373f08f850d17a599dc8206c116f47b486ccbe2088b808d901a71e7e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.
Transparency logRelease files / kaggle_shell_mcp-1.0.1-py3-none-any.whl
| Download URL | kaggle_shell_mcp-1.0.1-py3-none-any.whl |
|---|---|
| Size | 83.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ce49fddd7923fd330020dc40fdb466d3da5f22a3b0296aec531b62c1a57edcff
|
|
BLAKE2b-256 checksum How to use checksums |
f09338fe081acd7c7fc021242efb2ae105773e0f548cc8d2973011fd662ec383
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.
Transparency logSecurity for kaggle-shell-mcp 1.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for kaggle_shell_mcp-1.0.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.