Powershell MCP #25718
Replies: 3 comments
-
I suggest this should be an entirely separate project using the PowerShell SDK to invoke the capabilities. For example AIShell is separate.
The operating system already provides permissions and access rights and most commands are simply wrappers to the OS API or commands. Reflection can be trivially used to bypass any restriction imposed by PowerShell including AMSI, and of course PowerShell can invoke native commands. Existing PSGallery cmdlets won't change and will have their existing features. I suggest running such a server in a disposable container or sandbox as a non-administrator user and using Windows permissions or Linux SE to limit access. Unfortunately I have not had success running dotnet applications from a read-only filesystem so not sure if this could be used with PowerShell. What kind of things do you want to restrict and at what granularity? For example you can already require signed scripts. Do you want to prevent reflection, the ability to run external commands or import modules into the current process? Anything that you configure as a given user can be bypassed by PowerShell running as that same user by simply changing the configuration and running a child copy of PowerShell. |
Beta Was this translation helpful? Give feedback.
-
|
Converting to a discussion since it's not something strictly actionable in this project itself. |
Beta Was this translation helpful? Give feedback.
-
|
Hello. I'd like to introduce an implementation example related to this proposal. I've developed PowerShell.MCP, an MCP server: I'm aware that Microsoft is working on integrating PowerShell with AI through AI Shell as an MCP client. On the other hand, PowerShell.MCP as an MCP server takes a different approach by providing PowerShell capabilities. This project implements what was proposed in this discussion:
As @rhubarb-geek-nz pointed out, this project is implemented as a separate project using the PowerShell SDK. Regarding Security I hope this can be helpful for those with similar needs. Feedback and suggestions are always welcome. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Summary of the new feature / enhancement
A powershell MCP server that exposes available modules and allows the client to execute powershell scripts and commandlets
Proposed technical implementation details (optional)
Have tools that limit the powershell capabilities to be more secure (specific modules, using c#) - https://learn.microsoft.com/en-us/powershell/scripting/security/security-features
Beta Was this translation helpful? Give feedback.
All reactions