Add private protected ctors to McpClient and McpServer to prevent external derivation#1361
Closed
Add private protected ctors to McpClient and McpServer to prevent external derivation#1361
Conversation
…ent external derivation Co-authored-by: stephentoub <[email protected]>
Co-authored-by: stephentoub <[email protected]>
Contributor
|
@copilot lots of test failures in CI |
Co-authored-by: stephentoub <[email protected]>
…lTests Replace all Moq-based Mock<McpServer> usages with real McpServer instances created via McpServer.Create() using TestServerTransport. This removes the dependency on Moq in this test file. Co-authored-by: Copilot <[email protected]>
…mptTests Replace all Moq-based Mock<McpServer> usages with real McpServer instances created via McpServer.Create() using TestServerTransport. This removes the Moq dependency from this test file and uses concrete implementations instead. Co-authored-by: Copilot <[email protected]>
…ourceTests Remove Moq dependency and use McpServer.Create() with TestServerTransport to create real server instances instead of mocks. Co-authored-by: Copilot <[email protected]>
…erTransport Co-authored-by: stephentoub <[email protected]>
…ameter names Co-authored-by: stephentoub <[email protected]>
Co-authored-by: stephentoub <[email protected]>
Contributor
Author
Fixed in adb6f59. Replaced all |
Contributor
|
Replaced by #1363 |
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.
McpClientandMcpServerhave implicit protected constructors, allowing external derivation. The design hasn't been validated for that, and no external derived types are known.private protectedparameterless constructors toMcpClientandMcpServer, restricting derivation to same-assembly types (McpClientImpl,McpServerImpl)TestServerForIChatClient(a test-onlyMcpServersubclass) and rewrote the twoAsSamplingChatClienttests to useMcpServer.Create()withTestServerTransportMockSamplingResultproperty toTestServerTransport(consistent with existingMockTask/MockTaskResult/MockTaskListpattern) to support customizable sampling responsesMock<McpServer>usages across test files with realMcpServerinstances viaMcpServer.Create()+TestServerTransport, removing Moq dependency from 6 test files💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.