Add MCP probe to comprehensive health endpoint#3685
Add MCP probe to comprehensive health endpoint#3685souvikghosh04 with Copilot wants to merge 10 commits into
Conversation
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
/azp run |
|
Azure Pipelines successfully started running 6 pipeline(s). |
aaronburtle
left a comment
There was a problem hiding this comment.
Looks good just a couple nits
|
@copilot review and address the review comments Add MCP probe to comprehensive health endpoint by Copilot · Pull Request #3685 · Azure/data-api-builder. check my follow-up comments and suggesstions as well. |
Addressed in cb6fa46. I fixed the MCP review nits: added the missing semicolon in |
Addressed the latest follow-up comments in 29de25a (updated MCP health-check |
|
/azp run |
|
Azure Pipelines successfully started running 6 pipeline(s). |
Why make this change?
/healthreport advertised whether MCP was enabled in itsconfigurationblock but never actually probed the MCP endpoint, so MCP outages were invisible to health monitoring.What is this change?
HealthCheckHelper— NewUpdateMcpHealthCheckResultsAsync, wired intoUpdateHealthCheckDetailsAsyncalongside the data-source/entity/embeddings checks. Runs only whenIsMcpEnabled; emits aHealthCheckResultEntrynamedmcp, tagged["mcp"], comparing response time against the default 1000 ms threshold.HttpUtilities.ExecuteMcpQueryAsync— POSTs a JSON-RPCinitializerequest toruntimeConfig.McpPathwithAccept: application/json, text/event-stream, reusing the existingCheckSanityOfUrlSSRF guard and role-header propagation.initializeis used becausetools/listrequires an active session under the Streamable HTTP transport.Utilities.CreateHttpMcpQuery— Builds the minimal initialize payload.HealthCheckConstants— Adds themcptag.Single
mcptag (mirroring the data-source check's singledata-sourcetag) rather than reusingendpoint, which is reserved for per-entity REST/GraphQL checks. The check is gated solely onIsMcpEnabledwith a default threshold — no new config surface.How was this tested?
ComprehensiveHealthEndpoint_ValidateContentsto assert themcptag appears iff MCP is enabled.TestHealthCheckMcpResponseAsync/TestFailureHealthCheckMcpResponseAsynccover success and non-2xx responses.Sample Request(s)
Resulting check entry when MCP is enabled:
{ "name": "mcp", "status": "Healthy", "tags": ["mcp"], "data": { "duration-ms": 12, "threshold-ms": 1000 } }