### Start Azure MCP Server using npx Source: https://learn.microsoft.com/en-us/azure/developer/azure-mcp-server/get-started/tools/jet-brains Use this command to start the Azure MCP Server. Ensure Node.js and npm are installed. ```bash npx -y @azure/mcp@latest server start ``` -------------------------------- ### Start Azure MCP Server with Selective Tool Loading Source: https://learn.microsoft.com/en-us/azure/developer/azure-mcp-server/concepts Load only the specific tools required for your workflow to optimize performance and reduce resource consumption. This example loads commands for listing subscriptions, resource groups, and getting storage account details. ```json { "mcpServers": { "Azure Essentials": { "command": "npx", "args": [ "-y", "@azure/mcp@latest", "server", "start", "--tool", "azmcp_subscription_list", "--tool", "azmcp_group_list", "--tool", "azmcp_storage_account_get" ] } } } ``` -------------------------------- ### Install GitHub Copilot Go SDK Source: https://learn.microsoft.com/en-us/azure/developer/azure-mcp-server/how-to/github-copilot-sdk Command to install the GitHub Copilot Go SDK package using the Go build tool. ```bash go get github.com/github/copilot-sdk/go ``` -------------------------------- ### Example Output: Resource Groups Source: https://learn.microsoft.com/en-us/azure/developer/azure-mcp-server/get-started/languages/python This is an example of the output you should expect after querying for resource groups. ```text The following resource groups are available for your subscription: 1. **DefaultResourceGroup-EUS** (Location: `eastus`) 2. **rg-testing** (Location: `centralus`) 3. **rg-azd** (Location: `eastus2`) 4. **msdocs-sample** (Location: `southcentralus`) 14. **ai-testing** (Location: `eastus2`) Let me know if you need further details or actions related to any of these resource groups! ``` -------------------------------- ### Bash: Install GitHub Copilot SDK Source: https://learn.microsoft.com/en-us/azure/developer/azure-mcp-server/how-to/github-copilot-sdk Installs the GitHub Copilot SDK Node.js package using npm. ```Bash npm install @github/copilot-sdk ``` -------------------------------- ### Example output of storage account list tool Source: https://learn.microsoft.com/en-us/azure/developer/azure-mcp-server/get-started/tools/windsurf This is an example of the output you might see after running a tool like 'storage account list' in Windsurf. ```text The following resource groups are available for your subscription: 1. **DefaultResourceGroup-EUS** (Location: `eastus`) 2. **rg-testing** (Location: `centralus`) 3. **rg-d** (Location: `eastus2`) 4. **msdocs-sample** (Location: `southcentralus`) 5. **ai-testing** (Location: `eastus2`) Let me know if you need further details or actions related to any of these resource groups! ``` -------------------------------- ### Start Azure MCP Server with .NET Source: https://learn.microsoft.com/en-us/azure/developer/azure-mcp-server/how-to/github-copilot-cli Alternative command to start the Azure MCP Server locally using .NET. Use this if you prefer a .NET environment. ```bash dotnet dnx -p Azure.Mcp server start ``` -------------------------------- ### Install Python dependencies Source: https://learn.microsoft.com/en-us/azure/developer/azure-mcp-server/get-started/languages/python Install all the Python libraries listed in the 'requirements.txt' file into the active virtual environment. ```console pip install -r requirements.txt ``` -------------------------------- ### Example Deployment Output Source: https://learn.microsoft.com/en-us/azure/developer/azure-mcp-server/how-to/deploy-remote-mcp-server-microsoft-foundry Example output from the 'azd env get-values' command, showing key configuration values for the deployed Azure MCP Server. ```Text CONTAINER_APP_URL="https://azure-mcp-storage-server..eastus2.azurecontainerapps.io" ENTRA_APP_CLIENT_ID="" ENTRA_APP_IDENTIFIER_URI="api://" ENTRA_APP_OBJECT_ID="" ENTRA_APP_ROLE_ID="" ENTRA_APP_SERVICE_PRINCIPAL_ID="" ``` -------------------------------- ### Explore Other Prompts Source: https://learn.microsoft.com/en-us/azure/developer/azure-mcp-server/get-started/languages/python Use these example prompts to explore other Azure MCP Server operations, such as listing storage accounts or tables. ```bash List all of the storage accounts in my subscription Get the available tables in my storage accounts ``` -------------------------------- ### Example Prompts for Azure MCP Server Operations Source: https://learn.microsoft.com/en-us/azure/developer/azure-mcp-server/get-started/tools/visual-studio-code Use these example prompts to explore and test various Azure MCP Server operations within GitHub Copilot. ```text List all of the storage accounts in my subscription Get the available tables in my storage accounts ``` -------------------------------- ### Example Output: List Azure Resource Groups Source: https://learn.microsoft.com/en-us/azure/developer/azure-mcp-server/get-started/tools/visual-studio-code This is an example of the output you might receive when prompting GitHub Copilot to list your Azure resource groups using the Azure MCP Server. ```text The following resource groups are available for your subscription: 1. **DefaultResourceGroup-EUS** (Location: `eastus`) 2. **rg-testing** (Location: `centralus`) 3. **rg-azd** (Location: `eastus2`) 4. **msdocs-sample** (Location: `southcentralus`) 14. **ai-testing** (Location: `eastus2`) Let me know if you need further details or actions related to any of these resource groups! ``` -------------------------------- ### Start the Python App Source: https://learn.microsoft.com/en-us/azure/developer/azure-mcp-server/get-started/languages/python Run this command in the terminal from your project's root directory to start the Python application. ```bash python main.py ``` -------------------------------- ### Example Prompt for Azure Resource Groups Source: https://learn.microsoft.com/en-us/azure/developer/azure-mcp-server/how-to/github-copilot-cli An example natural language prompt to ask GitHub Copilot CLI to list Azure resource groups using the configured MCP server. ```text > List my Azure resource groups. ``` -------------------------------- ### Install GitHub Copilot SDK for Python Source: https://learn.microsoft.com/en-us/azure/developer/azure-mcp-server/how-to/github-copilot-sdk Install the Python SDK package using pip. This is the first step to integrating the SDK in Python applications. ```bash pip install github-copilot-sdk ``` -------------------------------- ### Start Azure MCP Server with Node.js Source: https://learn.microsoft.com/en-us/azure/developer/azure-mcp-server/how-to/github-copilot-cli Command to start the Azure MCP Server locally using Node.js and npm. This is used when configuring the server in GitHub Copilot CLI. ```bash npx -y @azure/mcp@latest server start ``` -------------------------------- ### Run the .NET Application Source: https://learn.microsoft.com/en-us/azure/developer/azure-mcp-server/get-started/languages/dotnet This command starts the .NET host application from the project's root directory. ```bash dotnet run ``` -------------------------------- ### Start Azure MCP Server in All Mode Source: https://learn.microsoft.com/en-us/azure/developer/azure-mcp-server/concepts Starts the Azure MCP Server in all mode, exposing over 200 individual tools for granular control. ```json { "mcpServers": { "Azure MCP Server": { "command": "npx", "args": ["-y", "@azure/mcp@latest", "server", "start", "--mode", "all"] } } } ``` -------------------------------- ### Get MCP Server Help Source: https://learn.microsoft.com/en-us/azure/developer/azure-mcp-server/how-to/github-copilot-cli Display help information for MCP server commands within the GitHub Copilot CLI. ```bash /mcp help ``` -------------------------------- ### Prompts for Exploring Azure MCP Operations Source: https://learn.microsoft.com/en-us/azure/developer/azure-mcp-server/get-started/tools/eclipse Use these example prompts to explore various Azure MCP Server operations, such as listing storage accounts or App Service configurations. ```text List all storage accounts in my subscription List available tables in my storage accounts Show the configuration of my App Service instances ``` -------------------------------- ### Start GitHub Copilot CLI Source: https://learn.microsoft.com/en-us/azure/developer/azure-mcp-server/how-to/github-copilot-cli Launch the GitHub Copilot CLI in interactive mode from your terminal. ```bash copilot ``` -------------------------------- ### Configure Azure MCP Server with Server Argument Source: https://learn.microsoft.com/en-us/azure/developer/azure-mcp-server/how-to/connect-sovereign-clouds Use this method when your MCP client starts Azure MCP Server. Add the `--cloud` argument to the server start command. ```json { "servers": { "Azure MCP Server": { "type": "stdio", "command": "npx", "args": [ "-y", "@azure/mcp@latest", "server", "start", "--cloud", "AzureUSGovernment" ] } } } ``` -------------------------------- ### Start Azure MCP Server with Debug Logging Source: https://learn.microsoft.com/en-us/azure/developer/azure-mcp-server/how-to/connect-sovereign-clouds Use this command to start the Azure MCP Server with debug logging enabled. This helps in verifying the authority host being used for authentication. ```bash azmcp server start --cloud AzureUSGovernment --log-level Debug ``` -------------------------------- ### Create resource group and storage account Source: https://learn.microsoft.com/en-us/azure/developer/azure-mcp-server/concepts Automates infrastructure setup by creating a resource group and then a storage account within it. ```Azure MCP Server Create a resource group called 'webapp-prod' in East US, then create a storage account called 'webappdata' in that resource group ``` -------------------------------- ### Initialize Copilot Client and Configure Azure MCP Server (Go) Source: https://learn.microsoft.com/en-us/azure/developer/azure-mcp-server/how-to/github-copilot-sdk Demonstrates initializing the Copilot client with specific arguments and configuring the Azure MCP local server for use within a session. This setup enables all Azure MCP tools. ```go package main import ( "context" "fmt" "log" copilot "github.com/github/copilot-sdk/go" ) func main() { ctx := context.Background() // Initialize the Copilot client client, err := copilot.NewClient(copilot.ClientOptions{ CLIArgs: []string{ "--allow-all-tools", "--allow-all-paths", }, }) if err != nil { log.Fatal(err) } if err := client.Start(ctx); err != nil { log.Fatal(err) } defer client.Stop(ctx) // Configure Azure MCP server in session config azureMcpConfig := map[string]copilot.MCPServerConfig{ "azure-mcp": { Type: "local", Command: "npx", Args: []string{" -y", "@azure/mcp@latest", "server", "start"}, Tools: []string{"*"}, // Enable all Azure MCP tools }, } // Create session with MCP servers session, err := client.CreateSession(ctx, copilot.SessionConfig{ Model: "gpt-4.1", // Default model; BYOK can override Streaming: true, MCPServers: azureMcpConfig, }) if err != nil { log.Fatal(err) } // Handle events session.OnEvent(func(event copilot.SessionEvent) { switch event.Type { case copilot.AssistantMessageDelta: if event.Data.DeltaContent != "" { fmt.Print(event.Data.DeltaContent) } case copilot.ToolExecutionStart: fmt.Printf("\n[TOOL: %s]\n", event.Data.ToolName) } }) // Send prompt err = session.SendAndWait(ctx, copilot.Message{ Prompt: "List all resource groups in my Azure subscription", }) if err != nil { log.Fatal(err) } } ``` -------------------------------- ### Get Azure SRE Agent Reference Documentation Source: https://learn.microsoft.com/en-us/azure/developer/azure-mcp-server/tools/azure-sre-agent Retrieves reference documentation for Site Reliability Engineering (SRE) Agent concepts. Specify a topic to get definitions, configuration details, and usage examples. ```bash azmcp sreagent docs get \ --topic ``` -------------------------------- ### Configure Azure MCP Server in Cline Source: https://learn.microsoft.com/en-us/azure/developer/azure-mcp-server/get-started/tools/cline Add this JSON configuration to your `cline_mcp_settings.json` file to enable the Azure MCP Server. This command uses `npx` to install and start the latest version of the Azure MCP Server. ```json "Azure MCP Server": { "command": "npx", "args": [ "-y", "@azure/mcp@latest", "server", "start" ] } ``` -------------------------------- ### Initialize Copilot Client and Configure Azure MCP Server (C#) Source: https://learn.microsoft.com/en-us/azure/developer/azure-mcp-server/how-to/github-copilot-sdk Demonstrates initializing the Copilot client with specific arguments and configuring the Azure MCP local server for use within a session. This setup enables all Azure MCP tools. ```csharp using GitHub.Copilot.SDK; // Initialize the Copilot client await using var client = new CopilotClient(new CopilotClientOptions { CliArgs = new[] { "--allow-all-tools", "--allow-all-paths" } }); await client.StartAsync(); // Configure Azure MCP server in session config var mcpServers = new Dictionary { ["azure-mcp"] = new McpLocalServerConfig { Type = "local", Command = "npx", Args = ["-y", "@azure/mcp@latest", "server", "start"], Tools = ["*"] // Enable all Azure MCP tools } }; // Create session with MCP servers await using var session = await client.CreateSessionAsync(new SessionConfig { Model = "gpt-4.1", // Default model; BYOK can override Streaming = true, McpServers = mcpServers }); // Handle events session.On(evt => { if (evt is AssistantMessageDeltaEvent delta) { if (!string.IsNullOrEmpty(delta.Data.DeltaContent)) { Console.Write(delta.Data.DeltaContent); } } else if (evt is ToolExecutionStartEvent toolStart) { Console.WriteLine($"\n[TOOL: {toolStart.Data.ToolName}]"); } }); // Send prompt await session.SendAndWaitAsync(new MessageOptions { Prompt = "List all resource groups in my Azure subscription" }); ``` -------------------------------- ### Python: Complete Azure MCP Server Flow Source: https://learn.microsoft.com/en-us/azure/developer/azure-mcp-server/how-to/github-copilot-sdk Demonstrates initializing the Copilot client, configuring the Azure MCP server, creating a session, handling events, and sending a prompt to list Azure resource groups. ```Python import asyncio from copilot import CopilotClient from copilot.generated.session_events import SessionEventType async def main(): # Initialize the Copilot client client = CopilotClient({ "cli_args": [ "--allow-all-tools", "--allow-all-paths", ] }) await client.start() # Configure Azure MCP server in session config azure_mcp_config = { "azure-mcp": { "type": "local", "command": "npx", "args": ["-y", "@azure/mcp@latest", "server", "start"], "tools": ["*"], # Enable all Azure MCP tools } } # Create session with MCP servers session = await client.create_session({ "model": "gpt-4.1", # Default model; BYOK can override "streaming": True, "mcp_servers": azure_mcp_config, }) # Handle events def handle_event(event): if event.type == SessionEventType.ASSISTANT_MESSAGE_DELTA: if hasattr(event.data, 'delta_content') and event.data.delta_content: print(event.data.delta_content, end="", flush=True) elif event.type == SessionEventType.TOOL_EXECUTION_START: tool_name = getattr(event.data, 'tool_name', 'unknown') print(f"\n[TOOL: {tool_name}]") session.on(handle_event) # Send prompt await session.send_and_wait({ "prompt": "List all resource groups in my Azure subscription" }) await client.stop() if __name__ == "__main__": asyncio.run(main()) ``` -------------------------------- ### Start Azure MCP Server in Namespace Mode Source: https://learn.microsoft.com/en-us/azure/developer/azure-mcp-server/concepts Starts the Azure MCP Server in default namespace mode, grouping tools by Azure service. ```json { "mcpServers": { "Azure MCP Server": { "command": "npx", "args": ["-y", "@azure/mcp@latest", "server", "start"] } } } ``` -------------------------------- ### Initialize the azmcp-obo-template template Source: https://learn.microsoft.com/en-us/azure/developer/azure-mcp-server/how-to/deploy-remote-mcp-server-on-behalf-of Initialize the `azmcp-obo-template` template using the `azd init` command. You will be prompted to enter an environment name. ```Bash azd init -t azmcp-obo-template ``` -------------------------------- ### Start Azure MCP Server in Consolidated Mode Source: https://learn.microsoft.com/en-us/azure/developer/azure-mcp-server/concepts Starts the Azure MCP Server in consolidated mode, recommended for AI agents, which groups related operations into curated tools. ```json { "mcpServers": { "Azure MCP Server": { "command": "npx", "args": ["-y", "@azure/mcp@latest", "server", "start", "--mode", "consolidated"] } } } ``` -------------------------------- ### Explore Azure MCP Server prompts Source: https://learn.microsoft.com/en-us/azure/developer/azure-mcp-server/get-started/tools/cline These examples demonstrate other prompts you can use with Azure MCP Server to interact with various Azure resources, such as listing storage accounts, retrieving table information, or showing App Service configurations. ```text List all of the storage accounts in my subscription Get the available tables in my storage accounts Show me the configuration of my App Service instances ``` -------------------------------- ### Create development environment Source: https://learn.microsoft.com/en-us/azure/developer/azure-mcp-server/concepts Sets up a development environment by creating necessary resources like a storage account, key vault, and App Service within a specified resource group. ```Azure MCP Server Create a development environment with a storage account, key vault, and App Service in resource group 'dev-environment' ``` -------------------------------- ### TypeScript: Complete Azure MCP Server Flow Source: https://learn.microsoft.com/en-us/azure/developer/azure-mcp-server/how-to/github-copilot-sdk Demonstrates initializing the Copilot client, configuring the Azure MCP server, creating a session, handling events, and sending a prompt to list Azure resource groups. ```TypeScript import { CopilotClient } from '@github/copilot-sdk'; import type { MCPLocalServerConfig } from '@github/copilot-sdk'; async function main() { // Initialize the Copilot client const client = new CopilotClient({ cliArgs: [ '--allow-all-tools', '--allow-all-paths', ] }); await client.start(); // Configure Azure MCP server in session config const azureMcpConfig: Record = { 'azure-mcp': { type: 'local', command: 'npx', args: ['-y', '@azure/mcp@latest', 'server', 'start'], tools: ['*'], // Enable all Azure MCP tools } }; // Create session with MCP servers const session = await client.createSession({ model: 'gpt-4.1', // Default model; BYOK can override streaming: true, mcpServers: azureMcpConfig, }); // Handle events session.on((event) => { if (event.type === 'assistant.message_delta') { if (event.data?.deltaContent) { process.stdout.write(event.data.deltaContent); } } else if (event.type === 'tool.execution_start') { const toolName = event.data?.toolName || 'unknown'; console.log(`\n[TOOL: ${toolName}]`); } }); // Send prompt await session.sendAndWait({ prompt: 'List all resource groups in my Azure subscription 16caa5c4-46f1-4bfd-8c1b-a99f1efc8845' }); await client.stop(); } main().catch(console.error); ``` -------------------------------- ### Install Azure MCP Server Configuration Source: https://learn.microsoft.com/en-us/azure/developer/azure-mcp-server/get-started/tools/windsurf Manually install Azure MCP Server by updating the `mcp_config.json` file with the provided JSON configuration object. This specifies the command and arguments to run the latest version of the Azure MCP Server. ```json { "mcpServers": { "Azure MCP Server": { "command": "npx", "args": [ "-y", "@azure/mcp@latest", "server", "start" ] } } } ``` -------------------------------- ### Initialize Azure Credentials and MCP Client Source: https://learn.microsoft.com/en-us/azure/developer/azure-mcp-server/get-started/languages/python Sets up authentication for Azure services and initializes the MCP client using a standard I/O transport. Ensure you have the necessary environment variables and Azure credentials configured. ```python from azure.identity import DefaultAzureCredential, get_bearer_token_provider from azure.openai import AzureOpenAI from mcp import stdio_client from mcp.client import ClientSession from mcp.server import StdioServerParameters import json import logging logger = logging.getLogger(__name__) AZURE_OPENAI_ENDPOINT = "YOUR_AZURE_OPENAI_ENDPOINT" AZURE_OPENAI_MODEL = "YOUR_AZURE_OPENAI_MODEL" token_provider = get_bearer_token_provider( DefaultAzureCredential(), "https://cognitiveservices.azure.com/.default" ) async def run(): # Initialize Azure OpenAI client client = AzureOpenAI( azure_endpoint=AZURE_OPENAI_ENDPOINT, api_version="2024-04-01-preview", azure_ad_token_provider=token_provider ) # MCP client configurations server_params = StdioServerParameters( command="npx", args=["-y", "@azure/mcp@latest", "server", "start"], env=None ) async with stdio_client(server_params) as (read, write): async with ClientSession(read, write) as session: await session.initialize() # List available tools tools = await session.list_tools() for tool in tools.tools: print(tool.name) # Format tools for Azure OpenAI available_tools = [{ "type": "function", "function": { "name": tool.name, "description": tool.description, "parameters": tool.inputSchema } } for tool in tools.tools] # Start conversational loop messages = [] while True: try: user_input = input("\nPrompt: ") messages.append({"role": "user", "content": user_input}) # First API call with tool configuration response = client.chat.completions.create( model = AZURE_OPENAI_MODEL, messages = messages, tools = available_tools) # Process the model's response response_message = response.choices[0].message messages.append(response_message) # Handle function calls if response_message.tool_calls: for tool_call in response_message.tool_calls: function_args = json.loads(tool_call.function.arguments) result = await session.call_tool(tool_call.function.name, function_args) # Add the tool response to the messages messages.append({ "tool_call_id": tool_call.id, "role": "tool", "name": tool_call.function.name, "content": result.content, }) else: logger.info("No tool calls were made by the model") # Get the final response from the model final_response = client.chat.completions.create( model = AZURE_OPENAI_MODEL, messages = messages, tools = available_tools) for item in final_response.choices: print(item.message.content) except Exception as e: logger.error(f"Error in conversation loop: {e}") print(f"An error occurred: {e}") if __name__ == "__main__": import asyncio asyncio.run(run()) ``` -------------------------------- ### Sign in to Azure PowerShell Source: https://learn.microsoft.com/en-us/azure/developer/azure-mcp-server/get-started/languages/dotnet Use this command to log in to Azure using Azure PowerShell. Ensure you have Azure PowerShell installed and configured. ```powershell Connect-AzAccount ``` -------------------------------- ### List storage accounts and show containers Source: https://learn.microsoft.com/en-us/azure/developer/azure-mcp-server/concepts Demonstrates sequential operations: first listing storage accounts, then iterating to show containers for each. ```Azure MCP Server List storage accounts, then for each one show the containers ``` -------------------------------- ### Get details for multiple storage accounts Source: https://learn.microsoft.com/en-us/azure/developer/azure-mcp-server/concepts Illustrates parallel operations for retrieving details of specified storage accounts. ```Azure MCP Server Get details for storage accounts 'account1', 'account2', and 'account3' ``` -------------------------------- ### Python project dependencies Source: https://learn.microsoft.com/en-us/azure/developer/azure-mcp-server/get-started/languages/python List the required Python libraries for the Azure MCP Server client application. Ensure these are installed in your virtual environment. ```plaintext mcp azure-identity openai logging ``` -------------------------------- ### Example GitHub Issue for Increasing Database Storage Source: https://learn.microsoft.com/en-us/azure/developer/azure-mcp-server/how-to/github-copilot-coding-agent Use this format to create a clear and concise GitHub issue for GitHub Copilot. Ensure the prompt includes 'Azure' to direct Copilot to use Azure-specific tools. ```markdown Title: Increase database storage Currently, when deploying to Azure via Bicep, we're creating a PostgreSQL database with 32gb of storage. I need the next tier higher -- whatever that is. ``` -------------------------------- ### Example MCP Server Configuration for GitHub Copilot Source: https://learn.microsoft.com/en-us/azure/developer/azure-mcp-server/how-to/github-copilot-coding-agent This JSON snippet is used to introduce the Azure MCP Server to the GitHub Copilot coding agent. Paste this into the MCP Configuration settings in GitHub. ```json { "mcpServers": { "Azure": { "type": "local", "command": "npx", "args": [ "-y", "@azure/mcp@latest", "server", "start" ], "tools": [ "*" ] } } } ``` -------------------------------- ### Configure Azure MCP Server with Environment Variable (Bash) Source: https://learn.microsoft.com/en-us/azure/developer/azure-mcp-server/how-to/connect-sovereign-clouds Set the AZURE_CLOUD environment variable in Bash before starting the Azure MCP Server. ```bash export AZURE_CLOUD=AzureUSGovernment azmcp server start ```