kotlin-sdk/samples/kotlin-mcp-server
Repository files (latest commit first)
Filename Latest commit message Latest commit date
dependabot[bot] e9b976198b
chore(deps): bump the other-dependencies group across 4 directories with 2 updates (#988)
Bumps the other-dependencies group with 2 updates in the
/samples/kotlin-mcp-client directory:
[com.anthropic:anthropic-java](https://github.com/anthropics/anthropic-sdk-java)
and org.slf4j:slf4j-simple.
Bumps the other-dependencies group with 1 update in the
/samples/kotlin-mcp-server directory: org.slf4j:slf4j-simple.
Bumps the other-dependencies group with 1 update in the
/samples/simple-streamable-server directory: org.slf4j:slf4j-simple.
Bumps the other-dependencies group with 1 update in the
/samples/weather-stdio-server directory: org.slf4j:slf4j-simple.

Updates `com.anthropic:anthropic-java` from 2.60.0 to 2.62.0
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/anthropics/anthropic-sdk-java/releases">com.anthropic:anthropic-java's
releases</a>.</em></p>
<blockquote>
<h2>v2.62.0</h2>
<h2>2.62.0 (2026-09-10)</h2>
<p>Full Changelog: <a
href="https://github.com/anthropics/anthropic-sdk-java/compare/v2.61.0...v2.62.0">v2.61.0...v2.62.0</a></p>
<h3>Features</h3>
<ul>
<li><strong>api:</strong> add auto mode tool permissions for Managed
Agents (<a
href="e373feae15">e373fea</a>)</li>
<li><strong>api:</strong> add content_too_large web_fetch tool error
code (<a
href="96451dee56">96451de</a>)</li>
<li><strong>api:</strong> add the user-profiles-2026-09-04 beta value
and external_user_details to user profiles (<a
href="eb8c5b8900">eb8c5b8</a>)</li>
<li><strong>api:</strong> support mounting public GitHub repositories
without an authorization_token in Managed Agents sessions (<a
href="2e1c9edbd4">2e1c9ed</a>)</li>
</ul>
<h3>Performance Improvements</h3>
<ul>
<li><strong>streaming:</strong> append tool input JSON in place (<a
href="d330f8bc51">d330f8b</a>)</li>
<li><strong>streaming:</strong> buffer text deltas instead of rebuilding
blocks per delta (<a
href="2bf8f70acd">2bf8f70</a>)</li>
</ul>
<h3>Chores</h3>
<ul>
<li><strong>docs:</strong> correct the environment scope field
description (<a
href="788877064e">7888770</a>)</li>
<li><strong>internal:</strong> cap formatter JVM heap at 1 GiB (<a
href="9b7b5a8b9a">9b7b5a8</a>)</li>
<li><strong>internal:</strong> restore package version (<a
href="28151f2eab">28151f2</a>)</li>
<li><strong>internal:</strong> restore package version (<a
href="6044d632e6">6044d63</a>)</li>
<li><strong>internal:</strong> stop stamping the package version into
generated files (<a
href="ee275adad3">ee275ad</a>)</li>
<li><strong>tests:</strong> restore empty test package marker files (<a
href="3e2284c0b3">3e2284c</a>)</li>
</ul>
<h2>v2.61.0</h2>
<h2>2.61.0 (2026-09-04)</h2>
<p>Full Changelog: <a
href="https://github.com/anthropics/anthropic-sdk-java/compare/v2.60.0...v2.61.0">v2.60.0...v2.61.0</a></p>
<h3>Features</h3>
<ul>
<li><strong>api:</strong> add Claude Tag category and user breakdowns to
usage reports (<a
href="7caaeb9fde">7caaeb9</a>)</li>
<li><strong>api:</strong> add named types for organization compliance
settings state (<a
href="9576c86dce">9576c86</a>)</li>
<li><strong>api:</strong> add workspace_id request option for
multi-workspace credentials (<a
href="cf7f13ccc1">cf7f13c</a>)</li>
<li><strong>api:</strong> raise Managed Agents vault refresh token limit
to 8192 chars (<a
href="d0c2286eda">d0c2286</a>)</li>
</ul>
<h3>Bug Fixes</h3>
<ul>
<li><strong>api:</strong> remove response text block maxLength
constraint (<a
href="b6225ce280">b6225ce</a>)</li>
<li><strong>client:</strong> read union common properties from raw JSON
for unknown variants (<a
href="3d2f38fe74">3d2f38f</a>)</li>
</ul>
<h3>Chores</h3>
<ul>
<li><strong>api:</strong> accept anthropic-version on Claude Enterprise
admin endpoints (<a
href="165fa6b5aa">165fa6b</a>)</li>
<li><strong>api:</strong> declare specific error statuses instead of a
generic 4XX response (<a
href="e0dc35b2c5">e0dc35b</a>)</li>
<li><strong>api:</strong> update authentication parameters on spend
limit create and delete (<a
href="d054f6cfe4">d054f6c</a>)</li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/anthropics/anthropic-sdk-java/blob/main/CHANGELOG.md">com.anthropic:anthropic-java's
changelog</a>.</em></p>
<blockquote>
<h2>2.62.0 (2026-09-10)</h2>
<p>Full Changelog: <a
href="https://github.com/anthropics/anthropic-sdk-java/compare/v2.61.0...v2.62.0">v2.61.0...v2.62.0</a></p>
<h3>Features</h3>
<ul>
<li><strong>api:</strong> add auto mode tool permissions for Managed
Agents (<a
href="e373feae15">e373fea</a>)</li>
<li><strong>api:</strong> add content_too_large web_fetch tool error
code (<a
href="96451dee56">96451de</a>)</li>
<li><strong>api:</strong> add the user-profiles-2026-09-04 beta value
and external_user_details to user profiles (<a
href="eb8c5b8900">eb8c5b8</a>)</li>
<li><strong>api:</strong> support mounting public GitHub repositories
without an authorization_token in Managed Agents sessions (<a
href="2e1c9edbd4">2e1c9ed</a>)</li>
</ul>
<h3>Performance Improvements</h3>
<ul>
<li><strong>streaming:</strong> append tool input JSON in place (<a
href="d330f8bc51">d330f8b</a>)</li>
<li><strong>streaming:</strong> buffer text deltas instead of rebuilding
blocks per delta (<a
href="2bf8f70acd">2bf8f70</a>)</li>
</ul>
<h3>Chores</h3>
<ul>
<li><strong>docs:</strong> correct the environment scope field
description (<a
href="788877064e">7888770</a>)</li>
<li><strong>internal:</strong> cap formatter JVM heap at 1 GiB (<a
href="9b7b5a8b9a">9b7b5a8</a>)</li>
<li><strong>internal:</strong> restore package version (<a
href="28151f2eab">28151f2</a>)</li>
<li><strong>internal:</strong> restore package version (<a
href="6044d632e6">6044d63</a>)</li>
<li><strong>internal:</strong> stop stamping the package version into
generated files (<a
href="ee275adad3">ee275ad</a>)</li>
<li><strong>tests:</strong> restore empty test package marker files (<a
href="3e2284c0b3">3e2284c</a>)</li>
</ul>
<h2>2.61.0 (2026-09-04)</h2>
<p>Full Changelog: <a
href="https://github.com/anthropics/anthropic-sdk-java/compare/v2.60.0...v2.61.0">v2.60.0...v2.61.0</a></p>
<h3>Features</h3>
<ul>
<li><strong>api:</strong> add Claude Tag category and user breakdowns to
usage reports (<a
href="7caaeb9fde">7caaeb9</a>)</li>
<li><strong>api:</strong> add named types for organization compliance
settings state (<a
href="9576c86dce">9576c86</a>)</li>
<li><strong>api:</strong> add workspace_id request option for
multi-workspace credentials (<a
href="cf7f13ccc1">cf7f13c</a>)</li>
<li><strong>api:</strong> raise Managed Agents vault refresh token limit
to 8192 chars (<a
href="d0c2286eda">d0c2286</a>)</li>
<li><strong>client:</strong> keep vault credential secrets out of
Terraform state with write-only arguments (<a
href="7556952191">7556952</a>)</li>
</ul>
<h3>Bug Fixes</h3>
<ul>
<li><strong>api:</strong> remove response text block maxLength
constraint (<a
href="b6225ce280">b6225ce</a>)</li>
<li><strong>client:</strong> raise a clear error when an httpx object is
passed instead of an httpx2 one (<a
href="130d7af1c6">130d7af</a>)</li>
<li><strong>client:</strong> read union common properties from raw JSON
for unknown variants (<a
href="3d2f38fe74">3d2f38f</a>)</li>
</ul>
<h3>Chores</h3>
<ul>
<li><strong>api:</strong> accept anthropic-version on Claude Enterprise
admin endpoints (<a
href="165fa6b5aa">165fa6b</a>)</li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="88a17532c5"><code>88a1753</code></a>
Merge pull request <a
href="https://redirect.github.com/anthropics/anthropic-sdk-java/issues/400">#400</a>
from anthropics/release-please--branches--main--chang...</li>
<li><a
href="6964f0722f"><code>6964f07</code></a>
release: 2.62.0</li>
<li><a
href="e373feae15"><code>e373fea</code></a>
feat(api): add auto mode tool permissions for Managed Agents</li>
<li><a
href="2e1c9edbd4"><code>2e1c9ed</code></a>
feat(api): support mounting public GitHub repositories without an
authorizati...</li>
<li><a
href="eb8c5b8900"><code>eb8c5b8</code></a>
feat(api): add the user-profiles-2026-09-04 beta value and
external_user_deta...</li>
<li><a
href="2bf8f70acd"><code>2bf8f70</code></a>
perf(streaming): buffer text deltas instead of rebuilding blocks per
delta</li>
<li><a
href="d330f8bc51"><code>d330f8b</code></a>
perf(streaming): append tool input JSON in place</li>
<li><a
href="788877064e"><code>7888770</code></a>
chore(docs): correct the environment scope field description</li>
<li><a
href="9b7b5a8b9a"><code>9b7b5a8</code></a>
chore(internal): cap formatter JVM heap at 1 GiB</li>
<li><a
href="96451dee56"><code>96451de</code></a>
feat(api): add content_too_large web_fetch tool error code</li>
<li>Additional commits viewable in <a
href="https://github.com/anthropics/anthropic-sdk-java/compare/v2.60.0...v2.62.0">compare
view</a></li>
</ul>
</details>
<br />

Updates `org.slf4j:slf4j-simple` from 2.0.18 to 2.0.19

Updates `org.slf4j:slf4j-simple` from 2.0.18 to 2.0.19

Updates `org.slf4j:slf4j-simple` from 2.0.18 to 2.0.19

Updates `org.slf4j:slf4j-simple` from 2.0.18 to 2.0.19

Updates `org.slf4j:slf4j-simple` from 2.0.18 to 2.0.19

Updates `org.slf4j:slf4j-simple` from 2.0.18 to 2.0.19

Updates `org.slf4j:slf4j-simple` from 2.0.18 to 2.0.19

Updates `org.slf4j:slf4j-simple` from 2.0.18 to 2.0.19

Updates `org.slf4j:slf4j-simple` from 2.0.18 to 2.0.19

Updates `org.slf4j:slf4j-simple` from 2.0.18 to 2.0.19

Updates `org.slf4j:slf4j-simple` from 2.0.18 to 2.0.19

Updates `org.slf4j:slf4j-simple` from 2.0.18 to 2.0.19

Updates `org.slf4j:slf4j-simple` from 2.0.18 to 2.0.19

Updates `org.slf4j:slf4j-simple` from 2.0.18 to 2.0.19

Updates `org.slf4j:slf4j-simple` from 2.0.18 to 2.0.19

Updates `org.slf4j:slf4j-simple` from 2.0.18 to 2.0.19

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-09-17 16:34:29 +02:00
..
gradle chore(deps): bump the other-dependencies group across 4 directories with 2 updates (#988) 2026-09-17 16:34:29 +02: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 5 directories with 3 updates (#854) 2026-06-24 15:31:46 +02:00
gradlew.bat chore(deps): bump the other-dependencies group across 5 directories with 3 updates (#854) 2026-06-24 15:31:46 +02: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.