Ubuntu SSH MCP Server
Allows connecting to Ubuntu servers over SSH to manage system packages, services, users, firewall, SSH configuration, perform security audits, and execute commands remotely.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Ubuntu SSH MCP Server Check system info on prod"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Ubuntu SSH MCP Server
An MCP server that lets Claude Code connect to Ubuntu servers over SSH to manage, maintain, and secure them — all from a natural language conversation.
Features
Category | Tools |
Connection | Connect/disconnect servers, list active sessions |
Commands | Run shell commands, sudo commands |
System Info | OS/CPU/RAM/disk overview, process list, disk usage |
Packages | apt update, upgrade, install, remove |
Services | Start/stop/restart/enable systemd services |
Logs | journalctl, tail log files |
Files | Read, write, list remote files |
Security Audit | Open ports, SUID files, sudo rights, failed logins |
Firewall (UFW) | Status, add/delete rules, enable/disable |
SSH Hardening | Disable root login, password auth, MaxAuthTries |
Users | List, create, delete users; add SSH public keys |
Fail2ban | Jail status, unban IPs |
Cron | List cron jobs |
Network | Interface info, routing, ping |
Related MCP server: Ubuntu VM Control
Requirements
Node.js 18+
Claude Code (
npm install -g @anthropic-ai/claude-code)
Installation
# 1. Clone / copy this folder somewhere permanent
cd ~/ubuntu-ssh-mcp
npm install
# 2. Register with Claude Code (global scope — available in all projects)
claude mcp add ubuntu-ssh-mcp -- node /ABSOLUTE/PATH/TO/ubuntu-ssh-mcp/index.js
# Verify it's registered
claude mcp listAlternative: Project-level config
Create or edit .mcp.json in your project root:
{
"mcpServers": {
"ubuntu-ssh-mcp": {
"command": "node",
"args": ["/ABSOLUTE/PATH/TO/ubuntu-ssh-mcp/index.js"]
}
}
}Usage Examples
Once Claude Code is running with the MCP server connected, just talk to it:
> Connect to my server at 192.168.1.10 as ubuntu using my key at ~/.ssh/id_rsa, call it "prod"
> Show me the system info for prod
> Check what security updates are available on prod
> Run a full security audit on prod
> Harden the SSH config on prod — make sure I have key auth working first
> Enable UFW on prod and allow only ports 22, 80, and 443
> Show the last 100 lines of the nginx error log on prod
> List all users on prod and check if any have unexpected sudo access
> Install fail2ban on prod and check the sshd jail statusSecurity Notes
Use SSH key auth — avoid passing passwords where possible.
sudo_passwordis passed as a parameter; Claude Code stores no secrets. UseNOPASSWDsudoers for a CI/automation account if you prefer not to pass passwords.harden_sshwill restart sshd — ensure key-based auth is working before calling it or you may lock yourself out.Connections persist for the life of the Claude Code session and are cleaned up on exit.
The server runs locally via stdio — no network ports are opened by the MCP server itself.
Tool Reference
Connection
Tool | Description |
| Connect to a server |
| Disconnect from a server |
| List active connections |
Execution
Tool | Description |
| Run a shell command |
| Run a command with sudo |
System
Tool | Description |
| OS, CPU, RAM, disk, uptime |
| Top processes by CPU/mem |
| Disk usage breakdown |
| Interfaces, routing, connections |
| Ping a host from the server |
Packages
Tool | Description |
| Update package index |
| Upgrade all packages |
| Install packages |
| Remove packages |
Services
Tool | Description |
| Check service status |
| Start/stop/restart/enable/disable |
| List all/running/failed services |
Logs
Tool | Description |
| journalctl for service or system |
| Last N lines of any log file |
Files
Tool | Description |
| Read a remote file |
| Write a remote file |
| List directory contents |
Security
Tool | Description |
| Full security audit |
| Security-only apt updates |
| Apply SSH hardening |
| UFW firewall status |
| Add/delete UFW rules |
| Enable/disable UFW |
| Fail2ban jail status |
| Unban an IP |
Users
Tool | Description |
| List system users |
| Create a user |
| Delete a user |
| Add SSH public key |
| List cron jobs |
Available Tools
35 toolsadd_authorized_keyC
Add an SSH public key to a user's authorized_keys.
Inputs: alias (required), publicKey (required), targetUser (required), sudo_password.
apt_installC
Install one or more packages.
Inputs: alias (required), packages (required), sudo_password.
apt_removeC
Remove one or more packages.
Inputs: alias (required), packages (required), purge, sudo_password.
apt_updateC
Run apt update and show available upgrades.
Inputs: alias (required), sudo_password.
apt_upgradeB
Upgrade all packages (apt upgrade). Use apt_update first.
Inputs: alias (required), autoRemove, sudo_password.
check_disk_usageB
Show disk usage for a specific directory or all mounts.
Inputs: alias (required), path.
check_updates_securityC
List security-only updates available via apt.
Inputs: alias (required), sudo_password.
cron_listC
List cron jobs for a user or all users.
Inputs: alias (required), user, sudo_password.
fail2ban_statusC
Show fail2ban jail status and banned IPs.
Inputs: alias (required), jail, sudo_password.
fail2ban_unbanC
Unban an IP address from a fail2ban jail.
Inputs: ip (required), jail (required), alias (required), sudo_password.
harden_sshA
Apply SSH hardening best practices via a drop-in file: disable root login, disable password auth, set MaxAuthTries. IMPORTANT: ensure you have key-based auth working before running this.
Inputs: alias (required), maxAuthTries, sudo_password, disableRootLogin, +1 more.
list_directoryC
List files in a remote directory.
Inputs: alias (required), long, path.
list_processesC
List top processes by CPU or memory usage.
Inputs: alias (required), count, sortBy.
list_servicesC
List all systemd services and their states.
Inputs: alias (required), filter.
network_infoC
Show network interfaces, routing table, and active connections.
Inputs: alias (required).
ping_from_serverC
Ping a host from the remote server.
Inputs: alias (required), target (required), count.
read_fileC
Read the contents of a remote file.
Inputs: path (required), alias (required).
security_auditB
Run a comprehensive security audit: open ports, users, SSH config, sudo rights, SUID files, failed logins.
Inputs: alias (required), sudo_password.
service_controlC
Start, stop, restart, reload, enable, or disable a systemd service.
Inputs: alias (required), action (required), service (required), sudo_password.
service_statusC
Check the status of a systemd service.
Inputs: alias (required), service (required).
ssh_connectB
Connect to an Ubuntu server via SSH. Stores the connection under an alias for subsequent commands.
Inputs: host (required), alias (required), username (required), port, +3 more.
ssh_disconnectC
Disconnect from a server.
Inputs: alias (required).
ssh_execB
Run any shell command on a connected server (as the SSH user).
Inputs: alias (required), command (required), timeout.
ssh_list_connectionsA
List all active SSH connections.
Inputs: no named parameters.
ssh_sudoC
Run a command with sudo on a connected server. Requires the user to have sudo rights.
Inputs: alias (required), command (required), sudo_password.
system_infoC
Get a comprehensive system overview: OS, CPU, RAM, disk, uptime, load.
Inputs: alias (required).
tail_log_fileC
Read the last N lines of any log file.
Inputs: path (required), alias (required), lines.
ufw_enable_disableC
Enable or disable the UFW firewall.
Inputs: alias (required), enable (required), sudo_password.
ufw_ruleC
Add or delete a UFW firewall rule.
Inputs: rule (required), alias (required), action (required), sudo_password.
ufw_statusC
Show UFW firewall status and rules.
Inputs: alias (required), sudo_password.
user_createC
Create a new system user.
Inputs: alias (required), newUser (required), addToSudo, createHome, +1 more.
user_deleteC
Delete a system user.
Inputs: alias (required), targetUser (required), removeHome, sudo_password.
user_listB
List system users.
Inputs: alias (required), humanOnly.
view_logsA
View systemd journal logs for a service or the whole system.
Inputs: alias (required), lines, since, service.
write_fileC
Write content to a remote file (overwrites). Use with caution.
Inputs: path (required), alias (required), content (required), sudo_password.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 35 tools
Each tool has a clear and distinct purpose. For example, apt_install and apt_remove are separate, ssh_exec and ssh_sudo are differentiated by privilege, and tail_log_file vs view_logs target different log sources. No two tools overlap significantly.
All tool names use snake_case and follow a consistent verb_noun or domain_action pattern (e.g., apt_install, list_directory, ufw_status). Even tools like fail2ban_status and harden_ssh fit this pattern. There is no mixing of conventions.
With 35 tools, the server covers a broad range of Ubuntu administration tasks. While slightly on the high side, each tool serves a specific function, and the count is reasonable for the comprehensive scope intended. A few tools like ssh_exec and ssh_sudo could be combined, but they are distinct enough to justify separation.
The tool set provides complete coverage for common server administration tasks: connection management, package management, file operations, user management, service control, firewall configuration, security hardening, and monitoring. There are no obvious gaps that would prevent an agent from performing typical administrative workflows.
Maintenance
Related MCP Connectors
Let AI operate servers without SSH. Choose actions, approve risky changes, and audit every step.
SSH client, server management and one remote MCP URL for your machines, with human approvals.
Operate Linux, macOS and Windows from your LLM. Every action runs through an auditable allowlist.
Manage servers through SSH.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceEnables managing Ubuntu/Linux servers through natural language by establishing SSH connections and executing remote commands. Supports real-time command execution and output through Claude Desktop or Cursor IDE.14-
- FlicenseNot gradedqualityDmaintenanceEnables AI assistants to interact with Ubuntu VMs via SSH, including executing commands, simulating keyboard/mouse input, capturing screenshots, and controlling GUI applications remotely.1-
- AlicenseNot gradedqualityBmaintenanceEnables AI agents to SSH into Linux servers, run commands, deploy code, and manage servers via natural language, also doubles as a CLI for manual use.3MIT
- AlicenseAqualityBmaintenanceEnables natural language control of SSH servers, allowing users to execute commands, manage files, view logs, deploy applications, and more through AI-driven conversations.9121 PyPI4MIT