A Model Context Protocol (MCP) server that provides AI agents with the ability to interact with Windows servers using Windows Remote Management (WinRM). This server enables secure remote PowerShell execution and system management tasks on Windows hosts.
- Secure Authentication: Uses domain credentials stored in macOS Keychain with TouchID authentication
- PowerShell Execution: Execute arbitrary PowerShell commands on remote Windows hosts
- System Information: Get basic system information, running services, and disk space
- Error Handling: Comprehensive error handling with helpful error messages
- Memory Safety: Credentials are cleared from memory immediately after use
pip install win-mcp-servergit clone https://github.com/rorymcmahon/win-mcp-server.git
cd win-mcp-server
pip install -e .-
WinRM Configuration: Ensure target Windows hosts have WinRM enabled and configured.
-
Credential Setup: The server will prompt for credentials on first use and cache them securely in macOS Keychain with 4-hour expiration.
Add to your MCP settings file (e.g., ~/.config/mcp/settings.json):
{
"mcpServers": {
"winrm": {
"command": "winrm-mcp-server"
}
}
}Setup credentials for a Windows host (interactive mode).
Parameters:
hostname: The target Windows hostname (FQDN)
Returns:
status: Success or error statusmessage: Confirmation message
Execute arbitrary PowerShell commands on a remote Windows host.
Parameters:
hostname: The target Windows hostname (FQDN)command: PowerShell command to execute
Returns:
status: Exit code of the commandstdout: Standard output from the commandstderr: Standard error from the command
Get basic system information from a Windows host.
Returns: JSON with Windows product name, total physical memory, and processor information.
Get list of running services from a Windows host.
Returns: JSON array of running services with name, status, and start type.
Get disk space information from a Windows host.
Returns: JSON array of logical disks with device ID, total size, and free space in GB.
"Setup credentials for server01.domain.local""Get system info and disk space for server01.domain.local""Check if IIS is running on webserver.domain.local"
"Get running services on server01.domain.local""Run 'Get-EventLog -LogName System -Newest 10' on server01.domain.local"
"Execute 'Get-Process | Sort-Object CPU -Descending | Select-Object -First 10' on server01.domain.local"- Credential Storage: Domain credentials are securely stored in macOS Keychain
- TouchID Authentication: Credentials require TouchID authentication for access
- Memory Safety: Passwords are immediately cleared from memory after use
- Transport Security: Uses NTLM authentication over HTTP (configurable for HTTPS)
- Automatic Expiration: Cached credentials expire after 4 hours
- Secure Prompting: Password input is hidden and never logged
git clone https://github.com/rorymcmahon/winrm-mcp-server.git
cd winrm-mcp-server
pip install -e ".[dev]"pytestblack src/
isort src/- Python 3.10+
- macOS (for Keychain integration)
- Target Windows hosts with WinRM enabled
MIT License - see LICENSE file for details.
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
For issues and questions: