Pwsh Exec MCP logo

Pwsh Exec MCP

Runs Windows PowerShell 7 commands through MCP and returns exit codes, stdout, and stderr with bounded execution.

Install Pwsh Exec MCP

Pick your client, then add it in one click or paste the config.

STDIOPython
~/Library/Application Support/Claude/claude_desktop_config.json
claude_desktop_config.json
{
  "mcpServers": {
    "pwsh-exec-mcp": {
      "command": "uvx",
      "args": [
        "pwsh-exec"
      ],
      "env": {
        "PWSH_EXEC_DEFAULT_DIR": "YOUR_VALUE_HERE"
      }
    }
  }
}

Settings → Developer → Edit Config, merge this into mcpServers, then fully quit and reopen Claude Desktop.

Values are written into the snippet above so you can paste it as is. They never leave your browser.

Automated check passed— started and listed 1 tools correctly ().

Overview

The pwsh-exec-mcp MCP server exposes Windows PowerShell 7 through one MCP tool, `run_command`. Each request starts a fresh `pwsh` process and returns the raw exit code, stdout, and stderr, with configurable timeout and working directory inputs. Use it when an agent needs synchronous command execution on Windows without persistent shell state. It requires Windows, PowerShell 7 on `PATH`, and `uv` for the `uvx` runner.

Use cases

  • Run Git commands and inspect their raw results
  • Execute PowerShell scripts in a selected working directory
  • Check stdout, stderr, and exit codes from Windows CLI tools
  • Run short synchronous development or automation tasks

Key features

  • Executes commands in fresh PowerShell 7 processes
  • Returns raw exit code, stdout, and stderr
  • Supports 1–300 second timeouts
  • Terminates the full process tree on timeout
  • Refreshes Windows PATH and enforces UTF-8 output
  • Trims oversized output by retaining its head and tail

Tools1

What Pwsh Exec MCP lets your agent do. Expand a tool for its parameters.

Verified live~179 tokens of context

Security & health

What it can reach and how reliably it runs — from our own checks, not the maintainer’s claims.

ActiveLast checked

Recent health check succeeded.

22/23 checks healthy over the last 112d

What it can do

From the 1 tool this server returned when we ran it.

Runs commands · 1
Network at startup2 connections
Files written at startup11

Observed 2026-11-16 in an isolated sandbox. A description of reach, not a security audit.

Supply-chain signal

No high-severity advisories surfaced by our automated scan.

Critical 0High 0Medium 0Low 0

Scanned 11d ago via OSV.dev · pwsh-exec (PyPI)

Adoption & maintenance

Factual signals from GitHub, npm, and our automated checks — not a rating.

GitHub stars1Stargazers on the source repository.
Last commit5mo agoMost recent push to the default branch.
Availability100%Our rolling endpoint + install checks that succeeded.
Install checkPassedOur sandbox started it and listed its tools.
Tools exposed1Callable tools this server registers over MCP.
Directory activity19 viewsConfig copies, upvotes, and views on AllMCPs.

How Pwsh Exec MCP works

What pwsh-exec-mcp MCP server does

The pwsh-exec-mcp MCP server gives an MCP client a narrow interface for executing commands in PowerShell 7 on Windows. Its single tool, run_command, accepts a command string, a timeout in seconds, and an optional absolute working directory.

Each invocation is isolated in a newly launched pwsh process. The response preserves the command's exit status and separates its standard output from standard error. It does not summarize or reinterpret command results. Empty streams remain identifiable, and non-zero exit codes are returned instead of being hidden.

This design fits agents that need to run commands such as Git operations, scripts, or local CLI utilities and inspect the terminal result directly. It is not a replacement for a persistent terminal session or a service runner.

How it works

The client starts the server over stdio with uvx pwsh-exec. A call to run_command launches PowerShell 7, detaches standard input to avoid interactive hangs, and waits synchronously for completion. The timeout must be between 1 and 300 seconds. If it expires, the server terminates the PowerShell process and its descendants rather than leaving child processes running.

Output is formatted with an exit-code section followed by labeled stdout and stderr sections, plus timing information. If either stream exceeds 500 lines, the first and last 250 lines are retained. This limits context growth while preserving both the beginning and end of long output.

The pwsh-exec-mcp MCP server also forces UTF-8 output and refreshes user-scope PATH values from the Windows registry on each call. Registry environment values that use expandable syntax are expanded, allowing tools installed after the MCP host started to be discovered.

Setup and configuration

The host system must be Windows with PowerShell 7 (pwsh) available on PATH. Windows PowerShell 5.1, invoked as powershell.exe, is not the required runtime. uv is also required because the standard launch command uses its uvx runner; cloning the repository is not necessary for this setup.

For a generic MCP client, configure the server command as:

text
uvx pwsh-exec

Claude Desktop should use cmd /c around that command:

config.json
{
  "mcpServers": {
    "pwsh-exec": {
      "command": "cmd",
      "args": ["/c", "uvx", "pwsh-exec"]
    }
  }
}

working_directory takes priority when supplied in a tool call. Without it, the server checks PWSH_EXEC_DEFAULT_DIR; if that variable is unset or blank, it uses %TEMP%\\pwsh-exec. Set the environment variable in the MCP client configuration to choose another default directory.

Tools and capabilities

The pwsh-exec-mcp MCP server provides one tool:

  • run_command: Runs a PowerShell command or script.
  • command: Required string containing the command.
  • timeout: Required integer in seconds, from 1 through 300.
  • working_directory: Optional absolute path for the process.

The server supports raw exit-code inspection, separate stdout and stderr capture, UTF-8 output across Windows locales, fresh PATH lookup, process-tree cleanup on timeout, detached stdin, and bounded long-output handling.

Limitations and notes

Calls are stateless. Directory changes, variables, and other shell state disappear when the process ends. Pass working_directory on later calls or combine dependent commands into one invocation.

Execution uses the permissions of the host user and does not elevate to administrator. Calls are synchronous and capped at five minutes, so persistent shells, background jobs, watchers, development servers, installers, and other long-running work are outside the intended scope.

Written by AllMCPs with AI assistance from the project’s README and listing data. How we build listings

Reviews

No reviews yet — be the first to share how it worked for you.

Frequently Asked Questions about Pwsh Exec MCP

pwsh-exec-mcp is an MCP server that connects AI clients to PowerShell 7 on Windows. Its main tool, `run_command`, executes a command in a fresh `pwsh` process and returns the raw exit code, stdout, and stderr, with optional timeout and working-directory controls.

Install PowerShell 7 and uv, then register `uvx pwsh-exec` as the server's stdio launch command. No repository clone is required because uvx fetches and runs the package on demand. Claude Desktop should launch it through `cmd /c`.

Yes, pwsh-exec-mcp works with Claude Desktop through a stdio configuration. Set the command to `cmd` and the arguments to `/c`, `uvx`, and `pwsh-exec` so the Windows child processes receive a working console.

No, pwsh-exec-mcp does not keep sessions open. Every tool call starts a new PowerShell 7 process, so directory changes and variables do not persist. Provide `working_directory` again or place dependent commands in one invocation.

A pwsh-exec-mcp command can run for at most 300 seconds, with a required timeout between 1 and 300 seconds. When the limit is reached, the server kills the PowerShell process and its child processes.

Related MCP servers

Add a badge to your READMEShow it’s listed — live SVG, Markdown or HTML.

AllMCPs Directory Badge

Full Badge Customizer

Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.

Badge Style:
Live Dynamic SVG PreviewPwsh Exec MCP AllMCPs Directory Badge
Markdown (GitHub README)
[![AllMCPs](https://allmcps.com/api/badge/pwsh-exec-mcp?style=directory)](https://allmcps.com/mcp/pwsh-exec-mcp)
HTML Embed
<a href="https://allmcps.com/mcp/pwsh-exec-mcp"><img src="https://allmcps.com/api/badge/pwsh-exec-mcp?style=directory" alt="Pwsh Exec MCP on AllMCPs" /></a>