Add SFTP tools with SCP fallback

This commit is contained in:
Vibe Myass
2026-05-24 21:18:09 +00:00
parent d3b39c590a
commit 8afa6dee62
12 changed files with 684 additions and 51 deletions

View File

@@ -30,10 +30,12 @@ The first implementation pass intentionally narrows the MVP:
* .NET 10 stdio MCP server
* `ssh_exec`
* `terminal_start`, `terminal_write`, `terminal_read`, and `terminal_stop`
* `sftp_list`, `sftp_get`, and `sftp_put`
* SSH.NET-based SSH connections
* Tool-supplied `host`, `username`, optional `port`, optional `keyPath`, and optional `keyPassphrase`
* Default key discovery from `~/.ssh/id_ed25519`, `~/.ssh/id_ecdsa`, then `~/.ssh/id_rsa` when `keyPath` is omitted
* No SSH agent, OpenSSH alias, `ssh -G`, ProxyJump, ProxyCommand, or SFTP support yet
* SFTP first for file transfer; `sftp_get` and `sftp_put` silently fall back to SCP if SFTP is unavailable
* No SSH agent, OpenSSH alias, `ssh -G`, ProxyJump, or ProxyCommand support yet
* Basic audit logging and timeout enforcement
## Non-Goals
@@ -169,21 +171,21 @@ Priority order:
```text
1. SFTP
2. SCP fallback (optional future enhancement)
2. SCP fallback for get/put
```
The implementation must:
* Validate SFTP subsystem availability during connection
* Return structured capability errors if unavailable
* Not silently downgrade to SCP
* Use SFTP for directory listing
* Use SFTP first for file get/put
* Silently fall back to SCP for file get/put if SFTP is unavailable
Example error:
```json
{
"error": "sftp_unavailable",
"message": "Remote host does not expose the SFTP subsystem.",
"message": "Remote host does not expose the SFTP subsystem for directory listing.",
"scpFallbackAvailable": false
}
```
@@ -243,7 +245,6 @@ Input:
{
"host": "prod-api.example.com",
"username": "deploy",
"shell": "bash",
"cols": 120,
"rows": 40,
"port": 22,
@@ -267,6 +268,7 @@ Requirements:
* Maintain server-side session state
* Support idle timeout cleanup
* Use the same key-auth inputs and default key discovery as `ssh_exec`
* Use the remote account's default shell; do not write shell setup commands into the PTY after startup
---
@@ -553,6 +555,9 @@ The MVP must include:
* terminal_write
* terminal_read
* terminal_stop
* sftp_list
* sftp_get
* sftp_put
* basic audit logging
---