Skip to content

Microsoft AI guidance- Migrating to Microsoft MCP package#3154

Open
souvikghosh04 wants to merge 9 commits intomainfrom
Usr/sogh/msftaiguidance
Open

Microsoft AI guidance- Migrating to Microsoft MCP package#3154
souvikghosh04 wants to merge 9 commits intomainfrom
Usr/sogh/msftaiguidance

Conversation

@souvikghosh04
Copy link
Contributor

@souvikghosh04 souvikghosh04 commented Feb 24, 2026

Why make this change?

Migrate DAB's MCP layer from the community SDK (ModelContextProtocol 0.3.0-preview.4) to Microsoft's official Microsoft.ModelContextProtocol.HttpServer (0.1.0-preview.25). This positions DAB for future Entra ID authentication, MISE integration, rate limiting, and first-party OpenTelemetry support.

What is this change?

  • Package swap: Replaced two community NuGet packages (ModelContextProtocol + ModelContextProtocol.AspNetCore) with single Microsoft.ModelContextProtocol.HttpServer. Added EngThrive-MCP ADO feed + package source mapping. Aligned all OpenTelemetry packages (1.9 to 1.12/1.13). Bumped Configuration.Binder (8.0 to 9.0).
  • SDK API migration: Adopted new builder pattern — WithListToolsHandler() / WithCallToolHandler() replacing inline options delegates. Moved ServerInfo/Capabilities to defensive PostConfigure<McpServerOptions>.
  • Breaking change fixes: Removed read-only TextContentBlock.Type assignments. Replaced deprecated OTel APIs (SetStatus/RecordException to Activity native methods). Removed unused using OpenTelemetry.Trace.
  • Stdio fix: McpToolRegistry.RegisterTool() now skips same-instance re-registration via ReferenceEquals to prevent duplicate errors in stdio mode.
  • CI pipeline: Added NuGetAuthenticate service connection for EngThrive-MCP feed across all pipeline YAMLs.

How was this tested?

  • Unit Tests — 44 MCP-related tests pass (tool registry + telemetry), including 2 new idempotency tests for ReferenceEquals fix
  • Integration Tests (manual) — HTTP and stdio transports validated end-to-end (initialize, tools/list, CRUD operations, shutdown)
  • Build — 0 errors, 0 warnings. dotnet format --verify-no-changes clean.

@souvikghosh04 souvikghosh04 added this to the Feb 2026 milestone Feb 24, 2026
@souvikghosh04 souvikghosh04 self-assigned this Feb 24, 2026
@souvikghosh04 souvikghosh04 linked an issue Feb 24, 2026 that may be closed by this pull request
@souvikghosh04 souvikghosh04 moved this from Todo to In Progress in Data API builder Feb 24, 2026
@souvikghosh04
Copy link
Contributor Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 6 pipeline(s).

Copy link
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

Migrates DAB’s MCP hosting layer from the community MCP SDK to Microsoft’s Microsoft.ModelContextProtocol.HttpServer, updating service registration, endpoint mapping, middleware, and related telemetry/content handling to support the new package and enterprise features (Entra ID/MISE, rate limiting, OTel).

Changes:

  • Swaps MCP NuGet dependencies to Microsoft.ModelContextProtocol.HttpServer and updates NuGet feed/source mapping.
  • Updates MCP server setup to conditionally use Microsoft MCP pipeline when Entra ID is configured; otherwise falls back to base MCP server.
  • Adjusts telemetry and MCP response/test helpers for API changes (OTel exception recording, MCP content blocks).

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/Service/Startup.cs Passes IConfiguration into MCP registration and conditionally adds Microsoft MCP middleware.
src/Service.Tests/UnitTests/McpTelemetryTests.cs Updates test helper to stop setting read-only/removed TextContentBlock.Type.
src/Directory.Packages.props Replaces community MCP packages with Microsoft MCP HttpServer and bumps several related dependency versions.
src/Core/Telemetry/TelemetryTracesHelper.cs Updates exception/status reporting on Activity for newer telemetry APIs.
src/Azure.DataApiBuilder.Mcp/Utils/McpResponseBuilder.cs Updates MCP response content construction for the new SDK shape.
src/Azure.DataApiBuilder.Mcp/Core/McpToolRegistry.cs Avoids duplicate-registration errors by skipping same-instance re-registration.
src/Azure.DataApiBuilder.Mcp/Core/McpServiceCollectionExtensions.cs Threads IConfiguration into MCP registration and exposes Entra-config check.
src/Azure.DataApiBuilder.Mcp/Core/McpServerConfiguration.cs Selects Microsoft vs base MCP server builder and wires tool handlers + HTTP transport.
src/Azure.DataApiBuilder.Mcp/Core/McpEndpointRouteBuilderExtensions.cs Conditionally maps Microsoft MCP endpoints when Entra ID is configured.
src/Azure.DataApiBuilder.Mcp/Azure.DataApiBuilder.Mcp.csproj Replaces community MCP package refs with Microsoft MCP HttpServer.
Nuget.config Adds EngThrive-MCP feed and package source mapping for MCP/MISE packages.

@souvikghosh04 souvikghosh04 force-pushed the Usr/sogh/msftaiguidance branch from 8744d53 to 6176d27 Compare February 26, 2026 13:44
@souvikghosh04
Copy link
Contributor Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 6 pipeline(s).

@souvikghosh04
Copy link
Contributor Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 6 pipeline(s).

@souvikghosh04
Copy link
Contributor Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 6 pipeline(s).

@souvikghosh04
Copy link
Contributor Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 6 pipeline(s).

@souvikghosh04
Copy link
Contributor Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 6 pipeline(s).

@souvikghosh04 souvikghosh04 changed the title Microsoft AI guidance- update MCP package Microsoft AI guidance- Use Microsoft MCP package Feb 27, 2026
@souvikghosh04 souvikghosh04 modified the milestones: Feb 2026, March 2026 Feb 27, 2026
@souvikghosh04
Copy link
Contributor Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 6 pipeline(s).

@souvikghosh04 souvikghosh04 changed the title Microsoft AI guidance- Use Microsoft MCP package Microsoft AI guidance- Migrating to Microsoft MCP package Feb 27, 2026
@souvikghosh04 souvikghosh04 marked this pull request as ready for review February 27, 2026 16:13
@souvikghosh04 souvikghosh04 moved this from In Progress to Review In Progress in Data API builder Feb 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Review In Progress

Development

Successfully merging this pull request may close these issues.

Microsoft AI guidance on MCP

3 participants