GP

gunjanjp/powershell-mcp

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

27 stars 8 forks 质量 66 趋势 11MIT

PowerShell MCP 服务器

概览

一个全面的模型上下文协议(MCP)服务器,使 Claude 及其他大型语言模型应用程序能够在 Windows 系统上执行 PowerShell 命令、脚本并执行系统操作。 - : 执行命令、运行脚本并创建新的PowerShell文件 - : 获取系统信息,监控进程,检查服务和磁盘空间 - : 列表目录,获取文件信息,并通过模式匹配搜索文件 - : 一命令安装,自动配置Claude桌面 - : 安全执行,正确处理错误和会话管理 - execute-powershell - 带可选工作目录执行PowerShell命令 - execute-powershell-script - 运行带参数的PowerShell脚本文件- create-powershell-script - 创建新的PowerShell脚本 - get-system-info - 全面的 Windows 系统信息 - get-进程列表 - 运行中具有 CPU/内存使用率(可排序/可筛选)的进程 - get-service-status - 带有过滤功能的 Windows 服务状态 - 检查磁盘空间 - 磁盘...

概述(AI 翻译)

一个全面的模型上下文协议(MCP)服务器,使 Claude 及其他大型语言模型应用程序能够在 Windows 系统上执行 PowerShell 命令、脚本并执行系统操作。

🌟 主要特色

  • ** 🔧 PowerShell 执行**:执行命令、运行脚本并创建新的 PowerShell 文件
  • ** 🖥️ 系统监控**:获取系统信息,监控进程,检查服务和磁盘空间
  • ** 📁 文件操作**:列表目录、获取文件信息,并搜索带有模式匹配的文件
  • ** ⚙️ 简单设置**:一命令安装,自动配置 Claude 桌面
  • ** 🛡️ 安全**:安全执行,正确错误处理和会话管理

🛠️ 可用工具

PowerShell 工具

  • execute-powershell - 执行带有可选工作目录的PowerShell命令
  • execute-powershell-script - 运行带有参数的PowerShell脚本文件
  • create-powershell-script - 创建新的PowerShell脚本

系统工具

  • get-system-info - 全面的Windows系统信息
  • get-process-list - 运行中具有 CPU/内存占用率(可排序/可筛选)
  • get-service-status - 带过滤功能的Windows服务状态

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

PowerShell MCP Server

A comprehensive Model Context Protocol (MCP) server that enables Claude and other LLM applications to execute PowerShell commands, scripts, and perform system operations on Windows systems.

🌟 Key Features

  • 🔧 PowerShell Execution: Execute commands, run scripts, and create new PowerShell files
  • 🖥️ System Monitoring: Get system info, monitor processes, check services and disk space
  • 📁 File Operations: List directories, get file info, and search files with pattern matching
  • ⚙️ Simple Setup: One-command installation with automatic Claude Desktop configuration
  • 🛡️ Secure: Safe execution with proper error handling and session management

🛠️ Available Tools

PowerShell Tools

  • execute-powershell - Execute PowerShell commands with optional working directory
  • execute-powershell-script - Run PowerShell script files with parameters
  • create-powershell-script - Create new PowerShell scripts

System Tools

  • get-system-info - Comprehensive Windows system information
  • get-process-list - Running processes with CPU/memory usage (sortable/filterable)
  • get-service-status - Windows services status with filtering
  • check-disk-space - Disk space usage for all or specific drives

File Tools

  • list-directory - Enhanced directory listing with filtering
  • get-file-info - Detailed file and directory metadata
  • search-files - Recursive file search with pattern matching

📋 Prerequisites

  • Windows 10/11 or Windows Server 2016+
  • Node.js 18.0.0 or higher
  • PowerShell 5.1+ or PowerShell Core 7+
  • Claude Desktop application

🚀 Quick Setup

# Clone and setup with configuration management
git clone https://github.com/gunjanjp/powershell-mcp.git
cd powershell-mcp
complete-setup.bat

Option 2: Configuration Recovery (If you had existing settings)

# If previous setup overwrote your existing configuration
node recovery.js status      # Check current state
node recovery.js scan        # Find backup configurations
node recovery.js restore 1   # Restore from backup
# OR
node recovery.js merge 1     # Merge backup with current config

Option 3: Manual Setup

# Clone the repository
git clone https://github.com/gunjanjp/powershell-mcp.git
cd powershell-mcp

# Install dependencies
npm install

# Safely add to existing configuration
node recovery.js add-powershell

# Restart Claude Desktop

📖 Usage Examples

Ask Claude:

  • “Execute PowerShell: Get-Date”
  • “Check my system information”
  • “Show me the top 10 processes by CPU usage”
  • “What’s my disk space usage?”
  • “List files in my Downloads folder”
  • “Search for all .txt files in C:\Users”
  • “Create a PowerShell script to backup my Documents folder”

🔧 Commands

Server Commands

# Start the server
npm start

# Test components
npm test

# Run diagnostics
node diagnose.bat
在 GitHub 查看完整 README

安装

This server does not publish a one-line install command.

Open the repository installation guide 新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "powershell": { "command": "node", "args": ["D:/claude/claude-powershell-mcp/src/server.js"], "env": {} } } }