Skip to content

Releases: yotsuda/PowerShell.MCP

v1.12.0

Choose a tag to compare

@github-actions github-actions released this 01 Jul 12:24

New Features

  • cancel tool — stops whatever command is currently running in the agent's active console. It ends a runaway or long-running PowerShell command (Start-Sleep, a loop, a slow cmdlet), and sends Ctrl+C to break out of a native CLI that is looping or waiting for input (git/npm/ssh/ping). A command that is stuck in an operation that can't be interrupted (e.g. [Threading.Thread]::Sleep, a blocking socket or file read) may not stop — use close_console. A PowerShell prompt waiting for you to type something (Read-Host, a missing required parameter, Get-Credential) also can't be canceled — answer it at the console or use close_console. The console itself stays alive and ready for the next command.
  • close_console tool — terminates a session-owned console by PID; use it to abandon a console stuck on a host prompt that cannot be answered programmatically.

Behavior Changes

  • The invoke_expression MCP tool is renamed to execute_command. The old name implied the Invoke-Expression cmdlet (which the tool never actually used) and tripped AMSI / antivirus security heuristics. Behavior and the pipeline parameter are unchanged. Migration: if you pinned the tool in an MCP permission allowlist (e.g. mcp__PowerShell__invoke_expression), update it to execute_command.
  • Interactive prompts no longer wedge the console. When an AI-run command hits a PowerShell host prompt (Read-Host, a missing mandatory parameter, Get-Credential, a confirmation), control returns to the AI immediately instead of waiting out the full timeout, with guidance to answer at the console or close it. The command stays blocked so a human can still answer at the terminal.

Improvements

  • The console reacts almost instantly when its AI session goes away. When the AI process that owns a console exits (you close the client, it crashes, or the session ends), the console now shows the "AI session disconnected" notice and clears its #PID ____ title within ~100ms instead of taking up to ~5s. It reacts to the process actually exiting rather than waiting for the next slow health-check poll.
  • File edits no longer fail across drives, and keep the right permissions (#51). Add-LinesToFile, Update-LinesInFile, Update-MatchInFile, and Remove-LinesFromFile now write their temporary file in the same folder as the file being edited. This keeps the final swap a rename within one drive — fixing the "not same device" failure that happened when the temp file landed on a different drive — and lets a newly created file inherit its folder's permissions.

Internal

  • Completed the execute_command rename through the Named Pipe wire protocol, DTOs, and handlers (previously only the MCP tool surface was renamed).
  • Translated the remaining Japanese documentation and test names/comments to English.

v1.11.0

Choose a tag to compare

@github-actions github-actions released this 23 Jun 10:49

New Features

  • Restart-MCPServer command to retry starting the console engine in the affected console — no need to restart PowerShell.

Behavior Changes

  • Resume-safe console handling (new server session). On the proxy's first console attach after a (re)start — the resume / cold-start boundary, where the runtime is fresh but the AI still carries cwd/variable/module assumptions from earlier in the conversation — invoke_expression normalizes the working directory to $HOME and announces a new server session (with a one-line restore hint for a reclaimed console's prior cwd), while get_current_location / start_console preserve the console's current cwd and only announce. This stops a resumed session from silently running at an unexpected cwd or relying on state that didn't carry over.
  • Reuse-first console acquisition. Without a reason, start_console now reclaims any available console — an owned standby or an unowned one (a prior session's released console, or a user-started one) — and only launches a new window when nothing is available. Previously an unowned console was reclaimed only when start_location was given; that guard is gone (the new-session normalization above handles the cwd concern), so the desktop no longer fills with console windows.

Bug Fixes

  • Reduced an AMSI / antivirus false positive that could block startup (#50). The embedded polling engine no longer uses Invoke-Expression. Its three call sites only wrapped literal strings (cmdlet/type resolution is already deferred to runtime, and each was inside try/catch), so they added nothing but the single highest-weighted AMSI heuristic token — which helped the engine script get flagged as malicious at Import-Module. They are now direct calls; the engine contains zero Invoke-Expression.
  • No more spurious "cwd changed" warnings caused by the AI's own work. A directory change left by an AI command (including one harvested in the background via wait_for_completion) is now recorded, so the next command no longer misreads it as a user-typed cd. Paths that differ only by a trailing separator (C:\proj vs C:\proj\) no longer trip a false drift warning either.
  • A disconnected AI session no longer leaks its output to the next one. When the owning AI goes away, the console discards its undrained cached output and returns to a clean standby state, so a freshly-connecting AI can't drain the previous session's results.
  • Fixed a possible NullReferenceException when resolving a console's display name while no pipe was active.

Improvements

  • Graceful degradation when the engine is blocked at startup. If an antivirus/AMSI scan blocks the embedded engine during Import-Module (often transient), the module now stays loaded and emits one actionable warning instead of failing with a bare error. While the engine is down, commands fast-fail with guidance (run Restart-MCPServer) instead of hanging until the request times out.
  • A green AI session connected. line is now shown when the AI claims or spawns a console — the visible counterpart to the yellow AI session disconnected notice.
  • Get-MCPOwner and Restart-MCPServer share one PowerShell.MCP.Status output type with identical columns (EngineReady / Owned / ProxyPid / AgentId / ClientName / LastError).

Internal

  • Hardened console launching: the Windows init command is built from the shared helper (escaping the agent id like the other platforms), console-readiness checks go through a single PipeStatus.IsReady definition, and dead launcher code was removed.
  • Release safety gates: tagged releases now run the full unit suite (net8.0 + net9.0) and an Import-Module smoke test of the assembled package before publishing to PSGallery; a missing CHANGELOG section fails fast; PRs are gated and the polling engine is checked to stay free of Invoke-Expression (the #50 regression guard).
  • Expanded automated tests: multi-console identity/routing, per-agent isolation, cross-AI console visibility (via real named pipes), cwd-drift detection and normalization, the resume / first-attach new-session treatment, and engine graceful-degradation.

v1.10.0

Choose a tag to compare

@github-actions github-actions released this 17 Jun 22:22

New Features

  • --no-profile flag for lean interactive consoles (#49, thanks @sharpninja). Pass --no-profile in the MCP server's args and the interactive launchers (Windows / macOS / Linux) start pwsh with -NoProfile, skipping the user's $PROFILE (prompt, aliases, PSReadLine, theme). Default off — those consoles are real human-facing shells, so the profile loads unless the operator opts out. One line in the client config makes every console the server launches lean.

Behavior Changes

  • The headless / CI launcher always starts pwsh with -NoProfile, independent of the --no-profile flag. It only runs when no terminal emulator is available — no window, stdout redirected — so there is no interactive experience to preserve, and a profile there only adds nondeterminism, startup latency, and the risk of blocking on input (e.g. Read-Host) in a process with no console.

Internal

  • Launcher command-line construction is centralized in shared per-platform Build* helpers (#49); -NoProfile is emitted from a single noProfile-gated point per interactive platform, covered by unit tests for both flag states plus the always-on headless path.

v1.9.0

Choose a tag to compare

@github-actions github-actions released this 09 Jun 11:55

Highlights

AI working-directory tracking now follows Set-Location correctly, and the elevation consent prompt is gone. Pre-1.9 the DLL tracked the OS process cwd, but PowerShell's Set-Location moves only $PWD / the PSDrive — so once the AI cd'd anywhere, cwd tracking was silently pinned to the startup directory, and busy-route / auto-start spawned new consoles at $HOME instead of resuming the AI's workspace. That tracking is now correct. Separately, the sudo / runas / gsudo Y/N consent prompt has been removed (#48) — it blocked unattended use, was never a real security boundary, and PowerShell.MCP's safety model is the visible, human-watched console.

Behavior Changes

  • Removed the sudo / runas / gsudo elevation consent prompt (#48). The Read-Host Y/N gate hung with no human to answer under unattended / SSH-admin use, and was never a real security boundary: any startup-read flag is settable by the agent itself and inherited by a freshly spawned console, so the gate never actually contained a misaligned agent. PowerShell.MCP's real safety model is the visible, human-watched console; singling out elevation was arbitrary, and the matching regex also misfired on incidental mentions of sudo.

Improvements

  • PSDrive-aware working-directory tracking. The DLL now captures $PWD on the polling engine's home thread (instead of the OS process cwd, which Set-Location never updates) and uses it for every cwd-emitting response — busy, status, and post-execution success / timeout / completed. Busy-route and auto-start now resume the AI's actual workspace instead of $HOME. User-cd drift between AI calls is handled safety-first: the proxy returns a Pipeline NOT executed notice carrying prev → new cwd and a single-quote-escaped Set-Location revert hint, rather than silently auto-cd'ing.

Bug Fixes

  • Tab-completion menus no longer mojibake on CJK Windows. Consoles created via CREATE_NEW_CONSOLE inherited the system code page (932 / 936 / 949 on JP / CN / KR Windows). A shared encoding prelude now runs chcp 65001 plus the [Console]::*Encoding sets before PSReadLine loads, so e.g. Japanese asset names render cleanly in a Get-OrchAsset <Tab> menu.
  • Sub-agents no longer lose their 🔑 agent_id notice. The notice — a freshly allocated sub-agent's only way to learn its own ID — was emitted on just a few return paths; a sub-agent whose first call landed on a timeout / cached / error / drift-bail branch could lose its ID forever. Every return now routes through one helper that prepends the notice exactly when the ID was newly allocated.
  • Remove-LinesFromFile preserves the trailing newline when the last line is removed. Deleting the final line of a file with a CRLF tail previously dropped the tail.
  • -Encoding gb18030 no longer collapses to GB2312. GB18030 (CP 54936) is a 4-byte Unicode superset; it was aliased to CP 936 (GBK), which silently substituted out-of-GBK 4-byte CJK characters with ?. It now resolves to CP 54936.
  • Regex display and combined -Contains -Pattern matching corrected. Update-MatchInFile regex mode now expands $1 / $2 capture-group references in the AI-visible display (the written file and -WhatIf path were already correct). Show-TextFiles and Remove-LinesFromFile now wrap each side of the combined Contains | Pattern regex in a non-capturing group, so a Pattern with top-level alternation or a {0,3}-style quantifier no longer matches every line.
  • Proxy-liveness poll no longer leaks process handles. GetProcessById returns a Process holding an OS handle; it is now disposed on every ~5 s poll instead of waiting on the GC finalizer.

Internal

  • Full-codebase review cleanup: removed an unreachable prompt-localization overload (WithLocalizedPromptsFromAssembly + LocalizedParameterNameAttribute), dead helpers, stale comments, a doc-comment segment-count error, and a literal typo — no behavior change.
  • Test / CI reliability: each test instance now allocates a unique sub-agent id to deflake parallel xunit runs; the Linux Named-Pipe integration test was updated for the same-call switch-and-execute shape; the CwdDrift revert-hint assertion was made platform-agnostic.
  • Dropped the orphan dist/PowerShell.MCP.psm1 snapshot and added an explicit dist/ gitignore rule — Staging/ is the only module source.

v1.8.0

Choose a tag to compare

@github-actions github-actions released this 02 May 10:46

Highlights

Verbose / Debug / native exe stderr are now visible to the AI. Pre-1.8 the tool description explicitly told you "Verbose and Debug streams are NOT visible to you" and native exe stderr (e.g. cmd /c '... 1>&2') was effectively swallowed. They now appear in the AI response in the same time-ordered position as everything else — closing the AI's biggest documented blind spot in the Output→Error→Warning→Verbose→Debug capture surface.

New Features

  • Hybrid stream capture: chronological pipeline replaces bucketed sections. Output, Error, Warning, Verbose, and Debug records now interleave in a single time-ordered text block in the AI response — the AI sees each event in its actual position relative to surrounding output. Pre-1.8 the four separate === ERRORS === / === WARNINGS === etc. sections lost the "warning fired between step-A and step-B, then the error hit" context.
  • Five output channels that used to bypass the AI's view are now captured:
    • Write-Verbose (was the AI's blind spot that the tool description explicitly called out as "Verbose and Debug streams are NOT visible to you").
    • Write-Debug (same).
    • [Console]::WriteLine / [Console]::Error.WriteLine direct writes (and any .NET interop that writes to System.Console without going through PowerShell streams) → new === CONSOLE.OUT (direct) === / === CONSOLE.ERR (direct) === sections.
    • Native exe stderr (cmd /c "..."-style) → ErrorRecord in the chronological pipeline, in emit order alongside surrounding output.
    • What if: text from $PSCmdlet.ShouldProcess and direct $Host.UI.WriteLine calls → new === HOST.UI (direct) === section.
  • Auto-route on busy console. When invoke_expression finds the chosen PowerShell console busy with a user-typed or another AI command, the proxy now spawns a new console at the source's cwd and re-runs the pipeline there in the same tool call. Pre-1.8 the AI got Pipeline NOT executed - verify location and re-execute and had to re-send manually with whatever cwd they wanted, costing two MCP round-trips for every busy race.
  • LastExit: N status-line tag surfaces the case where a pipeline overall succeeded ($? is true) but a native exe within it returned non-zero. The green ✓ badge no longer silently hides those signals.

Bug Fixes

  • get_current_location now sets the window title when it claims an unowned console. Pre-fix, an AI whose first tool call was get_current_location (instead of invoke_expression or start_console, both of which already handled this) left the user's pre-existing Import-Module PowerShell.MCP console with the placeholder title #PID ____ until some later tool call redrew it. Symptom appeared intermittently depending on which tool the AI happened to call first.

Improvements

  • Real-time streaming preserved through the new capture wiring — items render to the visible console as they arrive, not collected and rendered after the pipeline finishes.
  • Color preserved on the visible console for every stream type: red Write-Error, yellow WARNING:, yellow VERBOSE: / DEBUG: prefixes, and Write-Host's user-chosen ForegroundColor.
  • Write-Progress keeps rendering on the visible console for AI-initiated commands (Compress-Archive, Invoke-WebRequest, etc.) so the user can watch progress. Each redraw of pwsh 7's "Minimal" Progress view also writes the bar text to Console.Out; the polling engine recognizes those overlay blocks by their reverse-video bracketed-status framing — an ANSI SGR escape, then [, then a reverse-video toggle (ESC[7mESC[27m), then ] and reset (ESC[0m) — and strips them from the captured === CONSOLE.OUT (direct) === buffer before surfacing to the AI, so the response stays clean.

Internal

  • New TeeTextWriter for [Console]::Out / [Console]::Error tee, written to in parallel with the original streams so visible-console output is unaffected.
  • New TeePSHostUserInterface decorator wrapping $Host.UI (reflected swap on _externalUI) for host-UI-level capture of Write/WriteLine paths that bypass both PowerShell streams and [Console]::Out.
  • Stream merge map widened to 2>&1 3>&1 4>&1 5>&1. Stream 6 (Information) remains unmerged so Write-Host's user-chosen ForegroundColor survives to the visible console.
  • Single shared BuildInitCommand now drives the PowerShell init script for every non-Windows launcher (macOS tempFile, Linux Base64-encoded terminal launch, Linux headless ArgumentList path). Each platform keeps its own delivery mechanism for documented reasons — AppleScript echo on macOS, multi-shell quoting on Linux — but the script body and its single-quote escaping are now built in one place. xUnit pins the escaping for every platform that calls the helper.

PowerShell.MCP v1.7.7 - Authenticode-Signed Windows Binaries

Choose a tag to compare

@yotsuda yotsuda released this 18 Apr 02:45

Authenticode-Signed Windows Binaries

PowerShell.MCP.dll and PowerShell.MCP.Proxy.exe (win-x64) are now Authenticode-signed with the yotsuda code-signing certificate. This unblocks installation on machines with Windows Defender Application Control (WDAC) / Device Guard policies that require trusted publisher signatures.

The same certificate signs binaries across all yotsuda OSS projects, so trusting it once covers future releases of all of them.

Closes #46 — thanks @rblinton for the report!

What's New

Authenticode signing (Windows binaries)

Windows binaries are now signed with a self-signed certificate. The public certificate (yotsuda.cer) and full installation instructions for personal PCs, Active Directory domains, and WDAC environments are published at:

https://github.com/yotsuda/code-signing

Verify a signed binary on your machine:

Get-AuthenticodeSignature `
    "$((Get-Module PowerShell.MCP -ListAvailable).ModuleBase)\bin\win-x64\PowerShell.MCP.Proxy.exe"

The signer thumbprint should match the values below.

Certificate details

Field Value
Subject CN=yotsuda, O=Yoshifumi Tsuda, C=JP
Validity 2026-04-18 to 2036-04-18
Thumbprint (SHA-1) 74E5208228DFB12A067747D536BF497B6E98C73C
Thumbprint (SHA-256) ABCE0AFEE35BD19EE1DF8F16E64436439516DDC3FD40229EA7786A8B23BC8013

Note on other platforms: Authenticode is Windows-specific. macOS and Linux binaries are not signed in this release — their security models differ (macOS uses Gatekeeper/notarization with a paid Apple Developer ID; Linux has no comparable system enforcement).

Third-party license notices (Ude.NetStandard)

The bundled Ude.NetStandard.dll (used for character set detection) is redistributed under LGPL-2.1. The full license text and attribution are now included in the module under licenses/Ude.NetStandard/ and THIRD_PARTY_NOTICES.md.

Status line fix (multi-line pipelines)

Pipelines with leading newlines previously rendered a useless Pipeline: ... (or empty Pipeline:) in the status line. Status line truncation now strips leading whitespace before extracting the first line, so multi-line scripts are summarized correctly.

macOS console launch fix (Terminal.app / zsh quoting)

On macOS, Terminal.app's zsh parsed ''default'' in the spawned pwsh -Command argument as the bareword default, breaking $global:PowerShellMCPAgentId assignment and the IPC handshake — so the MCP connection would briefly show "Connected" and then drop. The init command is now written to a temp .ps1 file and executed with pwsh -File, avoiding shell quoting entirely. Same class of bug as #39 (Linux), now fixed for macOS.

Closes #45 — thanks @ben1440 for the detailed report with reproduction steps and the pointer to the Linux fix, and @mikenelson-io for confirming the issue!


What's Changed Since v1.7.6

  • Authenticode signing for PowerShell.MCP.dll and PowerShell.MCP.Proxy.exe (win-x64)
  • Build-AllPlatforms.ps1 gains a -Sign switch (off by default; signing only happens on publish builds, with the PFX passphrase prompted interactively)
  • licenses/Ude.NetStandard/ and THIRD_PARTY_NOTICES.md added (LGPL-2.1 compliance for bundled Ude.NetStandard.dll)
  • README: new "Enterprise Deployment (WDAC / Device Guard)" section linking to the code-signing repo
  • Status line: leading whitespace/newlines no longer collapse the displayed pipeline to ... or empty
  • macOS: Terminal.app/zsh quoting fix — init script now delivered via temp .ps1 file to avoid ''default'' bareword parsing (closes #45)

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

Internal: issue #45 macOS test artifact

Pre-release

Choose a tag to compare

@yotsuda yotsuda released this 17 Apr 04:12

Temporary pre-release for macOS E2E testing. Not for distribution.

PowerShell.MCP v1.7.6 - -Skip/-First Compatibility for All Line-Range Cmdlets

Choose a tag to compare

@yotsuda yotsuda released this 05 Apr 14:22
a46fb98

-Skip/-First Compatibility for All Line-Range Cmdlets

AI agents frequently attempt -Skip/-First (the standard PowerShell paging idiom) before discovering that PowerShell.MCP uses -LineRange. This release adds -Skip/-First as compatibility parameters across all four line-range cmdlets, so the first attempt just works.

Closes #41 — thanks @doraemonkeys for the suggestion!

What's New

-Skip/-First Compatibility (Show-TextFiles, Remove-LinesFromFile, Update-LinesInFile, Update-MatchInFile)

All cmdlets that accept -LineRange now also accept -Skip and -First. The parameters are mapped to -LineRange internally:

# These are equivalent:
Show-TextFiles file.txt -Skip 200 -First 50
Show-TextFiles file.txt -LineRange 201-250

# -First alone:
Show-TextFiles file.txt -First 20
Show-TextFiles file.txt -LineRange 1-20

# -Skip alone (to end of file):
Show-TextFiles file.txt -Skip 100
Show-TextFiles file.txt -LineRange 101,-1

# Works with all four cmdlets:
Remove-LinesFromFile file.txt -Skip 10 -First 5
Update-LinesInFile file.txt -Skip 3 -First 2 -Content "A", "B"
Update-MatchInFile file.txt -OldText "foo" -Replacement "bar" -First 20

Design decisions:

  • -LineRange remains the canonical interface
  • -Skip/-First cannot be mixed with -LineRange

What's Changed Since v1.7.5

  • -Skip/-First compatibility parameters added to Show-TextFiles, Remove-LinesFromFile, Update-LinesInFile, Update-MatchInFile
  • PlatyPS help updated for new parameters

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

PowerShell.MCP v1.7.5 - PromptAI Companion Module, Closed-Console Detection & MSIX Fix

Choose a tag to compare

@yotsuda yotsuda released this 01 Apr 21:35

PromptAI Companion Module, Closed-Console Detection & MSIX Fix

New companion module PromptAI brings Invoke-Claude, Invoke-GPT, and Invoke-Gemini to the console. Closed-console detection is overhauled so errors surface immediately and clearly. Register-PwshToClaudeDesktop now works correctly on MSIX (Microsoft Store) installs of Claude Desktop.

🐛 Bug Fixes

MSIX Detection in Register-PwshToClaudeDesktop

  • Previously always wrote to %APPDATA%\Claude\, which MSIX (Microsoft Store) installs of Claude Desktop don't read
  • Now detects MSIX by checking for the package directory (%LOCALAPPDATA%\Packages\Claude_*) and writes to the correct virtualized path

Closed-Console Detection Overhaul

  • Closed consoles are now reported immediately when pipe communication fails, not deferred
  • Fixed duplicate closed-console messages in AllPipesStatusInfo
  • Fixed start_console not reporting closed consoles when reusing a standby pipe
  • Fixed duplicate message when active pipe PID was in KnownBusyPids
  • Error messages now show the console display name (e.g., #1234 MyFolder) instead of raw pipe names

📦 PromptAI Module

A new companion module PromptAI adds Invoke-Claude, Invoke-GPT, and Invoke-Gemini cmdlets for calling AI APIs directly from PowerShell. Responses stream to the console in real time, pipe cleanly to other cmdlets, and are returned to the MCP client without duplication. This also enables AI-to-AI communication — an MCP client can call other AI models through the console and use their responses as part of its own workflow:

Install-PSResource PromptAI

🔧 Improvements

  • PlatyPS help migrated to v2 (Microsoft.PowerShell.PlatyPS 1.0.1)
  • Fixed flaky macOS test: isolated agent ID to prevent parallel test class interference

📊 What's Changed Since v1.7.4

  • 📦 New companion module PromptAI: Invoke-Claude / Invoke-GPT / Invoke-Gemini cmdlets
  • 🐛 Register-PwshToClaudeDesktop now correctly detects MSIX installs without existing config file
  • 🐛 Closed-console detection: immediate reporting, no duplicates, display names in errors
  • 🔧 PlatyPS v2 migration
  • 🔧 Test stability fix for macOS CI

🔄 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

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

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