Skip to content

PowerShell.MCP v1.7.4 - Orphaned Console Detection, Register Cmdlets & Robustness Improvements

Choose a tag to compare

@yotsuda yotsuda released this 28 Mar 16:14
· 66 commits to main since this release

Orphaned Console Detection, Register Cmdlets & Robustness Improvements

Consoles now detect when their parent AI proxy dies and automatically become available for reuse. New Register-Pwsh* cmdlets simplify MCP client configuration. Tool renamed from start_powershell_console to start_console.

✨ New Features

Proxy Liveness Detection

  • Consoles monitor their parent proxy PID every ~5 seconds via pipe name inspection
  • When the proxy process dies (e.g., AI client is closed), the console automatically:
    • Reverts to unowned state (available for the next proxy to claim)
    • Updates window title to #PID ____ to indicate waiting state
    • Displays a disconnect message: "AI session disconnected. Waiting for next connection."
  • On the next AI session, the orphaned console is discovered and reused instead of creating a new window

Register-PwshToClaudeCode / Register-PwshToClaudeDesktop

  • One-command MCP client registration — no manual path copying or JSON editing
  • Registers as "pwsh" — shorter to type in prompts (e.g., "use pwsh" instead of "use PowerShell")
  • Automatically migrates legacy "PowerShell" entry to the new "pwsh" server name
  • Register-PwshToClaudeCode checks for claude CLI availability before executing

LineRange Parameter Upgrade

  • LineRange type changed from string to string[] — comma syntax (-LineRange 10,20) now works without quoting
  • Added validation to reject ambiguous multi-dash input (e.g., 10-20-30)

🔧 Improvements

Tool Renamed: start_console

  • start_powershell_console renamed to start_console across all tools, prompts, and error messages
  • reason parameter description strengthened to reduce unnecessary console creation

Console Reuse Improvements

  • Console title set before reading location on reuse, so status line shows the new name immediately
  • Stricter reason parameter: omitting it now prefers reusing existing standby consoles

Error Handling Hardened

  • Fire-and-forget ClaimConsoleAsync now logs exceptions via ContinueWith
  • Mutex operations use WaitOne(timeout) with safe ReleaseMutex pattern
  • CleanupCategory catch narrowed to IOException/UnauthorizedAccessException
  • Cancellation token check added in pipe discovery polling loop
  • Silent catch blocks in PowerShellService and MCPModuleInitializer now log to stderr
  • IsModuleInstalled guards against missing C:\Program Files\PowerShell directory
  • Inner exception preserved in McpException wrapping

Other

  • Set-Content/Add-Content error messages now recommend Add-LinesToFile with examples
  • Markdown hint regex extended to match .markdown extension
  • Version mismatch error message now suggests Register-PwshToClaudeCode/Register-PwshToClaudeDesktop
  • macOS CI: install PowerShell from GitHub Release instead of broken Homebrew tap/cask

📊 What's Changed Since v1.7.3

  • ✨ Proxy liveness detection: orphaned consoles auto-revert to unowned state for reuse
  • Register-PwshToClaudeCode / Register-PwshToClaudeDesktop cmdlets for one-command setup
  • LineRange type upgraded to string[] — comma syntax works without quoting
  • 🔧 Tool renamed: start_powershell_consolestart_console
  • 🔧 Error handling hardened across proxy and module (mutex, logging, cancellation)
  • 🔧 Console title set before location read on reuse
  • 🔧 macOS CI fixed (Homebrew → GitHub Release)

🔄 Installation & Upgrade

Windows

# New installation
Install-PSResource PowerShell.MCP

# Upgrade existing
Update-PSResource PowerShell.MCP

Linux / macOS

# Install
Install-PSResource PowerShell.MCP

# Set execute permission
chmod +x (Get-MCPProxyPath)

Update MCP Configuration

For Claude Code:

Register-PwshToClaudeCode

For Claude Desktop:

Register-PwshToClaudeDesktop

For other MCP clients: Run Get-MCPProxyPath -Escape to get the JSON-escaped executable path, then add it to your client's configuration file manually.

Restart your MCP client after updating.


📖 Full Documentation: https://github.com/yotsuda/PowerShell.MCP

💬 Questions? GitHub Discussions | 🐞 Report Issues: GitHub Issues