Step 8AI Feature

MCP server integration

~10 minutes
Marks this step as complete and saves your progress

The Model Context Protocol (MCP) server connects GitHub Copilot to your running services, enabling AI-powered debugging, monitoring, and code assistance.

What is MCP?

MCP (Model Context Protocol) is a protocol that allows AI assistants like GitHub Copilot to access contextual information from your development environment. With azd-app's MCP server, Copilot can:

  • View logs from your running services
  • Check health status of services
  • Understand your application architecture
  • Help debug issues with real-time data

Start the MCP Server

Launch the MCP server:

bash
azd app mcp

Configure VS Code

Add the MCP server to your VS Code settings:

jsonsettings.json
{
  "github.copilot.chat.experimental.mcp": true,
  "github.copilot.chat.mcp.servers": {
    "azd-app": {
      "command": "azd",
      "args": ["app", "mcp"]
    }
  }
}

Using MCP with Copilot

Once configured, open Copilot Chat and try these prompts:

"What services are running and what's their health status?"
"Show me recent errors from the API service"
"Why is my database connection failing?"
"Help me debug the 500 error in the logs"

Available MCP Tools

The MCP server provides these tools to Copilot:

  • get_services - List all services and their status
  • get_logs - Retrieve logs from services
  • get_health - Get health information
  • get_config - View service configuration

Try It Yourself

With your services running and MCP configured, ask Copilot: 'What services are running and what's their health status?'

Expected: Copilot should respond with information about your running services, including their names, ports, and health status.

Environment Variables

Set a project directory for MCP to use:

bash
env AZD_APP_PROJECT_DIR="/path/to/project" azd app mcp serve

MCP in CI/CD

The MCP server can also be used in automated pipelines to provide context to AI-powered testing and debugging tools.

Security Considerations

The MCP server only exposes read-only information about your services. It does not allow execution of commands or modification of your application.

Troubleshooting

  • Ensure VS Code has the latest Copilot extension
  • Restart VS Code after updating settings
  • Check that azd app mcp runs without errors

Congratulations!

You've completed the final step of the guided tour!