mcp-powershell
Memory-optimized MCP server for executing PowerShell commands on Windows
claude mcp add --transport stdio saimanish1-mcp-powershell-server node mcp-shell-server.mjs \ --env MCP_SHELL_EXE="pwsh.exe"
How to use
This MCP server provides a hardware-efficient way to execute PowerShell commands from MCP clients. It runs a Node.js-based PowerShell shell server (mcp-shell-server.mjs) and exposes a dedicated run_shell_command tool that executes PowerShell scripts or commands with memory and timeout protections. By default, it uses pwsh.exe as the PowerShell executable, with safe defaults for output buffering and timeout limits. Clients can configure their MCP settings to point at this server and, optionally, override the shell executable via MCP_SHELL_EXE. When using the tool, you supply a PowerShell command or script and receive structured output including stdout, stderr, exit code, and status flags. This is particularly useful for AI assistants that need direct PowerShell access on Windows without Bash translation layers.
How to install
Prerequisites:
- Node.js 18+ installed on Windows (per Windows OS requirement)
- npm (comes with Node.js)
Step-by-step installation:
- Clone or download the MCP PowerShell server repository.
- In the project root, install dependencies: npm install
- Start the server locally to verify: node mcp-shell-server.mjs
- (Optional) Configure the MCP client to use the server by adding an entry for mcp-powershell-server in your MCP client config, pointing to the server script and, if needed, overriding the PowerShell executable via MCP_SHELL_EXE.
Notes:
- Ensure PowerShell (pwsh.exe) is installed on the host and accessible in PATH, or override via MCP_SHELL_EXE.
- The default environment is designed for Windows, with cross-platform MCP client compatibility.
Additional notes
Tips and considerations:
- The server uses memory-optimized output buffering with a default 64KB per stream and a maximum of 2MB per stream. If you anticipate large outputs, adjust maxOutputBytes in the client request.
- Commands run with user permissions; consider applying your own whitelisting or sandboxing for production deployments.
- The MCP shell can be overridden via the MCP_SHELL_EXE environment variable to point to pwsh.exe or powershell.exe depending on your environment.
- Timeout protection is enforced with a default of 60 seconds and a maximum of 10 minutes; customize timeoutMs per request as needed.
- If you need to terminate long-running processes, the server supports process-tree termination via taskkill on Windows.
- Ensure network and security policies allow Node.js-based MCP servers to communicate with MCP clients in your environment.
Related MCP Servers
zen
Selfhosted notes app. Single golang binary, notes stored as markdown within SQLite, full-text search, very low resource usage
MCP -Deepseek_R1
A Model Context Protocol (MCP) server implementation connecting Claude Desktop with DeepSeek's language models (R1/V3)
mcp-fhir
A Model Context Protocol implementation for FHIR
mcp
Inkdrop Model Context Protocol Server
mcp-appium-gestures
This is a Model Context Protocol (MCP) server providing resources and tools for Appium mobile gestures using Actions API..
dubco -npm
The (Unofficial) dubco-mcp-server enables AI assistants to manage Dub.co short links via the Model Context Protocol. It provides three MCP tools: create_link for generating new short URLs, update_link for modifying existing links, and delete_link for removing short links.