Remove dependency on CIO engine (#223)

<!-- Provide a brief summary of your changes -->
Replace the CIO dependency with only server/client core dependency.

## Motivation and Context
<!-- Why is this change needed? What problem does it solve? -->
In order to minimize the size of package. There are probably other
existing engines like Netty/Tomcat(server) or Java/OkHttp/Apache(client)
in the classpath. So we can reuse existing infrastructure.

## How Has This Been Tested?
<!-- Have you tested this in a real application? Which scenarios were
tested? -->
I have run:
- kotlin-sdk-client: jvmTest, jsTest
- kotlin-sdk-test: jvmTest, jsTest
- kotlin-sdk-server: allTests
- All `build` of samples

I have an issue about `samples/kotlin-mcp-server`.
`io.modelcontextprotocol` is not found in `commonMain`.

## Breaking Changes
<!-- Will users need to update their code or configurations? -->
Yes. They need to `implementation` CIO engine manually if they use it in
their app.

## Types of changes
<!-- What types of changes does your code introduce? Put an `x` in all
the boxes that apply: -->
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [x] Breaking change (fix or feature that would cause existing
functionality to change)
- [x] Documentation update

## Checklist
<!-- Go over all the following points, and put an `x` in all the boxes
that apply. -->
- [ ] I have read the [MCP
Documentation](https://modelcontextprotocol.io)
- [ ] My code follows the repository's style guidelines
- [x] New and existing tests pass locally
- [ ] I have added appropriate error handling
- [ ] I have added or updated documentation as needed

## Additional context
<!-- Add any other context, implementation notes, or design decisions
-->

closes https://github.com/modelcontextprotocol/kotlin-sdk/issues/111

---------

Co-authored-by: Konstantin Pavlov <1517853+kpavlov@users.noreply.github.com>
This commit is contained in:
木葉 Scarlet 2025-09-11 19:30:36 +08:00 • committed by GitHub
commit b1ba0cd371
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -40,10 +40,23 @@ Add the dependency:
```kotlin
dependencies {
// Use the badge above for the latest version
// See the badge above for the latest version
implementation("io.modelcontextprotocol:kotlin-sdk:$mcpVersion")
}
```
MCP SDK uses [Ktor](https://ktor.io/), but does not come with a specific engine dependency.
You should add [Ktor client](https://ktor.io/docs/client-dependencies.html#engine-dependency)
and/or [Ktor server](https://ktor.io/docs/client-dependencies.html#engine-dependency) dependency
to your project yourself, e.g.:
```kotlin
dependencies {
// for client:
implementation("io.ktor:ktor-client-cio:$ktorVersion")
// for server:
implementation("io.ktor:ktor-server-netty:$ktorVersion")
}
```
## Quick Start