Skip to main content
Glama
posidron

PowerShell MCP Server

by posidron

PowerShell MCP-Server

Ein Model Context Protocol-Server für die Interaktion mit PowerShell. Dieser Server bietet Tools zum Ausführen von PowerShell-Befehlen, Abrufen von Systeminformationen, Verwalten von Modulen und mehr.

Anforderungen

  • Node.js 18+

  • PowerShell 5.1 oder PowerShell Core 7+

Related MCP server: Command Executor MCP Server

Installation

  1. Installieren Sie Abhängigkeiten:

    npm install
  2. Erstellen Sie das Projekt:

    npm run build

Konfiguration

Für Claude Desktop

Konfiguration bearbeiten: $HOME/Library/Application\ Support/Claude/claude_desktop_config.json

Zu mcpServern hinzufügen:

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

Für VS Code

Konfiguration bearbeiten: $HOME/Library/Application\ Support/Code/User/settings.json

Zu den Einstellungen hinzufügen:

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

Für Cursor-IDE

Konfiguration bearbeiten: $HOME/.cursor/mcp.json

Zu mcpServern hinzufügen:

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

Verfügbare Tools

Dieser PowerShell MCP-Server bietet die folgenden Tools:

execute_ps

Führen Sie einen PowerShell-Befehl aus und erhalten Sie das Ergebnis.

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

Anwendungsbeispiel:

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

get_system_info

Rufen Sie detaillierte Systeminformationen ab, einschließlich Betriebssystemdetails, Prozessor, Speicher und PowerShell-Version.

Parameters: None

Anwendungsbeispiel:

get_system_info()

Modulliste

Listen Sie alle installierten PowerShell-Module mit Details wie Name, Version und Typ auf.

Parameters: None

Anwendungsbeispiel:

list_modules()

Befehlshilfe abrufen

Erhalten Sie ausführliche Hilfe zu einem bestimmten PowerShell-Befehl, einschließlich Syntax, Parametern und Beispielen.

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

Anwendungsbeispiel:

get_command_help(command: "Get-Process")

Befehle finden

Suchen Sie nach PowerShell-Befehlen nach Name oder Muster.

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

Anwendungsbeispiel:

find_commands(search: "Process")

Skript ausführen

Führen Sie eine PowerShell-Skriptdatei mit optionalen Parametern aus.

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

Anwendungsbeispiel:

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

Entwicklung

So führen Sie es im Entwicklungsmodus aus:

npm run dev

Erweiterung des Servers

So fügen Sie Ihre eigenen PowerShell-Tools hinzu:

  1. Bearbeiten Sie src/index.ts

  2. Fügen Sie in der Methode registerTools() neue Tools hinzu

  3. Befolgen Sie das vorhandene Muster für eine konsistente Fehlerbehandlung

  4. Erstellen mit npm run build

Hinzufügen eines Werkzeugbeispiels

// 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}`,
          },
        ],
      };
    }
  }
);

Sicherheitsüberlegungen

  • Dieser Server führt PowerShell-Befehle direkt auf Ihrem System aus

  • Befehle werden mit den gleichen Berechtigungen ausgeführt wie der Prozess, der den MCP-Server ausführt

  • Seien Sie vorsichtig, wenn Sie destruktive Operationen offenlegen

  • Erwägen Sie die Implementierung einer zusätzlichen Validierung für vertrauliche Befehle

Fehlerbehebung

Häufige Probleme

  1. Einschränkungen der PowerShell-Ausführungsrichtlinie

    • Möglicherweise müssen Sie Ihre PowerShell-Ausführungsrichtlinie anpassen, um die Skriptausführung zu ermöglichen

    • Verwenden Sie Set-ExecutionPolicy RemoteSigned -Scope CurrentUser um lokale Skripts zuzulassen

  2. Fehler „Pfad nicht gefunden“

    • Stellen Sie sicher, dass die Dateipfade absolut oder relativ zum Arbeitsverzeichnis sind.

    • Verwenden Sie geeignete Pfadtrennzeichen für Ihr Betriebssystem

  3. Fehler „Befehl nicht gefunden“

    • Für einige Befehle müssen möglicherweise bestimmte Module installiert werden

    • Verwenden Sie Install-Module ModuleName um erforderliche Module zu installieren

Lizenz

MIT

Available Tools

6 tools
execute_psD
ParametersJSON Schema
NameRequiredDescriptionDefault
commandYesPowerShell command to execute

TDQS

D1/5.0
Behavior1/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Tool has no description.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness1/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Tool has no description.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness1/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Tool has no description.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters1/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Tool has no description.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose1/5

Does the description clearly state what the tool does and how it differs from similar tools?

Tool has no description.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines1/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Tool has no description.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

find_commandsD
ParametersJSON Schema
NameRequiredDescriptionDefault
searchYesSearch term for PowerShell commands

TDQS

D1/5.0
Behavior1/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Tool has no description.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness1/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Tool has no description.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness1/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Tool has no description.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters1/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Tool has no description.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose1/5

Does the description clearly state what the tool does and how it differs from similar tools?

Tool has no description.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines1/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Tool has no description.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_command_helpD
ParametersJSON Schema
NameRequiredDescriptionDefault
commandYesPowerShell command to get help for

TDQS

D1/5.0
Behavior1/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Tool has no description.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness1/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Tool has no description.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness1/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Tool has no description.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters1/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Tool has no description.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose1/5

Does the description clearly state what the tool does and how it differs from similar tools?

Tool has no description.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines1/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Tool has no description.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_system_infoD
ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

D1/5.0
Behavior1/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Tool has no description.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness1/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Tool has no description.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness1/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Tool has no description.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters1/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Tool has no description.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose1/5

Does the description clearly state what the tool does and how it differs from similar tools?

Tool has no description.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines1/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Tool has no description.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

list_modulesD
ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

D1/5.0
Behavior1/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Tool has no description.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness1/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Tool has no description.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness1/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Tool has no description.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters1/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Tool has no description.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose1/5

Does the description clearly state what the tool does and how it differs from similar tools?

Tool has no description.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines1/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Tool has no description.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

run_scriptD
ParametersJSON Schema
NameRequiredDescriptionDefault
parametersNoOptional parameters to pass to the script
scriptPathYesPath to the PowerShell script file

TDQS

D1/5.0
Behavior1/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Tool has no description.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness1/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Tool has no description.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness1/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Tool has no description.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters1/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Tool has no description.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose1/5

Does the description clearly state what the tool does and how it differs from similar tools?

Tool has no description.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines1/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Tool has no description.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 6 tool updatesv1.0.0
    • First observedexecute_ps
    • First observedfind_commands
    • First observedget_command_help
    • First observedget_system_info
    • First observedlist_modules
    • First observedrun_script

TDQS

C2/5.0

Scored across 6 tools

Disambiguation5/5

Each tool has a clearly distinct purpose with no overlap: execute_ps runs commands, find_commands searches for commands, get_command_help provides documentation, get_system_info retrieves system data, list_modules shows available modules, and run_script executes script files. The verbs and nouns clearly differentiate their functions.

Naming Consistency5/5

All tool names follow a consistent snake_case verb_noun pattern (e.g., execute_ps, find_commands, get_command_help). The naming is uniform throughout with no deviations in style or convention.

Tool Count4/5

With 6 tools, the count is reasonable for a PowerShell server, covering core operations like command execution, help, and system info. It might benefit from additional tools for more advanced PowerShell features, but it's well-scoped for basic functionality.

Completeness3/5

The tools cover essential PowerShell operations like executing commands, getting help, and listing modules, but there are notable gaps such as no tools for managing processes, services, or files, which are common in PowerShell workflows. The surface is functional but incomplete for full domain coverage.

Maintenance

ActivityInactive
ResponsivenessSyncing

Related MCP Connectors

Related MCP Servers

  • A
    license
    B
    quality
    D
    maintenance
    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.
    3
    4 npm
    MIT
  • A
    license
    A
    quality
    F
    maintenance
    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.
    8
    10
    MIT
  • A
    license
    A
    quality
    D
    maintenance
    A comprehensive Model Context Protocol server that enables AI assistants to interact with and manage Windows systems, providing capabilities for file system operations, process management, system information retrieval, registry operations, service management, network diagnostics, and performance monitoring.
    7
    21 npm
    5
    Apache 2.0