SSH MCP Server for Automated Transfers and Timeouts
**Crafting a concise description**
npx -y @sinjab/mcp_sshOverview
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
# build (example using Go; replace with project's build steps if different)
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:
Example systemd unit (mcp_ssh.service):
[Unit]
MCP SSH Server
network.target
[Service]
mcp
/usr/local/bin/mcp_ssh --config /etc/mcp_ssh/config.yaml
on-failure
LC_ALL=C.UTF-8
[Install]
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
Automated model context uploads
- Agents or preprocessing jobs push a model input bundle to the MCP server using scp:
The server enforces transfer limits and will abort transfers exceeding size or timeout thresholds.
- Agents or preprocessing jobs push a model input bundle to the MCP server using scp:
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.
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.
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:
| Key | Type | Description |
|---|---|---|
| listen_addr | string | Host:port the server listens on |
| host_key | string | Path to SSH host private key |
| storage_dir | string | Directory where uploaded files are stored |
| auth.authorized_keys | string | Path to allowed public keys |
| timeouts.connect_timeout_seconds | int | Handshake timeout in seconds |
| timeouts.transfer_timeout_seconds | int | Per-transfer inactivity timeout |
| limits.max_transfer_bytes | int | Maximum bytes allowed per transfer |
| logging.level | string | Log 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.