test(mcp): add robust client-side behavioral tests for read-only and write modes#3791
test(mcp): add robust client-side behavioral tests for read-only and write modes#3791SeeyaVhora wants to merge 3 commits into
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: SeeyaVhora The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Hi @SeeyaVhora. Thanks for your PR. I'm waiting for a knative member to verify that this patch is reasonable to test. If it is, they should reply with Regular contributors should join the org to skip this step. Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
14784a9 to
ea9e39d
Compare
|
Hi @lkingland, As suggested in #3786, I've opened this follow-up PR to bring over the comprehensive client-side behavioral regression tests for the MCP server's read-only and write modes (since #3758 has merged). To make the review process as clean as possible, I've structured the changes into 3 logical commits:
Whenever you have a moment, I'd appreciate it if you could take a look. |
What does this PR do?
This PR introduces comprehensive, client-side behavioral regression tests for the Model Context Protocol (MCP) server.
Following the fix in #3758 (which solved the read-only state desync issue), these tests ensure that the MCP server's read-only and write modes behave exactly as expected from the perspective of an actual MCP client.
What is being tested?
Instead of just checking the internal state of the server, these tests use a real in-memory transport to interact with the server just like an MCP client would. We added four robust tests:
TestMCP_ToolsExposedViaProtocol:TestMCP_AllToolsExposedInReadonlyMode:deployanddelete) are still advertised when in read-only mode. (Read-only restrictions are enforced during execution, not by hiding the tools).TestMCP_ReadonlyEnforcedAtRuntime:deployanddelete) in read-only mode returns a protocol-level error (IsError=true), as expected.TestMCP_WriteModePermitsExecution:Verification
All tests have been run and are passing:
go test -v ./pkg/mcp/...PASS(including all new behavioral scenarios).This builds directly on the work approved in #3758 to ensure we prevent future regressions.