Winrdp Mcp

io.github.emog33k由 GitHub 账号 emog33k 发布v0.1.3更新于 Oct 24, 2026

Zero-config server to provision and administer any Windows RDP box over WinRM/SSH/SMB.

概览

AI 生成的概览

本地 MCP 服务器,通过 WinRM、SSH 或 SMB 开通并管理 Windows RDP 主机,为助手提供 147 个工具,涵盖命令行、文件、服务、RDP 与图形界面控制。

可以做什么
  • 管理主机清单:添加、列出、测试、诊断和开通主机,并按别名或标签向多台主机并行下发脚本
  • 执行命令与脚本:PowerShell、cmd、Python、Node 和批处理,支持提权、交互式桌面执行与运行时安装
  • 操作文件与系统状态:读写、搜索、上传下载、压缩、ACL,以及注册表、服务、进程、计划任务、用户、防火墙、事件日志和软件安装
  • 控制 RDP 与桌面:启用或关闭 RDP、查看会话、截图、发送按键与鼠标操作、通过 UI Automation 操作控件、录屏
  • 巡检与加固:一键健康报告、基线应用、权限检查、失败登录、开放端口、Defender 状态,以及 SSH 端口转发和等待类工具
适用场景
适合需要让助手搭建或运维你拥有或获授权管理的 Windows 机器时使用,尤其是尚未具备远程管理能力的新云主机或 VDS,也适合在同一个助手会话中管理多台 Windows 主机。
运行要求
操作机需 Python 3.10+(Windows、macOS 或 Linux),目标机须为 Windows。可通过 pipx、uvx 或 pip 安装。目标机需开放一种可用的管理通道(WinRM 5985/5986、SSH 22,或 SMB 445 加 DCOM 135),云厂商防火墙端口需自行放行。每台主机需管理员凭据;SMB 冷启动和机内 UI 代理需额外可选依赖。通过 WINRDP_VAULT_KEY、WINRDP_PROFILE 等环境变量配置。
安装前请注意
它本质上是一个远程代码执行面:大量工具会修改或破坏数据(重启、删除文件、删除服务、清空事件日志、修改用户与防火墙),请保持客户端确认开启。首次连接默认较宽松(忽略证书校验、自动信任 SSH 主机密钥),在不可信网络上可能遭中间人攻击。WINRDP_VAULT_KEY 用于加密保存的主机密码,未设置时会使用本机密钥文件。主机凭据会存入清单,启用 Basic 认证时密码近乎明文传输。仅用于你拥有或获授权管理的机器。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Winrdp Mcp,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

winrdp-mcp

A zero-config MCP server that provisions and fully administers any Windows RDP box — Windows 10/11 and Server 2016–2025 — for Claude and Claude Code.

[PyPI] [License: MIT] [Python 3.10+] [Platform: Windows] [MCP: FastMCP]

You give it a host and admin credentials. It makes the box remotely manageable by itself — turning on WinRM, opening the Windows firewall, and fixing local-admin token filtering — regardless of the box's starting state or Windows version. Claude then gets 147 tools: shell, files, registry, services, processes, scheduled tasks, users, firewall, event logs, software, networking, live RDP control, screenshots, GUI automation, real UAC elevation, one-call health/security reports, and on-demand tool staging — plus 6 guided workflows (prompts) and live host resources.

Nothing is pre-installed on the target. The controller reaches boxes over WinRM / SSH / SMB from wherever Claude Code runs, and manages one box or a whole fleet from a single server.

Why it's different

  • Zero-config provisioning. provision_host climbs a ladder — WinRM → SSH → SMB/WMI cold-start → paste-once bootstrap — and makes a fresh, locked-down box manageable with no manual WinRM setup.
  • Real UAC / elevation, not "please run as admin." Over WinRM a local admin gets a high-integrity full token and elevated ops run directly; a filtered token falls back to a one-shot SYSTEM Scheduled Task. as_user=True runs inside the interactive RDP desktop.
  • 147 tools across 15 modules, every one with readOnlyHint / destructiveHint safety annotations so MCP clients can gate destructive actions automatically. Narrow the surface to a focused set with a tool profile (WINRDP_PROFILE=admin|rdp|core).
  • Guided workflows & live context. 6 MCP prompts (provision_and_harden, diagnose_box, fix_connection, security_audit, setup_dev_box, open_service_locally) turn a whole operation into one click, and resources (winrdp://hosts, winrdp://host/{alias}/info) hand the model the inventory and a live box summary without spending a tool call.
  • On-demand code execution. run_python finds or installs Python, pip-installs deps, runs your code, and cleans up — same for Node, PowerShell, cmd, and batch. stage_tool pulls Sysinternals (or any URL/local file) onto the box mid-task.
  • Native GUI automation. Drive the interactive RDP desktop — keystrokes, mouse, and UI Automation (find/click/read controls by name) — plus live screenshots, with no on-box agent.
  • One-call ops. health_report (OS/CPU/RAM/disk/services/errors/updates/Defender in one read), apply_baseline (high-perf power plan, no sleep, long paths), whoami_priv, failed_logons, list_open_ports.
  • First-class RDP and an encrypted multi-host inventory (Fernet) with tags and parallel fan-out across the fleet.

Two modes, one package

ModeCommandRuns whereReaches the box via
Controller (default)winrdp-mcp servewherever Claude Code livesWinRM / SSH / SMB+DCOM
Agentwinrdp-mcp agenton the box itselflocal PowerShell

Both build the same server; python -m winrdp_mcp serve is equivalent to the console script.


Table of contents

  1. Quick start
  2. Tool groups
  3. Preparing a box
  4. Key capabilities
  5. Configuration
  6. Security
  7. Documentation
  8. Architecture
  9. Attribution & license

Quick start

1. Install

Python 3.10+ on the operator machine (Windows, macOS, or Linux). Targets are Windows.

bash
pipx install winrdp-mcp              # isolated, recommended — gives you the `winrdp-mcp` commanduvx winrdp-mcp serve                 # zero-install run via uvpip install winrdp-mcp               # plain pip

Optional extras and a local dev checkout:

bash
pip install "winrdp-mcp[bootstrap]"  # + impacket, for SMB/WMI cold-start of boxes with WinRM AND SSH offpip install "winrdp-mcp[agent-ui]"   # + on-box interactive-desktop UI agent (click/type/OCR)pip install -e ".[dev]"              # from a checkout of this repo (tests + ruff)

Claude Desktop, one click: grab winrdp-mcp.dxt from Releases and open it (Settings → Extensions → Install from file), or build it yourself with pwsh dxt/build.ps1.

2. Register with Claude Code

Drop a project .mcp.json at your repo root:

json
{  "mcpServers": {    "winrdp": {      "command": "winrdp-mcp",      "args": ["serve"],      "env": { "WINRDP_VAULT_KEY": "change-me", "WINRDP_PROFILE": "full" }    }  }}

Or register from the CLI:

bash
claude mcp add winrdp -- winrdp-mcp serve

Set WINRDP_VAULT_KEY to a strong passphrase — it encrypts stored credentials at rest (see Configuration). Set WINRDP_PROFILE to admin, rdp, or core to expose a focused tool set instead of all 147.

3. The 30-second flow

Ask Claude to run these tools (arguments shown inline). Every tool takes an optional host= alias; omit it to hit the active host.

text
add_host  alias="vps1"  host="203.0.113.10"  username="Administrator"  password="…"provision_host                        # climbs the ladder → box is now manageablesystem_info                           # OS, build, CPU, RAM, disks, IPsrun_powershell  script="Get-Service | Where Status -eq Running"run_python  code="import platform; print(platform.platform())"

If the box has only RDP open, provision_host returns a bootstrap_oneliner to paste once into an RDP session — or call rdp_bootstrap, which copies that command to your clipboard and opens mstsc so you just paste it once. See Preparing a box.


Tool groups

147 tools across fifteen modules. The full catalog — every signature, parameter, default, and safety class — is in docs/TOOLS.md.

GroupModule#What it covers
Hosts & Fleethosts.py9add_host, list_hosts, use_host, remove_host, test_host, diagnose_host, provision_host, run_on_hosts (parallel fan-out), reboot_and_wait
Provisioning / UAC / Toolingprovisioning.py11enable_winrm, enable_ssh, run_elevated, uac_get/uac_set, stage_tool, stage_script, list_staged_tools, cleanup_staged, deploy_ui_agent, rdp_bootstrap
Systemsystem.py8run_powershell, run_cmd, system_info, performance, event_log, screenshot, reboot, power_action
Scriptingscripting.py6run_python, run_python_file, pip_install, run_script (auto-interpreter), run_node, ensure_runtime
Filesfiles.py21list/read/write/search/upload/download/delete, make_dir, copy/move, file_hash, zip/unzip, ACL, download_file, tail_file, edit_file, sync_folder, transfer_between_hosts
Adminadmin.py25registry, services (service_control/service_create/service_delete), processes, scheduled tasks, users/groups, firewall, clipboard, event-log write/clear
RDPrdp.py12rdp_status/rdp_enable/rdp_disable/rdp_set_port, sessions, disconnect/logoff, rdp_connect_to_console (tscon), rdp_connection_file, rdp_open, install_rdp_wrapper, rdp_allow_multiple_sessions
Softwaresoftware.py4install_software (winget/choco/MSI/EXE-url), uninstall_software, list_installed_software, ensure_package_manager
Networknetwork.py8net_info, ping, port_check, net_connections, port_proxy_add/list/delete (tunneling), set_dns
Windowswindows.py11cim_query (any WQL), windows_features, windows_update, hotfixes, Defender (status/realtime/exclusion_add/scan), env_get/env_set, list_startup
GUIgui.py15windows/keyboard/mouse (send_keys, type_text, mouse_click, mouse_drag), UI Automation (ui_find/ui_invoke/ui_set_text), ocr_screen, find_and_click, wait_for_window, record_screen, gui_script
Waiterswaiters.py4wait_for_port, wait_for_service, wait_for_process, wait_for_file — block until a condition holds
Schedulingscheduling.py5schedule_command, run_at_startup, persist_as_service (NSSM auto-restart), unpersist_service, task_stop
Tunneltunnel.py3port_forward, port_forward_stop, port_forward_list — SSH local-forward a box's service to your machine
Opsops.py5health_report, apply_baseline, whoami_priv, failed_logons, list_open_ports — one-call health & security reads

Safety classification across all 147: 50 read-only, 24 destructive, 73 mutating. Read-only tools are safe to auto-run; destructive tools carry destructiveHint=True so clients gate them behind confirmation.

Prompts & resources

Beyond tools, the server exposes MCP prompts (user-invoked, one-click operations that steer the model through the right tool sequence) and resources (bounded read-only context the client can hand the model for free):

KindNameWhat it does
Promptprovision_and_harden(host, username, password, alias)Bring a new box under management and lock it down, step by step
Promptdiagnose_box(host)Gather health evidence and give a prioritized root-cause summary
Promptfix_connection(host)Figure out why a box won't connect (via diagnose_host) and get it working
Promptsecurity_audit(host)Read-only posture review → risk-ranked findings + remediations
Promptsetup_dev_box(host, runtimes)Install runtimes/tools and verify a working dev environment
Promptopen_service_locally(host, remote_port, note)Reach a box's loopback service from your machine over an SSH tunnel
Resourcewinrdp://hostsThe registered inventory (passwords redacted) + active host
Resourcewinrdp://host/{alias}/infoA compact live summary of one box (OS, build, CPU/RAM, disks, uptime)

Tool profiles

WINRDP_PROFILE selects which modules to expose, so the model's tool list stays focused:

ProfileToolsIncludes
full (default)147everything
dynamic44 at startlean core + list_toolsets/enable_toolset/disable_toolset; the model pulls in groups (rdp, gui, network, …) on demand
admin120systems administration (no GUI/RDP-desktop, no bare tunnel)
rdp106RDP + desktop/GUI focus
core89the essential subset (hosts, provisioning, system, scripting, files, admin, ops, waiters)

dynamic is the recommended profile for large/long sessions: it follows the 2026 MCP guidance on tool-list bloat. Only ~41 core tools load up front; the model calls enable_toolset("rdp") (etc.) to grow its tool list exactly when a task needs it, and disable_toolset(...) to shrink it again. Everything is still reachable — nothing is removed.


Preparing a box

The controller needs the target reachable on one management transport. In the best case (WinRM already up) provision_host does everything. The only two things you may have to do by hand on a brand-new cloud box are:

  1. Open one management port inbound in the provider firewall / security group (5985 for WinRM-HTTP, or 5986 for HTTPS) — this is outside Windows and winrdp-mcp cannot do it for you.
  2. Turn on a transport once — either paste the enable-WinRM one-liner into an RDP session, or let the SMB/WMI cold-start do it.

Print the paste-once one-liner any time:

bash
winrdp-mcp bootstrap        # prints the -EncodedCommand one-liner + the readable script

Full walkthrough — provider-firewall specifics (AWS/Azure/GCP/Hetzner/…), the cold-start rungs, RDP hardening, verification, and a "new box in 3 minutes" runbook — in docs/PREPARE-SERVER.md.


Key capabilities

Provisioning ladder

provision_host tries the best rung first and stops at the first that works (winrdp_mcp/provision.py):

  1. WinRM (5985/5986) reachable → use it, re-run the idempotent enable script to harden.
  2. SSH (22) reachable → use it, and turn WinRM on over the SSH channel for the richer path.
  3. SMB (445) + DCOM (135) only → stage the enable script over ADMIN$ and trigger it fire-and-forget over WMI ([bootstrap] extra), then switch to WinRM.
  4. Nothing but RDP → return a bootstrap_oneliner to paste once; then everything is remote.

The enable script opens the WinRM firewall rule, flips a Public network profile to Private, and sets LocalAccountTokenFilterPolicy=1 so a non-builtin local admin gets a full token over the network.

Elevated & interactive execution

text
run_powershell  script="Stop-Service W3SVC"  elevated=true     # full unfiltered tokenrun_powershell  script="Add-Type -AssemblyName System.Windows.Forms; …"  as_user=true   # interactive RDP desktop

Over WinRM a full-token admin runs elevated=True directly (fast path); a filtered token (SSH / non-elevated local) falls back to a one-shot SYSTEM Scheduled Task. as_user=True runs inside the visible desktop session — needed for GUI, clipboard, and screenshots.

Run any script in one call

text
run_python  code="import psutil; print(psutil.cpu_percent())"  pip="psutil"   # auto-installs Python + psutilrun_script  content=<any code>  interpreter="auto"                            # python | node | powershell | cmd | vbscriptrun_node    code="console.log(process.version)"ensure_runtime  runtime="python"                                             # or "node"

run_python with ensure_python=True (default) locates Python or installs it detached (winget → choco → python.org), resolving the concrete python.exe by glob so it works the same session. Long installs run as a Scheduled Task and poll a done-marker, so a mid-install WinRM disconnect doesn't fail them.

Parallel fan-out across the fleet

text
add_host  alias="web1"  host="10.20.0.11"  username="Administrator"  password="…"  tags="prod,web"run_on_hosts  script="(Get-CimInstance Win32_OperatingSystem).LastBootUpTime"  tag="prod"

run_on_hosts runs one script across many boxes concurrently (default max_parallel=8) and returns per-host {stdout, stderr, rc} keyed by alias. Select by aliases (CSV), by tag, or omit both to hit every box.

First-class RDP control

text
rdp_status                            # enabled? NLA? port? firewall?rdp_enable  nla=truerdp_sessions                          # id / user / state via qwinstascreenshot                            # live RDP desktop as a PNGrdp_open                              # launch mstsc pre-authenticated (operator = Windows)

rdp_connection_file generates a .rdp and stores the password via cmdkey on the operator machine — it is never returned to the model or written into the .rdp file. install_rdp_wrapper enables concurrent sessions on client SKUs.

On-demand tooling

text
stage_tool  source="psexec"                       # preset (Sysinternals), a URL, or a local filestage_tool  source="https://example.com/tool.exe"list_staged_toolscleanup_staged

Presets: psexec, handle, procdump, autoruns, tcpview, pslist, accesschk, sigcheck. Everything caches under C:\ProgramData\winrdp-mcp\tools; URLs and presets download on the box, local files are uploaded.


Configuration

All configuration is via environment variables (set them in the env block of your .mcp.json).

VariablePurpose
WINRDP_VAULT_KEYPassphrase (or raw Fernet key) that encrypts stored passwords. A passphrase is SHA-256-derived into a key. If unset, a machine-local vault.key (owner-only) is generated. Set it.
WINRDP_HOMEOverride the data directory holding inventory.json and vault.key (default %APPDATA%\winrdp-mcp).
WINRDP_DEBUG1/true/yes → verbose DEBUG logging to stderr (equivalent to --debug).
WINRDP_PROFILETool profile to expose: full (default, 147), admin (120), rdp (106), or core (89).
WINRDP_ENABLED_TOOLSCSV allowlist — if set, only these tools are registered.
WINRDP_DISABLED_TOOLSCSV blocklist — these tools are skipped (e.g. reboot,file_delete).
WINRDP_WINRM_OP_TIMEOUTWinRM per-operation timeout in seconds (default 180; read timeout is derived as +30).

Logging goes to stderr only — on the stdio transport, stdout is the MCP JSON-RPC channel. Known secrets are redacted from logs by exact match plus structural patterns.


Security

winrdp-mcp is admin tooling for boxes you own or are authorized to manage. It is a remote code-execution surface by design.

  • Permissive first contact. Defaults favor zero-setup provisioning: winrm_cert_validation="ignore" and ssh_host_key_policy="auto" (trust-on-first-use). On an untrusted network this allows an on-path attacker to MITM. For production, register with add_host(..., use_ssl=true, winrm_port=5986, winrm_cert_validation="validate", ssh_host_key_policy="reject") and restrict the firewall to your operator IP.
  • NTLM encrypts the payload over HTTP 5985. The default winrm_auth="ntlm" seals the message body even without TLS. The enable script deliberately does not turn on Basic/AllowUnencrypted/TrustedHosts=* (0.1.1+) — NTLM needs none of them, and they'd only weaken the box.
  • Secrets on the box are transient. user_create / service_create stage the new password to an admin-only file read on the box (kept off the process command line / Event 4688); cmdkey stores the RDP password on the operator machine. None are ever returned to the model, and logs redact known secrets.
  • Least privilege. Narrow the tool surface with WINRDP_ENABLED_TOOLS / WINRDP_DISABLED_TOOLS, and keep destructive-action confirmation on in your client.
  • Behind a proxy/VPN that breaks NTLM? A rotating proxy (e.g. Clash in TUN mode) breaks connection-oriented NTLM — the multi-leg handshake needs one persistent TCP connection it won't preserve, so WinRM auth fails even with the right password (you'll see InvalidCredentials despite a valid login). Route the box IPs DIRECT in the proxy, or enable stateless Basic auth: rdp_bootstrap(enable_basic=True) (or enable_winrm(basic=True)) turns on Basic + AllowUnencrypted on the box, then register with add_host(..., winrm_auth="basic"). Basic over HTTP sends the password near-cleartext, so scope WinRM to your operator IP at the provider firewall.
  • Server-side confirmation (optional). Set WINRDP_CONFIRM_DESTRUCTIVE=1 to make the server itself ask you to confirm (via MCP elicitation) before any destructive tool runs — a safety net for clients that don't gate on destructiveHint. Clients without elicitation support fall back to that client-side gating.

Full threat model, credential-vault internals, log redaction, argument-injection defenses, and a hardening checklist: docs/SECURITY.md.


Documentation

DocContents
docs/PREPARE-SERVER.mdTaking a fresh cloud/VDS/dedicated box from locked-down to managed: provider firewalls, cold-start options, RDP hardening, verification, sizing.
docs/PRODUCTION.mdRunning safely at scale: install options, vault, transport hardening, allow/block lists, observability, reliability, fleet management, background-service setup, checklist.
docs/SECURITY.mdThreat model, trust boundary, credential handling, transport/MITM, the enable-WinRM script, argument-injection defense, hardening checklist.
docs/TROUBLESHOOTING.mdSymptom → cause → fix for the failure modes you actually hit (provision failures, connection drops, slow elevation, Python/Node install, SSH banner, 5986 certs, MCP registration).
docs/ARCHITECTURE.mdInternal map for contributors: transports → PowerShell marshaling → provisioning → elevation → context → vault → tooling → server assembly.
docs/TOOLS.mdThe complete reference for all 147 tools — signatures, parameters, defaults, and safety class.

Architecture

winrdp-mcp is a FastMCP server: tools call a shared Context that resolves the target host from an encrypted vault, hands the PowerShell body to a cached Transport (WinRM / SSH / Local / SMB+WMI), and marshals delimited JSON back — nothing above the transport layer knows how the command reached the box. Full internals in docs/ARCHITECTURE.md.


Attribution & license

Built on and gratefully crediting two MIT-licensed projects — see NOTICE:

  • winremote-mcp — basis for the on-box tool surface, the risk-tier model, and the optional deploy_ui_agent interactive-desktop path.
  • windows-admin-mcp — basis for the WinRM-primary / SSH-fallback administration approach.

winrdp-mcp's own additions: the zero-config provisioning ladder, real UAC/elevation via one-shot Scheduled Tasks, on-demand tool staging, the encrypted multi-host inventory, and first-class RDP control.

MIT — see LICENSE and NOTICE.

来源:README.md,提交 fec1d38

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

1
  1. v0.1.3最新Sep 16, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分