PowerShell Exec MCP server

Enables real-time execution of PowerShell scripts through a lightweight Python server, bridging AI tools with PowerShell functionality for data analysis, Windows task automation, and module interaction.
Back to servers
Setup instructions
Provider
Doug Finke
Release date
Mar 19, 2025
Language
Python
Stats
52 stars

MCP PowerShell Exec Server is a lightweight server that accepts PowerShell scripts as strings, executes them, and returns the output. This tool enables AI assistants to understand and work with PowerShell commands by providing a secure execution environment.

Features

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

Installation

To install the MCP PowerShell Exec Server:

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

System Requirements

Before installation, ensure your system meets these requirements:

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

Usage

Setting Up with GitHub Copilot in VSCode Insiders

Follow these steps to integrate the MCP server with GitHub Copilot:

  1. Install VSCode Insiders

  2. Install GitHub Copilot Extension

    • Open VSCode Insiders
    • Go to the Extensions marketplace
    • Search for and install "GitHub Copilot"
  3. Configure MCP Server

    • Open or create .vscode/mcp.json with the following configuration:
    {
     "servers": {
         "powershell-integration": {
             "command": "py", // Python executable
             "args": [
                "drive:/yourpath/server.py"
             ],
             "env": {}
         }
     }
    }
    
    • Replace drive:/yourpath/server.py 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

Demonstration

For a visual demonstration of the MCP PowerShell Exec Server in action, check out the video tutorial on YouTube.

Troubleshooting

If you encounter issues while using the MCP PowerShell Exec Server:

  • Verify that Python 3.10+ and PowerShell 5.1 are properly installed
  • Check that the path in your mcp.json file is correct
  • Ensure VSCode Insiders and the GitHub Copilot extension are up to date

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "powershell-integration" '{"command":"py","args":["drive:/yourpath/server.py"],"env":[]}'

See the official Claude Code MCP documentation for more details.

For Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

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

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

2. Add this to your configuration file:

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

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later