Skip to content

Commit 2da14b0

Browse files
authored
#302 Update samples build workflow (#330)
# #302 Update samples build workflow - Introduce workflow to build samples independently from the main project - Keep building samples against the current snapshot version of the SDK. Update composite build configuration. - Temporarily disable "samples/kotlin-mcp-server": the multiplatform project is broken. **It doesn't compile for me even on the main branch**. Not working with [MCP Instepcor](https://modelcontextprotocol.io/docs/tools/inspector), because CORS is not configured. Deserves a separate PR to fix. ## Motivation and Context Samples should be independently buildable ## How Has This Been Tested? <!-- Have you tested this in a real application? Which scenarios were tested? --> ## 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 - [x] Build improvement - [x] Tests ## 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) - [x] My code follows the repository's style guidelines - [ ] 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 ba18b2b commit 2da14b0

File tree

37 files changed

+1271
-73
lines changed

37 files changed

+1271
-73
lines changed

.github/workflows/build.yml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,24 +36,26 @@ jobs:
3636

3737
- name: Build with Gradle
3838
run: |-
39-
./gradlew --no-daemon --rerun-tasks \
39+
./gradlew --no-daemon \
40+
--rerun-tasks \
4041
clean \
4142
ktlintCheck \
4243
build \
4344
koverLog koverHtmlReport \
44-
publishToMavenLocal
45+
publishToMavenLocal \
46+
-Pversion=0.0.1-SNAPSHOT
4547
4648
- name: Build Kotlin-MCP-Client Sample
4749
working-directory: ./samples/kotlin-mcp-client
48-
run: ./../../gradlew --no-daemon clean build
50+
run: ./gradlew --no-daemon clean build -Pmcp.kotlin.overrideVersion=0.0.1-SNAPSHOT
4951

50-
- name: Build Kotlin-MCP-Server Sample
51-
working-directory: ./samples/kotlin-mcp-server
52-
run: ./../../gradlew --no-daemon clean build
52+
# - name: Build Kotlin-MCP-Server Sample
53+
# working-directory: ./samples/kotlin-mcp-server
54+
# run: ./gradlew --no-daemon clean build -Pmcp.kotlin.overrideVersion=0.0.1-SNAPSHOT
5355

5456
- name: Build Weather-Stdio-Server Sample
5557
working-directory: ./samples/weather-stdio-server
56-
run: ./../../gradlew --no-daemon clean build
58+
run: ./gradlew --no-daemon clean build -Pmcp.kotlin.overrideVersion=0.0.1-SNAPSHOT
5759

5860
- name: Upload Reports
5961
if: ${{ !cancelled() }}

.github/workflows/samples.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
matrix:
2424
sample:
2525
- kotlin-mcp-client
26-
- kotlin-mcp-server
26+
# - kotlin-mcp-server
2727
- weather-stdio-server
2828

2929
name: Build Sample
@@ -47,7 +47,7 @@ jobs:
4747

4848
- name: "Build Sample: ${{ matrix.sample }}"
4949
working-directory: ./samples/${{ matrix.sample }}
50-
run: ./../../gradlew --no-daemon clean build
50+
run: ./gradlew --no-daemon clean build
5151

5252
- name: Upload Reports
5353
if: ${{ !cancelled() }}

build.gradle.kts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,6 @@ plugins {
44
alias(libs.plugins.kover)
55
}
66

7-
allprojects {
8-
group = "io.modelcontextprotocol"
9-
version = "0.7.4-SNAPSHOT"
10-
}
11-
127
dependencies {
138
dokka(project(":kotlin-sdk-core"))
149
dokka(project(":kotlin-sdk-client"))

gradle.properties

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,6 @@ kotlin.js.yarn=false
1212
# MPP
1313
kotlin.mpp.enableCInteropCommonization=true
1414
kotlin.native.ignoreDisabledTargets=true
15+
16+
group=io.modelcontextprotocol
17+
version=0.7.4-SNAPSHOT

gradle/libs.versions.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ mokksy = "0.6.1"
2424
# Samples
2525
mcp-kotlin = "0.7.3"
2626
anthropic = "2.9.0"
27-
shadow = "8.1.1"
27+
shadow = "9.2.2"
2828

2929
[libraries]
3030
# Plugins
@@ -82,4 +82,4 @@ kover = { id = "org.jetbrains.kotlinx.kover", version.ref = "kover" }
8282
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
8383
kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
8484
kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
85-
shadow = { id = "com.github.johnrengelman.shadow", version.ref = "shadow" }
85+
shadow = { id = "com.gradleup.shadow", version.ref = "shadow" }

samples/kotlin-mcp-client/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ The client application performs the following tasks:
3434
Use the Gradle wrapper to build the application. In a terminal, run:
3535

3636
```shell
37-
./gradlew clean build -x test
37+
./gradlew clean build
3838
```
3939

4040
To run the client, execute the jar file and provide the path to your MCP server script.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
org.gradle.configuration-cache=true
2+
org.gradle.parallel=true
3+
org.gradle.caching=true
4+
5+
#mcp.kotlin.overrideVersion=0.0.1-SNAPSHOT
6+
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
[versions]
2+
anthropic = "2.9.0"
3+
kotlin = "2.2.20"
4+
ktor = "3.3.0"
5+
mcp-kotlin = "0.7.3"
6+
shadow = "9.2.2"
7+
slf4j = "2.0.17"
8+
9+
[libraries]
10+
anthropic-java = { group = "com.anthropic", name = "anthropic-java", version.ref = "anthropic" }
11+
ktor-client-cio = { group = "io.ktor", name = "ktor-client-cio", version.ref = "ktor" }
12+
mcp-kotlin-client = { group = "io.modelcontextprotocol", name = "kotlin-sdk-client", version.ref = "mcp-kotlin" }
13+
slf4j-simple = { group = "org.slf4j", name = "slf4j-simple", version.ref = "slf4j" }
14+
15+
[plugins]
16+
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
17+
shadow = { id = "com.gradleup.shadow", version.ref = "shadow" }
44.4 KB
Binary file not shown.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
distributionBase=GRADLE_USER_HOME
2+
distributionPath=wrapper/dists
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-9.1.0-bin.zip
4+
networkTimeout=10000
5+
validateDistributionUrl=true
6+
zipStoreBase=GRADLE_USER_HOME
7+
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)