Skip to main content
Glama

ssh-winrm-mcp

A small, pure-Python MCP server for administering Linux/Unix hosts over SSH and Windows hosts over WinRM/PowerShell Remoting.

It is designed to run directly from GitHub with uvx. No repository checkout and no config path are required. The server starts with an empty inventory and can create and maintain its own persistent local inventory through MCP tools.

Features

  • Stored connection profiles or completely ad-hoc connection settings.

  • SSH password, private key, SSH agent, host-key verification, commands, programs, scripts, SFTP files, and recursive directories.

  • WinRM/PSRP with NTLM, Basic, Negotiate, Kerberos, CredSSP, or certificate settings supported by pypsrp.

  • PowerShell and CMD execution, script/program execution, and file or directory transfer.

  • Named persistent SSH shells and WinRM PowerShell runspaces.

  • Long-running asynchronous jobs inside named sessions.

  • Persistent local inventory with initialization, validation, create, read, update, rename, delete, tags, and atomic writes.

  • Built-in command groups for system information, services, restart/shutdown, and local user management.

  • Persistent external command-group folder for specialized modules.

  • stdio, Streamable HTTP, and SSE transports.

Related MCP server: MCP SSH Manager

Run directly from GitHub

Pinned to a release (recommended):

uvx --from git+https://github.com/bigbatmanorg/ssh-winrm-mcp.git@v0.3.0 ssh-winrm-mcp

Releases and changes: releases page, CHANGELOG.md.

The default transport is stdio, suitable for a local MCP client.

Install in your agent

Install in VS Code Install in VS Code Insiders Install in Cursor

It works with any MCP client that can start a stdio command. It needs uv. uvx fetches the pinned release, so no clone or virtualenv is needed. Pick your agent below.

No configuration is needed to start. Hosts and credentials are managed with the inventory tools (see Inventory tools). Optional variables are listed under Optional environment variables.

claude mcp add ssh-winrm -s user -- uvx --from git+https://github.com/bigbatmanorg/ssh-winrm-mcp.git@v0.3.0 ssh-winrm-mcp

Settings → Developer → Edit Config (claude_desktop_config.json):

{
  "mcpServers": {
    "ssh-winrm": {
      "command": "uvx",
      "args": [
        "--from",
        "git+https://github.com/bigbatmanorg/ssh-winrm-mcp.git@v0.3.0",
        "ssh-winrm-mcp"
      ]
    }
  }
}

Use the button above, or add this to .vscode/mcp.json (workspace) or to the user mcp.json (command MCP: Open User Configuration):

{
  "servers": {
    "ssh-winrm": {
      "type": "stdio",
      "command": "uvx",
      "args": [
        "--from",
        "git+https://github.com/bigbatmanorg/ssh-winrm-mcp.git@v0.3.0",
        "ssh-winrm-mcp"
      ]
    }
  }
}

Use the button above, or add this to ~/.cursor/mcp.json (global) or .cursor/mcp.json (project):

{
  "mcpServers": {
    "ssh-winrm": {
      "command": "uvx",
      "args": [
        "--from",
        "git+https://github.com/bigbatmanorg/ssh-winrm-mcp.git@v0.3.0",
        "ssh-winrm-mcp"
      ]
    }
  }
}

Add this to ~/.codeium/windsurf/mcp_config.json:

{
  "mcpServers": {
    "ssh-winrm": {
      "command": "uvx",
      "args": [
        "--from",
        "git+https://github.com/bigbatmanorg/ssh-winrm-mcp.git@v0.3.0",
        "ssh-winrm-mcp"
      ]
    }
  }
}
codex mcp add ssh-winrm -- uvx --from git+https://github.com/bigbatmanorg/ssh-winrm-mcp.git@v0.3.0 ssh-winrm-mcp

Or add this to ~/.codex/config.toml:

[mcp_servers.ssh-winrm]
command = "uvx"
args = ["--from", "git+https://github.com/bigbatmanorg/ssh-winrm-mcp.git@v0.3.0", "ssh-winrm-mcp"]

Add this to ~/.gemini/settings.json (or to .gemini/settings.json in a project):

{
  "mcpServers": {
    "ssh-winrm": {
      "command": "uvx",
      "args": [
        "--from",
        "git+https://github.com/bigbatmanorg/ssh-winrm-mcp.git@v0.3.0",
        "ssh-winrm-mcp"
      ]
    }
  }
}

Deep Agents CLI: add this to ~/.deepagents/.mcp.json (all projects) or to .mcp.json in a project.

{
  "mcpServers": {
    "ssh-winrm": {
      "command": "uvx",
      "args": [
        "--from",
        "git+https://github.com/bigbatmanorg/ssh-winrm-mcp.git@v0.3.0",
        "ssh-winrm-mcp"
      ]
    }
  }
}

Python library (pip install deepagents langchain-mcp-adapters):

import asyncio
import os

from deepagents import create_deep_agent
from langchain_mcp_adapters.client import MultiServerMCPClient

client = MultiServerMCPClient({
    "ssh-winrm": {
        "transport": "stdio",
        "command": "uvx",
        "args": ["--from", "git+https://github.com/bigbatmanorg/ssh-winrm-mcp.git@v0.3.0", "ssh-winrm-mcp"],
    }
})


async def main():
    tools = await client.get_tools()
    agent = create_deep_agent(model="anthropic:claude-sonnet-5-5", tools=tools)
    result = await agent.ainvoke({"messages": [{"role": "user", "content": "What can you do?"}]})
    print(result["messages"][-1].content)


asyncio.run(main())

Save this as agent.yaml, then run docker agent run agent.yaml:

agents:
  root:
    model: anthropic/claude-sonnet-5-5
    description: Assistant with the ssh-winrm MCP tools
    instruction: Use the ssh-winrm tools to answer the user's requests.
    toolsets:
      - type: mcp
        command: uvx
        args:
          - "--from"
          - "git+https://github.com/bigbatmanorg/ssh-winrm-mcp.git@v0.3.0"
          - "ssh-winrm-mcp"

Add this to ~/.hermes/config.yaml, then run /reload-mcp in a chat:

mcp_servers:
  ssh-winrm:
    command: uvx
    args: ["--from", "git+https://github.com/bigbatmanorg/ssh-winrm-mcp.git@v0.3.0", "ssh-winrm-mcp"]

MCP Servers → Configure (cline_mcp_settings.json / mcp_settings.json):

{
  "mcpServers": {
    "ssh-winrm": {
      "command": "uvx",
      "args": [
        "--from",
        "git+https://github.com/bigbatmanorg/ssh-winrm-mcp.git@v0.3.0",
        "ssh-winrm-mcp"
      ]
    }
  }
}

Add this to settings.json:

{
  "context_servers": {
    "ssh-winrm": {
      "command": "uvx",
      "args": [
        "--from",
        "git+https://github.com/bigbatmanorg/ssh-winrm-mcp.git@v0.3.0",
        "ssh-winrm-mcp"
      ]
    }
  }
}

Add this to opencode.json (project) or ~/.config/opencode/opencode.json:

{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "ssh-winrm": {
      "type": "local",
      "command": [
        "uvx",
        "--from",
        "git+https://github.com/bigbatmanorg/ssh-winrm-mcp.git@v0.3.0",
        "ssh-winrm-mcp"
      ],
      "enabled": true
    }
  }
}

Run goose configure → Add Extension → Command-line Extension, with the command uvx --from git+https://github.com/bigbatmanorg/ssh-winrm-mcp.git@v0.3.0 ssh-winrm-mcp. Or add this to ~/.config/goose/config.yaml:

extensions:
  ssh-winrm:
    type: stdio
    enabled: true
    cmd: uvx
    args: ["--from", "git+https://github.com/bigbatmanorg/ssh-winrm-mcp.git@v0.3.0", "ssh-winrm-mcp"]

Most clients take the standard mcpServers JSON shown for Claude Desktop. Some use servers instead.

To install once instead of fetching on each start:

uv tool install git+https://github.com/bigbatmanorg/ssh-winrm-mcp.git@v0.3.0

then use "command": "ssh-winrm-mcp", "args": [].

From a checkout: "command": "uv", "args": ["run", "--directory", "/abs/path/ssh-winrm-mcp", "ssh-winrm-mcp"].

Local development

git clone https://github.com/bigbatmanorg/ssh-winrm-mcp.git
cd ssh-winrm-mcp
uv sync --extra dev
uv run pytest
uv run ssh-winrm-mcp

Automatic local storage

When SSH_WINRM_MCP_CONFIG is not set, the inventory is stored here:

  • Linux/macOS: ${XDG_CONFIG_HOME:-~/.config}/ssh-winrm-mcp/inventory.json

  • Windows: %APPDATA%\ssh-winrm-mcp\inventory.json

The file does not need to exist before startup. The first profile create operation also creates it automatically. Writes are atomic and the file is restricted to the current user where the operating system supports Unix permissions.

A custom path remains possible:

SSH_WINRM_MCP_CONFIG=/srv/private/remote-inventory.json \
uvx --from git+https://github.com/bigbatmanorg/ssh-winrm-mcp.git@v0.3.0 ssh-winrm-mcp

Inventory tools

  • remote_inventory_status

  • remote_inventory_init

  • remote_inventory_validate

  • remote_profile_list

  • remote_profile_get

  • remote_profile_create

  • remote_profile_update

  • remote_profile_rename

  • remote_profile_delete

An agent can start with no file and create a profile itself:

remote_inventory_init()

remote_profile_create(
  name="linux01",
  settings={
    "protocol": "ssh",
    "host": "linux01.home",
    "username": "admin",
    "private_key_path": "~/.ssh/id_ed25519",
    "verify_host_key": true,
    "tags": ["linux", "lab"]
  }
)

Update only selected fields:

remote_profile_update(
  name="linux01",
  changes={"host": "192.168.1.20", "tags": ["linux", "production"]}
)

Remove optional fields:

remote_profile_update(
  name="linux01",
  changes={},
  remove_fields=["password", "password_env"]
)

Profiles may store inline credentials, but that means plaintext secrets are present in the protected JSON file. Prefer password_env, private_key_passphrase_env, and certificate_key_password_env where practical.

See inventory.example.json for SSH and WinRM examples.

Ad-hoc use

Every one-shot operation and remote_session_open accepts a full connection object without saving it:

{
  "protocol": "ssh",
  "host": "192.168.1.50",
  "username": "root",
  "password": "temporary-password",
  "verify_host_key": false
}

A connection object can also override selected fields from a saved profile.

WinRM HTTPS and self-signed certificates

ssl selects the transport; it does not control certificate verification. For the standard HTTPS listener on port 5986, use both "ssl": true and "cert_validation": false when the server has a self-signed certificate:

{
  "protocol": "winrm",
  "host": "192.168.1.50",
  "port": 5986,
  "username": "Administrator",
  "password_env": "WINRM_PASSWORD",
  "auth": "ntlm",
  "ssl": true,
  "cert_validation": false
}

For clients that need a process-wide default, set WINRM_DISABLE_SSL_CERT_CHECK=1 in the MCP server environment. An explicit cert_validation value in a profile or ad-hoc connection takes precedence. Disabling validation should only be used for trusted hosts; installing a certificate issued by a trusted CA is preferable.

Security model

The server runs commands with the remote account's full rights, and its arguments come from an AI agent that can be steered by untrusted content (web pages, files, command output). The operator limits what the agent can reach:

Setting

Default

Effect

SSH_WINRM_MCP_ALLOWED_HOSTS

any

Comma-separated glob patterns (*.lab.example,10.0.110.*); connections to other hosts are refused, including saved profiles.

SSH_WINRM_MCP_ALLOW_ADHOC

true

false allows only saved profiles; per-call connection may then only change timeouts.

SSH_WINRM_MCP_SECRET_ENV_PATTERNS

*PASSWORD*,*PASSWD*,*_PASS,*PASSPHRASE*

password_env and the other *_env fields may only read variables matching these globs, so an agent cannot send e.g. AWS_SECRET_ACCESS_KEY to a host as a password.

SSH_WINRM_MCP_ALLOW_INSECURE_BASIC

false

WinRM basic auth over plain HTTP (cleartext password) is refused unless enabled.

SSH_WINRM_MCP_LOCAL_ROOT

${XDG_DATA_HOME:-~/.local/share}/ssh-winrm-mcp/files

Uploads, downloads and local scripts are confined here; relative paths are relative to it. Set / to allow any path. The server's config directory (inventory and command plug-ins) is always refused, so a download can never plant a plug-in.

remote_policy shows the active policy. Every tool carries MCP annotations (readOnlyHint, destructiveHint, …) so clients can ask before running remote commands. Do not expose HTTP mode to untrusted networks.

Main remote tools

One-shot operations

  • remote_test

  • remote_execute

  • remote_run_program

  • remote_run_script

  • remote_upload

  • remote_download

Example:

remote_execute(profile="linux01", command="uname -a")
remote_run_script(
  profile="win01",
  language="powershell",
  script="Get-Service | Select-Object -First 10"
)

Persistent sessions

  • remote_session_open

  • remote_session_list

  • remote_session_execute

  • remote_session_close

  • remote_session_close_all

  • remote_session_cleanup_idle

SSH uses a real reusable remote shell, so cd, shell variables, and exported environment state persist:

remote_session_open(name="linux-maint", profile="linux01", shell="bash")
remote_session_execute(name="linux-maint", command="cd /opt/myapp")
remote_session_execute(name="linux-maint", command="export RELEASE=2026.07")
remote_session_execute(name="linux-maint", command="pwd; echo $RELEASE")

WinRM uses one reusable PSRP PowerShell runspace. Use global variables when state must survive separate PowerShell pipelines:

remote_session_open(name="win-maint", profile="win01", shell="powershell")
remote_session_execute(name="win-maint", command="$global:Target='C:\\Apps'")
remote_session_execute(name="win-maint", command="Get-ChildItem $global:Target")

Sessions are memory-only. Restarting the MCP process closes them. Commands in one session are serialized; create several named sessions for parallel work.

SSH sessions need a POSIX shell (sh, bash, zsh) and are non-interactive: each command's stdin is /dev/null, so commands that read input (cat, read, prompts) get end-of-file instead of hanging. exit ends the session. For Windows hosts use a WinRM session; one-shot remote_execute over SSH works with Windows OpenSSH.

Long-running jobs

  • remote_job_start

  • remote_job_list

  • remote_job_status

  • remote_job_result

  • remote_job_cancel

remote_job_start(
  session_name="linux-maint",
  command="./upgrade.sh",
  timeout=86400
)

The call returns a job ID immediately. Poll with remote_job_status, then retrieve the result with remote_job_result. Current job output is returned when the command finishes; it is not incrementally streamed while running.

Command groups

Built-in groups currently include (Unix actions use sudo -n, so they fail fast instead of waiting for a password prompt when passwordless sudo is not configured):

  • system: information, disk usage, processes, services, reboot, shutdown.

  • users: list, create, delete, enable, disable, and group membership.

Use:

  • remote_command_groups

  • remote_command_group_describe

  • remote_command_group_run

The persistent plug-in directory defaults beside the inventory:

~/.config/ssh-winrm-mcp/commands/

On Windows it is under %APPDATA%\ssh-winrm-mcp\commands\.

Create it through MCP:

remote_command_groups(create_directory=true)

Place Python modules there and call remote_command_groups(reload=true). The examples/custom_maintenance.py file is a starting point. A module exports GROUP_NAME and an ACTIONS dictionary containing CommandAction objects.

A custom location may be selected with SSH_WINRM_MCP_COMMANDS_DIR.

HTTP mode

SSH_WINRM_MCP_TRANSPORT=streamable-http \
SSH_WINRM_MCP_HOST=127.0.0.1 \
SSH_WINRM_MCP_PORT=8765 \
uvx --from git+https://github.com/bigbatmanorg/ssh-winrm-mcp.git@v0.3.0 ssh-winrm-mcp

Endpoint:

http://127.0.0.1:8765/mcp

Do not expose this server to an untrusted network. It intentionally provides remote command execution and credential-handling capabilities.

Optional environment variables

  • SSH_WINRM_MCP_CONFIG

  • SSH_WINRM_MCP_TRANSPORT

  • SSH_WINRM_MCP_HOST

  • SSH_WINRM_MCP_PORT

  • SSH_WINRM_MCP_LOCAL_ROOT

  • SSH_WINRM_MCP_ALLOWED_HOSTS, SSH_WINRM_MCP_ALLOW_ADHOC, SSH_WINRM_MCP_SECRET_ENV_PATTERNS, SSH_WINRM_MCP_ALLOW_INSECURE_BASIC (see Security model)

  • SSH_WINRM_MCP_MAX_OUTPUT_CHARS

  • SSH_WINRM_MCP_COMMANDS_DIR

Testing

uv sync --extra dev
uv run pytest                      # offline unit tests
REMOTE_LIVE=1 uv run pytest tests/live -v   # live tests over MCP stdio

Live tests read SSH_TEST_* (a disposable sshd container works well; the tests create and delete a local user there) and optionally WINRM_TEST_* for a Windows host; see tests/live/test_live_remote.py.

Project layout

ssh-winrm-mcp/
├── pyproject.toml
├── inventory.example.json
├── src/ssh_winrm_mcp/
│   ├── server.py
│   ├── operations.py
│   ├── sessions.py
│   ├── profiles.py
│   ├── backends/
│   └── commands/
├── examples/
└── tests/

Available Tools

30 tools
remote_command_group_describeC
Read-only

Describe the actions and parameters available in a specialized command group.

Inputs: group (required). Returns: object

remote_command_group_runB
Destructive

Build and run a specialized action, such as user management, services, reboot, or system inventory.

Use either session_name or profile/connection. dry_run returns the generated command without executing it.

Inputs: group (required), action (required), dry_run, profile, +5 more. Returns: object

remote_command_groupsA
Idempotent

List command groups and the persistent local plug-in directory.

Set create_directory=true once to create the folder. Set reload=true after adding or editing a module.

Inputs: reload, create_directory. Returns: object

remote_downloadC
Destructive

Copy a remote file or directory to the MCP server. Set recursive=true for directories.

Inputs: local_path (required), remote_path (required), profile, recursive, +1 more. Returns: object

remote_executeA
Destructive

Execute one command using a short-lived SSH or WinRM connection.

connection may override a profile or fully describe an ad-hoc target, for example: {"protocol":"ssh","host":"server","username":"root","password":"..."}. For self-signed WinRM HTTPS use ssl=true and cert_validation=false. WinRM shell may be powershell or cmd. SSH executes through the remote user's shell.

Inputs: command (required), cwd, env, shell, +4 more. Returns: object

remote_inventory_initC
Idempotent

Create an empty local inventory. A config path is not required to start the server.

Inputs: overwrite. Returns: object

remote_inventory_statusA
Read-only

Show the automatic local inventory path and whether it already exists.

Inputs: no named parameters. Returns: object

remote_inventory_validateA
Read-only

Validate the inventory JSON and every stored SSH/WinRM profile.

Inputs: no named parameters. Returns: object

remote_job_cancelB
Destructive

Interrupt and cancel a running job. SSH cancellation closes that named shell session.

Inputs: job_id (required). Returns: object

remote_job_listB
Read-only

List asynchronous jobs, optionally restricted to one session.

Inputs: session_name. Returns: object

remote_job_resultB
Read-only

Get a job result. Set wait=true to wait, optionally bounded by timeout seconds.

Inputs: job_id (required), wait, timeout. Returns: object

remote_job_startB
Destructive

Start a long-running command in a named session and return immediately with a job ID.

Inputs: command (required), session_name (required), timeout. Returns: object

remote_job_statusB
Read-only

Get the current state of a long-running job.

Inputs: job_id (required). Returns: object

remote_policyA
Read-only

Show the server version and the operator's security policy: allowed hosts, whether ad-hoc connections are allowed, which environment variables *_env fields may read, and the local directory that file and script tools are confined to.

Inputs: no named parameters. Returns: object

remote_profile_createC
Idempotent

Create a saved profile. Prefer password_env and passphrase environment references.

Inputs: name (required), settings (required). Returns: object

remote_profile_deleteC
DestructiveIdempotent

Delete a saved connection profile.

Inputs: name (required). Returns: object

remote_profile_getA
Read-only

Read one saved connection profile with secrets redacted.

Inputs: name (required). Returns: object

remote_profile_listA
Read-only

List saved profiles with secrets redacted; optionally filter by protocol or tag.

Inputs: tag, protocol. Returns: object

remote_profile_renameC
Idempotent

Rename a saved profile.

Inputs: name (required), new_name (required), overwrite. Returns: object

remote_profile_updateB
Idempotent

Update a profile by merging changes, or fully replace it with replace=true.

Use remove_fields to delete optional settings. Required fields must remain valid.

Inputs: name (required), changes (required), replace, remove_fields. Returns: object

remote_run_programC
Destructive

Run an executable with a safely quoted argument list on a saved or ad-hoc target.

Inputs: program (required), cwd, env, args, +4 more. Returns: object

remote_run_scriptB
Destructive

Upload and run an inline or local script. Supports bash/sh, PowerShell, batch, Python, and executables.

Inputs: args, script, cleanup, profile, +7 more. Returns: object

remote_session_cleanup_idleB
Destructive

Close named sessions which have been idle for at least the requested number of seconds.

Inputs: max_idle_seconds. Returns: object

remote_session_closeA
Destructive

Close one named session and its remote shell/runspace.

Inputs: name (required). Returns: object

remote_session_close_allB
Destructive

Close every active session.

Inputs: no named parameters. Returns: object

remote_session_executeB
Destructive

Run a command inside a named persistent session and wait for completion.

Inputs: name (required), command (required), timeout, output_limit. Returns: object

remote_session_listA
Read-only

List active named sessions and their health.

Inputs: no named parameters. Returns: object

remote_session_openA
Destructive

Open a named persistent SSH shell or WinRM PowerShell runspace.

Sessions remain alive until closed or until the MCP server process exits. SSH shell state such as cwd and exported variables persists. WinRM uses one reusable PSRP runspace.

Inputs: name (required), shell, profile, connection. Returns: object

remote_testA
Read-only

Test a saved or ad-hoc connection by executing a harmless marker command.

For WinRM HTTPS on port 5986, keep ssl=true. If the server uses a self-signed certificate, also set cert_validation=false; ssl=false selects plain HTTP instead of disabling certificate verification.

Inputs: profile, connection. Returns: object

remote_uploadC
Destructive

Copy a local file or directory to a remote host. Set recursive=true for directories.

Inputs: local_path (required), remote_path (required), profile, recursive, +1 more. Returns: object

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    B3/5.0

    Scored across 30 tools

    Disambiguation4/5

    Most tools are cleanly separated by resource (profiles, sessions, jobs, inventory, files) and action. A few boundaries are fuzzy: remote_execute vs remote_session_execute vs remote_run_program vs remote_run_script all execute things, and the distinction relies on descriptions. But the one-shot vs persistent-session vs job split is coherent enough to guide selection.

    Naming Consistency3/5

    All tools share the snake_case remote_ prefix and are readable, but verb ordering is mixed: resource-first (remote_job_start, remote_profile_create, remote_session_open) alongside action-first (remote_execute, remote_run_program, remote_run_script, remote_test). The inconsistency is tolerable but not a clean pattern.

    Tool Count2/5

    Thirty tools is heavy for the scope and pushes well past the typical 3-15 sweet spot. Job, session, profile, and inventory lifecycles each add several tools, inflating the surface more than the core purpose requires.

    Completeness4/5

    Coverage is strong: full profile CRUD (list/get/create/update/delete/rename), session lifecycle, job lifecycle, file transfer, scripts, and inventory validation are all present. Minor gaps like bulk job cleanup or richer inventory editing exist but are workaroundable.

    Maintenance

    ActivityNo data
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      MCP server for remote Linux/Unix server management via SSH, enabling command execution, system monitoring, file operations, and diagnostics through natural language.
      34
      1
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      MCP server for infrastructure discovery and remote management, enabling SSH command execution, file transfer, log tailing, and machine/service inventory with a companion web dashboard.
      2
      MIT