Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ See [How to Write a Git Commit Message](https://chris.beams.io/posts/git-commit/

* To build MCP Kotlin SDK, JDK version 21 or higher is required. Make sure this is your default JDK (`JAVA_HOME` is set
accordingly)
* To build for MacOS/iOS targets, Xcode/Command Line Tools should be installed. See Apple Developer [documentation](https://developer.apple.com/documentation/xcode/downloading-and-installing-additional-xcode-components) for details.
* To build JS/Wasm targets, [Node.js](https://nodejs.org/) must be installed.
* The project can be opened in IntelliJ IDEA without additional prerequisites.
Comment on lines +76 to 78
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

Specify minimum toolchain versions and quick install hints.

Add minimum versions (e.g., Xcode ≥ 15.x for current Kotlin/Native, Node.js ≥ LTS 18/20) and brief install commands to reduce setup friction.

What minimum versions are you targeting for:

  • Kotlin/Native toolchains on macOS/iOS (Xcode/CLT)?
  • Node.js for JS/Wasm builds?
🤖 Prompt for AI Agents
CONTRIBUTING.md lines 76-78: add explicit minimum toolchain versions and quick
install hints — target Xcode/Command Line Tools >= 15.x for Kotlin/Native on
macOS/iOS and Node.js LTS (preferably 18.x or 20.x) for JS/Wasm; update the
three bullets to include these minimum versions and a one-line install hint each
(e.g., obtain Xcode from the App Store and install the Command Line Tools, or
install Xcode via Homebrew Cask if preferred; use nvm or your package manager to
install the Node.js LTS version) and include a short note referencing where to
verify installed versions (xcodebuild -version / node -v) so contributors can
confirm they meet the minimums.


### Building MCP Kotlin SDK from source
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# MCP Kotlin SDK

[![Kotlin](https://img.shields.io/badge/kotlin-2.1-blue.svg?logo=kotlin)](http://kotlinlang.org)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

Align Kotlin badge with actual version (2.1.21).

Badge shows "2.1"; suggest "2.1.21" to match libs.versions.toml and avoid drift.

-[![Kotlin](https://img.shields.io/badge/kotlin-2.1-blue.svg?logo=kotlin)](http://kotlinlang.org)
+[![Kotlin](https://img.shields.io/badge/kotlin-2.1.21-blue.svg?logo=kotlin)](http://kotlinlang.org)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
[![Kotlin](https://img.shields.io/badge/kotlin-2.1-blue.svg?logo=kotlin)](http://kotlinlang.org)
[![Kotlin](https://img.shields.io/badge/kotlin-2.1.21-blue.svg?logo=kotlin)](http://kotlinlang.org)
🤖 Prompt for AI Agents
In README.md around line 3, the Kotlin version displayed in the shields.io badge
is "2.1" but should match libs.versions.toml ("2.1.21"); update the badge text
and URL segment from "kotlin-2.1-blue.svg" to "kotlin-2.1.21-blue.svg" (and any
other occurrences of 2.1 in the badge markup) so the badge displays 2.1.21 and
stays in sync with project versions.

[![Kotlin Multiplatform](https://img.shields.io/badge/Kotlin-Multiplatform-blueviolet?logo=kotlin)](https://kotlinlang.org/docs/multiplatform.html)
[![Platforms](https://img.shields.io/badge/Platforms-JVM%20%7C%20Wasm%2FJS%20%7C%20Native%20(iOS%2FiOS%20Simulator)-blue)](https://kotlinlang.org/docs/multiplatform.html)
[![Platforms](https://img.shields.io/badge/Platforms-JVM%20%7C%20Wasm%2FJS%20%7C%20Native-blue)](https://kotlinlang.org/docs/multiplatform.html)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

Clarify “Native” scope or list targets.

Consider mentioning the concrete KMP native targets (iOS/tvOS/watchOS/macOS, Linux, Windows) to set expectations, or link to a section that enumerates them.

🤖 Prompt for AI Agents
In README.md around line 5, the "Native" badge is ambiguous; update the badge
text or nearby sentence to either list the concrete Kotlin Multiplatform native
targets (iOS, tvOS, watchOS, macOS, Linux, Windows) or add a short parenthetical
or link to a section that enumerates supported native targets so readers know
the exact scope; keep wording concise and consistent with existing badge/link
style.

[![Maven Central](https://img.shields.io/maven-central/v/io.modelcontextprotocol/kotlin-sdk.svg?label=Maven%20Central)](https://search.maven.org/search?q=g:io.modelcontextprotocol%20a:kotlin-sdk)
[![License](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)

Expand Down
31 changes: 27 additions & 4 deletions buildSrc/src/main/kotlin/mcp.multiplatform.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import org.jetbrains.kotlin.gradle.ExperimentalWasmDsl
import org.jetbrains.kotlin.gradle.dsl.ExplicitApiMode
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_2_1

plugins {
kotlin("multiplatform")
Expand All @@ -24,18 +25,40 @@ val generateLibVersion by tasks.registering {

public const val LIB_VERSION: String = "${project.version}"

""".trimIndent()
""".trimIndent(),
)
}
}

kotlin {

compilerOptions {
languageVersion = KOTLIN_2_1
apiVersion = KOTLIN_2_1
// TODO: allWarningsAsErrors = true
extraWarnings = true
freeCompilerArgs =
listOf(
"-Xwhen-guards",
)
}
coreLibrariesVersion = "2.1.21"

Comment on lines +35 to +46
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

Compiler config for Kotlin 2.1 — LGTM; consider enabling Werror.

Settings look correct for 2.1. Consider turning on allWarningsAsErrors once CI is green.

-        // TODO: allWarningsAsErrors = true
+        // Enable once the tree is clean
+        // allWarningsAsErrors = true
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
compilerOptions {
languageVersion = KOTLIN_2_1
apiVersion = KOTLIN_2_1
// TODO: allWarningsAsErrors = true
extraWarnings = true
freeCompilerArgs =
listOf(
"-Xwhen-guards",
)
}
coreLibrariesVersion = "2.1.21"
compilerOptions {
languageVersion = KOTLIN_2_1
apiVersion = KOTLIN_2_1
// Enable once the tree is clean
// allWarningsAsErrors = true
extraWarnings = true
freeCompilerArgs =
listOf(
"-Xwhen-guards",
)
}
coreLibrariesVersion = "2.1.21"
🤖 Prompt for AI Agents
In buildSrc/src/main/kotlin/mcp.multiplatform.gradle.kts around lines 35 to 46,
the TODO for Werror remains; enable allWarningsAsErrors by setting
allWarningsAsErrors = true (or, if you want safer rollout, read a Gradle/project
property like "enableWerror" and set allWarningsAsErrors =
project.findProperty("enableWerror") == "true") so warnings are promoted to
errors once CI is verified; ensure the property default is false in CI until you
flip it.

jvm {
compilerOptions.jvmTarget = JvmTarget.JVM_1_8
compilerOptions {
jvmTarget = JvmTarget.JVM_1_8
javaParameters = true
}
}
macosX64(); macosArm64()
linuxX64(); linuxArm64()

macosX64()
macosArm64()

linuxX64()
linuxArm64()

mingwX64()

js { nodejs() }
wasmJs { nodejs() }
Comment on lines 62 to 63
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

JS/Wasm target setup: ensure consistency with module-level kotlin blocks.

This plugin sets js/wasm nodejs; kotlin-sdk-core also configures js { browser(); nodejs() }. Double-configuration is usually fine, but avoid divergent target declarations across plugin and module.

-    js { nodejs() }
-    wasmJs { nodejs() }
+    // Consider centralizing target declarations either here or per-module to prevent drift.

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In buildSrc/src/main/kotlin/mcp.multiplatform.gradle.kts around lines 62-63, the
plugin declares js { nodejs() } and wasmJs { nodejs() } which diverges from
module-level kotlin blocks that use js { browser(); nodejs() }; update the
plugin to match the module-level targets so declarations stay consistent —
either add browser() to the plugin's js target (js { browser(); nodejs() }) or
remove the js nodejs() from the plugin and let modules declare both browser()
and nodejs(); pick one approach and apply it consistently across plugin and
modules, remove duplicate/conflicting declarations, and add a short comment
explaining the chosen centralization.


Expand Down
4 changes: 4 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,9 @@ org.jetbrains.dokka.experimental.gradle.pluginMode.noWarn=true
# Kotlin
kotlin.code.style=official
kotlin.daemon.jvmargs=-Xmx4G
kotlin.native.ignoreDisabledTargets=true
# MPP
kotlin.mpp.enableCInteropCommonization=true

# Build JS targets using npm package manager https://kotlinlang.org/docs/js-project-setup.html#npm-dependencies
kotlin.js.yarn=false
Comment on lines +14 to +15
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

Switching Kotlin/JS to npm: document Node/NPM expectations.

With yarn disabled, ensure Node and npm are available in CI and optionally pin Node via a tool (e.g., actions/setup-node) to avoid non-reproducible builds.

🤖 Prompt for AI Agents
In gradle.properties around lines 14-15, you're switching Kotlin/JS to npm
(kotlin.js.yarn=false) but haven't documented or enforced Node/npm in CI; add a
short comment in gradle.properties stating the required Node version and that
npm must be available, and then update CI workflows (e.g., GitHub Actions) to
install and pin Node by adding actions/setup-node with a specific semver (or
exact) version and ensure npm is present before the build; verify the pipeline
runs npm --version and npm ci (or npm install) as part of the job to guarantee
reproducible builds.

23 changes: 13 additions & 10 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
[versions]
# plugins version
kotlin = "2.2.0"
kotlin = "2.1.21"
dokka = "2.0.0"
atomicfu = "0.29.0"
atomicfu = "0.28.0"
ktlint = "13.0.0"

# libraries version
serialization = "1.9.0"
binaryCompatibilityValidatorPlugin = "0.18.1"
collections-immutable = "0.4.0"
coroutines = "1.10.2"
kotlinx-io = "0.8.0"
jreleaser = "1.19.0"
kotest = "5.9.1"
kotlinx-datetime = "0.6.2"
kotlinx-io = "0.7.0"
ktor = "3.2.3"
logging = "7.0.7"
jreleaser = "1.19.0"
binaryCompatibilityValidatorPlugin = "0.18.1"
serialization = "1.8.1"
slf4j = "2.0.17"
kotest = "5.9.1"

# Samples
mcp-kotlin = "0.6.0"
Expand All @@ -31,11 +32,13 @@ dokka-gradle = { module = "org.jetbrains.dokka:dokka-gradle-plugin", version.ref
jreleaser-gradle = { module = "org.jreleaser:jreleaser-gradle-plugin", version.ref = "jreleaser" }

# Kotlinx libraries
kotlinx-serialization-json = { group = "org.jetbrains.kotlinx", name = "kotlinx-serialization-json", version.ref = "serialization" }
kotlin-logging = { group = "io.github.oshai", name = "kotlin-logging", version.ref = "logging" }
kotlinx-collections-immutable = { group = "org.jetbrains.kotlinx", name = "kotlinx-collections-immutable", version.ref = "collections-immutable" }
kotlinx-coroutines-core = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-core", version.ref = "coroutines" }
kotlinx-datetime = { module = "org.jetbrains.kotlinx:kotlinx-datetime", version.ref = "kotlinx-datetime" }
kotlinx-io-core = { group = "org.jetbrains.kotlinx", name = "kotlinx-io-core", version.ref = "kotlinx-io" }
kotlinx-collections-immutable = { group = "org.jetbrains.kotlinx", name = "kotlinx-collections-immutable", version.ref = "collections-immutable" }
kotlin-logging = { group = "io.github.oshai", name = "kotlin-logging", version.ref = "logging" }
kotlinx-serialization-json = { group = "org.jetbrains.kotlinx", name = "kotlinx-serialization-json", version.ref = "serialization" }


# Ktor
ktor-client-cio = { group = "io.ktor", name = "ktor-client-cio", version.ref = "ktor" }
Expand Down
Loading
Loading