SSH MCP is a tool that provides SSH functionality through an MCP (Machine Communication Protocol) interface. It allows you to connect to SSH servers, execute commands, transfer files, and manage SSH sessions.
- SSH connection management (connect/disconnect)
- Authentication methods (password, key-based)
- Command execution with timeout handling
- File transfer (upload/download)
- Directory listing
- Session management
- Security features (host allowlist/denylist, command filtering, rate limiting)
main.go: The main application entry pointinternal/: Internal packagesssh/: SSH client functionalitysession/: Session managementfile/: File operationssecurity/: Security features
e2e/: End-to-end tests.devcontainer/: Development container configuration
This project uses testcontainers for end-to-end testing with a real SSH server.
The project includes a dev container configuration in the .devcontainer directory that can be used for development. This is optional and not required for running the tests.
For more details, see .devcontainer/README.md.
The e2e directory contains end-to-end tests that verify the SSH MCP tool works correctly with a real SSH server. These tests use testcontainers to automatically create and manage an SSH server container for testing.
For more details, see e2e/README.md.
- Docker
- Go 1.24 or later
- Clone the repository
- Start the SSH MCP server:
go run main.goThe server will start on port 8081.
# Unit tests
go test ./internal/...
# End-to-end tests
cd e2e
go test -vThe end-to-end tests will automatically start the necessary containers and servers for testing.
The SSH MCP tool provides the following tools:
ssh_connect: Establish an SSH connectionssh_execute: Execute a command over SSHssh_disconnect: Close an SSH connectionssh_list_sessions: List active SSH sessionsssh_upload_file: Upload a file to the SSH serverssh_download_file: Download a file from the SSH serverssh_list_directory: List contents of a directory on the SSH server
These tools can be accessed through the MCP interface at http://localhost:8081/mcp.