[MCP] Respond to stdio initialize before metadata inference - #3804
Closed
Souvik Ghosh (Souvik04) wants to merge 1 commit into
Closed
[MCP] Respond to stdio initialize before metadata inference#3804Souvik Ghosh (Souvik04) wants to merge 1 commit into
Souvik Ghosh (Souvik04) wants to merge 1 commit into
Conversation
Defer metadata provider initialization and tool registration until the first tools/list or tools/call request so the MCP handshake is not blocked by schema introspection. Fixes Azure#3430
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
|
Superseded by #3805, opened from the Azure repository branch under the CODEOWNER account Souvik Ghosh (@souvikghosh04). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why make this change?
Fixes #3430.
MCP stdio currently performs database schema introspection before entering the JSON-RPC read loop. For remote databases with many entities, clients can time out waiting for the
initializeresponse even though the process and database are healthy.Related: #3783 and #3784. This change also ensures stdio initializes metadata providers without starting the HTTP host.
What is this change?
tools/listor validtools/callrequest.initializeresponds whiletools/listremains pending.How was this tested?
Focused MCP stdio and registry suite: 49 passed, 0 failed.
dotnet format --verify-no-changesandgit diff --checkalso pass.Sample Request(s)
Send
initialize,notifications/initialized, thentools/listover stdin. Theinitializeresponse is emitted immediately;tools/listwaits until schema inference and tool registration complete.{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-11-25","capabilities":{},"clientInfo":{"name":"probe","version":"1"}}} {"jsonrpc":"2.0","method":"notifications/initialized","params":{}} {"jsonrpc":"2.0","id":2,"method":"tools/list","params":{}}