-
Notifications
You must be signed in to change notification settings - Fork 341
MCP stdio: negotiate initialize protocol version, default to 2025-11-25, return description in serverInfo, and add initialize wire-shape tests #3622
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+353
−14
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
495609f
Initial plan
Copilot 56b7101
Negotiate MCP initialize protocol version with client request
Copilot 86564d1
Address MCP protocol negotiation review feedback
Copilot 474557b
Use serverInfo.description for MCP 2025-11-25 initialize metadata
Copilot 3216a24
Merge branch 'main' into copilot/fix-mcp-initialize-response
Aniruddh25 73540aa
Add HandleInitialize wire-shape tests for MCP initialize responses
Copilot 8dfe423
Merge branch 'main' into copilot/fix-mcp-initialize-response
Aniruddh25 59dca7a
Refactor MCP protocol negotiation tests to DataRow and add same-versi…
Copilot 22ebeef
Merge branch 'main' into copilot/fix-mcp-initialize-response
aaronburtle File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| // Copyright (c) Microsoft Corporation. | ||
| // Licensed under the MIT License. | ||
|
|
||
| using Azure.DataApiBuilder.Mcp.Core; | ||
| using Microsoft.Extensions.Configuration; | ||
| using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
|
|
||
| namespace Azure.DataApiBuilder.Service.Tests.UnitTests | ||
| { | ||
| [TestClass] | ||
| public class McpProtocolDefaultsTests | ||
|
Aniruddh25 marked this conversation as resolved.
|
||
| { | ||
| [TestMethod] | ||
| public void ResolveProtocolVersion_WithoutOverride_UsesLatestDefault() | ||
| { | ||
| IConfiguration config = new ConfigurationBuilder().Build(); | ||
|
|
||
| string resolved = McpProtocolDefaults.ResolveProtocolVersion(config); | ||
|
|
||
| Assert.AreEqual("2025-11-25", resolved); | ||
| } | ||
|
|
||
| [DataTestMethod] | ||
| [DataRow("2025-11-25", "2026-01-01", "2025-11-25")] | ||
| [DataRow("2025-11-25", "2025-06-18", "2025-06-18")] | ||
| [DataRow("2025-11-25", "2025-11-25", "2025-11-25")] | ||
| [DataRow("2025-11-25", null, "2025-11-25")] | ||
| [DataRow("a-version", "z-version", "a-version")] | ||
| public void ResolveInitializeResponseProtocolVersion_ReturnsExpectedNegotiatedVersion( | ||
| string supportedProtocolVersion, | ||
| string clientRequestedProtocolVersion, | ||
| string expectedVersion) | ||
| { | ||
| string resolved = McpProtocolDefaults.ResolveInitializeResponseProtocolVersion( | ||
| supportedProtocolVersion, | ||
| clientRequestedProtocolVersion); | ||
|
|
||
| Assert.AreEqual(expectedVersion, resolved); | ||
| } | ||
|
|
||
| [TestMethod] | ||
| public void ShouldUseServerInfoDescription_AtOrAboveThreshold_ReturnsTrue() | ||
| { | ||
| Assert.IsTrue(McpProtocolDefaults.ShouldUseServerInfoDescription("2025-11-25")); | ||
| Assert.IsTrue(McpProtocolDefaults.ShouldUseServerInfoDescription("2025-12-01")); | ||
| } | ||
|
|
||
| [TestMethod] | ||
| public void ShouldUseServerInfoDescription_BelowThreshold_ReturnsFalse() | ||
| { | ||
| Assert.IsFalse(McpProtocolDefaults.ShouldUseServerInfoDescription("2025-06-18")); | ||
| } | ||
| } | ||
| } | ||
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.