PowerShell MCP Server
Servidor MCP de PowerShell
Un servidor de Protocolo de Contexto de Modelo para interactuar con PowerShell. Este servidor proporciona herramientas para ejecutar comandos de PowerShell, recuperar información del sistema, administrar módulos y mucho más.
Requisitos
Node.js 18+
PowerShell 5.1 o PowerShell Core 7+
Related MCP server: Command Executor MCP Server
Instalación
Instalar dependencias:
npm installConstruir el proyecto:
npm run build
Configuración
Para Claude Desktop
Editar configuración: $HOME/Library/Application\ Support/Claude/claude_desktop_config.json
Agregar a mcpServers:
{
"mcpServers": {
"mcp-powershell": {
"command": "node",
"args": [
"/absolute/path/to/mcp-powershell/dist/index.js"
]
}
}
}Para VS Code
Editar configuración: $HOME/Library/Application\ Support/Code/User/settings.json
Agregar a la configuración:
"mcp": {
"servers": {
"mcp-powershell": {
"command": "node",
"args": [
"/absolute/path/to/mcp-powershell/dist/index.js"
]
}
}
}Para Cursor IDE
Editar configuración: $HOME/.cursor/mcp.json
Agregar a mcpServers:
{
"mcpServers": {
"mcp-powershell": {
"command": "node",
"args": [
"/absolute/path/to/mcp-powershell/dist/index.js"
]
}
}
}Herramientas disponibles
Este servidor MCP de PowerShell proporciona las siguientes herramientas:
ejecutar_ps
Ejecute un comando de PowerShell y obtenga el resultado.
Parameters:
- command (string): PowerShell command to executeEjemplo de uso:
execute_ps(command: "Get-Process | Select-Object -First 5")obtener_información_del_sistema
Recupere información detallada del sistema, incluidos detalles del sistema operativo, procesador, memoria y versión de PowerShell.
Parameters: NoneEjemplo de uso:
get_system_info()lista_módulos
Enumere todos los módulos de PowerShell instalados con detalles como nombre, versión y tipo.
Parameters: NoneEjemplo de uso:
list_modules()obtener_ayuda_de_comando
Obtenga ayuda detallada para un comando específico de PowerShell, incluida sintaxis, parámetros y ejemplos.
Parameters:
- command (string): PowerShell command to get help forEjemplo de uso:
get_command_help(command: "Get-Process")comandos_de_búsqueda
Busque comandos de PowerShell por nombre o patrón.
Parameters:
- search (string): Search term for PowerShell commandsEjemplo de uso:
find_commands(search: "Process")ejecutar_script
Ejecute un archivo de script de PowerShell con parámetros opcionales.
Parameters:
- scriptPath (string): Path to the PowerShell script file
- parameters (string, optional): Optional parameters to pass to the scriptEjemplo de uso:
run_script(scriptPath: "/path/to/script.ps1", parameters: "-Name 'Test' -Value 123")Desarrollo
Para ejecutar en modo de desarrollo:
npm run devAmpliación del servidor
Para agregar sus propias herramientas de PowerShell:
Editar
src/index.tsAgregar nuevas herramientas en el método
registerTools()Siga el patrón existente para un manejo consistente de errores
Construir con
npm run build
Ejemplo de adición de una herramienta
// 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}`,
},
],
};
}
}
);Consideraciones de seguridad
Este servidor ejecuta comandos de PowerShell directamente en su sistema
Los comandos se ejecutan con los mismos privilegios que el proceso que ejecuta el servidor MCP
Tenga cuidado al exponerse a operaciones destructivas
Considere implementar una validación adicional para comandos sensibles
Solución de problemas
Problemas comunes
Restricciones de la política de ejecución de PowerShell
Es posible que necesite ajustar su política de ejecución de PowerShell para permitir la ejecución de scripts
Utilice
Set-ExecutionPolicy RemoteSigned -Scope CurrentUserpara permitir scripts locales
Errores de ruta no encontrada
Asegúrese de que las rutas de archivo sean absolutas o relativas al directorio de trabajo
Utilice separadores de ruta adecuados para su sistema operativo
Errores de comando no encontrado
Algunos comandos pueden requerir la instalación de módulos específicos
Utilice
Install-Module ModuleNamepara instalar los módulos necesarios
Licencia
Instituto Tecnológico de Massachusetts (MIT)
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseBqualityDmaintenanceA 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.319MIT
- AlicenseBqualityDmaintenanceA Model Context Protocol server that allows secure execution of pre-approved commands, enabling AI assistants to safely interact with the user's system.11122ISC
- AlicenseAqualityFmaintenanceA 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.810MIT
- AlicenseAqualityDmaintenanceA 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.7265Apache 2.0
Related MCP Connectors
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
A Model Context Protocol server for Wix AI tools
Personal assistant MCP server with search, execute, packages, jobs, secrets, and integrations.
Appeared in Searches
- Excel and Visual Basic permissions for reading, writing, updating, and deleting data in spreadsheets
- MCP servers for retrieving system information
- MCP servers for monitoring application power and memory usage on Windows and macOS
- MCP server for real-time console interaction and log monitoring in Cursor IDE
- Assistance with PowerShell Commands or Scripts
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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