Skip to content

Add Azure Monitor Instrumentation MCP Server#1960

Merged
xiang17 merged 23 commits intomicrosoft:mainfrom
xiang17:xiang17/MonitorInstrumentation
Mar 14, 2026
Merged

Add Azure Monitor Instrumentation MCP Server#1960
xiang17 merged 23 commits intomicrosoft:mainfrom
xiang17:xiang17/MonitorInstrumentation

Conversation

@xiang17
Copy link
Copy Markdown
Member

@xiang17 xiang17 commented Mar 6, 2026

What does this PR do?

[Provide a clear, concise description of the changes]

This MCP server namespace provides guided, deterministic onboarding for Azure Monitor (Application Insights / OpenTelemetry) instrumentation. It helps an agent or developer inspect a local workspace, choose the right instrumentation path (greenfield or brownfield), and execute migration/onboarding steps in a controlled sequence.

The official document for instrumenting customer's ASP.NET Core application manually is here: https://learn.microsoft.com/en-us/dotnet/api/overview/azure/monitor.opentelemetry.aspnetcore-readme?view=azure-dotnet

[Any additional context, screenshots, or information that helps reviewers]

GitHub issue number?

[Link to the GitHub issue this PR addresses]
#1801

Pre-merge Checklist

  • Required for All PRs
    • Read contribution guidelines
    • PR title clearly describes the change
    • Commit history is clean with descriptive messages (cleanup guide)
    • Added comprehensive tests for new/modified functionality
    • Updated servers/Azure.Mcp.Server/CHANGELOG.md and/or servers/Fabric.Mcp.Server/CHANGELOG.md for product changes (features, bug fixes, UI/UX, updated dependencies)
  • For MCP tool changes:
    • One tool per PR: This PR adds or modifies only one MCP tool for faster review cycles
    • Updated servers/Azure.Mcp.Server/README.md and/or servers/Fabric.Mcp.Server/README.md documentation
    • Validate README.md changes using script at eng/scripts/Process-PackageReadMe.ps1. See Package README
    • Updated command list in /servers/Azure.Mcp.Server/docs/azmcp-commands.md and/or /docs/fabric-commands.md
    • Run .\eng\scripts\Update-AzCommandsMetadata.ps1 to update tool metadata in azmcp-commands.md (required for CI)
    • For new or modified tool descriptions, ran ToolDescriptionEvaluator and obtained a score of 0.4 or more and a top 3 ranking for all related test prompts
    • For tools with new names, including new tools or renamed tools, update consolidated-tools.json
    • For new tools associated with Azure services or publicly available tools/APIs/products, add URL to documentation in the PR description
  • Extra steps for Azure MCP Server tool changes:
    • Updated test prompts in /servers/Azure.Mcp.Server/docs/e2eTestPrompts.md
    • 👉 For Community (non-Microsoft team member) PRs:
      • Security review: Reviewed code for security vulnerabilities, malicious code, or suspicious activities before running tests (crypto mining, spam, data exfiltration, etc.)
      • Manual tests run: added comment /azp run mcp - pullrequest - live to run Live Test Pipeline

@chidozieononiwu chidozieononiwu self-assigned this Mar 9, 2026
@xiang17 xiang17 marked this pull request as ready for review March 10, 2026 19:54
@xiang17 xiang17 requested review from a team as code owners March 10, 2026 19:54
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new Azure Monitor Instrumentation area/tooling to the Azure MCP Server to provide deterministic, step-by-step onboarding and (App Insights 2.x → 3.x) migration guidance for local workspaces, plus a bundled set of learning resources and generator configs.

Changes:

  • Introduces an orchestrator-based workflow (orchestrator_start / orchestrator_next) and a brownfield findings submission flow.
  • Adds a generator pipeline (detectors + generators) and embedded learning-resource content to drive guidance.
  • Wires the new area into the server (registration, consolidated tool mapping, docs, changelog, slnx).

Reviewed changes

Copilot reviewed 67 out of 67 changed files in this pull request and generated 16 comments.

Show a summary per file
File Description
tools/Azure.Mcp.Tools.MonitorInstrumentation/src/Tools/SubmitBrownfieldAnalysisTool.cs MCP tool for submitting brownfield findings and generating a migration spec
tools/Azure.Mcp.Tools.MonitorInstrumentation/src/Tools/OrchestratorTool.cs Main orchestrator tool managing sessions and action progression
tools/Azure.Mcp.Tools.MonitorInstrumentation/src/Tools/ListLearningResourcesTool.cs Lists local markdown learning resources under Resources/
tools/Azure.Mcp.Tools.MonitorInstrumentation/src/Tools/GetLearningResourceTool.cs Reads a specific resource file with path traversal protections
tools/Azure.Mcp.Tools.MonitorInstrumentation/src/Resources/migration/dotnet/appinsights-2x-to-3x-no-code-change.md Migration guidance content (no-code-change path)
tools/Azure.Mcp.Tools.MonitorInstrumentation/src/Resources/migration/dotnet/appinsights-2x-to-3x-code-migration.md Migration guidance content (code-change path)
tools/Azure.Mcp.Tools.MonitorInstrumentation/src/Resources/generator-configs/templates/aspnetcore/instrumentation-code.cs Code template snippet for ASP.NET Core greenfield instrumentation
tools/Azure.Mcp.Tools.MonitorInstrumentation/src/Resources/generator-configs/aspnetcore-greenfield.json Generator config describing greenfield onboarding actions
tools/Azure.Mcp.Tools.MonitorInstrumentation/src/Resources/generator-configs/aspnet-classic-greenfield.json Generator config for classic ASP.NET onboarding (future/unused in this PR)
tools/Azure.Mcp.Tools.MonitorInstrumentation/src/Resources/examples/dotnet/aspnetcore-setup.md Example learning resource for ASP.NET Core setup
tools/Azure.Mcp.Tools.MonitorInstrumentation/src/Resources/concepts/dotnet/opentelemetry-pipeline.md Concept resource: OTel pipeline overview
tools/Azure.Mcp.Tools.MonitorInstrumentation/src/Resources/concepts/dotnet/azure-monitor-distro.md Concept resource: Azure Monitor distro overview
tools/Azure.Mcp.Tools.MonitorInstrumentation/src/Resources/api-reference/dotnet/WithTracing.md API reference content: tracing configuration
tools/Azure.Mcp.Tools.MonitorInstrumentation/src/Resources/api-reference/dotnet/WithMetrics.md API reference content: metrics configuration
tools/Azure.Mcp.Tools.MonitorInstrumentation/src/Resources/api-reference/dotnet/WithLogging.md API reference content: logging configuration
tools/Azure.Mcp.Tools.MonitorInstrumentation/src/Resources/api-reference/dotnet/UseAzureMonitorExporter.md API reference content: exporter helper
tools/Azure.Mcp.Tools.MonitorInstrumentation/src/Resources/api-reference/dotnet/UseAzureMonitor.md API reference content: distro helper
tools/Azure.Mcp.Tools.MonitorInstrumentation/src/Resources/api-reference/dotnet/SdkCreateTracerProviderBuilder.md API reference content: legacy per-signal builders
tools/Azure.Mcp.Tools.MonitorInstrumentation/src/Resources/api-reference/dotnet/Sampling.md API reference content: sampling overview
tools/Azure.Mcp.Tools.MonitorInstrumentation/src/Resources/api-reference/dotnet/OpenTelemetrySdkCreate.md API reference content: non-host multi-signal setup
tools/Azure.Mcp.Tools.MonitorInstrumentation/src/Resources/api-reference/dotnet/LogProcessors.md API reference content: log processor patterns
tools/Azure.Mcp.Tools.MonitorInstrumentation/src/Resources/api-reference/dotnet/ConfigureResource.md API reference content: resource configuration
tools/Azure.Mcp.Tools.MonitorInstrumentation/src/Resources/api-reference/dotnet/ConfigureOpenTelemetryProvider.md API reference content: ConfigureOpenTelemetry*Provider
tools/Azure.Mcp.Tools.MonitorInstrumentation/src/Resources/api-reference/dotnet/AzureMonitorExporter.md API reference content: per-signal exporters
tools/Azure.Mcp.Tools.MonitorInstrumentation/src/Resources/api-reference/dotnet/AddOpenTelemetry.md API reference content: hosted AddOpenTelemetry()
tools/Azure.Mcp.Tools.MonitorInstrumentation/src/Resources/api-reference/dotnet/AddApplicationInsightsTelemetry.md API reference content: AI SDK 3.x AddApplicationInsightsTelemetry()
tools/Azure.Mcp.Tools.MonitorInstrumentation/src/Resources/api-reference/dotnet/ActivityProcessors.md API reference content: activity processors patterns
tools/Azure.Mcp.Tools.MonitorInstrumentation/src/Pipeline/WorkspaceAnalyzer.cs Analyzer pipeline orchestrating detectors and generator selection
tools/Azure.Mcp.Tools.MonitorInstrumentation/src/Options/MonitorInstrumentationOptionDefinitions.cs CLI option definitions for the new commands
tools/Azure.Mcp.Tools.MonitorInstrumentation/src/Options/CommandOptions.cs Options models for command binding
tools/Azure.Mcp.Tools.MonitorInstrumentation/src/MonitorInstrumentationSetup.cs Area setup wiring DI + command registration
tools/Azure.Mcp.Tools.MonitorInstrumentation/src/Models/OnboardingSpecValidator.cs Validates generated onboarding specs
tools/Azure.Mcp.Tools.MonitorInstrumentation/src/Models/OnboardingSpecBuilder.cs Fluent builder for onboarding specs and config-driven actions
tools/Azure.Mcp.Tools.MonitorInstrumentation/src/Models/OnboardingSpec.cs Spec model
tools/Azure.Mcp.Tools.MonitorInstrumentation/src/Models/OnboardingJsonContext.cs STJ source-gen context for models/response types
tools/Azure.Mcp.Tools.MonitorInstrumentation/src/Models/OnboardingAction.cs Action model + typed detail records
tools/Azure.Mcp.Tools.MonitorInstrumentation/src/Models/GeneratorConfigLoader.cs Loads generator configs/templates from embedded resources
tools/Azure.Mcp.Tools.MonitorInstrumentation/src/Models/Enums.cs Enum definitions for language/app type/state/action type
tools/Azure.Mcp.Tools.MonitorInstrumentation/src/Models/Decision.cs Decision model
tools/Azure.Mcp.Tools.MonitorInstrumentation/src/Models/Constants.cs Shared constants used by generators/workflow
tools/Azure.Mcp.Tools.MonitorInstrumentation/src/Models/BrownfieldFindings.cs Brownfield findings schema submitted by the agent
tools/Azure.Mcp.Tools.MonitorInstrumentation/src/Models/Analysis.cs Analysis model and related records
tools/Azure.Mcp.Tools.MonitorInstrumentation/src/Models/ActionDetailsExtensions.cs Converts typed action details to dictionary form
tools/Azure.Mcp.Tools.MonitorInstrumentation/src/GlobalUsings.cs Global usings for commandline parsing types
tools/Azure.Mcp.Tools.MonitorInstrumentation/src/Generators/IGenerator.cs Generator interface
tools/Azure.Mcp.Tools.MonitorInstrumentation/src/Generators/AspNetCoreGreenfieldGenerator.cs Greenfield generator using JSON config
tools/Azure.Mcp.Tools.MonitorInstrumentation/src/Generators/AspNetCoreBrownfieldGenerator.cs Brownfield generator producing targeted migration plan
tools/Azure.Mcp.Tools.MonitorInstrumentation/src/Detectors/PythonInstrumentationRegistry.cs Python instrumentation registry loader (not wired in setup yet)
tools/Azure.Mcp.Tools.MonitorInstrumentation/src/Detectors/IDetectors.cs Detector interfaces and result record
tools/Azure.Mcp.Tools.MonitorInstrumentation/src/Detectors/DotNetLanguageDetector.cs Detects .NET workspaces
tools/Azure.Mcp.Tools.MonitorInstrumentation/src/Detectors/DotNetInstrumentationDetector.cs Detects existing instrumentation in .NET projects/config
tools/Azure.Mcp.Tools.MonitorInstrumentation/src/Detectors/DotNetAppTypeDetector.cs Detects .NET project types and entry points
tools/Azure.Mcp.Tools.MonitorInstrumentation/src/Commands/SubmitBrownfieldAnalysisCommand.cs CLI command wrapping brownfield submission tool
tools/Azure.Mcp.Tools.MonitorInstrumentation/src/Commands/OrchestratorStartCommand.cs CLI command wrapping orchestrator start
tools/Azure.Mcp.Tools.MonitorInstrumentation/src/Commands/OrchestratorNextCommand.cs CLI command wrapping orchestrator next
tools/Azure.Mcp.Tools.MonitorInstrumentation/src/Commands/MonitorInstrumentationJsonContext.cs STJ source-gen context for string result payloads
tools/Azure.Mcp.Tools.MonitorInstrumentation/src/Commands/ListLearningResourcesCommand.cs CLI command wrapping list resources tool
tools/Azure.Mcp.Tools.MonitorInstrumentation/src/Commands/GetLearningResourceCommand.cs CLI command wrapping get resource tool
tools/Azure.Mcp.Tools.MonitorInstrumentation/src/Azure.Mcp.Tools.MonitorInstrumentation.csproj New tool project definition + embedded/content resources
servers/Azure.Mcp.Server/src/Resources/consolidated-tools.json Adds a new “guide_azure_monitor_instrumentation” consolidated tool mapping
servers/Azure.Mcp.Server/src/Program.cs Registers the new area setup in the server
servers/Azure.Mcp.Server/README.md Adds prompt examples + area listing for Monitor Instrumentation
servers/Azure.Mcp.Server/docs/e2eTestPrompts.md Adds e2e prompts for the new tools
servers/Azure.Mcp.Server/docs/azmcp-commands.md Documents new azmcp monitorinstrumentation ... commands
servers/Azure.Mcp.Server/CHANGELOG.md Adds changelog entry for the new tool area
servers/Azure.Mcp.Server/changelog-entries/1772839803444.yaml Adds a changelog-entry YAML for the feature
Microsoft.Mcp.slnx Adds the new project to the solution tree

You can also share your feedback on Copilot code review. Take the survey.

Comment thread tools/Azure.Mcp.Tools.MonitorInstrumentation/src/Tools/OrchestratorTool.cs Outdated
Comment thread tools/Azure.Mcp.Tools.MonitorInstrumentation/src/Models/Constants.cs Outdated
Comment thread servers/Azure.Mcp.Server/README.md Outdated
Comment thread servers/Azure.Mcp.Server/docs/e2eTestPrompts.md Outdated
Copy link
Copy Markdown
Member

@chidozieononiwu chidozieononiwu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good, next step will be to add tests for the newly added tool and commands. see https://github.com/Azure/azure-mcp/blob/main/docs/new-command.md#%EF%B8%8F-test-infrastructure-requirements

@github-project-automation github-project-automation Bot moved this from Untriaged to In Progress in Azure MCP Server Mar 10, 2026
@xiang17
Copy link
Copy Markdown
Member Author

xiang17 commented Mar 13, 2026

Looking good, next step will be to add tests for the newly added tool and commands. see https://github.com/Azure/azure-mcp/blob/main/docs/new-command.md#%EF%B8%8F-test-infrastructure-requirements

I've addressed the feedbacks and added unit tests. Can you review it again?

@xiang17 xiang17 merged commit 81b3763 into microsoft:main Mar 14, 2026
15 checks passed
@github-project-automation github-project-automation Bot moved this from In Progress to Done in Azure MCP Server Mar 14, 2026
@xiang17 xiang17 deleted the xiang17/MonitorInstrumentation branch March 25, 2026 00:03
colbytimm pushed a commit to colbytimm/microsoft-mcp that referenced this pull request Apr 20, 2026
* Add support for only AspNetCore

* adjust code

* Check #file:azmcp-commands.md  to see if it's updated for the MonitorInstrumentation tool according to #file:new-command.md

* Run `cd .\eng\scripts\ && .\Update-AzCommandsMetadata.ps1` to update tool metadata in azmcp-commands.md

* Update CHANGELOG

* Updated servers/Azure.Mcp.Server/README.md documentation

* Updated test prompts in /servers/Azure.Mcp.Server/docs/e2eTestPrompts.md

* all related MonitorInstrumentation prompts now meet rank <= 3 and score >= 0.4

* Pre-merge checklist item: update consolidated-tools.json as this is a new tool

* Remove the links in markdowns

* update additional changes

* rename submit_brownfield_analysis to submit_brownfield_review

* fix whitespace formatting and imports ordering

* Revert command description changes

* Fix ToolMetadata Properties to pass the ConsolidatedMode_Should_List_Tools_Successfully test

* dotnet format Microsoft.Mcp.slnx

* Address feedbacks

* Rename SubmitBrownfieldAnalysis to SendBrownfieldAnalysis. Remove ModelContextProtocol package.

* update name changes in md files and consolidated-tools.json

* Add basic unit tests

* Add more unit tests for OrchestratorTool and SendBrownfieldAnalysisTool

* Fix error FINALNEWLINE: Fix final newline.

* Fix error in Azure.Mcp.Server.UnitTests.Infrastructure.CommandMetadataSyncTests.AzCommandsMetadata_Should_Be_Synchronized
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants