mcp-server-for-powershell
MCP server for PowerShell
Disclaimer
Unofficial Implementation: This project is an independent open-source software project. It is not affiliated with, endorsed by, sponsored by, or associated with Microsoft Corporation or the PowerShell team.
Trademarks: "PowerShell" and the PowerShell logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries. All other trademarks cited herein are the property of their respective owners. Use of these names is for descriptive purposes only (nominative fair use) to indicate compatibility.
Related MCP server: sliverc2-mcp
Installation
Run directly with uv (recommended):
uvx mcp-server-for-powershellpip:
pip install mcp-server-for-powershelluv:
uv pip install mcp-server-for-powershell
Configuration
The server can be configured using the following command-line arguments:
Argument | Description | Default |
| List of allowed PowerShell commands. If empty, all are allowed (subject to restrictions). |
|
| List of restricted PowerShell commands. | Safe defaults |
| List of restricted directories. | System directories |
| PowerShell Language Mode: |
|
| Initial working directory. | Current Directory |
Language Modes
0 (NoLanguage): No script execution allowed.
1 (ConstrainedLanguage): Restricts access to sensitive language elements (default).
2 (RestrictedLanguage): Only allows basic commands.
3 (FullLanguage): Unrestricted access.
Security Profiles
We recommend different configurations based on your security needs:
Default (Balanced)
By default, the server runs in ConstrainedLanguage mode with a curated blocklist of dangerous commands and restricted system directories. This provides "good enough" defaults for general use, preventing common dangerous operations while allowing most read-only and safe actions.
uvx mcp-server-for-powershellSafe Mode (Strict)
For environments requiring stricter controls, use NoLanguage mode (--language-mode 0). Only built-in commands and cmdlets can be executed.
uvx mcp-server-for-powershell --language-mode 0Nuclear Mode (Allow-List Only)
For the highest security "nuclear" option, explicitly whitelist ONLY the commands you need (e.g., allow get-items only). This blocks everything else by default.
uvx mcp-server-for-powershell --allowed-commands Get-Item Get-ChildItem Get-ContentLicense
mcp-server-for-powershell is provided as-is under the MIT license.
Available Tools
1 toolrun_powershellA
Executes PowerShell commands based on a structured JSON definition.
This tool allows you to run PowerShell commands safely strings.
It expects a JSON string that defines the command(s), parameters, pipelines, and sequences.
Args:
json: A JSON string defining the command structure.
Structure examples:
1. Single Command:
[{"command": "Get-Item", "parameters": ["."]}]
2. .NET Static Method:
[{"command": "[System.Math]::Sqrt", "parameters": [16]}]
# Generates: [System.Math]::Sqrt(16)
3. Command with Named Parameters:
[{"command": "Get-Item", "parameters": {"-Path": "."}}]
4. Pipeline:
[{"command": "Get-Process", "then": {"command": "Select-Object", "parameters": ["Name"]}}]
5. Sequence (Multiple commands):
[{"command": "mkdir", "parameters": ["test"]}, {"command": "cd", "parameters": ["test"]}]
Returns:
The standard output of the executed PowerShell command(s), or an error message if execution fails.
| Name | Required | Description | Default |
|---|---|---|---|
| json | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description must disclose behavioral traits alone. It only mentions 'Executes PowerShell commands... safely strings' (vague) and returns standard output or error. It does not disclose security implications, required permissions, sandboxing, or limitations on commands. This is insufficient for a command execution tool that could be destructive.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is relatively long due to detailed examples, which are justified given the complexity of the input format. It is well-structured with bullet points and clear sections (Args, Returns). The main purpose is front-loaded. Could be slightly trimmed, but overall efficient for the required detail.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's potential to execute arbitrary code and the presence of an output schema (not shown), the description is moderately complete. It covers input format well but lacks details on execution environment, error handling, performance considerations, or return value structure beyond 'standard output'. This leaves gaps for an agent deciding to use the tool.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The schema has 0% description coverage for the single parameter 'json', but the description compensates richly with seven examples of valid JSON structures, covering single commands, pipelines, and sequences. This adds significant meaning beyond the schema's raw 'string' type, making it very helpful for the agent.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's purpose: 'Executes PowerShell commands based on a structured JSON definition.' The verb 'executes' and the resource 'PowerShell commands' are specific, and the JSON-based input distinguishes it from general command execution. Despite an awkward phrase ('safely strings'), the purpose is unambiguous.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
While there are no sibling tools, the description provides extensive guidance on how to format the input, including multiple examples of single commands, .NET methods, named parameters, pipelines, and sequences. However, it does not explicitly state when to use this tool or mention any prerequisites (e.g., PowerShell availability). The implied context is sufficient for an AI agent to understand usage.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.
1 tool update
v1.0.0- First observed
run_powershell
TDQS
With only one tool, there is no possibility of confusion or overlap. The agent can uniquely identify the tool's purpose without ambiguity.
The single tool name follows a clear verb_noun pattern (run_powershell), which is consistent and readable. Since there's only one tool, no convention conflicts exist.
The server has only one tool for the broad domain of PowerShell execution. While the tool is versatile, it forces the agent to encode all operations as complex JSON, which is less ergonomic than dedicated tools for common tasks. The count is borderline.
The single tool can theoretically execute any PowerShell command, covering the domain of command execution comprehensively. However, it lacks specialized tools for session management, script handling, or error recovery, which may be needed for complex workflows.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
Related MCP Servers
- MIT
- MIT
- AGPL 3.0
- AlicenseNot gradedqualityAmaintenanceMCP server for advanced PowerShell integration with AI agents, enabling autonomous script execution, code analysis, and IntelliSense.3MIT
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- 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/danielklecha/mcp-server-for-powershell'
If you have feedback or need assistance with the MCP directory API, please join our Discord server