Back to MCP directory
publicPublicdnsLocal runtime

mcp-powershell-exec

一个轻量级服务器,用于执行PowerShell脚本并返回结果,支持AI助手集成

article

README

🚀 MCP PowerShell 执行服务器

MCP PowerShell 执行服务器是一款轻量级服务器,它允许用户输入 PowerShell 脚本字符串,执行后返回结果,让 AI 助手也能理解和操作 PowerShell。

🚀 快速开始

MCP PowerShell 执行服务器能让你轻松执行 PowerShell 脚本。以下是快速开始的步骤:

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

✨ 主要特性

  • 接受字符串形式的 PowerShell 脚本。
  • 在 MCP 服务器环境中安全执行脚本。
  • 实时返回执行结果。

📦 安装指南

克隆仓库并设置服务器:

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

💻 使用示例

基础用法

你可以直接向服务器输入 PowerShell 脚本字符串,服务器会执行并返回结果。

与 VSCode Insiders 中的 GitHub Copilot 集成

要使用此 MCP 服务器与 VSCode Insiders 中的 GitHub Copilot 结合,请按照以下步骤操作:

  1. 安装 VSCode Insiders
  2. 安装 GitHub Copilot 扩展
    • 打开 VSCode Insiders。
    • 进入扩展市场。
    • 搜索并安装 "GitHub Copilot"。
  3. 配置 MCP 服务器
    • 打开 .vscode/mcp.json
    {
        "servers": {
            "powershell-integration": {
                "command": "py", // Python 可执行文件路径
                "args": [
                    "drive:/yourpath/server.py"
                ],
                "env": {}
            }
        }
    }
    
    将路径替换为您实际的 server.py 文件位置。
  4. 启用代理模式
    • 打开 Copilot 聊天窗口。
    • 点击 "Copilot Edits"。
    • 选择 "Agent Mode"。
    • 点击聊天输入中的刷新按钮以加载可用工具。

📚 详细文档

动作展示

观看视频了解 MCP PowerShell 执行服务器的实际操作: 点击观看

系统要求

  • Python:版本 3.10 或更高(为获得最佳性能推荐)
  • PowerShell:版本 5.1

📄 许可证

此项目在 MIT 许可证下开源 - 具体内容请查看 LICENSE 文件。

🔧 支持

如需帮助或报告问题,请在该 GitHub 仓库创建问题。

help

Runtime guide

cloud

Hosted runtime

Hosted servers run from a provider-managed environment. You usually connect the MCP client to the hosted endpoint or follow the provider's authorization flow, without keeping a local process alive

  1. Open provider connection page
  2. Authorize or copy endpoint
  3. Connect from your MCP client
terminal

Local runtime / other methods

Local servers run on your own machine or infrastructure. You normally copy the server_config into your MCP client, install the required package, and provide env variables from env_schema when needed

  1. Copy server_config
  2. Install required package
  3. Fill env variables and restart client