Skip to content

Add DV MCP server - #6

Merged
Jon Gallant (jongio) merged 1 commit into
microsoft:mainfrom
gattimassimo:u/magatti/dvmcp
Jun 5, 2025
Merged

Jon Gallant (jongio) merged 1 commit into
microsoft:mainfrom
gattimassimo:u/magatti/dvmcp

Conversation

@gattimassimo

Copy link
Copy Markdown
Contributor

No description provided.

@jongio
Jon Gallant (jongio) merged commit b2b34ce into microsoft:main Jun 5, 2025
Patrick Hallisey (hallipr) pushed a commit that referenced this pull request Aug 20, 2025
* Add instructions for SSE

* Remove numbering

* Add one click install
Patrick Hallisey (hallipr) pushed a commit that referenced this pull request Aug 21, 2025
* onboard code to cloud tools

* fix source analysis errors

* rename iac command (#6)

* rename iac command

* revert changes

* update

* update deployment plan template

* fix comments

* fix the build error and refine the plan template

* refine the template

* add quota group (#9)

* add quota group

* add unit test

* update region checker return message

* refactor

* add unit test

* update

* revert

* [GenerateArchitectureDiagramCommand] Fix and AKS support (#8)

* init aks diagram support

* fix and test

* fix

* prompt fix encoding issue

* fix by replacing + with -

* fix encoding

* fix test

* resolve conflicts

* cspell and format

* fix the iac-rules-get tool name in e2etestprompt.md

* Refactor: extract prompt to md file (#10)

* fix

* extract prompt to md file

* rename available-region-list

* clean code (#11)

* clean code

* update

* add deploy command in md and fix analyze error

* Some fix according to e2e test (#12)

* fix prompt for test

* format

* update

* fix

* update

* update

* add rules

* Refactor deploy&quota to project

* fix test failure

* Add sub command description to goup description

* update description based on comment

* fix live test (#13)

* fix live test

* update quota test

* update

* update cspell (#14)

* force to save plan to file (#15)

* update plan command description

* Add PR guidance document

* Add test scenarios

* aot safe refactoring and update template md (#16)

* aot safe refactoring

* update template md

* move app topology definition to resource file and update the command extension implementation

* update test result - not completed

* update test result

* reorganize file folders (#17)

* reorganize file folders

* update test structure

* update pipeline template

* format

* remove comments

* fix

* update the command names in md file

* Add code review report for PR #626 on Deploy and Quota commands

* fix the comments in code review report

* remove code review doc

* fix test failure

* Add code review report for PR #626 addressing deploy and quota commands

- Summarized findings and compliance with architectural guidelines
- Documented command structure, integration issues, and AOT safety
- Provided targeted recommendations and next steps for improvements
- Included exhaustive merge-readiness checklist and quick quality gates snapshot
- Suggested documentation deltas and compliance matrix against final recommendations

* Add manual testing plan and update documentation checklist for PR #626

* update action plan and add invalid json test case

* feat: Add comprehensive unit tests for quota commands (#19)

- Add edge case tests for whitespace-only resource types
- Add tests for mixed casing in resource types with proper case preservation
- Add tests for very long resource types lists (50+ items)
- Enhance test coverage for AvailabilityListCommand and CheckCommand
- Ensure proper validation and error handling for edge cases

* lint (#20)

* Chentony/mermaid response refactor (#21)

* Fix diagram prompting

* Small change

* Reminder

* Fix

* Remove Mermaid Encode/Decode

---------

Co-authored-by: Tony Chen (DevDiv) <[email protected]>

* fix cspell errors

* Mermaid generation: Fix </br> hallucination, fix copilotmd file target, fix extension installation reminder (#22)

* Fix diagram prompting

* Small change

* Reminder

* Fix

* Remove Mermaid Encode/Decode

* Fix </br> hallucination, fix copilotmd file target, fix extension installation reminder

---------

Co-authored-by: Tony Chen (DevDiv) <[email protected]>

* feat: Add remaining work items for Deploy & Quota command areas

* feat: Add test execution log section to Manual Testing Plan for Copilot prompts

* Xf/updatecomm2 (#23)

* add logger

* Hard-coded endpoints

* update GetQuotaByUrlAsync

* update Error handling

* update doc

* HTTP usage pattern

* doc

* format

* format

* add test

* update

* aot check

* update document

* update the remaining work

* fix parser (#24)

* update remaining work

* Adds document describing tool organization tasks

* Updated organization task priorities

* Add 32 character max for resource names (#25)

Co-authored-by: Tony Chen (DevDiv) <[email protected]>

* fix build error and comments

* remove image

* Update Directory.Packages.props

update ARM versions

* Update cspell.json

fix cspell json

* Update sign-and-pack.yml

add YamlDotNet.dll to allow list

---------

Co-authored-by: xfz11 <[email protected]>
Co-authored-by: wchigit <[email protected]>
Co-authored-by: Vinay Gera <[email protected]>
Co-authored-by: Jon Gallant <[email protected]>
Co-authored-by: Tonychen0227 <[email protected]>
Co-authored-by: Tony Chen (DevDiv) <[email protected]>
Co-authored-by: Wallace Breza <[email protected]>
Shraddha Jain (shrja-ms) added a commit to shrja-ms/mcp that referenced this pull request May 4, 2026
Telemetry report skill (SKILL.md + kql-queries.md):
- Add case-sensitivity note for Kusto bag key access (microsoft#6)
- Fix week-over-week query range to include current partial week (microsoft#7)
- Add InvalidOperationException to MCP Tool Bug classification (microsoft#8)
- Add missing KQL queries 11-13 for WorkloadType, DatasourceType,
  OperationScope custom dimensions (microsoft#9)
- Fix live test count to use [Fact] only, avoiding double-count with
  [LiveTestOnly] on same method (microsoft#5)
- Update decision tree to include InvalidOperationException

Add-tool skill (SKILL.md):
- Fix broken relative link to new-command.md (5 levels up, not 3) (#1)
- Fix live test snippet to use [Fact] + CallToolAsync pattern, not
  non-existent [RecordedTest]/RunCommandAndAssert (#2, microsoft#11)
- Add missing Update-AzCommandsMetadata.ps1 step after docs update (microsoft#3)
- Add AOT/native build verification step (Build-Local.ps1 -BuildNative) (microsoft#4)
- Fix vault/vaultType to reference AzureBackupOptionDefinitions, not
  OptionDefinitions.Common (microsoft#10)
- Expand git add scope to include README.md and eng/vscode/README.md (microsoft#12)
- Add commands metadata regeneration and AOT build to PR checklist
Shraddha Jain (shrja-ms) added a commit that referenced this pull request May 8, 2026
…workflow (#2570)

* azurebackup: Add weekly telemetry report skill

Add a Copilot skill under tools/Azure.Mcp.Tools.AzureBackup/skills/ that
automates generation of weekly telemetry reports by:

- Running KQL queries against the ddazureclients Kusto cluster
- Classifying errors into Customer (4xx) / Azure Service / MCP Tool Bug
- Correlating with merged PRs, releases, and known bug IDs
- Producing an Outlook-compatible HTML report

Includes:
- SKILL.md with full procedure and error classification decision tree
- references/kql-queries.md with all 10 production KQL queries
- assets/report-template.html with Outlook-compatible HTML template

* azurebackup: Add 'add-tool' skill for new command workflow

Add a Copilot skill that guides the full lifecycle of adding a new
Azure Backup MCP command:

- Phase 1: Implementation (options, service, command, registration)
- Phase 2: Input validation checklist
- Phase 3: Unit tests with required test patterns
- Phase 4: Live tests with Record/Playback workflow
- Phase 5: CI validation (build, format, spell check)
- Phase 6: ToolDescriptionEvaluator scoring
- Phase 7: Documentation updates
- Phase 8: PR submission checklist

* azurebackup: Fix telemetry report skill - BUG-1 status and test count methodology

- BUG-1 (backup_status ArgumentNullException) is fixed in #2518 (code
  included in merged PR, though PR title only lists BUG-3,4,5,6,8)
- Fix unit test count methodology: count [Fact] + [InlineData] for
  runnable test cases, not [Fact] + [Theory] for method count
- Add Release column to bug tracker table
- Add note about verifying PR diff vs title for bug coverage

* azurebackup: Address all 12 PR review comments on skills

Telemetry report skill (SKILL.md + kql-queries.md):
- Add case-sensitivity note for Kusto bag key access (#6)
- Fix week-over-week query range to include current partial week (#7)
- Add InvalidOperationException to MCP Tool Bug classification (#8)
- Add missing KQL queries 11-13 for WorkloadType, DatasourceType,
  OperationScope custom dimensions (#9)
- Fix live test count to use [Fact] only, avoiding double-count with
  [LiveTestOnly] on same method (#5)
- Update decision tree to include InvalidOperationException

Add-tool skill (SKILL.md):
- Fix broken relative link to new-command.md (5 levels up, not 3) (#1)
- Fix live test snippet to use [Fact] + CallToolAsync pattern, not
  non-existent [RecordedTest]/RunCommandAndAssert (#2, #11)
- Add missing Update-AzCommandsMetadata.ps1 step after docs update (#3)
- Add AOT/native build verification step (Build-Local.ps1 -BuildNative) (#4)
- Fix vault/vaultType to reference AzureBackupOptionDefinitions, not
  OptionDefinitions.Common (#10)
- Expand git add scope to include README.md and eng/vscode/README.md (#12)
- Add commands metadata regeneration and AOT build to PR checklist

* azurebackup: Convert relative links to absolute paths for CI link checker

The link verification step requires absolute paths from repo root,
not relative paths. Convert all ./references/ and ../../../ links
to /tools/Azure.Mcp.Tools.AzureBackup/skills/... format.

* azurebackup: Use full GitHub URLs for CI link checker

Link checker requires https://github.com/microsoft/mcp/blob/main/... format,
not repo-root-relative paths.

* azurebackup: Add InvalidOperationException to Query 1, replace Power BI URLs with placeholder

- Query 1 (primary per-tool health) was missing InvalidOperationException
  in the McpToolBug case, causing inconsistency with Queries 2 and 4
- Replace hardcoded Power BI dashboard URLs in report template with
  {{POWERBI_DASHBOARD_URL}} placeholder (public repo, internal GUIDs)
Vinay Gera (g2vinay) added a commit to g2vinay/mcp that referenced this pull request Jul 9, 2026
- HTTP test processes: disable stdout/stderr redirection (never read by HTTP tests) to eliminate child-process pipe-buffer hang risk. Stdio tests that read stdout keep stdout redirect but disable stderr. (Copilot microsoft#1/microsoft#2)
- SendWithRetryAsync: dispose the 404 HttpResponseMessage before retrying to prevent socket/handler leaks. (Copilot microsoft#5/microsoft#6)
- WriteMissingRoutingHeaderResponse: emit a proper JSON-RPC 2.0 error envelope and use JsonEncodedText.Encode + .ToString() for correct string escaping. (Copilot microsoft#3 / my F1)
- RegistryServerProvider class doc: replace the misleading Authorization Hardening bullet list with accurate language — only HTTPS + non-empty scope checks are performed here; issuer/app-type/PRM checks are delegated to Azure Identity. (Copilot microsoft#4 / my F3)
Vinay Gera (g2vinay) added a commit that referenced this pull request Jul 23, 2026
* Phase 1 MCP stateless migration baseline

* Phase 1 elicitation wrapper hardening and HTTP stateless transport tests

* Phase 1 core test harness migration: fix obsolete SDK API errors and add negative HTTP test

* Phase 1 mode coverage and session-affinity regression tests

- Add ServerModeCoverageTests: stdio stateless tools/list for single,
  namespace, and all modes without initialize handshake (Workstream I
  item 5)
- Add Mcp-Session-Id absence assertion to HTTP positive test in
  ConsolidatedModeTests (Workstream I item 7 / Workstream B):
  server must not set Mcp-Session-Id under the 2026-07-28 stateless
  protocol

* Phase 1 Workstream B item 2: Mcp-Method/body mismatch rejection test

Add negative test that sends Mcp-Method: tools/call in headers but
tools/list in the JSON body. Under the 2026-07-28 protocol header/body
agreement is required for explicit gateway routing; server must respond
with a 4xx client error for a mismatch.

* Phase 2: harden HTTP header/meta conformance tests

* Phase 2: enforce required MCP HTTP routing headers

* Phase 2: implement W3C trace context propagation

- Add W3C trace context support (traceparent, tracestate, baggage) to _meta handling
- Capture trace context fields in both CallToolHandler and ListToolsHandler
- Add W3C trace context tags to telemetry constants (w3c.traceparent, w3c.tracestate, w3c.baggage)
- Add comprehensive test for W3C trace context propagation in HTTP mode
- Verified Azure telemetry enrichment remains compatible with new trace context capture

* Phase 3: establish deterministic tool resolution fallback for sampling deprecation

Workstream E: Sampling deprecation and deterministic routing

- Add telemetry tracking for sampling vs deterministic resolution (resolution.method, sampling.attempted, sampling.succeeded, resolution.confidence)
- Implement DeterministicToolResolution utility with token-based matching and Levenshtein distance for command/tool inference
- Support deterministic fallback when sampling is unavailable or deprecated
- Add 8 comprehensive unit tests validating tool name and command matching
- Fix pre-existing RequestContext constructor issue in ToolLoaderTelemetryTests

Strategy: Keep sampling as optional enhancement while building deterministic path parity through telemetry measurement. Enables Phase 3 sampling deprecation roadmap.

* Phase 2: finalize session-affinity disposition and operator guidance

- Record Workstream B item 4 decision: session-affinity package remains optional for explicit legacy/custom state-routing scenarios only
- Keep package out of default Azure MCP runtime assumptions
- Update operator guidance to header-first stateless routing for MCP 2026-07-28 (Mcp-Method/Mcp-Name)
- Clarify when not to enable session affinity in distributed package README

* Phase 2: add stateless server/discover discovery coverage

- Add consolidated-mode HTTP integration test for server/discover with MCP 2026-07-28 routing headers
- Validate discovery succeeds without initialize handshake
- Validate stateless response does not emit Mcp-Session-Id
- Record Workstream C progress in migration proposal

* Phase 2: codify startup/discovery split and list cache semantics

* Phase 2: mark cache metadata emission as SDK-gated

* MCP 2026-07-28: fix HTTP routing-header conformance and registry OAuth validation

Phase 2 (Workstream B / SEP-2243): gate Mcp-Method/Mcp-Name enforcement on the 2026-07-28 protocol version and require Mcp-Name only for named methods (tools/call, resources/read, prompts/get), preserving legacy 2025-11-25 HTTP interop. Correct and extend ConsolidatedMode header tests (named-method rejection, non-named-method acceptance, legacy initialize interop).

Workstream G: add outbound OAuth validation to RegistryServerProvider, remove misleading dead issuer-binding branch, and correct the OAuth resource-parameter RFC citation (RFC 8707) in Authentication.md.

Workstream I item 6: add ServerToolLoader external-server discovery and proxy-routing fallback tests.

Docs: record Phase 1/2 and Workstream G verification findings in the migration proposal.

* Remove MCP migration proposal doc from PR (design/proposal doc, not shipped)

* Fix test harness for MCP 2026-07-28 beta SDK (Workstream I)

The beta SDK (2.0.0-preview.1) added a private protected abstract member (ResolveInputRequestsAsync) to McpClient, making it impossible to proxy with NSubstitute or subclass from a test assembly; every Substitute.For<McpClient>() threw TypeLoadException at mock-creation time.

Add a reusable LoopbackMcpClient test helper that builds a real McpClient over an in-process loopback transport (forcing the legacy 2025-11-25 handshake) and answers requests via a responder. Convert all McpClient mock sites (MockMcpClientBuilder, MockMcpDiscoveryStrategyBuilder, ServerToolLoaderTests, SingleProxyToolLoaderTests, BaseDiscoveryStrategyTests) to the loopback client, and observe client disposal via a transport-backed tracker.

Also fix three pre-existing migration test gaps surfaced by the full run:
- ServerStartCommandTests.InvalidMode: expect ClientTransportClosedException (wrapping IOException), the SDK's new early-transport-failure type.
- ClientToolTests ping: assert ping is unavailable on the 2026-07-28 protocol (method name retained for recorded-session matching).
- McpRuntimeTests null-parameter test: pass null Params so the runtime null-guard is exercised.

Core, Microsoft.Mcp.Core, and Azure.Mcp.Server test suites are green.

* Fix whitespace formatting in migrated tool-loader tests

Normalize over-indented lines flagged by dotnet format (WHITESPACE) that were introduced during the SDK RequestContext API migration edits.

* Make InvalidMode test platform-agnostic

ClientTransportClosedException.InnerException is platform-dependent (IOException on Windows, null on Linux CI). Assert only the outer ClientTransportClosedException, which is thrown consistently and already proves the invalid mode fails to start the server.

* Address Copilot PR review: test hangs, 404 leak, error body, doc

- HTTP test processes: disable stdout/stderr redirection (never read by HTTP tests) to eliminate child-process pipe-buffer hang risk. Stdio tests that read stdout keep stdout redirect but disable stderr. (Copilot #1/#2)
- SendWithRetryAsync: dispose the 404 HttpResponseMessage before retrying to prevent socket/handler leaks. (Copilot #5/#6)
- WriteMissingRoutingHeaderResponse: emit a proper JSON-RPC 2.0 error envelope and use JsonEncodedText.Encode + .ToString() for correct string escaping. (Copilot #3 / my F1)
- RegistryServerProvider class doc: replace the misleading Authorization Hardening bullet list with accurate language — only HTTPS + non-empty scope checks are performed here; issuer/app-type/PRM checks are delegated to Azure Identity. (Copilot #4 / my F3)

* Fix Fabric ServerStartupTests: restore stderr redirection broken by redirect fix

The previous change (afb871c) set RedirectStandardError = false on all Fabric test blocks. However all three tests call process.BeginErrorReadLine() and assert on the captured stderr to detect DI errors — BeginErrorReadLine() requires RedirectStandardError = true and throws InvalidOperationException otherwise. Restored to true in all three test blocks.

* Fix import ordering in McpServerElicitationExtensionsTests

* Fix Authentication.md: clarify issuer validation is a deployment requirement, not server-enforced

Three places in Authentication.md overclaimed that the Azure MCP Server enforces issuer validation for outbound registry connections. The code (ValidateOAuthConfiguration) only checks HTTPS and non-empty scopes; issuer/audience validation is performed by the downstream resource via Azure Identity bearer tokens. Updated: (1) the remote auth layer description, (2) the MCP 2026-07-28 note box, (3) the OAuth requirements table — separating enforced checks (HTTPS, non-empty scopes) from deployment requirements (issuer, app-type, scope registration). Addresses RickWinter review comment.

* Defer DeterministicToolResolution and dead telemetry constants to Phase 3 PR

DeterministicToolResolution.cs (220 lines) and its test file (189 lines) have no production callers — all three loader paths still guard intent resolution with SupportsSampling(), so a client without sampling gets the learn response and never reaches this resolver. The four companion telemetry constants (ResolutionMethod, SamplingAttempted, SamplingSucceeded, ResolutionConfidence) are also never emitted. Per RickWinter's review, defer to the Phase 3 PR that actually wires up deterministic routing so the surface lands with its integration tests. The code is preserved in commit ae8ff11 and can be cherry-picked into the Phase 3 branch.

* Harden W3C trace context capture: validate inputs before recording to telemetry

CaptureToolCallMeta accepted traceparent, tracestate, and baggage verbatim from untrusted MCP _meta fields. An attacker controlling tool-call input could stuff arbitrary data into these fields and have it written into distributed traces. - traceparent: validate against the W3C format regex (^[0-9a-f]{2}-[0-9a-f]{32}-[0-9a-f]{16}-[0-9a-f]{2}$) before adding the tag; silently drop malformed values. - tracestate: cap at 512 chars per W3C spec guidance; drop if longer. - baggage: removed entirely. Baggage is an unbounded cross-service propagation bag, not a trace identifier. Recording it verbatim lets callers write arbitrary key-value pairs into telemetry. Remove the TagName.Baggage constant as it is now unused.

* Fix Insights build against MCP SDK 2.0.0-preview.1: suppress deprecated sampling APIs

Azure.Mcp.Tools.Insights was added to main after this branch was cut. When CI merges the PR into main the Insights source is compiled against the upgraded SDK, which made four sampling APIs error-level obsolete (MCP9005): CreateMessageRequestParams, SamplingMessage, McpServer.SampleAsync, ClientCapabilities.Sampling. Additionally, CommandContext.McpServer and CommandContext.ProgressToken were removed from CommandContext in this migration, causing CS1061 errors in InsightsGetCommand. Fixes: - Restore McpServer? and ProgressToken? to CommandContext (neither type is deprecated; only McpServer.SampleAsync is). - Restore McpServer = request.Server / ProgressToken = request.Params.ProgressToken in CommandFactoryToolLoader and NamespaceToolLoader. - Add NoWarn>MCP9005 to the Insights src and test csproj files with a comment noting migration to MRTR is tracked as Phase 3 work. All 54 Insights unit tests pass.

* Fix broken link in Authentication.md: correct csharp-sdk issue URL

* Address review: per-request client info, routing-header middleware docs, telemetry tests, changelog

Three open review comments addressed:

Comment 2 (alzimmermsft): In the 2026-07-28 stateless protocol there is no initialize handshake, so request.Server.ClientInfo is null on every request. Clients embed their identity in each request's _meta under 'io.modelcontextprotocol/clientInfo'. Update TelemetryService.StartActivity to read client name/version from _meta when present (per-request wins over session-level clientInfo).
- McpHelper: add ClientInfoMetaKey/ClientInfoNameKey/ClientInfoVersionKey constants
- ITelemetryService.StartActivity: add RequestParams? parameter
- TelemetryService: extract SetClientNameAndVersion helper; reads from _meta when requestParams != null
- McpRuntime: pass request.Params to both StartActivity calls

Comment 1 (vukelich): Document why ValidateMcpRoutingHeadersMiddleware exists alongside the SDK's own ValidateMcpHeaders. The SDK validates post-body-parse; at the Kestrel 30 MB limit it throws BadHttpRequestException instead of a clean JSON-RPC error. Our middleware rejects before the body is read. Updated block comment in ServiceStartCommand.cs.

New tests (15 total):
- McpRuntimeTests: 9 tests for CaptureToolCallMeta (valid/invalid traceparent, tracestate length cap, baggage never recorded, null meta)
- TelemetryServiceTests: 6 tests for SetClientNameAndVersion (null/null, session-only, _meta-only, _meta wins over session, non-string values ignored, missing key)
- Exposes CaptureToolCallMeta as internal TestHook_CaptureToolCallMeta; adds Azure.Mcp.Core.Tests to InternalsVisibleTo

Changelog: added servers/Azure.Mcp.Server/changelog-entries/1784709301470.yaml for the MCP 2026-07-28 migration.

* Add inline comments explaining elicitation wrapper and stateless ClientInfo behaviour

* Fix OTLP trace export: register SDK and ASP.NET Core activity sources

Two bugs in the OTLP trace pipeline (pre-existing on main, not introduced by this PR):

1. AddSource('Azure.Mcp.Server') was registered in ConfigureOpenTelemetryTracerProvider but not in the OTLP WithTracing chain. These are separate TracerProviderBuilder instances so the OTLP exporter never received those spans. Fixed by also calling AddSource in the OTLP WithTracing block.

2. ListToolsHandler/ToolExecuted spans are children of the ASP.NET Core HTTP request span. Without AddAspNetCoreInstrumentation(), the root HTTP span is unsampled and the entire trace tree is dropped. Added AddAspNetCoreInstrumentation() to the OTLP WithTracing chain so the full POST / -> ListToolsHandler -> (child ops) trace hierarchy appears in Aspire/OTLP collectors.

Also added AddSource for ModelContextProtocol and ModelContextProtocol.Server to export MCP SDK-internal spans in the same trace.

Validated locally: old server (no fix) shows zero tool traces in Aspire even after a successful tools/call. New server (with fix) shows full POST / + ToolExecuted trace hierarchy with ClientName, ClientVersion, w3c.traceparent, and w3c.tracestate tags.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants