Add integration tests for Microsoft Learn MCP server via Streamable HTTP #880
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.
This PR adds integration tests that connect to the Microsoft Learn MCP server at
https://learn.microsoft.com/api/mcp
using Streamable HTTP transport, validating the SDK's ability to work with production MCP servers.Changes
New Test Suite:
MicrosoftLearnMcpServerTests
Created a comprehensive test class in
tests/ModelContextProtocol.Tests/MicrosoftLearnMcpServerTests.cs
that validates:All tests explicitly use
HttpTransportMode.StreamableHttp
to ensure the Streamable HTTP transport implementation is properly exercised.Documentation
Added
tests/README.md
with instructions for running manual tests, including:Design Decisions
Manual Execution: All tests are marked with
[Trait("Execution", "Manual")]
to exclude them from automated CI/CD pipelines, as they depend on an external production service that requires internet connectivity.Clean Code: Tests use a helper method
CreateClientAsync()
to reduce code duplication while maintaining readability.Flexible Assertions: For resource and prompt listing tests, we only assert that the results are non-null rather than non-empty, since we don't know the Microsoft Learn server's configuration.
Running the Tests
These tests provide real-world validation of the C# SDK's Streamable HTTP transport against a production MCP server, complementing the existing unit and integration tests that use local test servers.
Original prompt
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.