Metadata-Version: 2.4
Name: ssh_agent_mcp
Version: 0.3.3
Summary: SSH Agent MCP服务 - 支持SSH连接管理、命令执行和SFTP文件传输的完整MCP服务器
Home-page: https://github.com/zhijun/ssh-mcp
Author: Your Name
Author-email: Your Name <your.email@example.com>
License: MIT License
        
        Copyright (c) 2024 zhijun
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
Project-URL: Homepage, https://github.com/zhijun/ssh-mcp
Project-URL: Repository, https://github.com/zhijun/ssh-mcp
Project-URL: Documentation, https://github.com/zhijun/ssh-mcp#readme
Project-URL: Bug Tracker, https://github.com/zhijun/ssh-mcp/issues
Keywords: mcp,ssh,remote,automation,claude,sftp,file-transfer
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: System :: Networking
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.12
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: mcp>=1.0.0
Requires-Dist: paramiko>=3.0.0
Requires-Dist: pydantic>=2.0.0
Requires-Dist: pytest>=8.4.2
Provides-Extra: dev
Requires-Dist: pytest>=7.0.0; extra == "dev"
Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
Requires-Dist: black>=23.0.0; extra == "dev"
Requires-Dist: ruff>=0.1.0; extra == "dev"
Requires-Dist: build>=0.10.0; extra == "dev"
Dynamic: author
Dynamic: home-page
Dynamic: license-file
Dynamic: requires-python

# SSH Agent MCP
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)

[中文文档 README_CN.md](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:

```json
{
  "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`:

```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

```json
{
  "tool": "ssh_connect",
  "params": {
    "name": "prod",
    "host": "prod.example.com",
    "username": "admin",
    "private_key": "/home/user/.ssh/id_rsa"
  }
}
```

```json
{
  "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`.

## Badges & Links

- Repository: https://github.com/zhijun/ssh-mcp
- Issues: https://github.com/zhijun/ssh-mcp/issues
- PyPI: https://pypi.org/project/ssh-agent-mcp/

## License

MIT License. See [LICENSE](LICENSE).
