Skip to main content
Glama

PowerShell MCP Server

by posidron

PowerShell MCP Server

A Model Context Protocol server for interacting with PowerShell. This server provides tools for executing PowerShell commands, retrieving system information, managing modules, and more.

Requirements

  • Node.js 18+
  • PowerShell 5.1 or PowerShell Core 7+

Installation

  1. Install dependencies:
    npm install
  2. Build the project:
    npm run build

Configuration

For Claude Desktop

Edit config: $HOME/Library/Application\ Support/Claude/claude_desktop_config.json

Add to mcpServers:

{ "mcpServers": { "mcp-powershell": { "command": "node", "args": [ "/absolute/path/to/mcp-powershell/dist/index.js" ] } } }

For VS Code

Edit config: $HOME/Library/Application\ Support/Code/User/settings.json

Add to settings:

"mcp": { "servers": { "mcp-powershell": { "command": "node", "args": [ "/absolute/path/to/mcp-powershell/dist/index.js" ] } } }

For Cursor IDE

Edit config: $HOME/.cursor/mcp.json

Add to mcpServers:

{ "mcpServers": { "mcp-powershell": { "command": "node", "args": [ "/absolute/path/to/mcp-powershell/dist/index.js" ] } } }

Available Tools

This PowerShell MCP server provides the following tools:

execute_ps

Execute a PowerShell command and get the result.

Parameters: - command (string): PowerShell command to execute

Example usage:

execute_ps(command: "Get-Process | Select-Object -First 5")

get_system_info

Retrieve detailed system information, including OS details, processor, memory, and PowerShell version.

Parameters: None

Example usage:

get_system_info()

list_modules

List all installed PowerShell modules with details like name, version, and type.

Parameters: None

Example usage:

list_modules()

get_command_help

Get detailed help for a specific PowerShell command, including syntax, parameters, and examples.

Parameters: - command (string): PowerShell command to get help for

Example usage:

get_command_help(command: "Get-Process")

find_commands

Search for PowerShell commands by name or pattern.

Parameters: - search (string): Search term for PowerShell commands

Example usage:

find_commands(search: "Process")

run_script

Run a PowerShell script file with optional parameters.

Parameters: - scriptPath (string): Path to the PowerShell script file - parameters (string, optional): Optional parameters to pass to the script

Example usage:

run_script(scriptPath: "/path/to/script.ps1", parameters: "-Name 'Test' -Value 123")

Development

To run in development mode:

npm run dev

Extending the Server

To add your own PowerShell tools:

  1. Edit src/index.ts
  2. Add new tools in the registerTools() method
  3. Follow the existing pattern for consistent error handling
  4. Build with npm run build

Adding a Tool Example

// In the registerTools() method: this.server.tool( "my_ps_tool", { param1: z.string().describe("Description of parameter 1"), param2: z.number().optional().describe("Optional numeric parameter"), }, async ({ param1, param2 }) => { try { // Your PowerShell command const command = `Your-PowerShell-Command -Param1 "${param1}" ${param2 ? `-Param2 ${param2}` : ''}`; const { stdout, stderr } = await execAsync(`powershell -Command "${command.replace(/"/g, '\\"')}"`); if (stderr) { return { isError: true, content: [ { type: "text" as const, text: `Error in my_ps_tool: ${stderr}`, }, ], }; } return { content: [ { type: "text" as const, text: stdout, }, ], }; } catch (error) { return { isError: true, content: [ { type: "text" as const, text: `Error in my_ps_tool: ${(error as Error).message}`, }, ], }; } } );

Security Considerations

  • This server executes PowerShell commands directly on your system
  • Commands are executed with the same privileges as the process running the MCP server
  • Use caution when exposing destructive operations
  • Consider implementing additional validation for sensitive commands

Troubleshooting

Common Issues

  1. PowerShell execution policy restrictions
    • You may need to adjust your PowerShell execution policy to allow script execution
    • Use Set-ExecutionPolicy RemoteSigned -Scope CurrentUser to allow local scripts
  2. Path not found errors
    • Ensure file paths are absolute or properly relative to the working directory
    • Use appropriate path separators for your OS
  3. Command not found errors
    • Some commands may require specific modules to be installed
    • Use Install-Module ModuleName to install required modules

License

MIT

Deploy Server
A
security – no known vulnerabilities
F
license - not found
A
quality - confirmed to work

local-only server

The server can only run on the client's local machine because it depends on local resources.

AI 어시스턴트가 PowerShell 명령을 실행하고, 시스템 정보를 검색하고, 모듈을 관리하고, Windows 시스템에서 스크립트를 실행할 수 있도록 하는 모델 컨텍스트 프로토콜 서버입니다.

  1. 요구 사항
    1. 설치
      1. 구성
        1. 클로드 데스크탑용
        2. VS 코드의 경우
        3. 커서 IDE용
      2. 사용 가능한 도구
        1. 실행_ps
        2. 시스템 정보 가져오기
        3. 목록_모듈
        4. get_command_help
        5. 찾기_명령
        6. 실행 스크립트
      3. 개발
        1. 서버 확장
          1. 도구 예제 추가
        2. 보안 고려 사항
          1. 문제 해결
            1. 일반적인 문제
          2. 특허

            Related MCP Servers

            • A
              security
              A
              license
              A
              quality
              A Model Context Protocol server that provides programmatic access to the Windows terminal, enabling AI models to interact with the Windows command line through standardized tools for writing commands, reading output, and sending control signals.
              Last updated -
              3
              MIT License
            • -
              security
              F
              license
              -
              quality
              A versatile Model Context Protocol server that enables AI assistants to manage calendars, track tasks, handle emails, search the web, and control smart home devices.
              Last updated -
              14
              • Apple
              • Linux
            • -
              security
              F
              license
              -
              quality
              A comprehensive Model Context Protocol server implementation that enables AI assistants to interact with file systems, databases, GitHub repositories, web resources, and system tools while maintaining security and control.
              Last updated -
              1
              1
            • A
              security
              A
              license
              A
              quality
              A secure Model Context Protocol server that allows AI models to safely interact with Windows command-line functionality, enabling controlled execution of system commands, project creation, and system information retrieval.
              Last updated -
              8
              6
              MIT License

            View all related MCP servers

            MCP directory API

            We provide all the information about MCP servers via our MCP API.

            curl -X GET 'https://glama.ai/api/mcp/v1/servers/posidron/mcp-powershell'

            If you have feedback or need assistance with the MCP directory API, please join our Discord server