MCP PowerShell Server
Click on "Deploy 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., "@MCP PowerShell Server List the files in the current directory with their sizes"
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.
MCP PowerShell Server
A memory-optimized MCP server for executing PowerShell commands on Windows.
Why This Exists
This server was created to solve a common Windows development issue: many AI coding assistants (like Claude Code) attempt to execute PowerShell commands through Bash on Windows, which fails because Bash doesn't understand PowerShell syntax. This server provides direct PowerShell execution with proper quoting, path handling, and memory optimization.
Instead of fighting with Bash translation layers or constantly reminding the AI to use cmd.exe, this MCP server gives AI assistants direct, reliable access to PowerShell with all the Windows-specific features they need.
Related MCP server: COP Plug
Features
PowerShell-only execution with -EncodedCommand for robust quoting
Memory optimized with 64KB default output limit, 2MB maximum
Buffer-based output handling to prevent memory leaks
Process tree killing with taskkill /t /f
Timeout protection (default 60 seconds, max 10 minutes)
Cross-platform MCP client compatibility
Installation
npm installUsage
Start the server
node mcp-shell-server.mjsConfigure with MCP clients
Add to your MCP client configuration (e.g., Gemini CLI settings.json):
{
"mcpServers": {
"mcp-powershell-server": {
"command": "node",
"args": ["path/to/mcp-shell-server/mcp-shell-server.mjs"],
"env": {
"MCP_SHELL_EXE": "pwsh.exe" // Optional: override shell executable
}
}
}
}Tool: run_shell_command
Execute PowerShell commands with memory and timeout protection.
Parameters
command(required): PowerShell command/script to executecwd(optional): Working directorytimeoutMs(optional): Timeout in milliseconds (max 10 minutes)maxOutputBytes(optional): Max output bytes per stream (default 64KB, max 2MB)
Response
{
"stdout": "...",
"stderr": "...",
"exitCode": 0,
"signal": null,
"truncated": false,
"timedOut": false,
"platform": "win32",
"shell": "pwsh.exe"
}Examples
List files
{
"command": "Get-ChildItem -Path ."
}Get system information
{
"command": "Get-ComputerInfo"
}With custom timeout and output limit
{
"command": "Get-Process",
"timeoutMs": 30000,
"maxOutputBytes": 128000
}Memory Optimization
Default output limit: 64KB per stream
Maximum output limit: 2MB per stream
Buffer chunks instead of string concatenation
Automatic cleanup of event listeners
Process tree termination on timeout/truncation
Security Notes
Commands run with user permissions
PowerShell ExecutionPolicy bypassed for MCP commands
Consider implementing command whitelisting for production use
Use working directory restrictions if needed
Environment Variables
MCP_SHELL_EXE: Override PowerShell executable (pwsh.exe or powershell.exe)Standard environment variables are passed through to child processes
Requirements
Node.js 18+
Windows OS
PowerShell (pwsh.exe recommended)
License
MIT
Available Tools
1 toolrun_shell_commandB
Execute commands using PowerShell on Windows (PowerShell-only). Returns stdout, stderr, exit code, signal, and flags for timeout/truncation.
Inputs: command (required), cwd, timeoutMs, maxOutputBytes.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 1 tool
With only a single tool, there is no possibility of confusion—an agent cannot misselect. The tool's purpose (execute PowerShell commands) is unambiguous.
run_shell_command follows a clear verb_noun snake_case convention. With one tool there is no inconsistency to speak of.
A single tool makes the surface feel thin, though for a command-execution server one general-purpose runner is defensible. It earns its place but offers no specialization.
The tool covers core execution output (stdout, stderr, exit code, signal, timeout/truncation flags), which is the essential lifecycle for running commands. Minor gaps exist around session persistence and working-directory management that agents may need to work around.
Maintenance
Related MCP Connectors
Execute PowerShell commands securely with controlled timeouts and input validation. Retrieve syste…
- DNS-DATA RemoteDeprecatedcom.dns-data
Connect AI assistants to authorized Windows and macOS devices for files, commands, and management.
Remote Desktop Commander: use files, terminal and processes on your own computers from any AI app.
Connect ChatGPT, Claude, Cursor or VS Code to your Windows PC: files, terminal, browser, apps.
Related MCP Servers
- AlicenseBqualityBmaintenanceEnables AI agents to securely manage and execute commands on remote Windows servers via WinRM, including PowerShell execution, system information retrieval, and service management.613 PyPI6MIT
- FlicenseNot gradedqualityAmaintenanceEnables AI assistants to execute PowerShell commands, manage files, inspect projects, run Git operations, and monitor system information on Windows through a local MCP server.-
- AlicenseBqualityBmaintenanceEnables AI agents to run PowerShell commands and manage Windows services without intrusive console windows, while also supporting remote execution via SSH and WinRM.20187 npm1MIT
- AlicenseNot gradedqualityCmaintenanceEnables Windows-native developer orchestration for Claude Code and Codex with PowerShell discovery, capability routing, safety-gated execution, package management, and sandbox-based isolation.MIT