PowerShell.MCP v1.7.4 - Orphaned Console Detection, Register Cmdlets & Robustness Improvements
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-PwshToClaudeCodechecks forclaudeCLI availability before executing
LineRange Parameter Upgrade
LineRangetype changed fromstringtostring[]— 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_consolerenamed tostart_consoleacross all tools, prompts, and error messagesreasonparameter 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
reasonparameter: omitting it now prefers reusing existing standby consoles
Error Handling Hardened
- Fire-and-forget
ClaimConsoleAsyncnow logs exceptions viaContinueWith - Mutex operations use
WaitOne(timeout)with safeReleaseMutexpattern CleanupCategorycatch narrowed toIOException/UnauthorizedAccessException- Cancellation token check added in pipe discovery polling loop
- Silent
catchblocks inPowerShellServiceandMCPModuleInitializernow log to stderr IsModuleInstalledguards against missingC:\Program Files\PowerShelldirectory- Inner exception preserved in
McpExceptionwrapping
Other
Set-Content/Add-Contenterror messages now recommendAdd-LinesToFilewith examples- Markdown hint regex extended to match
.markdownextension - 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-PwshToClaudeDesktopcmdlets for one-command setup - ✨
LineRangetype upgraded tostring[]— comma syntax works without quoting - 🔧 Tool renamed:
start_powershell_console→start_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.MCPLinux / macOS
# Install
Install-PSResource PowerShell.MCP
# Set execute permission
chmod +x (Get-MCPProxyPath)Update MCP Configuration
For Claude Code:
Register-PwshToClaudeCodeFor Claude Desktop:
Register-PwshToClaudeDesktopFor 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