-
Notifications
You must be signed in to change notification settings - Fork 181
Add MCP conformance test coverage #435
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
Conversation
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.
Pull request overview
This PR adds comprehensive MCP (Model Context Protocol) conformance test coverage to the Kotlin SDK. The implementation includes a test server, test client, and a test harness that integrates with the official @modelcontextprotocol/conformance testing framework from npm.
Key Changes
- Created a conformance test framework with dynamic JUnit tests for both server and client scenarios
- Implemented an HTTP-based MCP test server using Ktor with SSE support for streaming
- Added a conformance test client that validates MCP protocol compliance
- Integrated conformance testing into the CI/CD pipeline with artifact collection
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 12 comments.
Show a summary per file
| File | Description |
|---|---|
| kotlin-sdk-test/src/jvmTest/kotlin/io/modelcontextprotocol/kotlin/sdk/conformance/ConformanceTest.kt | Test harness that launches the conformance server and runs both server and client test scenarios using the official conformance tool |
| kotlin-sdk-test/src/jvmTest/kotlin/io/modelcontextprotocol/kotlin/sdk/conformance/ConformanceServer.kt | HTTP-based MCP server implementation with session management, SSE streaming, and test resources (tools, prompts, resources) |
| kotlin-sdk-test/src/jvmTest/kotlin/io/modelcontextprotocol/kotlin/sdk/conformance/ConformanceClient.kt | MCP client implementation that connects to test servers and validates tool calling functionality |
| kotlin-sdk-test/build.gradle.kts | Adds custom Gradle task for running conformance tests with detailed logging and test classpath configuration |
| .gitignore | Excludes conformance test results directory from version control |
| .github/workflows/build.yml | Integrates conformance tests into CI pipeline with Node.js setup and artifact upload for test results |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
...nce-test/src/test/kotlin/io/modelcontextprotocol/kotlin/sdk/conformance/ConformanceServer.kt
Show resolved
Hide resolved
...dk-test/src/jvmTest/kotlin/io/modelcontextprotocol/kotlin/sdk/conformance/ConformanceTest.kt
Outdated
Show resolved
Hide resolved
...-test/src/jvmTest/kotlin/io/modelcontextprotocol/kotlin/sdk/conformance/ConformanceServer.kt
Outdated
Show resolved
Hide resolved
...-test/src/jvmTest/kotlin/io/modelcontextprotocol/kotlin/sdk/conformance/ConformanceServer.kt
Outdated
Show resolved
Hide resolved
...-test/src/jvmTest/kotlin/io/modelcontextprotocol/kotlin/sdk/conformance/ConformanceClient.kt
Outdated
Show resolved
Hide resolved
...-test/src/jvmTest/kotlin/io/modelcontextprotocol/kotlin/sdk/conformance/ConformanceServer.kt
Show resolved
Hide resolved
...nce-test/src/test/kotlin/io/modelcontextprotocol/kotlin/sdk/conformance/ConformanceServer.kt
Show resolved
Hide resolved
...-test/src/jvmTest/kotlin/io/modelcontextprotocol/kotlin/sdk/conformance/ConformanceServer.kt
Outdated
Show resolved
Hide resolved
...dk-test/src/jvmTest/kotlin/io/modelcontextprotocol/kotlin/sdk/conformance/ConformanceTest.kt
Outdated
Show resolved
Hide resolved
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.
@skarpovdev, Thank you! It's cool to have these tests running!
I see ConformanceTest is running as a part of :kotlin-sdk-test:jvmTest. Did you consider creating a different module/source root and/or excluding ConformanceTest from the everyday jvmRun task?
Would it also make sense to create different ConformanceClient/Server for other protocols?
I'm okay with it being done in a follow-up PR
Co-authored-by: Konstantin Pavlov <1517853+kpavlov@users.noreply.github.com>
Good point, I'll
Will do in this PR while I'm in the context. |
|
Looking at |
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.
LGTM
Motivation and Context
ConformanceTest, see the TODOs.npx @modelcontextprotocol/conformance listand run all of them.kotlin-sdk-test/resultsdirectory and contains JSONs like the one below:[ { "id": "mcp-client-initialization", "name": "MCPClientInitialization", "description": "Validates that MCP client properly initializes with server", "status": "SUCCESS", "timestamp": "2025-11-28T14:38:36.718Z", "specReferences": [ { "id": "MCP-Lifecycle", "url": "https://modelcontextprotocol.io/specification/2025-06-18/basic/lifecycle" } ], "details": { "protocolVersionSent": "2025-06-18", "expectedSpecVersion": "2025-06-18", "versionMatch": true, "clientName": "kotlin-conformance-client", "clientVersion": "1.0.0" } }, { "id": "server-info", "name": "ServerInfo", "description": "Test server info returned to client", "status": "INFO", "timestamp": "2025-11-28T14:38:36.718Z", "specReferences": [ { "id": "MCP-Lifecycle", "url": "https://modelcontextprotocol.io/specification/2025-06-18/basic/lifecycle" } ], "details": { "serverName": "test-server", "serverVersion": "1.0.0" } } ]As another future improvement, we can do somethig with these JSON files, like putting them into a job summary on GitHub.
kotlin-sdk-test/results/initialize-.......which contains errors because it tries to call a tool. I haven't investigated if it's just the way I wrote the client or related toStreamableHttpClientTransport.How Has This Been Tested?
Breaking Changes
Types of changes
Checklist
Additional context