MCP HubMCP Hub
dfinke

mcp-powershell-exec

by: dfinke

MCP Server for executing PowerShell scripts

29created 18/03/2025
Visit
PowerShell
Automation

📌Overview

Purpose: The MCP PowerShell Exec Server aims to facilitate the execution of PowerShell scripts, enabling AI assistants to interpret and utilize PowerShell commands effectively.

Overview: MCP PowerShell Exec Server is a lightweight server designed to accept PowerShell scripts as string inputs, execute them securely, and provide real-time output. It enhances the integration experience with AI tools by allowing them to interact with PowerShell easily.

Key Features:

  • Script Execution: Accepts PowerShell scripts via string inputs, allowing users to run commands effortlessly.

  • Secure Environment: Executes scripts in a controlled MCP Server environment, prioritizing security during the execution process.

  • Real-time Results: Provides immediate feedback on script execution, enhancing user experience and workflow efficiency.


MCP PowerShell Exec Server

Overview

MCP PowerShell Exec Server is a lightweight server that accepts PowerShell scripts as strings, executes them, and returns the output. It enables AI assistants to understand and work with PowerShell.

Features

  • Accepts PowerShell scripts via string input
  • Executes scripts securely in an MCP Server environment
  • Returns execution results in real-time

Installation

Clone the repository and set up the server:

git clone https://github.com/yourusername/mcp-powershell-exec.git
cd mcp-powershell-exec

Usage

Integration with GitHub Copilot in VSCode Insiders

  1. Install VSCode Insiders
    Download and install the latest version of VSCode Insiders:
    https://code.visualstudio.com/insiders/

  2. Install GitHub Copilot Extension
    Open VSCode Insiders, go to the Extensions marketplace, and install "GitHub Copilot".

  3. Configure MCP Server
    Open .vscode/mcp.json and update it as follows:

    {
     "servers": {
         "powershell-integration": {
             "command": "py",
             "args": [
                "drive:/yourpath/server.py"
             ],
             "env": {}
         }
     }
    }
    

    Replace the path with the actual path to your server.py file.

  4. Enable Agent Mode

    • Open Copilot chat in VSCode Insiders
    • Click on "Copilot Edits"
    • Choose "Agent mode"
    • Click the refresh button in the chat input to load the available tools

System Requirements

  • Python: Version 3.10 or higher
  • PowerShell: Version 5.1

License

This project is licensed under the MIT License - see the LICENSE file for details.

Support

For issues and questions, create an issue in this GitHub repository.