kotlin-sdk/samples
Repository files (latest commit first)
Filename Latest commit message Latest commit date
dependabot[bot] 479527c7bb
chore(deps): bump mcp-kotlin from 0.12.0 to 0.13.0 in /samples/weather-stdio-server (#828)
Bumps `mcp-kotlin` from 0.12.0 to 0.13.0.
Updates `io.modelcontextprotocol:kotlin-sdk-client` from 0.12.0 to
0.13.0
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/modelcontextprotocol/kotlin-sdk/releases">io.modelcontextprotocol:kotlin-sdk-client's
releases</a>.</em></p>
<blockquote>
<h2>0.13.0</h2>
<h2>Description</h2>
<p>Adds a <code>tasks</code> capability and a typed
<code>elicitation</code> capability, hardens transport lifecycle,
dispatchers, and back-pressure, and enables DNS rebinding protection by
default.</p>
<h3>Breaking Changes</h3>
<p><strong>Typed <code>elicitation</code> capability and new
<code>tasks</code> capability</strong> by <a
href="https://github.com/devcrocod"><code>@​devcrocod</code></a> in <a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/pull/732">#732</a></p>
<p><code>ClientCapabilities.elicitation</code> is now a typed
<code>ClientCapabilities.Elicitation</code> (<code>form</code>,
<code>url</code>) instead of a raw <code>JsonObject?</code>, and both
<code>ClientCapabilities</code> and <code>ServerCapabilities</code>
gained a typed <code>tasks</code> capability. The constructors of both
types changed and are binary-incompatible; recompilation is
required.</p>
<p><strong>Transport handlers now run on
<code>Dispatchers.Default</code></strong> by <a
href="https://github.com/devcrocod"><code>@​devcrocod</code></a> in <a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/pull/778">#778</a></p>
<p>Handlers moved from <code>Dispatchers.IO</code> to
<code>Dispatchers.Default</code> (override via
<code>handlerDispatcher</code>), <code>send()</code> now suspends under
back-pressure instead of buffering unbounded, and the two-argument
<code>StdioServerTransport(input, output)</code> constructor is
deprecated in favor of the builder-lambda form. Also fixes a
<code>start()</code>/<code>close()</code> race, consistent
<code>CancellationException</code> propagation, and an
input-<code>Source</code> leak (closes <a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/issues/573">#573</a>,
<a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/issues/574">#574</a>,
<a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/issues/708">#708</a>).</p>
<p><strong>DNS rebinding protection enabled by default</strong> by <a
href="https://github.com/devcrocod"><code>@​devcrocod</code></a> in <a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/pull/659">#659</a></p>
<p><code>enableDnsRebindingProtection</code> now defaults to
<code>true</code> on
<code>mcpStreamableHttp</code>/<code>mcpStatelessStreamableHttp</code>,
and the <code>Route.mcp()</code> / <code>Application.mcp()</code>
overloads gained <code>enableDnsRebindingProtection</code>,
<code>allowedHosts</code>, and <code>allowedOrigins</code> parameters
(binary-incompatible on JVM). Only <code>localhost</code>,
<code>127.0.0.1</code>, and <code>[::1]</code> are allowed by default;
opt out with <code>enableDnsRebindingProtection = false</code>. The
<code>Configuration.enableDnsRebindingProtection</code>,
<code>.allowedHosts</code>, and <code>.allowedOrigins</code> properties
are deprecated in favor of the new <code>DnsRebindingProtection</code>
plugin.</p>
<h3>Features</h3>
<ul>
<li>Add a <code>tasks</code> capability (<code>list</code>,
<code>cancel</code>, and per-request augmentation for sampling and
elicitation) on <code>ClientCapabilities</code> and
<code>ServerCapabilities</code>, with assertions for
<code>tasks/*</code> and <code>notifications/tasks/status</code>
enforced by <code>Client</code> and <code>ServerSession</code> by <a
href="https://github.com/devcrocod"><code>@​devcrocod</code></a> in <a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/pull/732">#732</a></li>
<li>Configurable <code>handlerDispatcher</code> and
<code>ioDispatcher</code>, plus an optional caller-supplied
<code>CoroutineScope</code>, on transports by <a
href="https://github.com/devcrocod"><code>@​devcrocod</code></a> in <a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/pull/778">#778</a></li>
</ul>
<h3>Fixed</h3>
<ul>
<li>Fire <code>onClose</code> callbacks on
<code>SseClientTransport</code> when the SSE session ends — whether
closed gracefully or terminated by an error — matching the other client
transports by <a
href="https://github.com/jskjw157"><code>@​jskjw157</code></a> in <a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/pull/738">#738</a></li>
</ul>
<h3>Security</h3>
<ul>
<li>Enable DNS rebinding protection by default across all HTTP
transports, including the SSE endpoints that previously had none (see
Breaking Changes for migration) by <a
href="https://github.com/devcrocod"><code>@​devcrocod</code></a> in <a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/pull/659">#659</a></li>
<li>Cap a single stdio JSON-RPC frame at 16 MiB, throwing the new
<code>TooLongFrameException</code> instead of buffering unbounded when a
peer never sends a newline terminator by <a
href="https://github.com/devcrocod"><code>@​devcrocod</code></a> in <a
href="6e6f80512f">6e6f805</a></li>
</ul>
<h3>Maintenance</h3>
<ul>
<li>Remove the test-only <code>dev.mokksy:mokksy</code> dependency in
favor of <code>MockEngine</code> and <code>embeddedServer</code> by <a
href="https://github.com/devcrocod"><code>@​devcrocod</code></a> in <a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/pull/754">#754</a></li>
</ul>
<h3>Dependencies</h3>
<ul>
<li>Ktor to v3.4.3 in <a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/pull/785">#785</a></li>
<li>kotlinx.coroutines to v1.11.0 in <a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/pull/760">#760</a></li>
<li>kotlin-logging to v8.0.03 in <a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/pull/752">#752</a>,
<a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/pull/783">#783</a></li>
<li>24 further Dependabot updates across sample projects, TypeScript
conformance-test fixtures, and build/test tooling (JUnit, slf4j-simple,
Gradle wrapper, anthropic-java)</li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/modelcontextprotocol/kotlin-sdk/compare/0.12.0...0.13.0">https://github.com/modelcontextprotocol/kotlin-sdk/compare/0.12.0...0.13.0</a></p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="b7eeeb1205"><code>b7eeeb1</code></a>
release: 0.13.0 (<a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/issues/796">#796</a>)</li>
<li><a
href="6e6f80512f"><code>6e6f805</code></a>
Merge commit from fork</li>
<li><a
href="0eb1822853"><code>0eb1822</code></a>
Update Ktor to version 3.4.3 (<a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/issues/785">#785</a>)</li>
<li><a
href="0adfb3bcdb"><code>0adfb3b</code></a>
fix!: harden lifecycle, dispatchers, back-pressure (<a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/issues/778">#778</a>)</li>
<li><a
href="37ee423308"><code>37ee423</code></a>
chore(deps): bump the infrastructure group with 2 updates (<a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/issues/783">#783</a>)</li>
<li><a
href="ff4b6232ba"><code>ff4b623</code></a>
chore(deps): bump the other-dependencies group across 3 directories with
3 up...</li>
<li><a
href="78066a9cf6"><code>78066a9</code></a>
chore(deps): bump the all-dependencies group across 1 directory with 2
update...</li>
<li><a
href="1ff5f003b6"><code>1ff5f00</code></a>
chore(deps): bump qs from 6.14.2 to 6.15.2 in
/integration-test/src/jvmTest/t...</li>
<li><a
href="6d5bac1e67"><code>6d5bac1</code></a>
chore(deps): bump gradle-wrapper from 9.5.0 to 9.5.1 (<a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/issues/776">#776</a>)</li>
<li><a
href="c8545606bb"><code>c854560</code></a>
chore(deps): bump the all-dependencies group across 1 directory with 2
update...</li>
<li>Additional commits viewable in <a
href="https://github.com/modelcontextprotocol/kotlin-sdk/compare/0.12.0...0.13.0">compare
view</a></li>
</ul>
</details>
<br />

Updates `io.modelcontextprotocol:kotlin-sdk-server` from 0.12.0 to
0.13.0
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/modelcontextprotocol/kotlin-sdk/releases">io.modelcontextprotocol:kotlin-sdk-server's
releases</a>.</em></p>
<blockquote>
<h2>0.13.0</h2>
<h2>Description</h2>
<p>Adds a <code>tasks</code> capability and a typed
<code>elicitation</code> capability, hardens transport lifecycle,
dispatchers, and back-pressure, and enables DNS rebinding protection by
default.</p>
<h3>Breaking Changes</h3>
<p><strong>Typed <code>elicitation</code> capability and new
<code>tasks</code> capability</strong> by <a
href="https://github.com/devcrocod"><code>@​devcrocod</code></a> in <a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/pull/732">#732</a></p>
<p><code>ClientCapabilities.elicitation</code> is now a typed
<code>ClientCapabilities.Elicitation</code> (<code>form</code>,
<code>url</code>) instead of a raw <code>JsonObject?</code>, and both
<code>ClientCapabilities</code> and <code>ServerCapabilities</code>
gained a typed <code>tasks</code> capability. The constructors of both
types changed and are binary-incompatible; recompilation is
required.</p>
<p><strong>Transport handlers now run on
<code>Dispatchers.Default</code></strong> by <a
href="https://github.com/devcrocod"><code>@​devcrocod</code></a> in <a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/pull/778">#778</a></p>
<p>Handlers moved from <code>Dispatchers.IO</code> to
<code>Dispatchers.Default</code> (override via
<code>handlerDispatcher</code>), <code>send()</code> now suspends under
back-pressure instead of buffering unbounded, and the two-argument
<code>StdioServerTransport(input, output)</code> constructor is
deprecated in favor of the builder-lambda form. Also fixes a
<code>start()</code>/<code>close()</code> race, consistent
<code>CancellationException</code> propagation, and an
input-<code>Source</code> leak (closes <a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/issues/573">#573</a>,
<a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/issues/574">#574</a>,
<a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/issues/708">#708</a>).</p>
<p><strong>DNS rebinding protection enabled by default</strong> by <a
href="https://github.com/devcrocod"><code>@​devcrocod</code></a> in <a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/pull/659">#659</a></p>
<p><code>enableDnsRebindingProtection</code> now defaults to
<code>true</code> on
<code>mcpStreamableHttp</code>/<code>mcpStatelessStreamableHttp</code>,
and the <code>Route.mcp()</code> / <code>Application.mcp()</code>
overloads gained <code>enableDnsRebindingProtection</code>,
<code>allowedHosts</code>, and <code>allowedOrigins</code> parameters
(binary-incompatible on JVM). Only <code>localhost</code>,
<code>127.0.0.1</code>, and <code>[::1]</code> are allowed by default;
opt out with <code>enableDnsRebindingProtection = false</code>. The
<code>Configuration.enableDnsRebindingProtection</code>,
<code>.allowedHosts</code>, and <code>.allowedOrigins</code> properties
are deprecated in favor of the new <code>DnsRebindingProtection</code>
plugin.</p>
<h3>Features</h3>
<ul>
<li>Add a <code>tasks</code> capability (<code>list</code>,
<code>cancel</code>, and per-request augmentation for sampling and
elicitation) on <code>ClientCapabilities</code> and
<code>ServerCapabilities</code>, with assertions for
<code>tasks/*</code> and <code>notifications/tasks/status</code>
enforced by <code>Client</code> and <code>ServerSession</code> by <a
href="https://github.com/devcrocod"><code>@​devcrocod</code></a> in <a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/pull/732">#732</a></li>
<li>Configurable <code>handlerDispatcher</code> and
<code>ioDispatcher</code>, plus an optional caller-supplied
<code>CoroutineScope</code>, on transports by <a
href="https://github.com/devcrocod"><code>@​devcrocod</code></a> in <a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/pull/778">#778</a></li>
</ul>
<h3>Fixed</h3>
<ul>
<li>Fire <code>onClose</code> callbacks on
<code>SseClientTransport</code> when the SSE session ends — whether
closed gracefully or terminated by an error — matching the other client
transports by <a
href="https://github.com/jskjw157"><code>@​jskjw157</code></a> in <a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/pull/738">#738</a></li>
</ul>
<h3>Security</h3>
<ul>
<li>Enable DNS rebinding protection by default across all HTTP
transports, including the SSE endpoints that previously had none (see
Breaking Changes for migration) by <a
href="https://github.com/devcrocod"><code>@​devcrocod</code></a> in <a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/pull/659">#659</a></li>
<li>Cap a single stdio JSON-RPC frame at 16 MiB, throwing the new
<code>TooLongFrameException</code> instead of buffering unbounded when a
peer never sends a newline terminator by <a
href="https://github.com/devcrocod"><code>@​devcrocod</code></a> in <a
href="6e6f80512f">6e6f805</a></li>
</ul>
<h3>Maintenance</h3>
<ul>
<li>Remove the test-only <code>dev.mokksy:mokksy</code> dependency in
favor of <code>MockEngine</code> and <code>embeddedServer</code> by <a
href="https://github.com/devcrocod"><code>@​devcrocod</code></a> in <a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/pull/754">#754</a></li>
</ul>
<h3>Dependencies</h3>
<ul>
<li>Ktor to v3.4.3 in <a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/pull/785">#785</a></li>
<li>kotlinx.coroutines to v1.11.0 in <a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/pull/760">#760</a></li>
<li>kotlin-logging to v8.0.03 in <a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/pull/752">#752</a>,
<a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/pull/783">#783</a></li>
<li>24 further Dependabot updates across sample projects, TypeScript
conformance-test fixtures, and build/test tooling (JUnit, slf4j-simple,
Gradle wrapper, anthropic-java)</li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/modelcontextprotocol/kotlin-sdk/compare/0.12.0...0.13.0">https://github.com/modelcontextprotocol/kotlin-sdk/compare/0.12.0...0.13.0</a></p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="b7eeeb1205"><code>b7eeeb1</code></a>
release: 0.13.0 (<a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/issues/796">#796</a>)</li>
<li><a
href="6e6f80512f"><code>6e6f805</code></a>
Merge commit from fork</li>
<li><a
href="0eb1822853"><code>0eb1822</code></a>
Update Ktor to version 3.4.3 (<a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/issues/785">#785</a>)</li>
<li><a
href="0adfb3bcdb"><code>0adfb3b</code></a>
fix!: harden lifecycle, dispatchers, back-pressure (<a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/issues/778">#778</a>)</li>
<li><a
href="37ee423308"><code>37ee423</code></a>
chore(deps): bump the infrastructure group with 2 updates (<a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/issues/783">#783</a>)</li>
<li><a
href="ff4b6232ba"><code>ff4b623</code></a>
chore(deps): bump the other-dependencies group across 3 directories with
3 up...</li>
<li><a
href="78066a9cf6"><code>78066a9</code></a>
chore(deps): bump the all-dependencies group across 1 directory with 2
update...</li>
<li><a
href="1ff5f003b6"><code>1ff5f00</code></a>
chore(deps): bump qs from 6.14.2 to 6.15.2 in
/integration-test/src/jvmTest/t...</li>
<li><a
href="6d5bac1e67"><code>6d5bac1</code></a>
chore(deps): bump gradle-wrapper from 9.5.0 to 9.5.1 (<a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/issues/776">#776</a>)</li>
<li><a
href="c8545606bb"><code>c854560</code></a>
chore(deps): bump the all-dependencies group across 1 directory with 2
update...</li>
<li>Additional commits viewable in <a
href="https://github.com/modelcontextprotocol/kotlin-sdk/compare/0.12.0...0.13.0">compare
view</a></li>
</ul>
</details>
<br />

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-06-16 14:18:19 +02:00
..
kotlin-mcp-client chore(deps): bump io.modelcontextprotocol:kotlin-sdk-client from 0.12.0 to 0.13.0 in /samples/kotlin-mcp-client (#820) 2026-06-16 12:37:03 +02:00
kotlin-mcp-server chore(deps): bump mcp-kotlin from 0.12.0 to 0.13.0 in /samples/kotlin-mcp-server (#823) 2026-06-16 11:13:14 +00:00
kotlinlang-mcp-server chore(deps): bump mcp-kotlin from 0.12.0 to 0.13.0 in /samples/kotlinlang-mcp-server (#824) 2026-06-16 11:39:50 +02:00
notebooks samples: update mcp-kotlin to 0.10.0 across sample projects (#645) 2026-03-30 23:47:31 +03:00
simple-streamable-server chore(deps): bump mcp-kotlin from 0.12.0 to 0.13.0 in /samples/simple-streamable-server (#826) 2026-06-16 11:27:40 +00:00
weather-stdio-server chore(deps): bump mcp-kotlin from 0.12.0 to 0.13.0 in /samples/weather-stdio-server (#828) 2026-06-16 14:18:19 +02:00
README.md sample: kotlinlang mcp server (#713) 2026-04-27 15:07:03 +02:00

Kotlin MCP SDK Samples

Runnable projects demonstrating MCP server and client implementations with the Kotlin MCP SDK. For background on the protocol itself, see the MCP documentation.

Overview

Sample Type Transport MCP Features
simple-streamable-server Server Streamable HTTP Tools, Resources, Prompts, Logging
kotlinlang-mcp-server Server Streamable HTTP Tools
kotlin-mcp-server Server STDIO, SSE Tools, Resources, Prompts
weather-stdio-server Server STDIO Tools
kotlin-mcp-client Client STDIO Tool discovery & invocation
notebooks Client (Notebook) Streamable HTTP Tool discovery & invocation

Getting Started

  • Building a server? Start with simple-streamable-server — it uses the recommended Streamable HTTP transport and covers tools, resources, prompts, and logging.
  • Building a client? Open the notebooks sample for a step-by-step walkthrough, or see kotlin-mcp-client for a full CLI client with Anthropic API integration.

Samples

Simple Streamable HTTP Server

A minimal Streamable HTTP server with optional Bearer token authentication. Demonstrates tools (greet, multi-greet), a prompt template, a resource, and server-to-client logging notifications. Read more →

Kotlinlang MCP Server

A Streamable HTTP server that exposes the official Kotlin documentation (kotlinlang.org) to LLM clients — full-text search via Algolia and page retrieval in markdown. Demonstrates wrapping a real external API in an MCP server with in-memory caching. Read more →

Kotlin MCP Server

A multi-transport server supporting STDIO, SSE (plain), and SSE (Ktor plugin). Useful for exploring different transport modes side by side. Read more →

Weather STDIO Server

A focused STDIO server that exposes weather forecast and alert tools backed by the weather.gov API. Includes Claude Desktop integration instructions. Read more →

Kotlin MCP Client

An interactive CLI client that connects to any MCP server over STDIO and routes queries through Anthropic's Claude API, bridging MCP tools with LLM conversations. Read more →

MCP Client Notebook

A Kotlin notebook that connects to a remote MCP server via Streamable HTTP and demonstrates ping, tool listing, and tool invocation — all in an interactive cell-by-cell format. Read more →