Skip to main content
Glama

ssh-mcp

A small local MCP server that lets Claude (desktop app) run commands on network devices and servers over SSH, using Paramiko.

Companion to switch-console-mcp (serial console).

Tools

Tool

What it does

ssh_list_targets

Lists configured targets (name, host, port, mode). Never returns credentials.

ssh_test

Checks that a target is reachable and the login works.

ssh_run

Runs a list of commands on a target and returns the output.

Modes (per target)

  • shell – interactive CLI for switches, routers, firewalls. All commands run in one session, so enable → configure terminal → interface commands work in order. --More-- style paging is answered automatically.

  • exec – one command per channel for Linux / Windows OpenSSH. Returns stdout, stderr and exit code for each command.

Related MCP server: MCP SSH Server

Requirements

  • Python 3.10+

  • Claude desktop app

pip install -r requirements.txt

Works with both mcp 1.x (FastMCP) and 2.x (MCPServer).

Setup

  1. Copy ssh_mcp.py to the machine that can reach your devices.

  2. Copy ssh_targets.example.json to ssh_targets.json and fill in your devices (password or key_file, optional key_passphrase, mode).

  3. Add the server to your Claude desktop config (Windows: %APPDATA%\Claude\claude_desktop_config.json) inside "mcpServers" — see claude_desktop_config.ssh.example.json.

  4. Fully restart the Claude desktop app.

Environment variables

Variable

Default

Meaning

SSH_TARGETS_FILE

ssh_targets.json next to the script

Targets file

SSH_STRICT_HOST_KEYS

false

true = reject hosts not in known_hosts

SSH_LOG

ssh_mcp_log.txt next to the script

Output log

Example

Ask Claude: "On lab-switch, show the interface status." Claude calls ssh_run with target="lab-switch" and commands=["show interfaces status"].

Security notes

  • Credentials live only in ssh_targets.json on your machine (it is in .gitignore). Claude sees target names and command output, never passwords.

  • With SSH_STRICT_HOST_KEYS=false unknown host keys are auto-accepted — fine for a lab, not for production. Set it to true once your hosts are in known_hosts.

  • ssh_run gives Claude full CLI access to every configured target. Only add devices you are comfortable having Claude change, and prefer least-privilege accounts.

License

MIT

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      Enables SSH remote access to servers through Claude, allowing users to execute commands, transfer files via SFTP, and manage multiple remote connections using natural language.
      12
      9
      MIT
    • A
      license
      Not graded
      quality
      Not graded
      maintenance
      Connects Claude to remote servers via SSH to execute commands, manage files, and browse directories. It allows users to add, edit, and switch between multiple server configurations through natural language conversations.
      -
    • -
      license
      Not graded
      quality
      Not graded
      maintenance
      Enables Claude Code to control remote servers via SSH for automated deployment, testing, and operations, including command execution and file transfer.
      4
      -