{"id":20864,"date":"2025-08-05T10:40:38","date_gmt":"2025-08-05T18:40:38","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/powershell\/?p=20864"},"modified":"2025-08-15T08:02:58","modified_gmt":"2025-08-15T16:02:58","slug":"preview-6-ai-shell","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/powershell\/preview-6-ai-shell\/","title":{"rendered":"Introducing MCP Support in AI Shell Preview 6"},"content":{"rendered":"<p><!-- markdownlint-disable MD041 --><\/p>\n<h1>AI Shell Preview 6 is here!<\/h1>\n<p>We are super excited to announce the latest preview release of AI Shell. This release focuses on\nenhancing the user experience with new features, improved error handling, and better integration\nwith Model Context Protocol (MCP) tools.<\/p>\n<h2>What&#8217;s new at a glance<\/h2>\n<ul>\n<li>MCP client integration<\/li>\n<li>Built-in tools<\/li>\n<li><code>Resolve-Error<\/code> command improvements<\/li>\n<li>Aliases and flows for staying in your terminal<\/li>\n<\/ul>\n<h2>MCP Integration<\/h2>\n<p>AI Shell now acts as an MCP client, which allows you to add any MCP server to your AI Shell\nexperience. Connecting to an MCP server massively improves the capability of your AI Shell giving\nyou the tools that provide more relevant data or carry out actions!<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/powershell\/wp-content\/uploads\/sites\/30\/2025\/08\/AISHMCPDemo.gif\" alt=\"AI Shell MCP Client\" \/><\/p>\n<h3>Adding MCP Servers<\/h3>\n<p>To add an MCP server, create an <code>mcp.json<\/code> file in <code>$HOME\\.aish\\<\/code> folder. The following example\nshows two MCP servers: <code>everything<\/code> and <code>filesystem<\/code>. You can add any MCP servers you want.<\/p>\n<pre><code class=\"language-json\">{\r\n    \"servers\": {\r\n      \"everything\":{\r\n        \"type\":\"stdio\",\r\n        \"command\":\"npx\",\r\n        \"args\":[\"-y\", \"@modelcontextprotocol\/server-everything\"]\r\n      },\r\n      \"filesystem\": {\r\n        \"type\": \"stdio\",\r\n        \"command\": \"npx\",\r\n        \"args\": [\r\n          \"-y\",\r\n          \"@modelcontextprotocol\/server-filesystem\",\r\n          \"C:\/Users\/username\/\"\r\n        ]\r\n      }\r\n    }\r\n  }<\/code><\/pre>\n<p>If it&#8217;s a remote MCP server, change the type to <code>https<\/code>. You know that you have successfully added\nan MCP server when you see it in the AI Shell UI. You can confirm that it&#8217;s running by checking the\nstatus of the server through the <code>\/mcp<\/code> command. Using <code>\/mcp<\/code> also lists each MCP Server and the\ntools available.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/powershell\/wp-content\/uploads\/sites\/30\/2025\/08\/mcpui.jpeg\" alt=\"Screenshot of MCP servers registered in AI Shell\" \/><\/p>\n<p><div class=\"alert alert-primary\"><p class=\"alert-divider\"><i class=\"fabric-icon fabric-icon--Info\"><\/i><strong>NOTE<\/strong><\/p>You must have <code>Node.js<\/code> or <code>uv<\/code> installed to use MCP servers that\nuse those command lines tools.<\/div><\/p>\n<h3>Standalone experience with AI Shell and MCP Servers<\/h3>\n<p>MCP servers enhance your standalone experience with AI Shell, allowing your command line to use MCP\nservers and AI to perform tasks. For example, <a href=\"https:\/\/github.com\/SimonB97\/win-cli-mcp-server?tab=readme-ov-file\"><code>@simonb97\/server-win-cli<\/code><\/a> is an MCP server that\nallows you to run commands on your Windows machine, whether it be PowerShell, CMD, Git Bash, or any\nconfigured shell you use! It also provides configuration settings to define which commands and\noperations are allowed to run.<\/p>\n<p><div class=\"alert alert-danger\"><p class=\"alert-divider\"><i class=\"fabric-icon fabric-icon--ErrorBadge\"><\/i><strong>CAUTION<\/strong><\/p>Please note this is a community MCP server and not an\nofficial Microsoft MCP Server. We encourage you to do your own research and testing before using\nit.<\/div><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/powershell\/wp-content\/uploads\/sites\/30\/2025\/08\/standaloneMCPDemo.gif\" alt=\"AI Shell with MCP Server\" \/><\/p>\n<p>Additional MCP servers:<\/p>\n<ul>\n<li><a href=\"https:\/\/github.com\/wonderwhy-er\/DesktopCommanderMCP\">DesktopCommander<\/a><\/li>\n<li><a href=\"https:\/\/mcpservers.org\/\">Other community MCP Servers<\/a><\/li>\n<\/ul>\n<h2>Built-in Tools for AI Shell<\/h2>\n<p>This release introduces built-in tools that are now accessible to agents within AI Shell. These\ncommands are similar to MCP Server tools, but are exclusive to the AI Shell experience. These tools\nare designed to enhance the AI Shell experience by providing context-aware capabilities and\nautomation features. They can be used in conjunction with the MCP servers to create a powerful\nAI-driven shell environment.<\/p>\n<table>\n<thead>\n<tr>\n<th>Tool Name<\/th>\n<th>Description<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><code>get_working_directory<\/code><\/td>\n<td>Get the current working directory of the connected PowerShell session, including the provider name (e.g., <code>FileSystem<\/code>, <code>Certificate<\/code>) and the path (e.g., <code>C:\\\\<\/code>, <code>cert:\\\\<\/code>).<\/td>\n<\/tr>\n<tr>\n<td><code>get_command_history<\/code><\/td>\n<td>Get up to 5 of the most recent commands executed in the connected PowerShell session.<\/td>\n<\/tr>\n<tr>\n<td><code>get_terminal_content<\/code><\/td>\n<td>Get all output currently displayed in the terminal window of the connected PowerShell session.<\/td>\n<\/tr>\n<tr>\n<td><code>get_environment_variables<\/code><\/td>\n<td>Get environment variables and their values from the connected PowerShell session. Values of potentially sensitive variables are redacted.<\/td>\n<\/tr>\n<tr>\n<td><code>copy_text_to_clipboard<\/code><\/td>\n<td>Copy the provided text or code to the system clipboard, making it available for pasting elsewhere.<\/td>\n<\/tr>\n<tr>\n<td><code>post_code_to_terminal<\/code><\/td>\n<td>Insert code into the prompt of the connected PowerShell session without executing it. The user can review and choose to run it manually by pressing Enter.<\/td>\n<\/tr>\n<tr>\n<td><code>run_command_in_terminal<\/code><\/td>\n<td>This tool allows you to execute shell commands in a persistent PowerShell session, preserving environment variables, working directory, and other context across multiple commands.<\/td>\n<\/tr>\n<tr>\n<td><code>get_command_output<\/code><\/td>\n<td>Get the output of a command previously started with <code>run_command_in_terminal<\/code>.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><div class=\"alert alert-primary\"><p class=\"alert-divider\"><i class=\"fabric-icon fabric-icon--Info\"><\/i><strong>Note<\/strong><\/p>The built-in tools rely on the side-car experience with a\nconnected PowerShell session and provide enhanced context awareness and automation capabilities.<\/div><\/p>\n<p>Here is a simple demo showing how you can have AI Shell run commands on your behalf using the\n<code>run_command_in_terminal<\/code> tool:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/powershell\/wp-content\/uploads\/sites\/30\/2025\/08\/openai-agent-1.gif\" alt=\"Run command in terminal tool\" \/><\/p>\n<p>This example shows how additional context is provided to AI Shell to improve results:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/powershell\/wp-content\/uploads\/sites\/30\/2025\/08\/openai-agent-2.gif\" alt=\"Getting more context with built-in tools\" \/><\/p>\n<p>You can also use the <code>get_terminal_content<\/code> tool to get the content from the connected terminal and\nprovide it to AI Shell to help it understand what you are trying to do:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/powershell\/wp-content\/uploads\/sites\/30\/2025\/08\/openai-agent-3.gif\" alt=\"Getting content from the screen ran before AI Shell starts to get assistance\" \/><\/p>\n<h2>Resolve-Error Command Improvements<\/h2>\n<p>Previously the <code>Resolve-Error<\/code> command was only able to run after an error occurred in the previous\ncommand. Now, <code>Resolve-Error<\/code> identifies which command the user wants to troubleshoot:<\/p>\n<ul>\n<li>If the last error&#8217;s command matches the most recent command in history, it&#8217;s assumed to be the one\nthe user is interested in.<\/li>\n<li>If the last error&#8217;s command isn&#8217;t the most recent and <code>$LastErrorCode<\/code> is null or zero, the error\nlikely comes from an earlier command, not the very last one.<\/li>\n<li>If <code>$LastErrorCode<\/code> is non-zero and <code>$?<\/code> is false, the last command was a failing native command.<\/li>\n<li>If <code>$LastErrorCode<\/code> is non-zero but <code>$?<\/code> is true, it&#8217;s unclear which command or failure the user\nis focused on, so the agent analyzes the terminal content to determine the relevant context.<\/li>\n<\/ul>\n<p>This logic allows AI Shell to better understand what the error the user is trying to resolve is\nrather than requiring you to ask for AI&#8217;s help immediately after an error occurs.<\/p>\n<h2>Staying in your shell<\/h2>\n<p>The <code>Invoke-AIShell<\/code> and <code>Resolve-Error<\/code> commands allow you to stay in your working terminal to\ninteract with the AI Shell agent. To learn more about the parameters added, see the\n<a href=\"https:\/\/devblogs.microsoft.com\/powershell\/preview-4-ai-shell\/\">previous blog post<\/a> that details these features. For your convenience, these commands have\naliases that make them quicker to use.<\/p>\n<table>\n<thead>\n<tr>\n<th>Command Name<\/th>\n<th>Alias<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><code>Invoke-AIShell<\/code><\/td>\n<td><code>askai<\/code><\/td>\n<\/tr>\n<tr>\n<td><code>Resolve-Error<\/code><\/td>\n<td><code>fixit<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/powershell\/wp-content\/uploads\/sites\/30\/2025\/08\/openai-agent-4.gif\" alt=\"Fixing an error and utilizing fixit and askai commands\" \/><\/p>\n<h2>How to install AI Shell<\/h2>\n<p>To install the latest version of AI Shell, run the following command in your PowerShell terminal:<\/p>\n<pre><code class=\"language-powershell\">Invoke-Expression \"&amp; { $(Invoke-RestMethod 'https:\/\/aka.ms\/install-aishell.ps1') }\"<\/code><\/pre>\n<p>We hope that these enhancements make your experience with AI Shell more powerful! We are always\nlooking for feedback and suggestions, so please submit issues or feature requests in our\n<a href=\"https:\/\/github.com\/PowerShell\/AIShell\">GitHub repository<\/a>.<\/p>\n<p>Thank you so much!<\/p>\n<p>AI Shell Team<\/p>\n<p>Steven Bucher &amp; Dongbo Wang<\/p>\n<p><!-- link references --><\/p>\n","protected":false},"excerpt":{"rendered":"<p>We&#8217;re excited to share the latest preview release of AI Shell that includes new features and improvements based on your feedback.<\/p>\n","protected":false},"author":98569,"featured_media":20640,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[3196,3193,3195,3194],"class_list":["post-20864","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-powershell","tag-ai","tag-ai-shell","tag-azure-openai","tag-copilot-in-azure"],"acf":[],"blog_post_summary":"<p>We&#8217;re excited to share the latest preview release of AI Shell that includes new features and improvements based on your feedback.<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts\/20864","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/users\/98569"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/comments?post=20864"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts\/20864\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/media\/20640"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/media?parent=20864"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/categories?post=20864"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/tags?post=20864"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}