ssh-winrm-mcp
MCP server for administering Linux/Unix hosts via SSH and Windows hosts via WinRM/PowerShell Remoting, supporting persistent inventory, sessions, jobs, and command groups.
README
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.
Run directly from GitHub
After publishing the repository as YOUR_GITHUB_USER/ssh-winrm-mcp:
uvx --from git+https://github.com/YOUR_GITHUB_USER/ssh-winrm-mcp.git ssh-winrm-mcp
For a fixed release or commit:
uvx --from git+https://github.com/YOUR_GITHUB_USER/ssh-winrm-mcp.git@v0.2.0 ssh-winrm-mcp
The default transport is stdio, suitable for a local MCP client.
VS Code MCP configuration
{
"servers": {
"ssh-winrm": {
"type": "stdio",
"command": "uvx",
"args": [
"--from",
"git+https://github.com/YOUR_GITHUB_USER/ssh-winrm-mcp.git",
"ssh-winrm-mcp"
]
}
}
}
No inventory environment variable is required.
Local development
git clone https://github.com/YOUR_GITHUB_USER/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/YOUR_GITHUB_USER/ssh-winrm-mcp.git ssh-winrm-mcp
Inventory tools
remote_inventory_statusremote_inventory_initremote_inventory_validateremote_profile_listremote_profile_getremote_profile_createremote_profile_updateremote_profile_renameremote_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.
Main remote tools
One-shot operations
remote_testremote_executeremote_run_programremote_run_scriptremote_uploadremote_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_openremote_session_listremote_session_executeremote_session_closeremote_session_close_allremote_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.
Long-running jobs
remote_job_startremote_job_listremote_job_statusremote_job_resultremote_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:
system: information, disk usage, processes, services, reboot, shutdown.users: list, create, delete, enable, disable, and group membership.
Use:
remote_command_groupsremote_command_group_describeremote_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/YOUR_GITHUB_USER/ssh-winrm-mcp.git 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_CONFIGSSH_WINRM_MCP_TRANSPORTSSH_WINRM_MCP_HOSTSSH_WINRM_MCP_PORTSSH_WINRM_MCP_LOCAL_ROOTSSH_WINRM_MCP_MAX_OUTPUT_CHARSSSH_WINRM_MCP_COMMANDS_DIR
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/
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。