powershell-mcp

v0.9.1
io.github.IMRRD/powershell-mcp Checked 2 hours ago Published 21 days ago

Headless Windows ops over MCP: hidden PowerShell plus in-process SSH, WinRM and SFTP.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

run_powershell

Run a PowerShell script/command on this Windows host in a hidden process (no console window appears). Returns stdout, stderr and exit code. Use for any Windows command, file, or system task.

ParameterTypeDescription
script *stringPowerShell script or command to execute.
cwdstringWorking directory.
enginestringExplicit engine; no fallback when specified. Omit to use only configured PWSH_MCP_EXE if set; otherwise try pwsh then powershell.exe on Windows (pwsh only elsewhere).
errorPolicystringDefault legacy raw script; strict detects unhandled PowerShell ErrorRecords. Check native exits immediately in the script.
logOutputbooleanOpt in to private file-backed raw output logs; may include secrets emitted by command.
logQuotaBytesintegerCombined stdout/stderr quota (default 8 MiB); incomplete beyond quota.
maxOutputBytesintegerRaw UTF-8 bytes per stream (default 1 MiB).
parametersobjectJSON-safe named script parameters, delivered via stdin; never interpolated into source.
tailbooleanKeep last bytes rather than first; incomplete UTF-8 boundary scalars are omitted.
timeoutMsintegerHard timeout in ms (default 60000).

list_services

List Windows services, optionally filtered by a name pattern. Returns Name, DisplayName, Status.

ParameterTypeDescription
filterstringWildcard name filter, e.g. 'Sql*' or '*backup*'.

get_service

Get detailed status of one Windows service by name.

ParameterTypeDescription
name *stringExact service name (not display name).

control_service

Start, stop, or restart a Windows service (requires the MCP host process to have sufficient privileges).

ParameterTypeDescription
action *stringAction to perform.
name *stringExact service name.

system_info

Return OS, CPU, memory and disk summary for this Windows host.

ssh_exec

Run a command on a remote host over SSH, fully in-process (no ssh.exe, no WSL — works headless). Use for Linux hosts or any OpenSSH target. Auth via privateKeyPath or password. Returns stdout, stderr, exit code.

ParameterTypeDescription
command *stringCommand to run on the remote host.
host *stringRemote host or IP.
username *stringSSH username.
credentialRefstringOperator-provisioned scoped credential reference, exclusive with raw auth.
hostKeyPinsarrayExplicit SHA256:base64 trusted host key fingerprints; multiple keys permit rotation.
jumpsarray
logOutputbooleanOpt in to private file-backed raw output logs; may include secrets emitted by command.
logQuotaBytesintegerCombined stdout/stderr quota (default 8 MiB); incomplete beyond quota.
maxOutputBytesintegerCap captured stdout/stderr per stream (bytes, default 1 MiB).
passphrasestringPassphrase for the private key, if any.
passwordstringPassword auth (used if no key).
portintegerSSH port (default 22).
privateKeyPathstringPath to a private key file on this Windows host, e.g. C:\\Users\\isak\\.ssh\\id_ed25519.
tailbooleanKeep the LAST maxOutputBytes instead of the first (tail) — useful for long logs.
timeoutMsintegerHard timeout in ms (default 60000). Also bounds the connection handshake.

winrm_exec

Run a command on a remote Windows host via PowerShell Remoting (WinRM / Invoke-Command). Native to Windows Server — no SSH server or agent needed on the target, only WinRM enabled. Output captured in-process (no console window).

ParameterTypeDescription
command *stringPowerShell command/scriptblock body to run remotely.
computerName *stringRemote Windows host name or IP.
authenticationstringWinRM auth mechanism.
credentialRefstringOperator-provisioned scoped credential reference, exclusive with raw auth.
logOutputbooleanOpt in to private file-backed raw output logs; may include secrets emitted by command.
logQuotaBytesintegerCombined stdout/stderr quota (default 8 MiB); incomplete beyond quota.
maxOutputBytesintegerRaw UTF-8 bytes per stream (default 1 MiB).
parametersobjectJSON-safe named remote script parameters; delivered through protected WinRM stdin payload.
passwordstringCredential password.
tailbooleanKeep last bytes rather than first; incomplete UTF-8 boundary scalars are omitted.
timeoutMsintegerHard timeout in ms (default 120000).
useSslbooleanUse HTTPS/5986 WinRM.
usernamestringCredential username (DOMAIN\\user or host\\user). Omit to use the host process identity.

sftp_upload

Upload a local file to a remote host over SFTP, in-process (ssh2 — no scp.exe, no WSL, headless). Use to deploy scripts/configs to Linux hosts.

ParameterTypeDescription
host *stringRemote host or IP.
localPath *stringLocal file path on this Windows host.
remotePath *stringDestination path on the remote host.
username *stringSSH username.
credentialRefstringOperator-provisioned scoped credential reference, exclusive with raw auth.
hostKeyPinsarrayExplicit SHA256:base64 trusted host key fingerprints; multiple keys permit rotation.
passphrasestringPassphrase for the private key, if any.
passwordstringPassword auth (used if no key).
portintegerSSH port (default 22).
privateKeyPathstringPath to a private key file on this Windows host.
stagedbooleanOpt-in verified staging. Upload fails closed where atomic no-clobber is unsupported; download uses SHA-256 readback and atomic no-clobber hard link.
timeoutMsintegerHard timeout in ms (default 120000).

sftp_download

Download a file from a remote host to this Windows host over SFTP, in-process (ssh2 — no scp.exe, no WSL, headless).

ParameterTypeDescription
host *stringRemote host or IP.
localPath *stringDestination path on this Windows host.
remotePath *stringSource path on the remote host.
username *stringSSH username.
credentialRefstringOperator-provisioned scoped credential reference, exclusive with raw auth.
hostKeyPinsarrayExplicit SHA256:base64 trusted host key fingerprints; multiple keys permit rotation.
passphrasestringPassphrase for the private key, if any.
passwordstringPassword auth (used if no key).
portintegerSSH port (default 22).
privateKeyPathstringPath to a private key file on this Windows host.
stagedbooleanOpt-in verified staging. Upload fails closed where atomic no-clobber is unsupported; download uses SHA-256 readback and atomic no-clobber hard link.
timeoutMsintegerHard timeout in ms (default 120000).

run_program

Run a native executable DIRECTLY (no shell) in a hidden process and capture clean stdout/stderr + exit code. Use this for console programs like gh, git, docker, node, python, etc. -- direct execution captures their stdout/stderr without PowerShell pipeline semantics. Historical hidden-shell native stdout loss is executable/environment-specific; it is not universal. Provide the program and an args array (no shell quoting needed). For work expected to outlast the synchronous deadline, choose start_execution before launching, then poll execution_status and read_execution_output. A timeout never a…

ParameterTypeDescription
program *stringExecutable name on PATH or a full path, e.g. 'git' or 'C:\Program Files\GitHub CLI\gh.exe'.
argsarrayArguments as an array; each element is passed verbatim (no shell quoting).
cwdstringWorking directory.
logOutputbooleanOpt in to private file-backed raw output logs; may include secrets emitted by command.
logQuotaBytesintegerCombined stdout/stderr quota (default 8 MiB); incomplete beyond quota.
maxOutputBytesintegerRaw UTF-8 bytes per stream (default 1 MiB).
stdinstringUTF-8 stdin, max 1 MiB bytes. Empty string still opens stdin and sends EOF; no stdin in argv, environment or logs.
tailbooleanKeep last bytes rather than first; incomplete UTF-8 boundary scalars are omitted.
timeoutMsintegerHard timeout in ms (default 60000).

start_remote_batch

Opt-in process-local SSH/WinRM batch; 1–32 explicit targets, up to 8 concurrent, per-target deadline. No discovery or retry. SSH supports at most four explicit jumps. Unknown after server restart.

ParameterTypeDescription
concurrency *integer
targets *array
timeoutMs *integer

remote_batch_status

Read ordered per-target batch records; unavailable after process restart.

ParameterTypeDescription
id *string

cancel_remote_batch

Stop dispatch of queued targets; active targets become unknown, not confirmed terminated.

ParameterTypeDescription
id *string

runtime_capabilities

Read-only runtime package, protocol, supported and available engines, transports and limits; no identity, environment or secrets.

start_execution

Start a local executable directly with durable idempotency and bounded output. No shell; remote targets unsupported.

ParameterTypeDescription
idempotencyKey *string
owner *stringPrivate caller namespace token; keep secret and stable across restarts. This is a bearer secret, not authenticated MCP identity.
program *string
argsarray
cwdstring

execution_status

Read a local execution state. Unknown after restart means no automatic replay or verified ownership.

ParameterTypeDescription
id *string
owner *stringPrivate caller namespace token; keep secret and stable across restarts. This is a bearer secret, not authenticated MCP identity.

read_execution_output

Read a bounded base64 output page, including while running.

ParameterTypeDescription
id *string
length *integer
offset *integer
owner *stringPrivate caller namespace token; keep secret and stable across restarts. This is a bearer secret, not authenticated MCP identity.
stream *string

cancel_execution

Request bounded local cancellation. Windows Job Objects and Linux subreaper/pidfds confirm owned-tree termination asynchronously; failures remain unknown. Recovered runs are never signalled.

ParameterTypeDescription
id *string
owner *stringPrivate caller namespace token; keep secret and stable across restarts. This is a bearer secret, not authenticated MCP identity.

read_output_log

Read a bounded raw byte page from an opt-in session log; base64 encoded. Handles are process-local and expire after one hour.

ParameterTypeDescription
handle *string
length *integer
offset *integer
stream *string

delete_output_log

Delete a session log by opaque handle.

ParameterTypeDescription
handle *string