Skip to content

Commit 4e76cd7

Browse files
committed
Add CIO runtime dependencies and slf4j
- Add runtime dependencies to CIO server/client in samples - Update README.md about adding Ktor engine dependencies - Add test runtime dependency to slf4j-simple
1 parent d24c6e7 commit 4e76cd7

File tree

7 files changed

+38
-11
lines changed

7 files changed

+38
-11
lines changed

README.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,23 @@ Add the dependency:
4040

4141
```kotlin
4242
dependencies {
43-
// Use the badge above for the latest version
43+
// See the badge above for the latest version
4444
implementation("io.modelcontextprotocol:kotlin-sdk:$mcpVersion")
4545
}
4646
```
47+
MCP SDK uses [Ktor](https://ktor.io/), but does not come with a specific engine dependency.
48+
You should add [Ktor client](https://ktor.io/docs/client-dependencies.html#engine-dependency)
49+
and/or [Ktor server](https://ktor.io/docs/client-dependencies.html#engine-dependency) dependency
50+
to your project yourself, e.g.:
51+
```kotlin
52+
dependencies {
53+
// for client:
54+
implementation("io.ktor:ktor-client-cio:$ktorVersion")
55+
// for server:
56+
implementation("io.ktor:ktor-server-netty:$ktorVersion")
57+
58+
}
59+
```
4760

4861
## Quick Start
4962

kotlin-sdk-client/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ kotlin {
4343
implementation(kotlin("test"))
4444
implementation(libs.ktor.client.mock)
4545
implementation(libs.kotlinx.coroutines.test)
46+
runtimeOnly(libs.slf4j.simple)
4647
}
4748
}
4849
}

kotlin-sdk-core/build.gradle.kts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,5 +47,11 @@ kotlin {
4747
implementation(libs.kotest.assertions.json)
4848
}
4949
}
50+
51+
jvmTest {
52+
dependencies {
53+
runtimeOnly(libs.slf4j.simple)
54+
}
55+
}
5056
}
5157
}

kotlin-sdk-server/build.gradle.kts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,12 @@ kotlin {
2121
dependencies {
2222
implementation(kotlin("test"))
2323
implementation(libs.kotlinx.coroutines.test)
24-
implementation(libs.slf4j.simple)
24+
}
25+
}
26+
27+
jvmTest {
28+
dependencies {
29+
runtimeOnly(libs.slf4j.simple)
2530
}
2631
}
2732
}

kotlin-sdk-test/build.gradle.kts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,18 @@ kotlin {
1313
dependencies {
1414
implementation(project(":kotlin-sdk"))
1515
implementation(kotlin("test"))
16+
implementation(libs.kotest.assertions.json)
17+
implementation(libs.kotlin.logging)
18+
implementation(libs.kotlinx.coroutines.test)
1619
implementation(libs.ktor.client.cio)
1720
implementation(libs.ktor.server.cio)
1821
implementation(libs.ktor.server.test.host)
19-
implementation(libs.kotlinx.coroutines.test)
20-
implementation(libs.kotest.assertions.json)
2122
}
2223
}
2324
jvmTest {
2425
dependencies {
2526
implementation(kotlin("test-junit5"))
26-
implementation(libs.kotlin.logging)
27-
implementation(libs.ktor.server.cio)
28-
implementation(libs.ktor.client.cio)
27+
runtimeOnly(libs.slf4j.simple)
2928
}
3029
}
3130
}

samples/kotlin-mcp-client/build.gradle.kts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ version = "0.1.0"
1313

1414
dependencies {
1515
implementation(libs.mcp.kotlin)
16-
implementation(libs.slf4j.simple)
16+
implementation(libs.ktor.client.cio)
1717
implementation(libs.anthropic.java)
18+
runtimeOnly(libs.slf4j.simple)
1819
}
1920

2021
tasks.test {

samples/weather-stdio-server/build.gradle.kts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,17 @@ repositories {
1313
mavenCentral()
1414
}
1515

16-
1716
group = "org.example"
1817
version = "0.1.0"
1918

2019
dependencies {
21-
implementation(libs.mcp.kotlin)
22-
implementation(libs.slf4j.simple)
2320
implementation(libs.ktor.client.content.negotiation)
2421
implementation(libs.ktor.serialization.kotlinx.json)
22+
implementation(libs.mcp.kotlin)
23+
runtimeOnly(libs.ktor.server.cio)
24+
runtimeOnly(libs.ktor.client.cio)
25+
runtimeOnly(libs.slf4j.simple)
26+
2527
testImplementation(kotlin("test"))
2628
testImplementation(libs.kotlinx.coroutines.test)
2729
}

0 commit comments

Comments
 (0)