mcp-win-stdio-ssh 0.2.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,60 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ *$py.class
4
+ *.so
5
+ .Python
6
+ build/
7
+ develop-eggs/
8
+ dist/
9
+ downloads/
10
+ eggs/
11
+ .eggs/
12
+ lib/
13
+ lib64/
14
+ parts/
15
+ sdist/
16
+ var/
17
+ wheels/
18
+ share/python-wheels/
19
+ *.egg-info/
20
+ .installed.cfg
21
+ *.egg
22
+ MANIFEST
23
+
24
+ *.manifest
25
+ *.spec
26
+
27
+ pip-log.txt
28
+ pip-delete-this-directory.txt
29
+ pypi api.txt
30
+ htmlcov/
31
+ .tox/
32
+ .nox/
33
+ .coverage
34
+ .coverage.*
35
+ .cache
36
+ nosetests.xml
37
+ coverage.xml
38
+ *.cover
39
+ *.py,cover
40
+ .hypothesis/
41
+ .pytest_cache/
42
+ cover/
43
+
44
+ *.mo
45
+ *.pot
46
+
47
+ .env
48
+ .venv
49
+ env/
50
+ venv/
51
+ ENV/
52
+ env.bak/
53
+ venv.bak/
54
+
55
+ .idea/
56
+ .vscode/
57
+ *.swp
58
+ *.swo
59
+
60
+ *.log
@@ -0,0 +1,96 @@
1
+ Metadata-Version: 2.5
2
+ Name: mcp-win-stdio-ssh
3
+ Version: 0.2.4
4
+ Summary: Advanced Multi-SSH Connection & Remote Management Model Context Protocol (MCP) server for Windows & Claude: 25+ tools for multi-host pooling, ~/.ssh/config auto-discovery, PTY interactive shells, SFTP file management, systemd/docker services, background jobs, and local port forwarding tunnels.
5
+ Author: Mohan Kumar Indala
6
+ License-Expression: MIT
7
+ Keywords: ai,claude,docker,llm,mcp,port-forwarding,pty,remote-management,sftp,ssh,systemd,tunnels,windows
8
+ Classifier: Development Status :: 4 - Beta
9
+ Classifier: Environment :: Win32 (MS Windows)
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Operating System :: Microsoft :: Windows
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Programming Language :: Python :: 3.14
19
+ Classifier: Topic :: System :: Systems Administration
20
+ Requires-Python: >=3.10
21
+ Requires-Dist: cryptography>=3.3.0
22
+ Requires-Dist: mcp-win-stdio>=0.2.4
23
+ Requires-Dist: mcp>=1.2.0
24
+ Requires-Dist: paramiko>=3.0.0
25
+ Description-Content-Type: text/markdown
26
+
27
+ # mcp-win-stdio-ssh
28
+
29
+ > Advanced Multi-SSH Connection & Remote Management Model Context Protocol (MCP) Server for Windows & Claude Desktop / Claude Code CLI.
30
+
31
+ Part of the **[mcp-win-stdio](https://github.com/indala/mcp-win-stdio)** suite.
32
+
33
+ ---
34
+
35
+ ## 🌟 Key Features
36
+
37
+ - **Multi-Host Connection Pooling & Persistence**: Connect to unlimited remote servers. Automatically parses `~/.ssh/config` (aliases, identity files, JumpHosts) and persists active host preferences.
38
+ - **Sticky Active Host**: Run commands against an active default host or specify `host="server_name"` per tool call.
39
+ - **Remote Execution & Elevated Commands**: Non-interactive command execution (`ssh_exec`), `sudo` password automation (`ssh_exec_sudo`), multi-line script execution (`ssh_exec_script`), and detached background jobs (`ssh_exec_background`).
40
+ - **Interactive PTY Shell Sessions**: Start stateful pseudo-terminals (`ssh_pty_start`, `ssh_pty_send`, `ssh_pty_read`) for interactive REPLs, prompts, and long-running interactive tools.
41
+ - **Remote Diagnostics & Services**: System health stats (`ssh_system_overview`), process monitoring (`ssh_list_processes`), systemd / docker / pm2 services (`ssh_list_services`, `ssh_service_action`), and live log tailing (`ssh_tail_logs`).
42
+ - **High-Performance SFTP**: Explore remote file systems (`sftp_list_dir`), read/write files (`sftp_read_file`, `sftp_write_file`), inspect metadata (`sftp_stat`), and sync local/remote folders (`sftp_upload`, `sftp_download`).
43
+ - **Port Forwarding & Tunnels**: Create background local-to-remote SSH port forwarding tunnels (`ssh_tunnel_open`, `ssh_tunnel_list`, `ssh_tunnel_close`) to securely access remote databases or web services.
44
+
45
+ ---
46
+
47
+ ## 📦 Installation
48
+
49
+ ```bash
50
+ # Standalone package installation:
51
+ pip install mcp-win-stdio-ssh
52
+
53
+ # Or with full mcp-win-stdio suite:
54
+ pip install "mcp-win-stdio[all]"
55
+ ```
56
+
57
+ ---
58
+
59
+ ## 🚀 Quick Start & Claude Configuration
60
+
61
+ ### Claude Desktop (`%APPDATA%\Claude\claude_desktop_config.json`)
62
+
63
+ ```json
64
+ {
65
+ "mcpServers": {
66
+ "ssh": {
67
+ "command": "mws-ssh",
68
+ "args": ["run"]
69
+ }
70
+ }
71
+ }
72
+ ```
73
+
74
+ ### Claude Code CLI
75
+
76
+ ```bash
77
+ claude mcp add ssh mws-ssh run
78
+ ```
79
+
80
+ ---
81
+
82
+ ## 🛠️ CLI Utilities
83
+
84
+ ```bash
85
+ # Open interactive diagnostic CLI & host manager
86
+ mws-ssh
87
+
88
+ # List configured SSH hosts and test latency
89
+ mws-ssh test
90
+
91
+ # Launch MCP stdio server
92
+ mws-ssh run
93
+
94
+ # View comprehensive prompt recipes & tool documentation
95
+ mws-ssh guide
96
+ ```
@@ -0,0 +1,70 @@
1
+ # mcp-win-stdio-ssh
2
+
3
+ > Advanced Multi-SSH Connection & Remote Management Model Context Protocol (MCP) Server for Windows & Claude Desktop / Claude Code CLI.
4
+
5
+ Part of the **[mcp-win-stdio](https://github.com/indala/mcp-win-stdio)** suite.
6
+
7
+ ---
8
+
9
+ ## 🌟 Key Features
10
+
11
+ - **Multi-Host Connection Pooling & Persistence**: Connect to unlimited remote servers. Automatically parses `~/.ssh/config` (aliases, identity files, JumpHosts) and persists active host preferences.
12
+ - **Sticky Active Host**: Run commands against an active default host or specify `host="server_name"` per tool call.
13
+ - **Remote Execution & Elevated Commands**: Non-interactive command execution (`ssh_exec`), `sudo` password automation (`ssh_exec_sudo`), multi-line script execution (`ssh_exec_script`), and detached background jobs (`ssh_exec_background`).
14
+ - **Interactive PTY Shell Sessions**: Start stateful pseudo-terminals (`ssh_pty_start`, `ssh_pty_send`, `ssh_pty_read`) for interactive REPLs, prompts, and long-running interactive tools.
15
+ - **Remote Diagnostics & Services**: System health stats (`ssh_system_overview`), process monitoring (`ssh_list_processes`), systemd / docker / pm2 services (`ssh_list_services`, `ssh_service_action`), and live log tailing (`ssh_tail_logs`).
16
+ - **High-Performance SFTP**: Explore remote file systems (`sftp_list_dir`), read/write files (`sftp_read_file`, `sftp_write_file`), inspect metadata (`sftp_stat`), and sync local/remote folders (`sftp_upload`, `sftp_download`).
17
+ - **Port Forwarding & Tunnels**: Create background local-to-remote SSH port forwarding tunnels (`ssh_tunnel_open`, `ssh_tunnel_list`, `ssh_tunnel_close`) to securely access remote databases or web services.
18
+
19
+ ---
20
+
21
+ ## 📦 Installation
22
+
23
+ ```bash
24
+ # Standalone package installation:
25
+ pip install mcp-win-stdio-ssh
26
+
27
+ # Or with full mcp-win-stdio suite:
28
+ pip install "mcp-win-stdio[all]"
29
+ ```
30
+
31
+ ---
32
+
33
+ ## 🚀 Quick Start & Claude Configuration
34
+
35
+ ### Claude Desktop (`%APPDATA%\Claude\claude_desktop_config.json`)
36
+
37
+ ```json
38
+ {
39
+ "mcpServers": {
40
+ "ssh": {
41
+ "command": "mws-ssh",
42
+ "args": ["run"]
43
+ }
44
+ }
45
+ }
46
+ ```
47
+
48
+ ### Claude Code CLI
49
+
50
+ ```bash
51
+ claude mcp add ssh mws-ssh run
52
+ ```
53
+
54
+ ---
55
+
56
+ ## 🛠️ CLI Utilities
57
+
58
+ ```bash
59
+ # Open interactive diagnostic CLI & host manager
60
+ mws-ssh
61
+
62
+ # List configured SSH hosts and test latency
63
+ mws-ssh test
64
+
65
+ # Launch MCP stdio server
66
+ mws-ssh run
67
+
68
+ # View comprehensive prompt recipes & tool documentation
69
+ mws-ssh guide
70
+ ```
@@ -0,0 +1,44 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "mcp-win-stdio-ssh"
7
+ version = "0.2.4"
8
+ description = "Advanced Multi-SSH Connection & Remote Management Model Context Protocol (MCP) server for Windows & Claude: 25+ tools for multi-host pooling, ~/.ssh/config auto-discovery, PTY interactive shells, SFTP file management, systemd/docker services, background jobs, and local port forwarding tunnels."
9
+ readme = "README.md"
10
+
11
+ requires-python = ">=3.10"
12
+ license = "MIT"
13
+ authors = [
14
+ { name = "Mohan Kumar Indala" }
15
+ ]
16
+ keywords = ["mcp", "claude", "ssh", "sftp", "pty", "tunnels", "port-forwarding", "remote-management", "systemd", "docker", "ai", "llm", "windows"]
17
+ classifiers = [
18
+ "Development Status :: 4 - Beta",
19
+ "Environment :: Win32 (MS Windows)",
20
+ "Intended Audience :: Developers",
21
+ "License :: OSI Approved :: MIT License",
22
+ "Operating System :: Microsoft :: Windows",
23
+ "Programming Language :: Python :: 3",
24
+ "Programming Language :: Python :: 3.10",
25
+ "Programming Language :: Python :: 3.11",
26
+ "Programming Language :: Python :: 3.12",
27
+ "Programming Language :: Python :: 3.13",
28
+ "Programming Language :: Python :: 3.14",
29
+ "Topic :: System :: Systems Administration",
30
+ ]
31
+
32
+ dependencies = [
33
+ "mcp-win-stdio>=0.2.4",
34
+ "mcp>=1.2.0",
35
+ "paramiko>=3.0.0",
36
+ "cryptography>=3.3.0",
37
+ ]
38
+
39
+ [project.scripts]
40
+ mcp-win-stdio-ssh = "mcp_win_stdio.ssh.cli:main"
41
+ mws-ssh = "mcp_win_stdio.ssh.cli:main"
42
+
43
+ [tool.hatch.build.targets.wheel]
44
+ packages = ["src/mcp_win_stdio"]
@@ -0,0 +1,5 @@
1
+ """
2
+ Advanced Multi-SSH Connection & Remote Management MCP Server for mcp-win-stdio.
3
+ """
4
+
5
+ __version__ = "0.2.4"
@@ -0,0 +1,8 @@
1
+ """
2
+ Direct execution entrypoint: python -m mcp_win_stdio.ssh
3
+ """
4
+
5
+ from mcp_win_stdio.ssh.server import mcp
6
+
7
+ if __name__ == "__main__":
8
+ mcp.run(transport="stdio")
@@ -0,0 +1,152 @@
1
+ """
2
+ CLI entry point for mcp-win-stdio-ssh.
3
+ """
4
+
5
+ import argparse
6
+ import os
7
+ from pathlib import Path
8
+ import shutil
9
+ import subprocess
10
+ import sys
11
+ import time
12
+
13
+ # Ensure Windows console uses UTF-8 without crashing on cp1252
14
+ if sys.platform == "win32":
15
+ try:
16
+ sys.stdout.reconfigure(encoding="utf-8", errors="replace")
17
+ sys.stderr.reconfigure(encoding="utf-8", errors="replace")
18
+ except Exception:
19
+ pass
20
+
21
+ from mcp_win_stdio.ssh import __version__
22
+ from mcp_win_stdio.ssh.connection import (
23
+ SYSTEM_SSH_CONFIG,
24
+ get_all_registered_hosts,
25
+ get_active_host_name,
26
+ resolve_host_info,
27
+ get_cached_or_connect,
28
+ )
29
+ from mcp_win_stdio.ssh.guide import print_ssh_guide
30
+ from mcp_win_stdio.ssh.server import mcp
31
+
32
+
33
+ def cmd_run(args: argparse.Namespace) -> None:
34
+ """Run SSH MCP server over stdio."""
35
+ mcp.run()
36
+
37
+
38
+ def cmd_doctor(args: argparse.Namespace) -> None:
39
+ """Run diagnostic checks on SSH drivers, Windows OpenSSH service, keys, and configs."""
40
+ print(f"\n=== mcp-win-stdio-ssh Doctor Diagnostic (v{__version__}) ===\n")
41
+ print(f"[OK] Python Runtime: {sys.version.split()[0]} ({sys.executable})")
42
+
43
+ # 1. Driver Checks
44
+ for dep in ("mcp", "paramiko", "cryptography"):
45
+ try:
46
+ mod = __import__(dep)
47
+ ver = getattr(mod, "__version__", "installed")
48
+ print(f"[OK] Python Module: {dep:<14} (v{ver})")
49
+ except ImportError:
50
+ print(f"[FAIL] Python Module: {dep:<14} (MISSING - run `pip install {dep}`)")
51
+
52
+ # 2. OpenSSH Windows client check
53
+ ssh_bin = shutil.which("ssh")
54
+ if ssh_bin:
55
+ print(f"[OK] System SSH CLI: {ssh_bin}")
56
+ else:
57
+ print(f"[INFO] System SSH CLI: Not on PATH (Optional: Paramiko native SSH client active)")
58
+
59
+ # 3. SSH Config & Keys
60
+ ssh_dir = Path.home() / ".ssh"
61
+ if ssh_dir.is_dir():
62
+ print(f"[OK] SSH Directory: {ssh_dir}")
63
+ if SYSTEM_SSH_CONFIG.exists():
64
+ print(f"[OK] SSH Config: {SYSTEM_SSH_CONFIG}")
65
+ else:
66
+ print(f"[INFO] SSH Config: No ~/.ssh/config found (can use add_host or create config)")
67
+
68
+ keys = [f.name for f in ssh_dir.iterdir() if f.is_file() and not f.name.endswith(".pub") and "id_" in f.name]
69
+ if keys:
70
+ print(f"[OK] Found Keys: {', '.join(keys)}")
71
+ else:
72
+ print(f"[INFO] Found Keys: No default id_* keys found in ~/.ssh/")
73
+ else:
74
+ print(f"[INFO] SSH Directory: {ssh_dir} not created yet.")
75
+
76
+ # 4. Registered Hosts
77
+ hosts = get_all_registered_hosts()
78
+ active = get_active_host_name()
79
+ print(f"\n--- Registered Hosts ({len(hosts)}) ---")
80
+ for name, h in hosts.items():
81
+ is_act = " (ACTIVE DEFAULT)" if name == active else ""
82
+ print(f" • {name:<16} -> {h.get('user')}@{h.get('hostname')}:{h.get('port')} [{h.get('source')}]{is_act}")
83
+
84
+ print("\nDiagnostic complete.\n")
85
+
86
+
87
+ def cmd_test(args: argparse.Namespace) -> None:
88
+ """Test SSH connectivity and latency to configured hosts."""
89
+ target = args.host
90
+ hosts = get_all_registered_hosts()
91
+
92
+ if not hosts and not target:
93
+ print("\n[!] No SSH hosts configured. Use 'add_host' tool or configure ~/.ssh/config.\n")
94
+ return
95
+
96
+ targets = [target] if target else list(hosts.keys())
97
+
98
+ print(f"\n=== Testing SSH Connectivity ({len(targets)} host{'s' if len(targets) > 1 else ''}) ===\n")
99
+
100
+ for h_name in targets:
101
+ try:
102
+ h_info = resolve_host_info(h_name)
103
+ t_start = time.time()
104
+ client = get_cached_or_connect(h_info["name"], timeout=10)
105
+ lat_ms = round((time.time() - t_start) * 1000, 2)
106
+
107
+ stdin, stdout, stderr = client.exec_command("uname -srmo 2>/dev/null || ver", timeout=5)
108
+ os_info = stdout.read().decode("utf-8", errors="replace").strip()
109
+
110
+ print(f" [OK] {h_name:<16} -> {h_info.get('user')}@{h_info.get('hostname')}:{h_info.get('port')} ({lat_ms}ms) | {os_info}")
111
+ except Exception as e:
112
+ print(f" [FAIL] {h_name:<14} -> Error: {e}")
113
+
114
+ print("\nTest complete.\n")
115
+
116
+
117
+ def cmd_guide(args: argparse.Namespace) -> None:
118
+ """Print guide and prompt recipes."""
119
+ print_ssh_guide()
120
+
121
+
122
+ def main() -> None:
123
+ parser = argparse.ArgumentParser(
124
+ prog="mcp-win-stdio-ssh",
125
+ description="Unified Multi-SSH Connection & Remote Management MCP Server CLI",
126
+ )
127
+ parser.add_argument("--version", "-v", action="version", version=f"%(prog)s {__version__}")
128
+ subparsers = parser.add_subparsers(dest="command", help="Command to execute")
129
+
130
+ sub_guide = subparsers.add_parser("guide", help="View usage guide and recipes")
131
+ sub_guide.set_defaults(func=cmd_guide)
132
+
133
+ sub_doctor = subparsers.add_parser("doctor", help="Check SSH configuration and drivers")
134
+ sub_doctor.set_defaults(func=cmd_doctor)
135
+
136
+ sub_test = subparsers.add_parser("test", help="Test connectivity to configured hosts")
137
+ sub_test.add_argument("host", nargs="?", help="Specific host name to test")
138
+ sub_test.set_defaults(func=cmd_test)
139
+
140
+ sub_run = subparsers.add_parser("run", help="Run SSH MCP server over stdio")
141
+ sub_run.set_defaults(func=cmd_run)
142
+
143
+ args = parser.parse_args()
144
+ if hasattr(args, "func"):
145
+ args.func(args)
146
+ else:
147
+ # Default action is run
148
+ cmd_run(args)
149
+
150
+
151
+ if __name__ == "__main__":
152
+ main()