windows-host-mcp
Click on "Install 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., "@windows-host-mcprun 'ipconfig' on Windows host"
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.
windows-host-mcp
An MCP server that runs on Linux and gives an MCP agent (e.g. Claude Code) SSH access to a Windows machine — to build, test, run commands, transfer files, and drive long-running or interactive jobs.
┌──────────────┐ MCP (stdio) ┌──────────────────┐ SSH / SFTP ┌────────────────┐
│ Claude Code │ ◄────────────► │ windows-host-mcp │ ◄────────────► │ Windows machine │
│ (agent) │ │ (this server) │ │ (OpenSSH Server)│
└──────────────┘ └──────────────────┘ └────────────────┘Multiple hosts / devices
The server can manage several Windows hosts at once — e.g. a CUDA box and a ROCm box. Each host is defined in a JSON config with capability labels, and each keeps its own SSH connection, session (cwd/env), and jobs. The agent picks a device with list_hosts + use_host, or targets any host per call via the host parameter.
list_hosts— see every host, its labels (cuda,rocm, …), which is active, and whether it's connected.use_host— switch the active device bynameor by alabel(e.g.{ "label": "cuda" }).Every command/file/job tool takes an optional
hostto override the active one for a single call.
Point the server at a JSON file with WINDOWS_HOSTS_CONFIG (see hosts.example.json). A single host can still be configured with the flat WINDOWS_SSH_* env vars instead.
Tools
Tool | Purpose |
| List devices and switch the active host (by name or capability label). |
| Verify SSH and report hostname + user. Run this first. |
| Run a one-shot command, wait, return stdout/stderr/exit code. |
| Start a long-running / interactive command; returns a |
| Poll new output (pass |
| Write to a running job's stdin (answer prompts, drive a REPL). |
| Stop a running job. |
| List jobs and their status. |
| SFTP a file to / from Windows. |
| List a Windows directory. |
| Recursively copy a directory up (local→remote) or down. |
| Transfer many files (by explicit list, regex, or whole folder) in one zip round-trip, with a write policy for conflicts. |
| Read / set default cwd, env, and shell that persist across calls. |
Commands run in PowerShell by default; each command tool accepts a shell of powershell | cmd | bash (WSL / Git-Bash).
Prerequisites
Linux (this machine): Node.js ≥ 18.
Windows (target): OpenSSH Server installed and running, with your public key authorized.
Install
Not published to the npm registry — clone and link it instead:
git clone https://github.com/thnak/windows-host-mcp.git
cd windows-host-mcp
git checkout v0.2.0 # pin to a release tag; omit to track main instead
npm install
npm linknpm link puts a windows-host-mcp binary on your PATH (a symlink back to this clone — dist/ is committed to
the repo, so no separate build step is required). If npm link fails with an EACCES permission error, npm's
global prefix isn't user-writable; the standard fix is to point it at a directory you own, e.g.:
mkdir -p ~/.npm-global
npm config set prefix ~/.npm-global
# add ~/.npm-global/bin to your PATH (e.g. in ~/.bashrc), then re-run npm linkwindows-host-mcp update (below) keeps this same checkout current, so there's no separate update mechanism to
learn.
Note:
npm install -g git+https://...(installing directly from a git URL without cloning) looks like it should work too, but hit real, reproducible corruption in testing on some npm versions — it silently dropped files fromdist/and from a dependency'sdist/during npm's git-dependency packing step. Until that's sorted out,git clone+npm linkis the only install path this repo tests and recommends.
CLI commands
Command | Purpose |
| Run the MCP server over stdio (default — this is what an MCP client invokes). |
| Interactive wizard: add/edit/remove hosts in |
| Check GitHub Releases for a newer tag, |
| Print the installed version. |
| Show usage. |
windows-host-mcp config is the fastest way to get set up: it prompts for each host's connection details, writes
them to hosts.json (default ~/.config/windows-host-mcp/hosts.json, or wherever WINDOWS_HOSTS_CONFIG already
points), and then — if the claude CLI is on PATH — offers to run claude mcp add/claude mcp remove for you so
Claude Code picks up the change immediately. Re-run it any time to add another host or edit an existing one; it
loads whatever's already there. See "Configure the MCP client" below for the manual/scripted equivalent.
Windows setup (one-time)
1. Install & start OpenSSH Server
In an elevated PowerShell on the Windows machine:
Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0
Set-Service -Name sshd -StartupType Automatic
Start-Service sshd
# Firewall rule (usually created automatically):
New-NetFirewallRule -Name sshd -DisplayName 'OpenSSH Server (sshd)' `
-Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 222. Create a key pair (on Linux)
ssh-keygen -t ed25519 -f ~/.ssh/windows_host_ed25519 -C "windows-host-mcp"This produces ~/.ssh/windows_host_ed25519 (private — point the server at this) and ...pub (public — install on Windows).
3. Authorize the public key on Windows
Copy the contents of the .pub file into the right file on Windows:
Normal (non-admin) user →
C:\Users\<you>\.ssh\authorized_keysAdministrator account →
C:\ProgramData\ssh\administrators_authorized_keys, and fix its ACLs:
# For the administrators file only:
icacls "C:\ProgramData\ssh\administrators_authorized_keys" /inheritance:r `
/grant "Administrators:F" /grant "SYSTEM:F"Test from Linux:
ssh -i ~/.ssh/windows_host_ed25519 <user>@<windows-host> hostname4. (Optional) Make PowerShell the login shell
The server wraps every command in its chosen shell explicitly, so this is optional. If you also want interactive ssh sessions to land in PowerShell:
New-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" -Name DefaultShell `
-Value "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" `
-PropertyType String -ForceConfigure the MCP client
windows-host-mcp config (above) does this for you interactively. This section is the manual/scripted
equivalent — useful for automation or if you'd rather edit files by hand. There are two ways to configure hosts:
the JSON file for multiple hosts, or the flat env vars for a single host. Examples below assume windows-host-mcp
is on PATH (via npm link, see Install); without that, replace -- windows-host-mcp with
-- node /absolute/path/to/windows-host-mcp/dist/index.js.
Multiple hosts (recommended)
Write a hosts.json (see hosts.example.json) and point WINDOWS_HOSTS_CONFIG at it:
claude mcp add windows-host-mcp -s user \
--env WINDOWS_HOSTS_CONFIG=/absolute/path/to/hosts.json \
-- windows-host-mcpEach host entry accepts: name (required), host (required), username (required), keyPath (required, path to the private key on Linux), and optional port, keyPassphrase, shell (powershell|cmd|bash), cwd, labels (capability tags), description, readyTimeoutMs. The top-level defaultHost chooses which host is active on startup (defaults to the first).
Single host (env vars)
For Claude Code:
claude mcp add windows-host-mcp -s user \
--env WINDOWS_SSH_HOST=192.168.1.50 \
--env WINDOWS_SSH_USER=builder \
--env WINDOWS_SSH_KEY_PATH=/home/you/.ssh/windows_host_ed25519 \
--env WINDOWS_SSH_DEFAULT_SHELL=powershell \
-- windows-host-mcpOr as raw MCP JSON config:
{
"mcpServers": {
"windows-host-mcp": {
"command": "windows-host-mcp",
"env": {
"WINDOWS_SSH_HOST": "192.168.1.50",
"WINDOWS_SSH_PORT": "22",
"WINDOWS_SSH_USER": "builder",
"WINDOWS_SSH_KEY_PATH": "/home/you/.ssh/windows_host_ed25519",
"WINDOWS_SSH_DEFAULT_SHELL": "powershell",
"WINDOWS_SSH_DEFAULT_CWD": "C:\\build"
}
}
}
}Configuration reference
Variable | Required | Default | Description |
| — | — | Path to a multi-host JSON file. If set, the |
| yes* | — | Windows host name or IP. |
| no |
| SSH port. |
| yes | — | SSH user on Windows. |
| yes | — | Path (on Linux) to the private key. |
| no | — | Passphrase for the private key, if any. |
| no |
|
|
| no | — | Default working directory on Windows. |
| no |
| SSH handshake timeout. |
| no |
| Display name for the single env-configured host. |
| no | — | Comma-separated capability labels for the single host. |
* Required only when WINDOWS_HOSTS_CONFIG is not set. See .env.example and hosts.example.json.
Try it
Inspect the tools interactively with the MCP Inspector (env vars must be set in your shell):
npm run inspectTypical agent flow:
list_hosts→ see devices;use_host { "label": "cuda" }→ target the CUDA box.test_connection→ confirms hostname + user.set_session { "cwd": "C:\\src\\MyApp" }→ work from one directory.run_command { "command": "nvidia-smi" }.start_job { "command": "dotnet build MyApp.sln" }→ pollget_job_outputuntilstatus: exited.download_file { "remotePath": "C:/src/MyApp/bin/Release/app.zip", "localPath": "/tmp/app.zip" }.use_host { "label": "rocm" }→ run the same build on the ROCm box (its own session & jobs).
Notes & caveats
One host per server instance. To reach several Windows machines, register multiple instances with different names/env.
Signals on Windows OpenSSH are unreliable.
cancel_jobsends a signal and closes the channel; for a stubborn process, runtaskkill /PID <pid> /F(or/IM <image>) viarun_command.pty: trueallocates a terminal (needed for programs that demand a TTY / interactive prompts) but merges stdout and stderr; leave it off for clean build logs.Output is capped (~1 MB per stream for
run_command, ~5 MB buffered per job) to protect the agent's context; truncation is flagged in the result.batch_uploadzips the selected files locally, sends them in one SFTP transfer, and unpacks with PowerShell's built-inExpand-Archive— no extra tooling needed on either side. Select files viafiles(explicit relative paths),pattern(regex over paths relative tolocalDir), or neither (whole folder, recursive by default).writePolicycontrols collisions with existing remote files:overwrite(default) always replaces,keep-newerreplaces only if the local file's mtime is newer (zip timestamps have ~2s resolution),skip-existingnever touches an existing file.batch_downloadis the mirror: files are selected and zipped on the Windows host with PowerShell's built-inCompress-Archive, pulled down in one SFTP transfer, and unpacked here. Samefiles/pattern/ whole-folder selection (relative toremoteDirthis time) and the samewritePolicysemantics, applied to local files instead of remote ones.Secrets: the private key stays on Linux; only its path is passed via env. Keep keys out of the repo (
.gitignorecovers*.key,id_*,.env).Updating: run
windows-host-mcp update— it checks GitHub Releases for a newer tag, then runsgit fetch/git checkout <tag>/npm installin your existing clone (the same onenpm linkpointed the binary at). Restart (or reconnect) any running MCP client session afterward so it picks up the new build.
Development
npm run dev # tsx watch mode
npm run check # type-check only
npm run build # emit dist/This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/thnak/windows-host-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server