kotlin-sdk/samples/kotlin-mcp-server
Repository files (latest commit first)
Filename Latest commit message Latest commit date
dependabot[bot] b946e4eaf9
chore(deps): bump mcp-kotlin from 0.8.1 to 0.9.0 in /samples/kotlin-mcp-server (#638)
Bumps `mcp-kotlin` from 0.8.1 to 0.9.0.
Updates `io.modelcontextprotocol:kotlin-sdk-client` from 0.8.1 to 0.9.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.9.0</h2>
<h2>What's Changed</h2>
<h3>Breaking Changes</h3>
<ul>
<li><strong>Server call handlers now receive a
<code>RequestContext</code></strong> — handler lambdas for tools,
prompts, and resources have a new <code>context</code> parameter
providing access to request metadata (<a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/issues/515">#515</a>)
by <a href="https://github.com/rnett"><code>@​rnett</code></a></li>
<li><strong>Ktor extension functions moved from <code>Routing</code> to
<code>Route</code></strong> — update call sites: <code>routing {
mcpSse() }</code> → <code>route(&quot;/mcp&quot;) { mcpSse() }</code> or
use directly in any <code>Route</code> block (<a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/issues/531">#531</a>)
by <a href="https://github.com/kpavlov"><code>@​kpavlov</code></a></li>
<li><strong><code>StdioServerTransport</code> rethrows
<code>CancellationException</code></strong> — cancellation is no longer
silently swallowed; <code>ReadBuffer</code> parsing was also fixed (<a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/issues/571">#571</a>)
by <a href="https://github.com/kpavlov"><code>@​kpavlov</code></a></li>
</ul>
<h3>New Features</h3>
<ul>
<li><strong><code>kotlin-sdk-testing</code> module</strong> — new
artifact providing an in-process, channel-based
<code>TestClientTransport</code> / <code>TestServerTransport</code> for
unit testing MCP servers and clients without network I/O (<a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/issues/505">#505</a>)
by <a href="https://github.com/kpavlov"><code>@​kpavlov</code></a></li>

<li><strong><code>StreamableHttpServerTransport.Configuration</code></strong>
— configurable builder for the Streamable HTTP server transport
(timeouts, session handling, etc.) (<a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/issues/560">#560</a>)
by <a href="https://github.com/kpavlov"><code>@​kpavlov</code></a></li>
<li><strong>Ktor extensions for Streamable HTTP</strong> —
<code>mcpStreamableHttp()</code> Ktor plugin and routing DSL for
mounting a Streamable HTTP MCP server (<a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/issues/504">#504</a>
by <a href="https://github.com/devcrocod"><code>@​devcrocod</code></a>,
<a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/issues/568">#568</a>
by <a href="https://github.com/kpavlov"><code>@​kpavlov</code></a>)</li>
<li><strong><code>$defs</code> support in
<code>ToolSchema</code></strong> — JSON Schema <code>$defs</code> /
definitions can now be expressed in tool input schemas (<a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/issues/526">#526</a>)
by <a href="https://github.com/i1bro"><code>@​i1bro</code></a></li>
</ul>
<h3>Bug Fixes</h3>
<ul>
<li>Fixed SSE transport endpoint resolution for non-root mount paths (<a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/issues/565">#565</a>)
by <a
href="https://github.com/Amaneusz"><code>@​Amaneusz</code></a></li>
<li>Fixed <code>StdioClientTransport</code> hanging indefinitely by
adding proper read timeouts (<a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/issues/528">#528</a>)
by <a href="https://github.com/kpavlov"><code>@​kpavlov</code></a></li>
</ul>
<h3>Improvements</h3>
<ul>
<li>Introduced <code>AbstractClientTransport</code> base class,
simplifying client transport lifecycle management (<a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/issues/516">#516</a>)
by <a href="https://github.com/kpavlov"><code>@​kpavlov</code></a></li>
<li>Deprecation cycle started — annotated APIs scheduled for removal in
a future release (<a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/issues/498">#498</a>)
by <a
href="https://github.com/devcrocod"><code>@​devcrocod</code></a></li>
<li>Detekt static analysis integrated into CI (<a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/issues/493">#493</a>,
<a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/issues/507">#507</a>)
by <a href="https://github.com/kpavlov"><code>@​kpavlov</code></a></li>
<li>Code coverage reporting added via Codecov (<a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/issues/579">#579</a>,
<a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/issues/580">#580</a>)
by <a href="https://github.com/kpavlov"><code>@​kpavlov</code></a></li>
<li>Flaky <code>StdioClientTransport</code> tests replaced with real
stdin pipe–based tests (<a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/issues/508">#508</a>)
by <a href="https://github.com/kpavlov"><code>@​kpavlov</code></a></li>
</ul>
<h3>Dependency Updates</h3>
<ul>
<li>Kotest 6.1.2, MockK 1.14.9, AtomicFU 0.31.0, Gradle 9.3.1, Kover
0.9.7</li>
</ul>
<h2>New Contributors</h2>
<ul>
<li><a href="https://github.com/jskjw157"><code>@​jskjw157</code></a>
made their first contribution in <a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/pull/486">modelcontextprotocol/kotlin-sdk#486</a></li>
<li><a href="https://github.com/i1bro"><code>@​i1bro</code></a> made
their first contribution in <a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/pull/526">modelcontextprotocol/kotlin-sdk#526</a></li>
<li><a href="https://github.com/localden"><code>@​localden</code></a>
made their first contribution in <a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/pull/536">modelcontextprotocol/kotlin-sdk#536</a></li>
<li><a
href="https://github.com/aozherelyeva"><code>@​aozherelyeva</code></a>
made their first contribution in <a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/pull/551">modelcontextprotocol/kotlin-sdk#551</a></li>
<li><a href="https://github.com/rnett"><code>@​rnett</code></a> made
their first contribution in <a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/pull/515">modelcontextprotocol/kotlin-sdk#515</a></li>
<li><a href="https://github.com/Amaneusz"><code>@​Amaneusz</code></a>
made their first contribution in <a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/pull/565">modelcontextprotocol/kotlin-sdk#565</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/modelcontextprotocol/kotlin-sdk/compare/0.8.4...0.9.0">https://github.com/modelcontextprotocol/kotlin-sdk/compare/0.8.4...0.9.0</a></p>
<h2>0.8.4</h2>
<h2>Changes</h2>
<ul>
<li>feat: Ktor extensions for streamable http (<a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/issues/504">#504</a>)
by <a
href="https://github.com/devcrocod"><code>@​devcrocod</code></a></li>
<li>fix: Add $defs to ToolSchema and tests (<a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/issues/526">#526</a>)
by <a href="https://github.com/i1bro"><code>@​i1bro</code></a></li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="5b58814613"><code>5b58814</code></a>
feat: bump version to 0.9.0 (<a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/issues/576">#576</a>)</li>
<li><a
href="1454229ad9"><code>1454229</code></a>
test: add serialization tests and guidelines for handling
<code>null</code> and omitted ...</li>
<li><a
href="3e7ea39bf7"><code>3e7ea39</code></a>
chore: relax Detekt rules for tests (<a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/issues/582">#582</a>)</li>
<li><a
href="a38818018a"><code>a388180</code></a>
fix!(server): <a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/issues/575">#575</a>
Rethrow CancellationException in StdioServerTransport, fix...</li>
<li><a
href="9eabb54cb5"><code>9eabb54</code></a>
refactor: refactor Streamable HTTP ktor extensions (<a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/issues/562">#562</a>)
(<a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/issues/568">#568</a>)</li>
<li><a
href="66d31d32a9"><code>66d31d3</code></a>
ci: update Codecov configuration for test and coverage upload (<a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/issues/580">#580</a>)</li>
<li><a
href="eb94f14132"><code>eb94f14</code></a>
chore(deps): bump dev.mokksy:mokksy from 0.6.2 to 0.8.0 (<a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/issues/557">#557</a>)</li>
<li><a
href="c36881282f"><code>c368812</code></a>
ci: add Codecov coverage upload and XML report generation (<a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/issues/579">#579</a>)</li>
<li><a
href="45fcc17a23"><code>45fcc17</code></a>
doc: update API reference URL in README.md (<a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/issues/578">#578</a>)</li>
<li><a
href="e124262982"><code>e124262</code></a>
chore(deps): bump actions/download-artifact from 7 to 8</li>
<li>Additional commits viewable in <a
href="https://github.com/modelcontextprotocol/kotlin-sdk/compare/0.8.1...0.9.0">compare
view</a></li>
</ul>
</details>
<br />

Updates `io.modelcontextprotocol:kotlin-sdk-server` from 0.8.1 to 0.9.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.9.0</h2>
<h2>What's Changed</h2>
<h3>Breaking Changes</h3>
<ul>
<li><strong>Server call handlers now receive a
<code>RequestContext</code></strong> — handler lambdas for tools,
prompts, and resources have a new <code>context</code> parameter
providing access to request metadata (<a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/issues/515">#515</a>)
by <a href="https://github.com/rnett"><code>@​rnett</code></a></li>
<li><strong>Ktor extension functions moved from <code>Routing</code> to
<code>Route</code></strong> — update call sites: <code>routing {
mcpSse() }</code> → <code>route(&quot;/mcp&quot;) { mcpSse() }</code> or
use directly in any <code>Route</code> block (<a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/issues/531">#531</a>)
by <a href="https://github.com/kpavlov"><code>@​kpavlov</code></a></li>
<li><strong><code>StdioServerTransport</code> rethrows
<code>CancellationException</code></strong> — cancellation is no longer
silently swallowed; <code>ReadBuffer</code> parsing was also fixed (<a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/issues/571">#571</a>)
by <a href="https://github.com/kpavlov"><code>@​kpavlov</code></a></li>
</ul>
<h3>New Features</h3>
<ul>
<li><strong><code>kotlin-sdk-testing</code> module</strong> — new
artifact providing an in-process, channel-based
<code>TestClientTransport</code> / <code>TestServerTransport</code> for
unit testing MCP servers and clients without network I/O (<a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/issues/505">#505</a>)
by <a href="https://github.com/kpavlov"><code>@​kpavlov</code></a></li>

<li><strong><code>StreamableHttpServerTransport.Configuration</code></strong>
— configurable builder for the Streamable HTTP server transport
(timeouts, session handling, etc.) (<a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/issues/560">#560</a>)
by <a href="https://github.com/kpavlov"><code>@​kpavlov</code></a></li>
<li><strong>Ktor extensions for Streamable HTTP</strong> —
<code>mcpStreamableHttp()</code> Ktor plugin and routing DSL for
mounting a Streamable HTTP MCP server (<a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/issues/504">#504</a>
by <a href="https://github.com/devcrocod"><code>@​devcrocod</code></a>,
<a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/issues/568">#568</a>
by <a href="https://github.com/kpavlov"><code>@​kpavlov</code></a>)</li>
<li><strong><code>$defs</code> support in
<code>ToolSchema</code></strong> — JSON Schema <code>$defs</code> /
definitions can now be expressed in tool input schemas (<a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/issues/526">#526</a>)
by <a href="https://github.com/i1bro"><code>@​i1bro</code></a></li>
</ul>
<h3>Bug Fixes</h3>
<ul>
<li>Fixed SSE transport endpoint resolution for non-root mount paths (<a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/issues/565">#565</a>)
by <a
href="https://github.com/Amaneusz"><code>@​Amaneusz</code></a></li>
<li>Fixed <code>StdioClientTransport</code> hanging indefinitely by
adding proper read timeouts (<a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/issues/528">#528</a>)
by <a href="https://github.com/kpavlov"><code>@​kpavlov</code></a></li>
</ul>
<h3>Improvements</h3>
<ul>
<li>Introduced <code>AbstractClientTransport</code> base class,
simplifying client transport lifecycle management (<a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/issues/516">#516</a>)
by <a href="https://github.com/kpavlov"><code>@​kpavlov</code></a></li>
<li>Deprecation cycle started — annotated APIs scheduled for removal in
a future release (<a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/issues/498">#498</a>)
by <a
href="https://github.com/devcrocod"><code>@​devcrocod</code></a></li>
<li>Detekt static analysis integrated into CI (<a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/issues/493">#493</a>,
<a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/issues/507">#507</a>)
by <a href="https://github.com/kpavlov"><code>@​kpavlov</code></a></li>
<li>Code coverage reporting added via Codecov (<a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/issues/579">#579</a>,
<a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/issues/580">#580</a>)
by <a href="https://github.com/kpavlov"><code>@​kpavlov</code></a></li>
<li>Flaky <code>StdioClientTransport</code> tests replaced with real
stdin pipe–based tests (<a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/issues/508">#508</a>)
by <a href="https://github.com/kpavlov"><code>@​kpavlov</code></a></li>
</ul>
<h3>Dependency Updates</h3>
<ul>
<li>Kotest 6.1.2, MockK 1.14.9, AtomicFU 0.31.0, Gradle 9.3.1, Kover
0.9.7</li>
</ul>
<h2>New Contributors</h2>
<ul>
<li><a href="https://github.com/jskjw157"><code>@​jskjw157</code></a>
made their first contribution in <a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/pull/486">modelcontextprotocol/kotlin-sdk#486</a></li>
<li><a href="https://github.com/i1bro"><code>@​i1bro</code></a> made
their first contribution in <a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/pull/526">modelcontextprotocol/kotlin-sdk#526</a></li>
<li><a href="https://github.com/localden"><code>@​localden</code></a>
made their first contribution in <a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/pull/536">modelcontextprotocol/kotlin-sdk#536</a></li>
<li><a
href="https://github.com/aozherelyeva"><code>@​aozherelyeva</code></a>
made their first contribution in <a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/pull/551">modelcontextprotocol/kotlin-sdk#551</a></li>
<li><a href="https://github.com/rnett"><code>@​rnett</code></a> made
their first contribution in <a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/pull/515">modelcontextprotocol/kotlin-sdk#515</a></li>
<li><a href="https://github.com/Amaneusz"><code>@​Amaneusz</code></a>
made their first contribution in <a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/pull/565">modelcontextprotocol/kotlin-sdk#565</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/modelcontextprotocol/kotlin-sdk/compare/0.8.4...0.9.0">https://github.com/modelcontextprotocol/kotlin-sdk/compare/0.8.4...0.9.0</a></p>
<h2>0.8.4</h2>
<h2>Changes</h2>
<ul>
<li>feat: Ktor extensions for streamable http (<a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/issues/504">#504</a>)
by <a
href="https://github.com/devcrocod"><code>@​devcrocod</code></a></li>
<li>fix: Add $defs to ToolSchema and tests (<a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/issues/526">#526</a>)
by <a href="https://github.com/i1bro"><code>@​i1bro</code></a></li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="5b58814613"><code>5b58814</code></a>
feat: bump version to 0.9.0 (<a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/issues/576">#576</a>)</li>
<li><a
href="1454229ad9"><code>1454229</code></a>
test: add serialization tests and guidelines for handling
<code>null</code> and omitted ...</li>
<li><a
href="3e7ea39bf7"><code>3e7ea39</code></a>
chore: relax Detekt rules for tests (<a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/issues/582">#582</a>)</li>
<li><a
href="a38818018a"><code>a388180</code></a>
fix!(server): <a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/issues/575">#575</a>
Rethrow CancellationException in StdioServerTransport, fix...</li>
<li><a
href="9eabb54cb5"><code>9eabb54</code></a>
refactor: refactor Streamable HTTP ktor extensions (<a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/issues/562">#562</a>)
(<a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/issues/568">#568</a>)</li>
<li><a
href="66d31d32a9"><code>66d31d3</code></a>
ci: update Codecov configuration for test and coverage upload (<a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/issues/580">#580</a>)</li>
<li><a
href="eb94f14132"><code>eb94f14</code></a>
chore(deps): bump dev.mokksy:mokksy from 0.6.2 to 0.8.0 (<a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/issues/557">#557</a>)</li>
<li><a
href="c36881282f"><code>c368812</code></a>
ci: add Codecov coverage upload and XML report generation (<a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/issues/579">#579</a>)</li>
<li><a
href="45fcc17a23"><code>45fcc17</code></a>
doc: update API reference URL in README.md (<a
href="https://redirect.github.com/modelcontextprotocol/kotlin-sdk/issues/578">#578</a>)</li>
<li><a
href="e124262982"><code>e124262</code></a>
chore(deps): bump actions/download-artifact from 7 to 8</li>
<li>Additional commits viewable in <a
href="https://github.com/modelcontextprotocol/kotlin-sdk/compare/0.8.1...0.9.0">compare
view</a></li>
</ul>
</details>
<br />


Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-03-27 05:59:26 +00:00
..
gradle chore(deps): bump mcp-kotlin from 0.8.1 to 0.9.0 in /samples/kotlin-mcp-server (#638) 2026-03-27 05:59:26 +00:00
src Fix kotlin-mcp-server sample (#459) 2025-12-08 23:25:55 +02:00
build.gradle.kts Update Kotlin-MCP-Server with STDIO support, logging & CORS (#371) 2025-11-06 18:18:04 +02:00
gradle.properties #302 Update samples build workflow (#330) 2025-10-23 13:02:22 +03:00
gradlew chore(deps): bump the other-dependencies group across 4 directories with 4 updates (#634) 2026-03-27 00:58:15 +00:00
gradlew.bat chore(deps): bump the other-dependencies group across 4 directories with 4 updates (#634) 2026-03-27 00:58:15 +00:00
mcp-inspector-config.json Update Kotlin-MCP-Server with STDIO support, logging & CORS (#371) 2025-11-06 18:18:04 +02:00
README.md docs: streamable server sample (#595) 2026-03-10 12:45:21 +01:00
settings.gradle.kts #302 Update samples build workflow (#330) 2025-10-23 13:02:22 +03:00

Kotlin MCP Server

A sample MCP server demonstrating multiple transport modes: STDIO, SSE (plain), and SSE (Ktor plugin).

Note: The SSE transport modes are provided for backward compatibility. For new projects, consider using the simple-streamable-server sample, which uses the recommended Streamable HTTP transport.

Overview

This sample registers a prompt, a tool, and a resource, then lets you choose how to expose them. STDIO mode is the default and is best for process-based clients. The two SSE modes show how to serve MCP over HTTP using either a manual Ktor routing setup or the built-in mcp { } Ktor plugin.

Prerequisites

Build & Run

STDIO mode (default)

./gradlew run

Or explicitly:

./gradlew run --args="--stdio"

Connect with the MCP Inspector:

npx @modelcontextprotocol/inspector --config samples/kotlin-mcp-server/mcp-inspector-config.json --server stdio-server

SSE with Ktor plugin

./gradlew run --args="--sse-server-ktor 3002"

Connect with the MCP Inspector:

npx @modelcontextprotocol/inspector --config samples/kotlin-mcp-server/mcp-inspector-config.json --server sse-ktor-server

SSE with plain configuration

Known issue: This mode may not work correctly at this time.

./gradlew run --args="--sse-server 3001"

Connect with the MCP Inspector:

npx @modelcontextprotocol/inspector --config samples/kotlin-mcp-server/mcp-inspector-config.json --server sse-server

MCP Capabilities

Tools

Name Description
kotlin-sdk-tool A test tool that returns a "Hello, world!" greeting.

Prompts

Name Description
Kotlin Developer Generates a prompt to develop a small Kotlin application for a given project name.

Resources

Name URI Description
Web Search https://search.com/ A placeholder resource demonstrating resource handling.