Releases: yotsuda/PowerShell.MCP
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
PowerShell.MCP v1.6.7 - Smart Console Reuse & Tool Description Refinements
Smart Console Reuse & Tool Description Refinements
This release redesigns start_powershell_console with smart console reuse via the new reason parameter, introduces a fast-path optimization in pipe discovery, and refines tool descriptions for clearer AI agent guidance.
✨ New Features
Smart Console Reuse (reason parameter)
start_powershell_console now intelligently reuses existing standby consoles instead of always launching a new one:
- No
reason: Checks for an existing standby console and reuses it if available. Banner is displayed silently on the existing console. - With
reason: Always launches a new console regardless of existing ones. The reason is displayed in dark yellow at startup.
# Reuse existing console (default behavior)
start_powershell_console(banner: "Hello!")
# Force a new console with reason
start_powershell_console(reason: "Need a separate console for background task", banner: "Worker console")
This reduces unnecessary console proliferation while preserving the ability to create dedicated consoles when needed.
⚡ Performance
Faster Tool Response When Console Is Ready
When the active console is already in a ready state, tool calls now skip the full console discovery process and connect immediately. This reduces latency for the most common case — consecutive commands on a single console.
📊 What's Changed Since v1.6.6
User-Facing Changes
- ✨
start_powershell_console: Smart console reuse withreasonparameter - ⚡ Faster tool response when active console is already ready
- 📝
invoke_expression: Console visibility hint and stronger text editing guidance - 📝
invoke_expression: Multi-line history warning shown once per session - 📝 Tool parameter descriptions unified and simplified
📖 Full Documentation: https://github.com/yotsuda/PowerShell.MCP
💬 Questions? GitHub Discussions | 🐞 Report Issues: GitHub Issues
PowerShell.MCP v1.6.6 - Elevation Consent, Pipe Security, Literal Variables & Guardrails
Elevation Consent, Pipe Security, Literal Variables & Guardrails
This release introduces an elevation consent prompt for RunAs/sudo commands, Named Pipe access control restricting connections to the current user, var1-var4 literal string parameters for safe content injection bypassing the PowerShell parser, and server-side guardrails that enforce correct variable usage for text editing cmdlets.
✨ New Features
Elevation Consent Prompt
When a pipeline contains elevation patterns (-Verb RunAs, runas, gsudo, sudo), PowerShell.MCP now displays the command in the console and requires explicit user confirmation via Read-Host before execution. This provides a user consent mechanism independent of OS UAC, which may auto-approve elevation without displaying a prompt on certain configurations (e.g., Entra ID joined devices with Windows Hello).
⚠ ELEVATION REQUEST DETECTED
Start-Process pwsh -Verb RunAs -ArgumentList '-Command', 'Get-Process'
Allow? (Y/N):
- Only the physical user at the console can approve (AI agents communicate via Named Pipe and cannot interact with console stdin)
- Denial throws
"Elevation denied by user"and the pipeline is not executed
var1-var4 Literal String Parameters
invoke_expression now accepts var1, var2, var3, and var4 parameters that inject literal string values into the pipeline via Set-Variable, completely bypassing the PowerShell parser. This prevents unintended expansion of $, backtick, and double-quote characters when editing source code files.
invoke_expression(
pipeline: "Update-MatchInFile file.cs -OldText $var1 -Replacement $var2",
var1: "$oldVariable = `Get-Value`",
var2: "$newVariable = \"Get-Value\""
)
Key behaviors:
- Values are injected as PowerShell variables (
$var1-$var4) before pipeline execution - No escaping required — content is passed as-is, never parsed by PowerShell
- Ideal for
-Content,-OldText,-Replacement,-Value,-Pattern,-Containsparameters var1/var2cover most use cases;var3/var4provide headroom for complex pipelines
Variable Enforcement Guardrails
The proxy now validates that text editing cmdlets are called with the required variable parameters. If a cmdlet is detected in the pipeline without the required variable, an error is returned before the pipeline reaches the PowerShell console. The validation is aware of context: Get-Help/Get-Command pipelines are skipped, and cmdlet names appearing in file paths (e.g., Show-TextFiles "C:\...\Add-LinesToFile.md") are not falsely matched.
| Cmdlet | Required |
|---|---|
Add-LinesToFile |
var1 (for -Content) |
Update-LinesInFile |
var1 (for -Content) |
Update-MatchInFile |
var1 (for -OldText) + var2 (for -Replacement) |
Remove-LinesFromFile |
var1 when -Pattern or -Contains is used |
Set-Content |
var1 (for -Value) |
Add-Content |
var1 (for -Value) |
🔒 Security
Named Pipe Access Control (Windows)
Named Pipes now use PipeSecurity to explicitly restrict access to the current user's SID only. Without explicit PipeSecurity, Windows assigns a default ACL that may grant access to other principals (SYSTEM, Administrators, or broader groups depending on the environment). The new ACL ensures only the user who started the console can connect.
On Linux/macOS, Named Pipes (Unix domain sockets) already default to owner-only permissions — no change needed.
📝 Improvements
Full Output for Add-LinesToFile and Update-LinesInFile
Previously, inserting or replacing 6+ lines showed only the first 2 + ellipsis + last 2 lines. Now all changed lines are displayed, giving AI agents full visibility of editing results without a separate Show-TextFiles call.
PSReadLine History: 1-2 Line Commands Only
Single-line and 2-line commands are now added to PSReadLine console history for user learning. Multi-line commands (3+ lines) are skipped to avoid cluttering history with large code blocks. A warning is returned when a multi-line command is not added to history.
Improved Tool Description
The invoke_expression tool description now includes guidance on var1-var4 usage and references to bundled text editing cmdlets (Show-TextFiles, Add-LinesToFile, etc.).
Show-TextFiles Help Improvement
Updated Show-TextFiles help to clarify its file search capability (recursive search with -Pattern/-Contains). SYNOPSIS now reads "Display file contents with line numbers, or search across files with regex or literal patterns". Also worked around a PlatyPS rendering issue where * wildcards were stripped from help output.
📊 What's Changed Since v1.6.5
User-Facing Changes
- ✨
invoke_expression: Elevation consent prompt for RunAs/sudo commands - ✨
invoke_expression:var1-var4literal string parameters for safe content injection - ✨
invoke_expression: Server-side guardrails enforcing variable usage for text editing cmdlets - 🔒 Named Pipe access restricted to current user SID via
PipeSecurity(Windows) - 📝
Add-LinesToFile/Update-LinesInFile: Full output display (no more 6+ line abbreviation) - 📝
invoke_expression: PSReadLine history limited to 1-2 line commands - 📝
invoke_expression: Improved tool description with variables guidance - 📝
Show-TextFiles: Help updated to clarify search/grep capability; PlatyPS wildcard fix
📖 Full Documentation: https://github.com/yotsuda/PowerShell.MCP
💬 Questions? GitHub Discussions | 🐞 Report Issues: GitHub Issues