Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Oct 16, 2025

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:

  1. Connection and Initialization - Verifies successful connection to the Microsoft Learn MCP server and proper protocol negotiation
  2. Tool Discovery - Tests the ability to list available tools from the server
  3. Resource Enumeration - Tests listing resources (if available)
  4. Prompt Enumeration - Tests listing prompts (if available)
  5. Server Ping - Validates basic connectivity via ping

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:

  • How to run the Microsoft Learn MCP server tests specifically
  • How to run all manual tests or exclude them from test runs
  • Requirements (networking, .NET 10.0 SDK)

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

# Run just the Microsoft Learn MCP server tests
dotnet test --filter "(FullyQualifiedName~MicrosoftLearnMcpServerTests)"

# Run all manual tests
dotnet test --filter "(Execution=Manual)"

# Exclude manual tests from a test run
dotnet test --filter "(Execution!=Manual)"

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

Please open a PR that adds a test against the Microsoft Learn MCP server (https://learn.microsoft.com/api/mcp) via streamable HTTP.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Copy link
Contributor Author

Copilot AI commented Oct 16, 2025

@stephentoub Unfortunately, I hit an error while trying to use the custom Copilot setup steps configured for this repository and had to close this PR. The error I am seeing is:

no valid jobs found in copilot-setup-steps.yaml

Once you or someone with the necessary access fixes the problem, please unassign and then reassign issue #0 to me and I'll retry. Thanks!

@Copilot Copilot AI changed the title [WIP] Add test for Microsoft Learn MCP server via streamable HTTP Add integration tests for Microsoft Learn MCP server via Streamable HTTP Oct 16, 2025
@Copilot Copilot AI requested a review from stephentoub October 16, 2025 16:53
Copilot finished work on behalf of stephentoub October 16, 2025 16:53
@stephentoub stephentoub deleted the copilot/add-test-microsoft-learn-mcp branch October 17, 2025 00:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants