Releases: yotsuda/PowerShell.MCP
PowerShell.MCP v1.7.7 - Authenticode-Signed Windows Binaries
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.dllandPowerShell.MCP.Proxy.exe(win-x64) Build-AllPlatforms.ps1gains a-Signswitch (off by default; signing only happens on publish builds, with the PFX passphrase prompted interactively)licenses/Ude.NetStandard/andTHIRD_PARTY_NOTICES.mdadded (LGPL-2.1 compliance for bundledUde.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
.ps1file to avoid''default''bareword parsing (closes #45)
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
Internal: issue #45 macOS test artifact
Temporary pre-release for macOS E2E testing. Not for distribution.
PowerShell.MCP v1.7.6 - -Skip/-First Compatibility for All Line-Range Cmdlets
-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 20Design decisions:
-LineRangeremains the canonical interface-Skip/-Firstcannot be mixed with-LineRange
What's Changed Since v1.7.5
-Skip/-Firstcompatibility parameters added toShow-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.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
PowerShell.MCP v1.7.5 - PromptAI Companion Module, Closed-Console Detection & MSIX Fix
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_consolenot 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-Geminicmdlets - 🐛
Register-PwshToClaudeDesktopnow 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.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
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
PowerShell.MCP v1.7.3 - Text Cmdlet Improvements, Console Naming & MarkdownPointer Hint
Text Cmdlet Improvements, Console Naming & MarkdownPointer Hint
Text file cmdlets get improved parameters, console display is unified, and a new one-time hint promotes the MarkdownPointer module.
✨ New Feature
One-Time MarkdownPointer Module Hint
- When
invoke_expressionoutput contains.mdfile references, a hint message is appended to the response (Windows only) - The hint is shown once per session to avoid being noisy
- MarkdownPointer — Vibe editing for Markdown with Mermaid/KaTeX support and MCP server integration
- Message varies based on installation status:
- Installed: Suggests using
mdp .\README.mdto render and preview, mentions MCP server integration - Not installed: Suggests
Install-Module MarkdownPointerandGet-Command -Module MarkdownPointerto explore commands after installation
- Installed: Suggests using
🔧 Improvements
Text File Cmdlet Enhancements
LineRangeparameter changed fromint[]tostring— now supports both dash ('10-20') and comma ('10,20') formats acrossShow-TextFiles,Update-MatchInFile,Update-LinesInFile, andRemove-LinesFromFileUpdate-MatchInFile: added-Containsas alias for-OldTextto matchShow-TextFilesnaming convention
Unified Console Display Name
- All console references now use consistent
PID #xxx Titleformat (e.g.,PID #12345 Phoenix) - Previously mixed formats:
PID#xxx,pwsh PID: xxx,Console PID xxx - Closed consoles retain their friendly name in status messages
📊 What's Changed Since v1.7.2
- ✨ One-time MarkdownPointer module hint when
.mdfiles detected in output (Windows only) - 🔧
LineRangeparameter:int[]→string, supports'10-20'and'10,20'formats - 🔧
Update-MatchInFile:-Containsalias for-OldText - 🔧 Unified console naming to
PID #xxx Titleformat
🔄 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:
claude mcp add PowerShell -s user -- "$(Get-MCPProxyPath)"For Claude Desktop — Update claude_desktop_config.json:
Get-MCPProxyPath -Escape # Returns JSON-escaped path{
"mcpServers": {
"PowerShell": {
"command": "C:\Users\YourName\Documents\PowerShell\Modules\PowerShell.MCP\1.7.3\bin\win-x64\PowerShell.MCP.Proxy.exe"
}
}
}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.2 - Sub-Agent ID Redesign & Dead Console Detection
Sub-Agent ID Redesign & Dead Console Detection
This release redesigns sub-agent identification to prevent infinite console creation loops, and surfaces dead console warnings in all MCP tool responses.
🔧 Improvements
Server-Issued Sub-Agent IDs
- Replaced the
generate_agent_idMCP tool with a simpleris_subagentparameter onstart_powershell_console,invoke_expression,get_current_location, andwait_for_completion - When
is_subagent=trueis passed (without anagent_id), the server automatically allocates a unique ID (sa-xxxxxxxx) and returns it in the response with🔑 Your agent_id is: ... - Any
agent_idnot previously allocated by the server is rejected with an error, preventing the infinite console creation loop that occurred when AI agents mistakenly passed console names as agent IDs wait_for_completionwithis_subagent=truebut noagent_idreturns an error (since there is no console to wait on)
Dead Console Detection in All Tools
invoke_expressionandget_current_locationnow report closed console warnings (e.g.,⚠ Console PID 12345 was closed)- Previously, dead console detection was only surfaced in
wait_for_completion - Agents are now immediately aware when a console has died, regardless of which tool they call
🐛 Bug Fixes
Revert Progress Bar Remnant Clearing
- Reverted the
\e[0K(Erase in Line) escape sequences added in v1.7.1 to clear progress bar remnants after prompt display - While the escape sequences did clear remnants, they caused incorrect caret positioning that broke the console display
- Progress bar remnants may occasionally appear but are less disruptive than the caret position issues
🗑 Removed
generate_agent_id MCP Tool
- Removed in favor of the
is_subagentparameter approach, which is simpler and less error-prone
📊 What's Changed Since v1.7.1
- 🔧
is_subagentparameter replacesgenerate_agent_idtool — server issues validatedsa-xxxxxxxxIDs - 🔧 Invalid
agent_idvalues are now rejected, preventing infinite console creation loops - 🔧 Dead console warnings surfaced in
invoke_expressionandget_current_location - 🐛 Reverted progress bar remnant clearing (
\e[0K) that caused caret position issues - 🗑 Removed
generate_agent_idMCP tool
📖 Full Documentation: https://github.com/yotsuda/PowerShell.MCP
💬 Questions? GitHub Discussions | 🐞 Report Issues: GitHub Issues
PowerShell.MCP v1.7.1 - Cross-Platform Fixes, Cmdlet Display Improvements & Skills Removal
Cross-Platform Fixes, Cmdlet Display Improvements & Skills Removal
This release fixes critical issues on macOS/Linux, improves file editing cmdlet output, and removes the now-redundant skills infrastructure.
🐛 Bug Fixes
macOS/Linux: Commands No Longer Require Manual Enter (#38)
- On macOS/Linux, after
Remove-Module PSReadLine, the built-inPSConsoleHostReadLinecalledConsole.ReadLine()which blocked the main runspace, preventing MCP timer events from firing - Replaced with a custom
PSConsoleHostReadLinethat pollsConsole.KeyAvailable+Start-Sleep -Milliseconds 50, allowing the MCP timer action block to run between input polls - This fixes the issue where commands sent via
invoke_expressionappeared in Terminal.app but required pressing Enter to execute
Linux: Terminal Launch Shell Quoting (#39)
- On Linux, launching pwsh via terminal emulators (konsole, gnome-terminal, etc.) failed due to nested shell quoting issues with the
-Commandargument - Replaced with
-EncodedCommand(Base64 UTF-16LE), which completely bypasses shell quote interpretation - Verified on Ubuntu + konsole (same terminal emulator as the reporter)
macOS: Named Pipe Path Too Long
- On macOS, UNIX domain socket paths are limited to 104 characters (
sun_path) - The previous pipe name
CoreFxPipe_PowerShell.MCP.Communication.{proxyPid}.{agentId}.{pwshPid}exceeded this limit under/var/folders/.../T/ - Shortened the base pipe name from
PowerShell.MCP.CommunicationtoPSMCP ⚠️ Note: Due to the pipe name change, mixing v1.7.0 Proxy with v1.7.1 Module (or vice versa) will fail silently instead of showing the usual version mismatch error. After upgrading, make sure to update your MCP client configuration so the Proxy path points to the new version
🔧 Improvements
File Edit Cmdlet Display
- With the
var1–var4parameters added toinvoke_expressionin v1.7.0, file content is passed via variables instead of inline strings. The actual content being written is no longer visible in the console command line, so the cmdlet output now shows the full detail of what was changed. Add-LinesToFile: Now displays added content in green when creating new or empty filesRemove-LinesFromFile: Shows actual deleted line content in red instead of position markers (:)Update-LinesInFile: Replaced deferred context buffer with real-time single-pass display (pre-context → deleted lines in red → inserted lines in green → post-context)
Get-Content / Set-Content Usage Warning
- When
Get-Content(or aliases:gc,cat,type) orSet-Contentis used viainvoke_expression, a warning is now appended to the response suggesting the optimized PowerShell.MCP cmdlets instead:Show-TextFilesinstead ofGet-ContentUpdate-MatchInFile,Update-LinesInFile,Add-LinesToFile,Remove-LinesFromFileinstead ofSet-Content
- Warning is shown once per command invocation (not noisy)
Multi-Line Command History Warning Removed
- Removed the warning that discouraged 3+ line commands due to console history limitations
- This warning caused AI to write less readable single-line pipelines; history recall is not a primary use case for MCP-driven sessions
Cmdlet Help Streamlined
- Removed boilerplate
-WhatIf,-Confirm,-ProgressActionparameter sections from all cmdlet help (covered by CommonParameters) - Added
var1/var2usage hints to NOTES section for cmdlets that accept text content - Help now provides all essential information with or without
-Full/-Examplesflags
🗑 Removed
Install-ClaudeSkill Cmdlet & Skills Infrastructure
- Removed
Install-ClaudeSkillcmdlet and theskills/folder - Claude Code now supports MCP prompts as slash commands natively, making the separate skills installation mechanism unnecessary
- MCP prompts (served by PowerShell.MCP.Proxy) continue to work as before
- If you previously ran
Install-ClaudeSkill, you can safely remove the installed files:rm -rf ~/.claude/skills/ps-*
🧪 Testing
macOS Terminal E2E Test
- Added GitHub Actions workflow (
macos-terminal-test.yml) that launches Terminal.app on macOS, starts pwsh with the MCP module, and verifies command execution via Named Pipe - Tests: quick command, 5-second delayed command (#38 scenario), long-running command, and post-long-running command
📊 What's Changed Since v1.7.0
- 🐛 macOS/Linux: custom
PSConsoleHostReadLinepolling loop fixes blocked MCP commands (#38) - 🐛 Linux:
-EncodedCommandfixes terminal launch shell quoting (#39) - 🐛 macOS: shortened pipe name (
PSMCP) fixes 104-char UNIX socket path limit ⚠️ Pipe name changed — update MCP client configuration after upgrading- 🔧 File edit cmdlets: real-time display with colored deleted/inserted lines
- 🔧 Get-Content/Set-Content usage warning guides AI to optimized cmdlets
- 🔧 Removed noisy multi-line command history warning
- 🔧 Streamlined cmdlet help with var1/var2 hints
- 🗑 Removed
Install-ClaudeSkilland skills infrastructure (replaced by MCP prompts) - 🧪 Added macOS Terminal E2E test in GitHub Actions
🙏 Acknowledgements
- @davidbordenwi — Detailed analysis of the macOS blocking issue (#38), including the
PSConsoleHostReadLinepolling approach that became the fix - @Fabelwesen — Root cause analysis and
-EncodedCommandsolution for the Linux terminal launch failure (#39), plus thecaseFixempty path guard
📖 Full Documentation: https://github.com/yotsuda/PowerShell.MCP
💬 Questions? GitHub Discussions | 🐞 Report Issues: GitHub Issues
PowerShell.MCP v1.7.0 - Reliability, Thread Safety & Security Hardening
Reliability, Thread Safety & Security Hardening
This release focuses on internal reliability and security improvements. Thread safety issues in the command execution pipeline have been resolved, named pipe communication has been hardened, and several resource management and code quality fixes have been applied.
🔒 Security Hardening
Named Pipe Access Control
- Unix/macOS: Named pipe socket permissions are now set to
0600(owner-only), preventing other local users from connecting - All platforms: Added 10 MB upper bound on message length to prevent out-of-memory from malformed length headers
Stop-AllPwsh Confirmation
Stop-AllPwshnow requires explicit confirmation (SupportsShouldProcesswithConfirmImpact=High) before killing all pwsh processes
SHA256 for File Comparison
- Replaced MD5 with SHA256 for file comparison in module loader
🐛 Bug Fixes
Thread Safety in Command Execution
- ExecutionState: Replaced
_cacheLockwith a unified_lockprotecting all shared state (_isBusy,_currentPipeline,_shouldCacheOutput, heartbeat fields) to eliminate race conditions between status reads and state mutations - McpServerHost: Replaced volatile fields with lock-protected private fields and atomic
ConsumeCommand/ConsumeSilentCommandmethods to prevent partial reads across command+variables fields - PowerShellCommunication: Replaced
ManualResetEventwithMonitor.Wait/PulseAlland a submitted/completed generation counter pair to prevent lost wakeups from late-completing timed-out commands
One-Shot Timer for Polling Engine
- Redesigned from
AutoReset = $trueto one-shot mode (AutoReset = $falsewithtry/finallyrestart), preventing event queue buildup while the main runspace is busy
Atomic File Replacement
FileOperationHelper: Now usesFile.Replacefor truly atomic file replacement instead of 3-step move sequence- Added millisecond precision to backup timestamps to prevent collisions
Resource Leaks
ConsoleSessionManager: DisposeProcessobject fromGetProcessByIdto prevent handle leaksPowerShellProcessManager: Dispose fire-and-forgetProcessfrom terminal emulator launch- Module loader: Added
try/finallyforStreamReader/Streamdispose
🔧 Code Quality
- EncodingHelper: Consolidated duplicated encoding alias switch expressions into single
GetEncodingByNamemethod - MCPPollingEngine.ps1: Fixed
$nullcomparison order to prevent collection filtering gotcha ($null -ne ...instead of... -ne $null) - PipelineHelper: Marked static display-state booleans as
volatile - MCPModuleInitializer: Added
_serverLockto protect_namedPipeServerand_tokenSourcefrom concurrent access; escaped single quotes in error messages
📊 What's Changed Since v1.6.8
- 🔒 Named pipe socket restricted to owner-only on Unix/macOS
- 🔒 Message length validation (10 MB cap) on pipe communication
- 🔒
Stop-AllPwshnow requires confirmation - 🐛 Thread safety: unified locking in ExecutionState, atomic command consumption, lost-wakeup prevention
- 🐛 Polling engine: one-shot timer to prevent event accumulation
- 🐛 Atomic file replacement in FileOperationHelper
- 🐛 Resource leak fixes (Process handles, StreamReader)
- 🔧 SHA256 for file comparison, encoding helper consolidation, null comparison fix
📖 Full Documentation: https://github.com/yotsuda/PowerShell.MCP
💬 Questions? GitHub Discussions | 🐞 Report Issues: GitHub Issues
PowerShell.MCP v1.6.8 - Output Truncation & AX Improvements
Output Truncation & AX Improvements
AX (Agent Experience) — just as UX focuses on human users, AX focuses on the experience of AI agents interacting with tools and APIs. Term coined by Matt Biilmann (Netlify CEO).
This release introduces automatic output truncation to protect the AI context window from large command results, and improves AX across the board — smarter scope warnings, enhanced tool descriptions, and clearer console behavior for AI agents.
✨ New Features
Output Truncation for Large Results (#34)
Commands that produce large output (>15,000 characters) are now automatically truncated to preserve the AI's context window budget:
- Head preview (~1,000 chars) + tail preview (~2,000 chars) with newline-aligned boundaries
- Full output is saved to a temp file and retrievable via
Show-TextFiles - Old output files are automatically cleaned up after 120 minutes
Output too large (47066 characters). Full output saved to: C:\Users\...\pwsh_output_20260217_205404.txt
Use invoke_expression('Show-TextFiles "..." -Contains "search term"') to search the output.
--- Preview (first ~1000 chars) ---
...
--- truncated (44106 chars omitted) ---
--- Preview (last ~2000 chars) ---
...
⚡ Improvements
Smarter Scope Warnings
Optimized variable scope warnings to reduce AI token consumption:
- First occurrence shows a detailed warning; subsequent ones show a compact one-liner
forloop initializer variables (e.g.,$i) are now excluded from warnings- Warnings are now displayed after command output for better readability
Enhanced Tool Descriptions
invoke_expression: Clarified primary use cases (git, build, file operations, etc.) and added string interpolation guidancestart_powershell_console: Added capability overview and PowerShell Gallery module installation hints
Other
- Console reuse message is now always displayed for clearer behavior
📊 What's Changed Since v1.6.7
AI-Facing Changes
- ✨
invoke_expression: Automatic output truncation for large results (>15,000 chars) - ⚡ Scope warning: Compact one-liner after first detailed warning
- ⚡ Scope warning:
forloop initializer variables excluded from warnings - ⚡ Scope warning moved after command output for better readability
- 📝
invoke_expression: Clarified primary use cases and added string interpolation guidance - 📝
start_powershell_console: Added capability overview and module installation hints - 📝
start_powershell_console: Console reuse message always displayed
🙏 Contributors
- @doraemonkeys — Design and implementation of the output truncation feature (#34)
Thank you @doraemonkeys for the output truncation implementation that keeps the AI context window safe!
📖 Full Documentation: https://github.com/yotsuda/PowerShell.MCP
💬 Questions? GitHub Discussions | 🐞 Report Issues: GitHub Issues