Skip to content

Commit 80726d6

Browse files
committed
README: Add API exploration and self-evolving capabilities
1 parent 4737403 commit 80726d6

1 file changed

Lines changed: 145 additions & 122 deletions

File tree

README.md

Lines changed: 145 additions & 122 deletions
Original file line numberDiff line numberDiff line change
@@ -6,119 +6,128 @@
66
[![PowerShell Gallery](https://img.shields.io/powershellgallery/dt/PowerShell.MCP)](https://www.powershellgallery.com/packages/PowerShell.MCP)
77
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
88

9-
## Security Warning
10-
**This module provides complete PowerShell access to your system.**
11-
Malicious use could result in severe damage. Use responsibly and only in trusted environments.
9+
> **Security Warning:** This module provides complete PowerShell access to your system. Malicious use could result in severe damage. Use responsibly and only in trusted environments.
1210
1311
## Overview
1412

15-
PowerShell.MCP is a tool that enables AI assistants (such as Claude Desktop) to execute any PowerShell commands and CLI tools within a PowerShell console. Users can also execute cmdlets/.ps1/.bat/CLI tools in the same console, allowing AI and users to work collaboratively. It operates at high speed without needing to launch a new console each time, while preserving the state of imported modules, functions and variables.
13+
PowerShell.MCP connects AI assistants to the entire PowerShell ecosystem through a single MCP server. You and AI collaborate in the same PowerShell console—every command is visible, auditable, and saved to history.
1614

17-
Despite its powerful capabilities, PowerShell.MCP is built with just four carefully designed tools:
18-
- **start_powershell_console:** launching a persistent console
19-
- **get_current_location:** retrieving the current working directory
20-
- **invoke_expression:** executing any cmdlets/.ps1/.bat/CLI tools (chainable with pipes) in the PS console
21-
- **wait_for_completion:** waiting for busy console(s) to complete and retrieving cached results
15+
## Why PowerShell.MCP?
2216

23-
This minimalist architecture provides maximum flexibility while maintaining simplicity.
17+
**A universal gateway to the PowerShell ecosystem.**
2418

25-
### What Makes It Powerful
19+
PowerShell.MCP takes a different approach from service-specific MCP servers. Rather than providing curated tools for individual services, it gives AI assistants direct access to PowerShell—letting them use the same modules and CLI tools that professionals use every day.
20+
21+
This means:
22+
- **Immediate access** to 10,000+ modules on [PowerShell Gallery](https://www.powershellgallery.com/) without waiting for dedicated MCP servers
23+
- **Cross-service workflows** combining multiple services in a single pipeline
24+
- **Industry-standard skills** — commands you learn transfer directly to your own work
25+
- **API exploration** — prototype and verify API behavior with immediate feedback before writing production code
26+
- **Self-evolving capabilities** — AI writes PowerShell scripts that both AI and users can execute, continuously extending what's possible
27+
28+
**Examples: PowerShell pipeline processing**
29+
30+
*"Show me bug issues from the PowerShell repo with their authors"*
31+
32+
```powershell
33+
gh issue list --repo PowerShell/PowerShell --json title,author,labels |
34+
ConvertFrom-Json |
35+
Where-Object { $_.labels.name -contains "Issue-Bug" } |
36+
Select-Object title, @{N='by';E={$_.author.login}}
37+
```
38+
39+
*"List my running Azure VMs with their sizes"*
40+
41+
```powershell
42+
Get-AzVM -Status | Where-Object PowerState -eq "VM running" |
43+
Select-Object Name, @{N='Size';E={$_.HardwareProfile.VmSize}}, Location
44+
```
45+
46+
*"Check if GitHub's API returns rate limit info"*
47+
48+
```powershell
49+
Invoke-RestMethod https://api.github.com/rate_limit |
50+
Select-Object -ExpandProperty rate
51+
```
52+
53+
*"Get the current user's Windows username via Win32 API"*
54+
55+
```powershell
56+
Add-Type -MemberDefinition '[DllImport("advapi32.dll")] public static extern bool GetUserName(System.Text.StringBuilder sb, ref int len);' -Name Win32 -Namespace API
57+
$sb = [System.Text.StringBuilder]::new(256); $len = 256
58+
[API.Win32]::GetUserName($sb, [ref]$len); $sb.ToString()
59+
```
60+
61+
PowerShell.MCP complements your existing MCP setup by providing a flexible, general-purpose foundation.
62+
63+
## What Makes It Powerful
64+
65+
**🖥️ Multi-Client Architecture**
66+
- Each MCP client (Claude Code, Claude Desktop, etc.) gets its own exclusive console
67+
- Safe parallel operation with no resource conflicts
68+
- Unique window titles (e.g., "#12345 Taxi") for easy identification
69+
- `Get-MCPOwner` cmdlet shows which client owns the current console
2670

2771
**🤝 Shared Console Experience**
28-
- You and AI collaborate in the same PowerShell session
29-
- Every command the AI executes appears in your console in real-time
30-
- PowerShell cmdlets display colorful output
31-
- You can respond to input requests from AI-executed commands directly in the console
32-
- You can run your own commands between AI operations
33-
- AI-executed commands are saved to history, allowing you to recall and modify parameters for re-execution
34-
- Complete transparency - see exactly what's happening
72+
- You and AI collaborate in the same PowerShell session with full transparency
73+
- Every command AI executes appears in your console in real-time
74+
- You can respond to interactive prompts directly in the console
75+
- Commands are saved to history—learn by watching AI work
3576

3677
**🔄 Persistent Session State**
37-
- Current directory persists across all commands and interactions
38-
- Imported modules and authenticated sessions remain active throughout the entire session
39-
- Variables, functions, and mounted PSDrives stay available throughout the session
40-
- No need to re-initialize or re-authenticate between commands
41-
- True model context protocol implementation preserves your entire working state
42-
43-
**⚡ Instant Response, Zero Overhead**
44-
- Commands execute immediately without launching new PowerShell processes
45-
- Eliminates the typical 1-5 second startup delay per cmdlet
46-
- Fast initial feedback to users with instant acknowledgment before full results
47-
- Real-time streaming of output as commands run
48-
49-
**🔍 Comprehensive Output Stream Capture**
50-
- Command output is captured and returned to the AI assistant, with PowerShell's critical streams (error, warning, success, information) completely separated
51-
- Verbose and debug streams display naturally in the console under user control, and can be shared manually when needed
52-
- Clear execution statistics for every command: duration, error count, warning count, and info count
53-
54-
**🌐 Universal Modules & CLI Integration**
55-
- PowerShell.MCP acts as a universal bridge, instantly making any PowerShell modules or CLI tools available as fully functional MCP servers
56-
- Access the vast ecosystem of PowerShell Gallery with over 3,000 pre-built modules, instantly integrating with everything from cloud services like [Azure](https://www.powershellgallery.com/packages/Az), [AWS](https://www.powershellgallery.com/packages/AWSPowerShell.NetCore), [Google Cloud](https://www.powershellgallery.com/packages/GoogleCloud) or [UiPath Orchestrator](https://www.powershellgallery.com/packages/UiPathOrch) to enterprise tools like [Active Directory](https://learn.microsoft.com/powershell/module/activedirectory/), [Exchange](https://www.powershellgallery.com/packages/ExchangeOnlineManagement) or [SQL Server](https://www.powershellgallery.com/packages/SqlServer)
57-
- Uses `Get-Help` to automatically learn each cmdlet's syntax, parameters, and usage patterns for immediate productive use
58-
- AI effectively leverages well-known command-line tools like [Git](https://git-scm.com/) or [Docker](https://www.docker.com/)
59-
- PowerShell.MCP fundamentally transforms the MCP ecosystem by making virtually any command-line tool AI-accessible without custom development
60-
61-
**🔗 PowerShell Pipeline Composability**
62-
- PowerShell naturally chains commands together, passing rich data between them
63-
- AI assistants leverage this composability to build sophisticated workflows from simple building blocks
64-
- Example: "Show me the top 5 largest log files" becomes `Get-ChildItem *.log | sort Length -Descending | select -First 5`
65-
- Unlike approaches that expose each cmdlet/CLI tool as individual MCP tools, PowerShell.MCP enables AI to freely combine any commands into flexible pipelines
66-
- You describe what you want in natural language - AI constructs the optimal pipeline automatically
67-
- No need to understand pipeline syntax yourself - just tell AI what you need
68-
69-
**📝 LLM-Optimized Text File Operations**
70-
- Traditional Get/Set-Content cmdlets frequently fail for LLMs due to line number confusion and poor performance
71-
- To address this, PowerShell.MCP includes 5 specialized cmdlets designed specifically for AI assistants to handle text file operations reliably
72-
- Single-pass processing architecture enables up to 100x faster performance than Get/Set-Content on large files
73-
- 1-based line numbering eliminates array index confusion and matches compiler error messages
74-
- Automatic encoding detection and preservation (UTF-8/16/32, Shift-JIS, line endings)
75-
- Pattern matching with regex support and capture groups
76-
77-
**📚 No RAG or Context Grounding Required**
78-
- Simply gather necessary documents and files in a folder
79-
- Tell the AI assistant "Check this folder" in your prompt
80-
- AI instantly accesses all the knowledge needed for the task
81-
- Works with any content: documentation, project templates, code samples, configurations, and more
82-
- No need for complex RAG systems or context grounding infrastructure
83-
- Natural and intuitive way to provide domain-specific knowledge to AI
84-
85-
**🎯 Ready-to-Use Built-in Prompts**
86-
- 7 specialized prompts for development, analysis, administration, and learning scenarios
87-
- Intelligent automation with native language support and interactive guidance
88-
- Built-in safety measures, progress tracking, and hands-on learning environments
89-
- Accessible directly through MCP client prompts list - no command writing required
78+
- Authenticate once, stay authenticated: Azure, AWS, Microsoft 365, and more
79+
- Modules, variables, and functions persist across commands
80+
- No re-initialization overhead
81+
82+
**🌐 Universal Access**
83+
- [PowerShell Gallery](https://www.powershellgallery.com/): 10,000+ modules including [Az](https://www.powershellgallery.com/packages/Az), [AWS.Tools](https://www.powershellgallery.com/packages/AWS.Tools.Common), [Microsoft.Graph](https://www.powershellgallery.com/packages/Microsoft.Graph)
84+
- Any CLI tool: git, docker, kubectl, terraform, gh, az cli, aws cli
85+
- AI learns syntax automatically via `Get-Help`
86+
87+
**🔗 Pipeline Composability**
88+
- Describe what you want in natural language—AI constructs the optimal pipeline
89+
- "Top 5 largest logs" → `Get-ChildItem *.log | Sort-Object Length -Descending | Select-Object -First 5`
90+
- Chain any commands across any services
91+
92+
**⚡ Instant Execution**
93+
- Commands execute immediately in an existing console
94+
- No process startup overhead per command
95+
- Real-time streaming output
9096

9197
**🔐 Enterprise-Ready Security**
92-
- Local-only communication through named pipes
93-
- No network exposure or remote connections
94-
- Every executed command is visible and auditable
95-
- Compatible with strict corporate security policies
98+
- Local-only named pipe communication—no network exposure
99+
- Every command visible and auditable
100+
- Integrates with existing security policies
96101

97-
**🖥️ Multi-Console Support**
98-
- Multiple AI assistants can work simultaneously with separate PowerShell consoles
99-
- Each console gets a unique window title (e.g., "#12345 Taxi") for easy identification
100-
- User-started consoles with PowerShell.MCP module can be automatically adopted by AI assistants
101-
- `Get-MCPOwner` cmdlet shows which AI client owns the current console
102+
## Architecture
103+
104+
Four tools provide maximum flexibility with minimum complexity:
105+
106+
| Tool | Purpose |
107+
|------|---------|
108+
| `start_powershell_console` | Launch a persistent console for the MCP client |
109+
| `get_current_location` | Get current directory and available drives |
110+
| `invoke_expression` | Execute any PowerShell command or CLI tool |
111+
| `wait_for_completion` | Wait for long-running commands to complete |
102112

103113
## Quick Start
104114

105115
### Prerequisites
106116

107-
| Platform | Requirements |
108-
|----------|-------------|
109-
| **Windows** | Windows 10/11 or Windows Server 2016+ |
110-
| **Linux** | Ubuntu 22.04+, Debian 11+, RHEL 8+, or other distributions with GUI desktop |
111-
| **macOS** | macOS 12 (Monterey) or later, Intel or Apple Silicon |
112-
113117
**All platforms require:**
114-
- PowerShell 7.5 or higher ([installation guide](https://learn.microsoft.com/powershell/scripting/install/installing-powershell))
115-
- Claude Desktop ([download](https://claude.ai/download)), Claude Code, or any MCP client
118+
- PowerShell 7.5+ ([installation guide](https://learn.microsoft.com/powershell/scripting/install/installing-powershell))
119+
- Claude Desktop, Claude Code, or any MCP client
116120

117-
> **Note:** Claude Desktop and Claude Code are recommended. Claude Code is ideal for development work with its multi-console support. Other MCP clients may not deliver optimal performance.
121+
| Platform | OS Requirements |
122+
|----------|-----------------|
123+
| Windows | Windows 10/11 or Windows Server 2016+ |
124+
| Linux | Ubuntu 22.04+, Debian 11+, RHEL 8+, or distributions with GUI desktop |
125+
| macOS | macOS 12 (Monterey)+, Intel or Apple Silicon |
118126

119127
---
120128

121-
### Windows Setup
129+
<details>
130+
<summary><b>Windows Setup</b></summary>
122131

123132
#### 1. Open PowerShell 7
124133
Press `Win + R`, type `pwsh`, press `Enter`
@@ -135,8 +144,9 @@ Get-MCPProxyPath
135144
# Example: C:\Users\YourName\Documents\PowerShell\Modules\PowerShell.MCP\1.4.1\bin\win-x64\PowerShell.MCP.Proxy.exe
136145
```
137146

138-
#### 4. Configure Claude Desktop
139-
Add to `%APPDATA%\Claude\claude_desktop_config.json`:
147+
#### 4. Configure your MCP client
148+
149+
**For Claude Desktop** — Add to `%APPDATA%\Claude\claude_desktop_config.json`:
140150
```json
141151
{
142152
"mcpServers": {
@@ -147,11 +157,17 @@ Add to `%APPDATA%\Claude\claude_desktop_config.json`:
147157
}
148158
```
149159

150-
#### 5. Restart Claude Desktop
160+
**For Claude Code:**
161+
```bash
162+
claude mcp add powershell-mcp -- "C:\path\to\PowerShell.MCP.Proxy.exe"
163+
```
151164

152-
---
165+
#### 5. Restart your MCP client
153166

154-
### Linux Setup
167+
</details>
168+
169+
<details>
170+
<summary><b>Linux Setup</b></summary>
155171

156172
#### 1. Install PowerShell 7
157173
```bash
@@ -170,56 +186,50 @@ sudo apt-get install -y powershell
170186
pwsh -Command "Install-Module PowerShell.MCP -Scope CurrentUser"
171187
```
172188

173-
#### 3. Get your Proxy path
189+
#### 3. Get your Proxy path and set permissions
174190
```bash
175191
pwsh -Command "Import-Module PowerShell.MCP; Get-MCPProxyPath"
176192
# Example: /home/username/.local/share/powershell/Modules/PowerShell.MCP/1.4.1/bin/linux-x64/PowerShell.MCP.Proxy
177-
```
178193

179-
#### 4. Set execute permission
180-
```bash
181194
chmod +x /path/to/PowerShell.MCP.Proxy
182195
```
183196

184-
#### 5. Configure Claude Code
197+
#### 4. Configure your MCP client
198+
199+
**For Claude Code:**
185200
```bash
186201
claude mcp add powershell-mcp -- /path/to/PowerShell.MCP.Proxy
187202
```
188203

189-
Or edit `~/.claude.json` manually.
204+
**For Claude Desktop** — Edit `~/.config/Claude/claude_desktop_config.json`
190205

191-
---
206+
</details>
192207

193-
### macOS Setup
208+
<details>
209+
<summary><b>macOS Setup</b></summary>
194210

195211
#### 1. Install PowerShell 7
196212
```bash
197-
# Using Homebrew
198213
brew install powershell/tap/powershell
199-
200-
# Or download the official pkg installer from:
201-
# https://learn.microsoft.com/powershell/scripting/install/installing-powershell-on-macos
202214
```
203215

204216
#### 2. Install PowerShell.MCP
205217
```bash
206218
pwsh -Command "Install-Module PowerShell.MCP -Scope CurrentUser"
207219
```
208220

209-
#### 3. Get your Proxy path
221+
#### 3. Get your Proxy path and set permissions
210222
```bash
211223
pwsh -Command "Import-Module PowerShell.MCP; Get-MCPProxyPath"
212224
# Apple Silicon: ~/.local/share/powershell/Modules/PowerShell.MCP/1.4.1/bin/osx-arm64/PowerShell.MCP.Proxy
213225
# Intel Mac: ~/.local/share/powershell/Modules/PowerShell.MCP/1.4.1/bin/osx-x64/PowerShell.MCP.Proxy
214-
```
215226

216-
#### 4. Set execute permission
217-
```bash
218227
chmod +x /path/to/PowerShell.MCP.Proxy
219228
```
220229

221-
#### 5. Configure Claude Desktop
222-
Add to `~/Library/Application Support/Claude/claude_desktop_config.json`:
230+
#### 4. Configure your MCP client
231+
232+
**For Claude Desktop** — Add to `~/Library/Application Support/Claude/claude_desktop_config.json`:
223233
```json
224234
{
225235
"mcpServers": {
@@ -230,19 +240,27 @@ Add to `~/Library/Application Support/Claude/claude_desktop_config.json`:
230240
}
231241
```
232242

233-
#### 6. Restart Claude Desktop
243+
**For Claude Code:**
244+
```bash
245+
claude mcp add powershell-mcp -- /path/to/PowerShell.MCP.Proxy
246+
```
247+
248+
#### 5. Restart your MCP client
249+
250+
</details>
234251

235252
---
236253

237254
## First-Time Demo
238-
🎨 Experience PowerShell.MCP's capabilities with these engaging demonstrations:
255+
256+
Experience PowerShell.MCP's capabilities:
239257

240258
- "Show what PowerShell.MCP can do in a colorful, dynamic, and fun demo"
241259
- "Try out different styles of notifications using the BurntToast module"
242260
- "Automate Notepad: type text and smoothly move the window in a circle"
243261
- "How does it feel now that you have a tool like PowerShell.MCP?"
244262

245-
After trying these demos, explore the 7 built-in prompts below or ask AI to explain any command - learning by doing is the best approach.
263+
After trying these demos, explore the built-in prompts below or ask AI to explain any command.
246264

247265
## Built-in Prompts
248266

@@ -406,21 +424,26 @@ Generates interactive HTML maps with markers, descriptions, and optional 3D disp
406424
---
407425

408426
## Limitations
409-
- **AI Command Cancellation**: Commands executed by AI assistants cannot be cancelled with Ctrl+C. To cancel AI-executed commands, close the PowerShell console
410-
- **User Command Privacy**: Commands executed by users are not visible to AI assistants
411-
- **Verbose/Debug Streams**: Verbose and Debug output streams are not captured. Users can share this information with AI assistants via clipboard if needed
412-
- **Standard Error (stderr)**: Standard error output from CLI programs is not displayed in the PowerShell console and is not visible to AI assistants. To capture stderr, explicitly redirect it to a variable (e.g., `$result = & command.exe 2>&1`)
413-
- **External Command Colors**: Color output from external commands (e.g., git.exe) is lost and displayed without colors in the PowerShell console
427+
428+
- **AI Command Cancellation**: Commands executed by AI cannot be cancelled with Ctrl+C. Close the console to stop.
429+
- **User Command Privacy**: Commands you execute are not visible to AI assistants.
430+
- **Verbose/Debug Streams**: Not captured. Share via clipboard if needed.
431+
- **CLI stderr**: Not captured by default. Use `$result = & command.exe 2>&1` to capture.
432+
- **External Command Colors**: Color output from CLI tools (e.g., git) is not preserved.
414433

415434
## Disclaimer
416-
This software is provided "AS IS" without warranty of any kind, either expressed or implied.
435+
436+
This software is provided "AS IS" without warranty of any kind, either expressed or implied.
417437
The author assumes no responsibility for any damages arising from the use of this software.
418438

419439
## License
440+
420441
MIT License - see [LICENSE](LICENSE) for details.
421442

422443
## Author
444+
423445
Yoshifumi Tsuda
424446

425447
---
448+
426449
**For enterprise use, ensure compliance with your organization's security policies.**

0 commit comments

Comments
 (0)