Skip to main content

SSH Agent MCP

License: MIT

中文文档 README_CN.md

Manage SSH and SFTP via MCP tools for AI assistants.

SSH Agent MCP is a Python-based MCP (Model Context Protocol) stdio server that lets AI assistants manage SSH connections, execute commands, and transfer files via SFTP. It supports zero-argument startup, pure CLI configuration, and JSON config files, making it simple to operate multiple remote servers securely.

  • Requires: Python >= 3.12
  • Project status: Beta

Why uvx?

  • No local install: run uvx ssh-agent-mcp@latest directly
  • Always up-to-date: pin to @latest for consistent versioning
  • Ideal for desktop assistants: simplest setup for Claude Desktop

Why SSH Agent MCP?

  • Multiple concurrent sessions: manage and track many SSH connections at once
  • Async long-running tasks: stream outputs and control jobs like top, tail, logs
  • Built-in SFTP: upload/download, list, mkdir, remove, and rename directories/files
  • Auto keepalive & reconnect: maintain session health and minimize drops
  • Interactive commands: handle sudo, shells, editors with input events

Install

  • Recommended (no local install): uvx ssh-agent-mcp@latest
  • Pip (use PyPI to avoid cached mirrors): pip install -i https://pypi.org/simple ssh-agent-mcp
  • Externally managed environments: use virtualenv or pipx
    • python -m venv .venv && source .venv/bin/activate
    • pipx install ssh-agent-mcp

Quick Start

Run via uvx (Claude Desktop)

Minimal config:

{
  "mcpServers": {
    "ssh-mcp": {
      "command": "uvx",
      "args": ["ssh-agent-mcp@latest"]
    }
  }
}

The assistant can then connect using ssh_connect or ssh_connect_by_name.

CLI examples

  • Zero-argument startup: ssh-agent-mcp
  • Direct params: ssh-agent-mcp --host example.com --user admin --password secret
  • With config file: ssh-agent-mcp --config /path/to/ssh_config.json --connection production

Minimal config file

ssh_config.json:

{
  "connections": [
    {
      "name": "production",
      "host": "prod.example.com",
      "username": "admin",
      "private_key": "/home/user/.ssh/id_rsa"
    }
  ],
  "auto_connect": ["production"]
}

Tools (MCP)

  • Connection: ssh_connect, ssh_connect_by_name, ssh_disconnect, ssh_list_connections
  • Commands: ssh_execute, ssh_execute_interactive, ssh_execute_async
  • Lifecycle: ssh_check_status, ssh_terminate, ssh_list_async
  • SFTP: sftp_upload, sftp_download, sftp_list, sftp_mkdir, sftp_remove, sftp_rename
  • Files: remote_read_file, remote_write_file
  • Status: ssh_status

Example: Connect and Execute

{
  "tool": "ssh_connect",
  "params": {
    "name": "prod",
    "host": "prod.example.com",
    "username": "admin",
    "private_key": "/home/user/.ssh/id_rsa"
  }
}
{
  "tool": "ssh_execute",
  "params": {
    "connection": "prod",
    "command": "uname -a"
  }
}

Notes

  • Prefer uvx ssh-agent-mcp@latest for frictionless use.
  • If domestic mirrors cache old versions, specify PyPI index explicitly.
  • For full CLI options and advanced usage, see the Chinese guide: README_CN.md.

License

MIT License. See LICENSE.

Metadata

Release files for ssh_agent_mcp 0.3.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ssh_agent_mcp 0.3.3
File Size Uploaded Provenance
ssh_agent_mcp-0.3.3.tar.gz 29.4 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for ssh_agent_mcp 0.3.3
File Interpreter ABI Platform
ssh_agent_mcp-0.3.3-py3-none-any.whl Python 3 none any Details

Total release size: 58.0 kB

Release files / ssh_agent_mcp-0.3.3.tar.gz

Download URL ssh_agent_mcp-0.3.3.tar.gz
Size 29.4 kB
Tags Source
SHA-256 checksum
How to use checksums
61f8d5f21dae2d3ea7f4bbc43918ca1b716289f4631b96a3d728eee8825cda20
BLAKE2b-256 checksum
How to use checksums
8fa7deb02eca0f7fe15e38b9af28f2779d1cf517345164441910d8ae8f6a25f5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.5

Release files / ssh_agent_mcp-0.3.3-py3-none-any.whl

Download URL ssh_agent_mcp-0.3.3-py3-none-any.whl
Size 28.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
92569dfafe72eecde4cf277d8f031f63e27a74003d34513afa215c838fbbd5ca
BLAKE2b-256 checksum
How to use checksums
24c2ad205d6aff7e587f8d401f5c084f26ca34753e8c42e69e0112129ccbe1e7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.5

Security for ssh_agent_mcp 0.3.3

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page