Skip to content

Commit cdda685

Browse files
authored
#196 Update build configuration and workflows for enhanced local publ… (#275)
#196 Update build configuration and workflows for enhanced local publishing and sample builds - Add `mavenLocal()` to repository configuration in sample projects. - Update dependencies to distinguish between `mcp.kotlin.client` and `mcp.kotlin.server`. - Include `JAVA_OPTS` for optimized memory usage in GitHub workflow. - Enhance build workflow to include local publishing and build steps for sample projects. - Add package-lock.json for Kotlin JS/WASM Store - Switch to SNAPSHOT versions by default ## Motivation and Context #196 Samples MUST be validated as part of the build ## How Has This Been Tested? ```sh ./gradlew :kotlin-sdk-core:publishToMavenLocal ./gradlew :kotlin-sdk-client:publishToMavenLocal ./gradlew :kotlin-sdk-server:publishToMavenLocal ( cd ./samples/kotlin-mcp-client && ./../../gradlew clean build ) ( cd ./samples/kotlin-mcp-server && ./../../gradlew clean build ) ( cd ./samples/weather-stdio-server && ./../../gradlew clean build ) ``` ## Breaking Changes <!-- Will users need to update their code or configurations? --> ## 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) - [ ] Breaking change (fix or feature that would cause existing functionality to change) - [ ] Documentation update ## Checklist <!-- Go over all the following points, and put an `x` in all the boxes that apply. --> - [x] 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 -->
1 parent 41fc351 commit cdda685

File tree

10 files changed

+33
-20
lines changed

10 files changed

+33
-20
lines changed

.github/workflows/build.yml

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ jobs:
1616
validate-pr:
1717
runs-on: macos-latest-xlarge
1818
name: Validate PR
19+
env:
20+
JAVA_OPTS: "-Xmx8g -Dfile.encoding=UTF-8 -Djava.awt.headless=true -Dkotlin.daemon.jvm.options=-Xmx6g"
1921
steps:
2022
- uses: actions/checkout@v5
2123

@@ -32,9 +34,21 @@ jobs:
3234
cache-read-only: true
3335

3436
- name: Build with Gradle
35-
run: ./gradlew clean ktlintCheck build koverLog koverHtmlReport
36-
env:
37-
JAVA_OPTS: "-Xmx8g -Dfile.encoding=UTF-8 -Djava.awt.headless=true -Dkotlin.daemon.jvm.options=-Xmx6g"
37+
run: |-
38+
./gradlew clean ktlintCheck build koverLog koverHtmlReport
39+
./gradlew :kotlin-sdk-core:publishToMavenLocal :kotlin-sdk-client:publishToMavenLocal :kotlin-sdk-server:publishToMavenLocal
40+
41+
- name: Build Kotlin-MCP-Client Sample
42+
working-directory: ./samples/kotlin-mcp-client
43+
run: ./../../gradlew clean build
44+
45+
- name: Build Kotlin-MCP-Server Sample
46+
working-directory: ./samples/kotlin-mcp-server
47+
run: ./../../gradlew clean build
48+
49+
- name: Build Weather-Stdio-Server Sample
50+
working-directory: ./samples/weather-stdio-server
51+
run: ./../../gradlew clean build
3852

3953
- name: Upload Reports
4054
if: ${{ !cancelled() }}

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ plugins {
66

77
allprojects {
88
group = "io.modelcontextprotocol"
9-
version = "0.7.1"
9+
version = "0.7.2-SNAPSHOT"
1010
}
1111

1212
dependencies {

gradle.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ org.jetbrains.dokka.experimental.gradle.pluginMode.noWarn=true
77
# Kotlin
88
kotlin.code.style=official
99
kotlin.daemon.jvmargs=-Xmx4G
10+
# Build JS targets using npm package manager https://kotlinlang.org/docs/js-project-setup.html#npm-dependencies
11+
kotlin.js.yarn=false
1012
# MPP
1113
kotlin.mpp.enableCInteropCommonization=true
1214
kotlin.native.ignoreDisabledTargets=true

gradle/libs.versions.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ kotest = "5.9.1"
2020
awaitility = "4.3.0"
2121

2222
# Samples
23-
mcp-kotlin = "0.7.1"
23+
mcp-kotlin = "0.7.2-SNAPSHOT"
2424
anthropic = "2.7.0"
2525
shadow = "8.1.1"
2626

@@ -57,7 +57,8 @@ slf4j-simple = { group = "org.slf4j", name = "slf4j-simple", version.ref = "slf4
5757
# Samples
5858
ktor-client-cio = { group = "io.ktor", name = "ktor-client-cio", version.ref = "ktor" }
5959
ktor-server-cio = { group = "io.ktor", name = "ktor-server-cio", version.ref = "ktor" }
60-
mcp-kotlin = { group = "io.modelcontextprotocol", name = "kotlin-sdk", version.ref = "mcp-kotlin" }
60+
mcp-kotlin-client = { group = "io.modelcontextprotocol", name = "kotlin-sdk-client", version.ref = "mcp-kotlin" }
61+
mcp-kotlin-server = { group = "io.modelcontextprotocol", name = "kotlin-sdk-server", version.ref = "mcp-kotlin" }
6162
anthropic-java = { group = "com.anthropic", name = "anthropic-java", version.ref = "anthropic" }
6263
ktor-client-content-negotiation = { group = "io.ktor", name = "ktor-client-content-negotiation", version.ref = "ktor" }
6364
ktor-serialization-kotlinx-json = { group = "io.ktor", name = "ktor-serialization-kotlinx-json", version.ref = "ktor" }

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ group = "org.example"
1212
version = "0.1.0"
1313

1414
dependencies {
15-
implementation(libs.mcp.kotlin)
15+
implementation(libs.mcp.kotlin.client)
1616
implementation(libs.ktor.client.cio)
1717
implementation(libs.anthropic.java)
1818
implementation(libs.slf4j.simple)

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,12 @@ pluginManagement {
99

1010
dependencyResolutionManagement {
1111
repositories {
12+
mavenLocal()
1213
mavenCentral()
1314
}
1415
versionCatalogs {
1516
create("libs") {
1617
from(files("../../gradle/libs.versions.toml"))
1718
}
1819
}
19-
}
20+
}

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

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@ plugins {
1111
group = "org.example"
1212
version = "0.1.0"
1313

14-
repositories {
15-
mavenCentral()
16-
}
17-
1814
val jvmMainClass = "Main_jvmKt"
1915

2016
kotlin {
@@ -43,7 +39,7 @@ kotlin {
4339

4440
sourceSets {
4541
commonMain.dependencies {
46-
implementation(libs.mcp.kotlin)
42+
implementation(libs.mcp.kotlin.server)
4743
implementation(libs.ktor.server.cio)
4844
}
4945
jvmMain.dependencies {

samples/kotlin-mcp-server/settings.gradle.kts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,12 @@ pluginManagement {
99

1010
dependencyResolutionManagement {
1111
repositories {
12+
mavenLocal()
1213
mavenCentral()
1314
}
1415
versionCatalogs {
1516
create("libs") {
1617
from(files("../../gradle/libs.versions.toml"))
1718
}
1819
}
19-
}
20+
}

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

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,19 @@ application {
99
mainClass.set("io.modelcontextprotocol.sample.server.MainKt")
1010
}
1111

12-
repositories {
13-
mavenCentral()
14-
}
15-
1612
group = "org.example"
1713
version = "0.1.0"
1814

1915
dependencies {
2016
implementation(libs.ktor.client.content.negotiation)
2117
implementation(libs.ktor.serialization.kotlinx.json)
22-
implementation(libs.mcp.kotlin)
18+
implementation(libs.mcp.kotlin.server)
2319
implementation(libs.ktor.server.cio)
2420
implementation(libs.ktor.client.cio)
2521
implementation(libs.slf4j.simple)
2622

2723
testImplementation(kotlin("test"))
24+
testImplementation(libs.mcp.kotlin.client)
2825
testImplementation(libs.kotlinx.coroutines.test)
2926
}
3027

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,12 @@ pluginManagement {
99

1010
dependencyResolutionManagement {
1111
repositories {
12+
mavenLocal()
1213
mavenCentral()
1314
}
1415
versionCatalogs {
1516
create("libs") {
1617
from(files("../../gradle/libs.versions.toml"))
1718
}
1819
}
19-
}
20+
}

0 commit comments

Comments
 (0)