SS

SSH MCP Server for Automated Transfers and Timeouts

**Crafting a concise description**

Quick Install
npx -y @sinjab/mcp_ssh

Overview

This MCP (Model Context Protocol) SSH server provides a simple, production-oriented gateway for automated file transfers used by model-serving or agent-based systems. It exposes a narrow SSH interface tailored to push and pull context bundles (files or archives) between compute processes and a centralized store, while enforcing timeouts and transfer limits to keep automated workflows predictable and safe.

The server is useful when you need a lightweight transfer endpoint that integrates with existing SSH tooling (scp/sftp/ssh keys) but behaves deterministically for automated clients: transfers can be limited in duration, size and lifetime; logs are structured for audit; and the storage layout is easy to mount or snapshot for downstream model components.

GitHub: https://github.com/sinjab/mcp_ssh

Features

  • SSH-based file transfers compatible with standard clients (scp/sftp/ssh)
  • Automatic per-connection and per-transfer timeouts to avoid stuck transfers
  • Pluggable authentication (public keys, optional token hooks)
  • Configurable storage directory and per-namespace quotas
  • Transfer size limits and cleanup policies for ephemeral contexts
  • Structured logging and optional audit trail for transfer events
  • Low-footprint binary suitable for containers or system services

Installation / Configuration

Clone the repository and build or download a release binary. Typical steps:

# clone
git clone https://github.com/sinjab/mcp_ssh.git
cd mcp_ssh

# build (example using Go; replace with project's build steps if different)
go build -o mcp_ssh ./cmd/mcp_ssh

Basic configuration is provided via a YAML file. Example config (config.yaml):

listen_addr: "0.0.0.0:2222"
host_key: "/etc/mcp_ssh/host_key"
storage_dir: "/var/lib/mcp_ssh/storage"
auth:
  authorized_keys: "/etc/mcp_ssh/authorized_keys"
timeouts:
  connect_timeout_seconds: 10
  transfer_timeout_seconds: 60
limits:
  max_transfer_bytes: 104857600  # 100 MB
logging:
  level: "info"

Run the server with the config file:

./mcp_ssh --config /path/to/config.yaml

Example systemd unit (mcp_ssh.service):

[Unit]
Description=MCP SSH Server
After=network.target

[Service]
User=mcp
ExecStart=/usr/local/bin/mcp_ssh --config /etc/mcp_ssh/config.yaml
Restart=on-failure
Environment=LC_ALL=C.UTF-8

[Install]
WantedBy=multi-user.target

Adjust firewall or cloud security groups to allow your chosen listen port (default 2222 in examples).

Available Resources

  • Repository: https://github.com/sinjab/mcp_ssh
  • Example configuration files and systemd unit in the repo’s examples/ directory
  • Client compatibility: scp, sftp, and standard SSH libraries
  • Logs location: configurable in config.yaml (default often /var/log/mcp_ssh.log)
  • Troubleshooting: enable debug logging to trace authentication and timeout issues

Use Cases

  1. Automated model context uploads

    • Agents or preprocessing jobs push a model input bundle to the MCP server using scp:
      scp -P 2222 input_bundle.tar.gz mcp_user@your-host:/namespace/job123/
      
      The server enforces transfer limits and will abort transfers exceeding size or timeout thresholds.
  2. CI/CD artifact staging for inference

    • CI jobs stage artifacts to a centralized context store before deployment. The MCP server’s storage_dir can be mounted into downstream containers to supply inputs to model-hosting services.
  3. Ephemeral workspace provisioning for LLM agents

    • Orchestrators provision ephemeral namespaces; agents fetch their context via sftp and have guaranteed time-limited access. A cleanup policy removes expired namespaces automatically.
  4. Secure, auditable transfer layer

    • Use public-key authentication and structured logs to record who uploaded which context and when. Helpful for compliance in regulated workflows.

Configuration Reference

A quick table of common config keys:

KeyTypeDescription
listen_addrstringHost:port the server listens on
host_keystringPath to SSH host private key
storage_dirstringDirectory where uploaded files are stored
auth.authorized_keysstringPath to allowed public keys
timeouts.connect_timeout_secondsintHandshake timeout in seconds
timeouts.transfer_timeout_secondsintPer-transfer inactivity timeout
limits.max_transfer_bytesintMaximum bytes allowed per transfer
logging.levelstringLog level: debug, info, warn, error

Tips for Developers

  • Test integration with the same scp command you plan to use in production to catch permission or path issues early.
  • Start with conservative timeouts when troubleshooting and gradually tighten them for production.
  • Use a dedicated user and chroot or careful filesystem permissions for storage_dir to reduce blast radius.
  • Rotate host keys and authorized keys as part of your security schedule.

This MCP SSH server is intended as a predictable, SSH-compatible transfer endpoint for automated model workflows—combining familiar tools with configurable limits and logging to support production-grade pipelines.

Tags:ai-ml