Skip to content

Commit aa40f7e

Browse files
committed
Add a Windows PowerShell version of the MCP key script
1 parent e282887 commit aa40f7e

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

articles/azure-functions/scenario-custom-remote-mcp-server.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,8 @@ Your MCP server is now running in Azure. When you access the tools, you need to
242242

243243
1. Run this script that uses `azd` and the Azure CLI to print out both the MCP server URL and the system key (`mcp_extension`) required to access the tools:
244244

245+
### [Linux/macOS](#tab/linux)
246+
245247
```bash
246248
eval $(azd env get-values --output dotenv)
247249
MCP_EXTENSION_KEY=$(az functionapp keys list --resource-group $AZURE_RESOURCE_GROUP \
@@ -250,6 +252,22 @@ Your MCP server is now running in Azure. When you access the tools, you need to
250252
printf "MCP Server key: %s\n" "$MCP_EXTENSION_KEY"
251253
```
252254

255+
### [Windows](#tab/windows-cmd)
256+
257+
```powershell
258+
azd env get-values --output dotenv | ForEach-Object {
259+
if ($_ -match "^([^=]+)=(.*)$") {
260+
Set-Variable -Name $matches[1] -Value ($matches[2] -replace '"', '')
261+
}
262+
}
263+
$MCP_EXTENSION_KEY = az functionapp keys list --resource-group $AZURE_RESOURCE_GROUP `
264+
--name $AZURE_FUNCTION_NAME --query "systemKeys.mcp_extension" -o tsv
265+
Write-Host "MCP Server URL: https://$SERVICE_API_NAME.azurewebsites.net/runtime/webhooks/mcp"
266+
Write-Host "MCP Server key: $MCP_EXTENSION_KEY"
267+
```
268+
269+
---
270+
253271
1. In Visual Studio Code, press <kbd>F1</kbd> to open the command palette, search for and run the command `MCP: Open Workspace Folder MCP Configuraton`, which opens the `mcp.json` configuration file.
254272

255273
1. In the `mcp.json` configuration, find the named MCP server you added earlier, change the `url` value to your remote MCP server URL, and add a `headers.x-functions-key` element, which contains your copied MCP server access key, as in this example:

0 commit comments

Comments
 (0)