-
Notifications
You must be signed in to change notification settings - Fork 189
[WIP]test(integration): Add Streamable HTTP transport integration tests #486
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
[WIP]test(integration): Add Streamable HTTP transport integration tests #486
Conversation
e71221c to
56cd2d7
Compare
kpavlov
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, @jskjw157!
Could we take a look at the test scenarios and see, if we can move any use cases that aren’t specific to the protocol to the base class?
Also, could we tidy up those long TODO comments?
Let’s give another go, this time with a focus on making the tests easier to maintain.
...t/src/jvmTest/kotlin/io/modelcontextprotocol/kotlin/sdk/integration/kotlin/KotlinTestBase.kt
Show resolved
Hide resolved
...Test/kotlin/io/modelcontextprotocol/kotlin/sdk/integration/utils/MockAuthorizationWrapper.kt
Outdated
Show resolved
Hide resolved
...ntextprotocol/kotlin/sdk/integration/kotlin/streamablehttp/StreamableHttpToolSpecificTest.kt
Outdated
Show resolved
Hide resolved
...ntextprotocol/kotlin/sdk/integration/kotlin/streamablehttp/StreamableHttpToolSpecificTest.kt
Outdated
Show resolved
Hide resolved
...ntextprotocol/kotlin/sdk/integration/kotlin/streamablehttp/StreamableHttpToolSpecificTest.kt
Outdated
Show resolved
Hide resolved
...mTest/kotlin/io/modelcontextprotocol/kotlin/sdk/integration/utils/StreamableHttpTestUtils.kt
Outdated
Show resolved
Hide resolved
...xtprotocol/kotlin/sdk/integration/kotlin/streamablehttp/ToolIntegrationTestStreamableHttp.kt
Outdated
Show resolved
Hide resolved
|
Fixed in 97f1fa9 |
kpavlov
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please rebase onto main and squash the commits so we maintain a clear commit history.
...commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/server/StreamableHttpServerTransport.kt
Show resolved
Hide resolved
97f1fa9 to
921bed3
Compare
c2a5d9f to
8e9557c
Compare
|
Done! Rebased onto main and squashed the commits. Are there any other issues or features you'd recommend I work on next? |
8e9557c to
e253b80
Compare
kpavlov
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, @jskjw157!
While this PR does add some useful integration tests for the Streamable HTTP protocol, the security tests could use a bit more thought.
To start, I’d suggest moving the security tests to a separate PR and keeping this one focused on adding Streamable HTTP transport support to the existing tests (we can remove the ‘Security tests’ tag).
The access control system isn’t quite ready to go on the server yet, but we’re running some tests to check it out a bit early. Also, the list resource tests should make sure that resources are only shown to users who have the right to see them. Maybe we could replace MockAuthorizationWrapper with something more like a production-code solution, such as a chain of generic (resource+principal)-aware predicates. You might want to have a look at Spring Security, where you can find examples of how these ideas are put into action.
TL;DR - Let's remove security tests from this PR and keep it focused on adding Streamable HTTP protocol tests.
| private var stdioClientOutput: Sink? = null | ||
|
|
||
| // StreamableHTTP-specific fields | ||
| private var streamableHttpServerTransport: StreamableHttpServerTransport? = null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a heads-up: this should probably be in the streamable test subclass, but since we already have transport-specific fields here, let’s tackle it separately.
...textprotocol/kotlin/sdk/integration/kotlin/security/AbstractPromptSecurityIntegrationTest.kt
Outdated
Show resolved
Hide resolved
...textprotocol/kotlin/sdk/integration/kotlin/security/AbstractPromptSecurityIntegrationTest.kt
Outdated
Show resolved
Hide resolved
| fun testListPromptsDenied() { | ||
| runBlocking { | ||
| val result = client.listPrompts() | ||
| assertNotNull(result, "List prompts should succeed") | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test does not redundant
...textprotocol/kotlin/sdk/integration/kotlin/security/AbstractPromptSecurityIntegrationTest.kt
Outdated
Show resolved
Hide resolved
...Test/kotlin/io/modelcontextprotocol/kotlin/sdk/integration/utils/MockAuthorizationWrapper.kt
Outdated
Show resolved
Hide resolved
...Test/kotlin/io/modelcontextprotocol/kotlin/sdk/integration/utils/MockAuthorizationWrapper.kt
Outdated
Show resolved
Hide resolved
...mTest/kotlin/io/modelcontextprotocol/kotlin/sdk/integration/utils/StreamableHttpTestUtils.kt
Outdated
Show resolved
Hide resolved
...xtprotocol/kotlin/sdk/integration/kotlin/security/AbstractResourceSecurityIntegrationTest.kt
Outdated
Show resolved
Hide resolved
...ontextprotocol/kotlin/sdk/integration/kotlin/security/AbstractToolSecurityIntegrationTest.kt
Outdated
Show resolved
Hide resolved
e253b80 to
d1b3f67
Compare
5ac3cba to
5d71104
Compare
|
Thanks, @kpavlov! I've updated the PR to address the review feedback:
There are still a couple of notes around transport-specific fields in |
|
Follow-up: there are a couple of inline notes about transport-specific fields living in |
| console.error('Error:', error); | ||
| process.exit(1); | ||
| // Don't hard-exit; allow finally{} to run so the client always closes cleanly. | ||
| process.exitCode = 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍🏻
5d71104 to
600285a
Compare
600285a to
3c65404
Compare
…ing in MockMcp - remove unised StreamableHttpTestUtils - fix session id header is [MCP-Session-Id"](https://modelcontextprotocol.io/specification/2025-11-25/basic/transports)
kpavlov
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let’s merge this and focus more on testing in the follow-up PRs.
Summary
Add integration tests for Prompts, Resources, and Tools over Streamable HTTP transport as outlined in #183.
Changes
STREAMABLE_HTTPtransport in test baseRelated to #332