Skip to main content

Win MCP Server

Python 3.10+ License: MIT Pylint Safety Security Scan Dependency Security Check

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.

Features

  • 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

Installation

pip install win-mcp-server

From Source

git clone https://github.com/rorymcmahon/win-mcp-server.git
cd win-mcp-server
pip install -e .

Configuration

Prerequisites

  1. WinRM Configuration: Ensure target Windows hosts have WinRM enabled and configured.

  2. Credential Setup: The server will prompt for credentials on first use and cache them securely in macOS Keychain with 4-hour expiration.

    For non-interactive/CI environments you can skip the prompt entirely by setting environment variables. When both are present they take precedence over any cached Keychain entry:

    export WINRM_USER="myuser"
    export WINRM_PWD="mypassword"
    

    The hyphenated names WINRM-USER / WINRM-PWD are also accepted if your launcher can set them.

MCP Configuration

Add to your MCP settings file (e.g., ~/.config/mcp/settings.json):

{
  "mcpServers": {
    "winrm": {
      "command": "winrm-mcp-server"
    }
  }
}

Available Tools

setup_credentials(hostname: str)

Setup credentials for a Windows host (interactive mode).

Parameters:

  • hostname: The target Windows hostname (FQDN)

Returns:

  • status: Success or error status
  • message: Confirmation message

execute_powershell(hostname: str, command: str)

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 command
  • stdout: Standard output from the command
  • stderr: Standard error from the command

get_system_info(hostname: str)

Get basic system information from a Windows host.

Returns: JSON with Windows product name, total physical memory, and processor information.

get_running_services(hostname: str)

Get list of running services from a Windows host.

Returns: JSON array of running services with name, status, and start type.

get_disk_space(hostname: str)

Get disk space information from a Windows host.

Returns: JSON array of logical disks with device ID, total size, and free space in GB.

Usage Examples

Initial Setup

"Setup credentials for server01.domain.local"

Basic System Check

"Get system info and disk space for server01.domain.local"

Service Management

"Check if IIS is running on webserver.domain.local"
"Get running services on server01.domain.local"

Custom PowerShell Commands

"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"

Security

  • 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

Development

Setup Development Environment

git clone https://github.com/rorymcmahon/winrm-mcp-server.git
cd winrm-mcp-server
pip install -e ".[dev]"

Running Tests

pytest

Code Formatting

black src/
isort src/

Requirements

  • Python 3.10+
  • macOS (for Keychain integration)
  • Target Windows hosts with WinRM enabled

License

MIT License - see LICENSE file for details.

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. Submit a pull request

Support

For issues and questions:

Metadata

Release files for win-mcp-server 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for win-mcp-server 0.3.0
File Size Uploaded Provenance Actions
win_mcp_server-0.3.0.tar.gz 15.0 kB Without provenance Details for win_mcp_server-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for win-mcp-server 0.3.0
File Interpreter ABI Platform Actions
win_mcp_server-0.3.0-py3-none-any.whl Python 3 none any Details for win_mcp_server-0.3.0-py3-none-any.whl

Total release size: 26.2 kB

Release files / win_mcp_server-0.3.0.tar.gz

Download URL win_mcp_server-0.3.0.tar.gz
Size 15.0 kB
Tags Source
SHA-256 checksum
How to use checksums
4be16fcda9ab143bad3e56fa15628020b914e2783e5ad02de72b55a9aed8731c
BLAKE2b-256 checksum
How to use checksums
faedb05c16882fb122c1cfb4a59ef87f7b5f6236e9396adcce64218f7d383598
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / win_mcp_server-0.3.0-py3-none-any.whl

Download URL win_mcp_server-0.3.0-py3-none-any.whl
Size 11.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f4c36f9f903d058c5712aa89cff09c3af5909e551a20b565f47aff966f718b86
BLAKE2b-256 checksum
How to use checksums
eec0147be8a57f71af1978fa71d8d2a66a9671175add8fa2184227ab4ef0323e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Security for win-mcp-server 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page