- Kotlin 98%
- TypeScript 1.7%
- Shell 0.3%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
Bumps [com.vanniktech:gradle-maven-publish-plugin](https://github.com/vanniktech/gradle-maven-publish-plugin) from 0.35.0 to 0.36.0. <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/vanniktech/gradle-maven-publish-plugin/releases">com.vanniktech:gradle-maven-publish-plugin's releases</a>.</em></p> <blockquote> <h2>0.36.0</h2> <p><strong>BREAKING</strong></p> <ul> <li>Updated minimum supported JDK, Gradle, Android Gradle Plugin and Kotlin versions.</li> <li>Removed support for Dokka v1, it's now required to use Dokka in v2 mode.</li> <li>Mark <code>DirectorySignatureType</code> internal.</li> </ul> <p><strong>Behavior changes</strong></p> <ul> <li><code>validateDeployment</code> now has the <code>DeploymentValidation</code> enum as type instead of being a boolean. The default is now to just wait for the <code>VALIDATED</code> state. The previous behavior can be achieved by setting it to <code>PUBLISHED</code>. <code>NONE</code> can be used for disabling the validation completely.</li> <li>When calling <code>configure(...)</code> manually to configure what to publish and not passing <code>javadocJar</code> explicity, the plugin now defaults to publishing an empty javadoc jar.</li> </ul> <p><strong>Features</strong></p> <ul> <li>Android projects now support using Dokka for javadoc creation, this will happen automatically when using the default options and the Dokka plugin is applied to the project.</li> <li>Added consistent <code>JavadocJar</code> and <code>SourcesJar</code> options to <code>configureBasedOnAppliedPlugins</code> and to all applicable project types that can be passed to <code>configure</code>. The previous <code>Boolean</code> based versions have been deprecated.</li> <li>When enabling Maven Central publishing through the DSL, the <code>mavenCentralDeploymentValidation</code> and <code>mavenCentralAutomaticPublishing</code> are used for the default values of the 2 parameters when they are not passed explicitly. This allows to more easily override them in certain environments.</li> <li>When isolated projects is enabled the module/project specific <code>gradle.properties</code> files are now considered in the same way they are when isolated projects is disabled.</li> </ul> <p><strong>Improvements</strong></p> <ul> <li>Better error message when Maven Central credentials are missing.</li> </ul> <h4>Minimum supported versions</h4> <ul> <li>JDK 17</li> <li>Gradle 9.0.0</li> <li>Android Gradle Plugin 8.13.0</li> <li>Kotlin Gradle Plugin 2.2.0</li> </ul> <h4>Compatibility tested up to</h4> <ul> <li>JDK 25</li> <li>Gradle 9.3.0</li> <li>Gradle 9.4.0-milestone-4</li> <li>Android Gradle Plugin 8.13.2</li> <li>Android Gradle Plugin 9.0.0</li> <li>Android Gradle Plugin 9.1.0-alpha05</li> <li>Kotlin Gradle Plugin 2.3.0</li> <li>Kotlin Gradle Plugin 2.3.20-Beta1</li> </ul> <h2>0.36.0-rc2</h2> <p><strong>BREAKING</strong></p> <ul> <li>Updated minimum supported JDK, Gradle, Android Gradle Plugin and Kotlin versions.</li> <li>Removed support for Dokka v1, it's now required to use Dokka in v2 mode.</li> <li>Mark <code>DirectorySignatureType</code> internal.</li> </ul> <!-- raw HTML omitted --> </blockquote> <p>... (truncated)</p> </details> <details> <summary>Changelog</summary> <p><em>Sourced from <a href="https://github.com/vanniktech/gradle-maven-publish-plugin/blob/main/CHANGELOG.md">com.vanniktech:gradle-maven-publish-plugin's changelog</a>.</em></p> <blockquote> <h2><a href="https://github.com/vanniktech/gradle-maven-publish-plugin/releases/tag/0.36.0">0.36.0</a> <em>(2026-01-13)</em></h2> <p><strong>BREAKING</strong></p> <ul> <li>Updated minimum supported JDK, Gradle, Android Gradle Plugin and Kotlin versions.</li> <li>Removed support for Dokka v1, it's now required to use Dokka in v2 mode.</li> <li>Mark <code>DirectorySignatureType</code> internal.</li> </ul> <p><strong>Behavior changes</strong></p> <ul> <li><code>validateDeployment</code> now has the <code>DeploymentValidation</code> enum as type instead of being a boolean. The default is now to just wait for the <code>VALIDATED</code> state. The previous behavior can be achieved by setting it to <code>PUBLISHED</code>. <code>NONE</code> can be used for disabling the validation completely.</li> <li>When calling <code>configure(...)</code> manually to configure what to publish and not passing <code>javadocJar</code> explicity, the plugin now defaults to publishing an empty javadoc jar.</li> </ul> <p><strong>Features</strong></p> <ul> <li>Android projects now support using Dokka for javadoc creation, this will happen automatically when using the default options and the Dokka plugin is applied to the project.</li> <li>Added consistent <code>JavadocJar</code> and <code>SourcesJar</code> options to <code>configureBasedOnAppliedPlugins</code> and to all applicable project types that can be passed to <code>configure</code>. The previous <code>Boolean</code> based versions have been deprecated.</li> <li>When enabling Maven Central publishing through the DSL, the <code>mavenCentralDeploymentValidation</code> and <code>mavenCentralAutomaticPublishing</code> are used for the default values of the 2 parameters when they are not passed explicitly. This allows to more easily override them in certain environments.</li> <li>When isolated projects is enabled the module/project specific <code>gradle.properties</code> files are now considered in the same way they are when isolated projects is disabled.</li> </ul> <p><strong>Improvements</strong></p> <ul> <li>Better error message when Maven Central credentials are missing.</li> </ul> <h4>Minimum supported versions</h4> <ul> <li>JDK 17</li> <li>Gradle 9.0.0</li> <li>Android Gradle Plugin 8.13.0</li> <li>Kotlin Gradle Plugin 2.2.0</li> </ul> <h4>Compatibility tested up to</h4> <ul> <li>JDK 25</li> <li>Gradle 9.3.0</li> <li>Gradle 9.4.0-milestone-4</li> <li>Android Gradle Plugin 8.13.2</li> <li>Android Gradle Plugin 9.0.0</li> <li>Android Gradle Plugin 9.1.0-alpha05</li> <li>Kotlin Gradle Plugin 2.3.0</li> <li>Kotlin Gradle Plugin 2.3.20-Beta1</li> </ul> </blockquote> </details> <details> <summary>Commits</summary> <ul> <li><a href=" |
||
| .github | ||
| .idea | ||
| buildSrc | ||
| config/detekt | ||
| conformance-test | ||
| docs | ||
| gradle | ||
| integration-test | ||
| kotlin-sdk | ||
| kotlin-sdk-client | ||
| kotlin-sdk-core | ||
| kotlin-sdk-server | ||
| samples | ||
| test-utils | ||
| .editorconfig | ||
| .gitignore | ||
| AGENTS.md | ||
| build.gradle.kts | ||
| CODE_OF_CONDUCT.md | ||
| CONTRIBUTING.md | ||
| gradle.properties | ||
| gradlew | ||
| gradlew.bat | ||
| LICENSE | ||
| README.md | ||
| settings.gradle.kts | ||
MCP Kotlin SDK
Kotlin Multiplatform implementation of the Model Context Protocol (MCP), providing both client and server capabilities for integrating with LLM surfaces across various platforms.
Overview
The Model Context Protocol allows applications to provide context for LLMs in a standardized way, separating the concerns of providing context from the actual LLM interaction. This SDK implements the MCP specification for Kotlin, enabling you to build applications that can communicate using MCP on the JVM, WebAssembly and iOS.
- Build MCP clients that can connect to any MCP server
- Create MCP servers that expose resources, prompts and tools
- Use standard transports like stdio, SSE, and WebSocket
- Handle all MCP protocol messages and lifecycle events
Samples
- kotlin-mcp-server: demonstrates a multiplatform (JVM, Wasm) MCP server setup with various features and transports.
- weather-stdio-server: shows how to build a Kotlin MCP server providing weather forecast and alerts using STDIO transport.
- kotlin-mcp-client: demonstrates building an interactive Kotlin MCP client that connects to an MCP server via STDIO and integrates with Anthropic’s API.
Installation
Add the new repository to your build file:
repositories {
mavenCentral()
}
Add the dependency:
dependencies {
// See the badge above for the latest version
implementation("io.modelcontextprotocol:kotlin-sdk:$mcpVersion")
}
MCP SDK uses Ktor, but does not come with a specific engine dependency. You should add Ktor client and/or Ktor server dependency to your project yourself, e.g.:
dependencies {
// for client:
implementation("io.ktor:ktor-client-cio:$ktorVersion")
// for server:
implementation("io.ktor:ktor-server-netty:$ktorVersion")
}
Quick Start
Creating a Client
import io.modelcontextprotocol.kotlin.sdk.client.Client
import io.modelcontextprotocol.kotlin.sdk.client.StdioClientTransport
import io.modelcontextprotocol.kotlin.sdk.Implementation
val client = Client(
clientInfo = Implementation(
name = "example-client",
version = "1.0.0"
)
)
val transport = StdioClientTransport(
inputStream = processInputStream,
outputStream = processOutputStream
)
// Connect to server
client.connect(transport)
// List available resources
val resources = client.listResources()
// Read a specific resource
val resourceContent = client.readResource(
ReadResourceRequest(uri = "file:///example.txt")
)
Creating a Server
import io.modelcontextprotocol.kotlin.sdk.server.Server
import io.modelcontextprotocol.kotlin.sdk.server.ServerOptions
import io.modelcontextprotocol.kotlin.sdk.server.StdioServerTransport
import io.modelcontextprotocol.kotlin.sdk.ServerCapabilities
val server = Server(
serverInfo = Implementation(
name = "example-server",
version = "1.0.0"
),
options = ServerOptions(
capabilities = ServerCapabilities(
resources = ServerCapabilities.Resources(
subscribe = true,
listChanged = true
)
)
)
){
"This server provides example resources and demonstrates MCP capabilities."
}
// Add a resource
server.addResource(
uri = "file:///example.txt",
name = "Example Resource",
description = "An example text file",
mimeType = "text/plain"
) { request ->
ReadResourceResult(
contents = listOf(
TextResourceContents(
text = "This is the content of the example resource.",
uri = request.uri,
mimeType = "text/plain"
)
)
)
}
// Start server with stdio transport
val transport = StdioServerTransport()
server.connect(transport)
Using SSE Transport
Directly in Ktor's Application:
import io.ktor.server.application.*
import io.modelcontextprotocol.kotlin.sdk.server.mcp
fun Application.module() {
mcp {
Server(
serverInfo = Implementation(
name = "example-sse-server",
version = "1.0.0"
),
options = ServerOptions(
capabilities = ServerCapabilities(
prompts = ServerCapabilities.Prompts(listChanged = null),
resources = ServerCapabilities.Resources(subscribe = null, listChanged = null)
)
),
) {
"This SSE server provides prompts and resources via Server-Sent Events."
}
}
}
Inside a custom Ktor's Route:
import io.ktor.server.application.*
import io.ktor.server.sse.SSE
import io.modelcontextprotocol.kotlin.sdk.server.mcp
fun Application.module() {
install(SSE)
routing {
route("myRoute") {
mcp {
Server(
serverInfo = Implementation(
name = "example-sse-server",
version = "1.0.0"
),
options = ServerOptions(
capabilities = ServerCapabilities(
prompts = ServerCapabilities.Prompts(listChanged = null),
resources = ServerCapabilities.Resources(subscribe = null, listChanged = null)
)
),
) {
"Connect via SSE to interact with this MCP server."
}
}
}
}
}
Contributing
Please see the contribution guide and the Code of conduct before contributing.
License
This project is licensed under Apache 2.0 for new contributions, with existing code under MIT—see the LICENSE file for details.