返回 MCP 目录
public公开dns本地运行

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

运行方式说明

cloud

托管运行

托管运行通常表示这个 MCP Server 由服务方环境承载,用户一般按页面提供的连接方式或授权流程接入,不需要在本地长期启动一个 MCP 进程

  1. 打开服务方连接页
  2. 完成授权或复制端点
  3. 在 MCP 客户端中连接
terminal

本地运行 / 其它方式

本地运行通常需要用户在自己的电脑或服务器上安装依赖,把 server_config 复制到 MCP 客户端,并按 env_schema 补齐环境变量、密钥或其它配置

  1. 复制 server_config
  2. 安装所需依赖
  3. 补齐环境变量后重启客户端