kotlin-sdk/samples/kotlin-mcp-client
Repository files (latest commit first)
Filename Latest commit message Latest commit date
dependabot[bot] ff4b6232ba
chore(deps): bump the other-dependencies group across 3 directories with 3 updates (#781)
Bumps the other-dependencies group with 1 update in the
/samples/kotlin-mcp-client directory:
[com.anthropic:anthropic-java](https://github.com/anthropics/anthropic-sdk-java).
Bumps the other-dependencies group with 1 update in the
/samples/simple-streamable-server directory:
[org.junit.jupiter:junit-jupiter](https://github.com/junit-team/junit-framework).
Bumps the other-dependencies group with 1 update in the
/samples/weather-stdio-server directory:
[io.github.oshai:kotlin-logging-jvm](https://github.com/oshai/kotlin-logging).

Updates `com.anthropic:anthropic-java` from 2.32.0 to 2.34.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.34.0</h2>
<h2>2.34.0 (2026-05-21)</h2>
<p>Full Changelog: <a
href="https://github.com/anthropics/anthropic-sdk-java/compare/v2.33.0...v2.34.0">v2.33.0...v2.34.0</a></p>
<h3>Features</h3>
<ul>
<li><strong>api:</strong> Add support for thinking-token-count beta for
estimated tokens in thinking block deltas when streaming (<a
href="c814c7a248">c814c7a</a>)</li>
</ul>
<h3>Bug Fixes</h3>
<ul>
<li><strong>test:</strong> set required estimatedTokens on
BetaThinkingDelta in BetaMessageAccumulatorTest (<a
href="04aedf3c0b">04aedf3</a>)</li>
</ul>
<h2>v2.33.0</h2>
<h2>2.33.0 (2026-05-19)</h2>
<p>Full Changelog: <a
href="https://github.com/anthropics/anthropic-sdk-java/compare/v2.32.0...v2.33.0">v2.32.0...v2.33.0</a></p>
<h3>Features</h3>
<ul>
<li><strong>client:</strong> Add support for self-hosted sandboxes in
CMA with sandbox helpers (<a
href="d5193622da">d519362</a>)</li>
</ul>
</blockquote>
</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.34.0 (2026-05-21)</h2>
<p>Full Changelog: <a
href="https://github.com/anthropics/anthropic-sdk-java/compare/v2.33.0...v2.34.0">v2.33.0...v2.34.0</a></p>
<h3>Features</h3>
<ul>
<li><strong>api:</strong> Add support for thinking-token-count beta for
estimated tokens in thinking block deltas when streaming (<a
href="c814c7a248">c814c7a</a>)</li>
</ul>
<h3>Bug Fixes</h3>
<ul>
<li><strong>test:</strong> set required estimatedTokens on
BetaThinkingDelta in BetaMessageAccumulatorTest (<a
href="04aedf3c0b">04aedf3</a>)</li>
</ul>
<h2>2.33.0 (2026-05-19)</h2>
<p>Full Changelog: <a
href="https://github.com/anthropics/anthropic-sdk-java/compare/v2.32.0...v2.33.0">v2.32.0...v2.33.0</a></p>
<h3>Features</h3>
<ul>
<li><strong>client:</strong> Add support for self-hosted sandboxes in
CMA with sandbox helpers (<a
href="d5193622da">d519362</a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="765ec0e21c"><code>765ec0e</code></a>
release: 2.34.0</li>
<li><a
href="56c637fc19"><code>56c637f</code></a>
fix(test): set required estimatedTokens on BetaThinkingDelta in
BetaMessageAc...</li>
<li><a
href="5d636b2d1a"><code>5d636b2</code></a>
feat(api): Add support for thinking-token-count beta for estimated
tokens in ...</li>
<li><a
href="ba2d183062"><code>ba2d183</code></a>
release: 2.33.0</li>
<li><a
href="56312dbf89"><code>56312db</code></a>
feat(client): Add support for self-hosted sandboxes in CMA with sandbox
helpers</li>
<li>See full diff in <a
href="https://github.com/anthropics/anthropic-sdk-java/compare/v2.32.0...v2.34.0">compare
view</a></li>
</ul>
</details>
<br />

Updates `org.junit.jupiter:junit-jupiter` from 6.0.3 to 6.1.0
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/junit-team/junit-framework/releases">org.junit.jupiter:junit-jupiter's
releases</a>.</em></p>
<blockquote>
<p>JUnit 6.1.0 = Platform 6.1.0 + Jupiter 6.1.0 + Vintage 6.1.0</p>
<p>See <a href="https://docs.junit.org/6.1.0/release-notes.html">Release
Notes</a>.</p>
<h2>New Contributors</h2>
<ul>
<li><a
href="https://github.com/JarvisCraft"><code>@​JarvisCraft</code></a>
made their first contribution in <a
href="https://redirect.github.com/junit-team/junit-framework/pull/5633">junit-team/junit-framework#5633</a></li>
<li><a href="https://github.com/Maran23"><code>@​Maran23</code></a> made
their first contribution in <a
href="https://redirect.github.com/junit-team/junit-framework/pull/5644">junit-team/junit-framework#5644</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/junit-team/junit-framework/compare/r6.0.3...r6.1.0">https://github.com/junit-team/junit-framework/compare/r6.0.3...r6.1.0</a></p>
<p>JUnit 6.1.0-RC1 = Platform 6.1.0-RC1 + Jupiter 6.1.0-RC1 + Vintage
6.1.0-RC1</p>
<p>See <a href="https://docs.junit.org/6.1.0-RC1/release-notes/">Release
Notes</a>.</p>
<h2>New Contributors</h2>
<ul>
<li><a
href="https://github.com/mariokhoury4"><code>@​mariokhoury4</code></a>
made their first contribution in <a
href="https://redirect.github.com/junit-team/junit-framework/pull/4574">junit-team/junit-framework#4574</a></li>
<li><a href="https://github.com/Ogu1208"><code>@​Ogu1208</code></a> made
their first contribution in <a
href="https://redirect.github.com/junit-team/junit-framework/pull/5145">junit-team/junit-framework#5145</a></li>
<li><a
href="https://github.com/HyungGeun94"><code>@​HyungGeun94</code></a>
made their first contribution in <a
href="https://redirect.github.com/junit-team/junit-framework/pull/5271">junit-team/junit-framework#5271</a></li>
<li><a
href="https://github.com/yalishevant"><code>@​yalishevant</code></a>
made their first contribution in <a
href="https://redirect.github.com/junit-team/junit-framework/pull/5316">junit-team/junit-framework#5316</a></li>
<li><a
href="https://github.com/JINU-CHANG"><code>@​JINU-CHANG</code></a> made
their first contribution in <a
href="https://redirect.github.com/junit-team/junit-framework/pull/5290">junit-team/junit-framework#5290</a></li>
<li><a href="https://github.com/jaschdoc"><code>@​jaschdoc</code></a>
made their first contribution in <a
href="https://redirect.github.com/junit-team/junit-framework/pull/5427">junit-team/junit-framework#5427</a></li>
<li><a
href="https://github.com/kawshikbuet17"><code>@​kawshikbuet17</code></a>
made their first contribution in <a
href="https://redirect.github.com/junit-team/junit-framework/pull/5561">junit-team/junit-framework#5561</a></li>
<li><a href="https://github.com/msridhar"><code>@​msridhar</code></a>
made their first contribution in <a
href="https://redirect.github.com/junit-team/junit-framework/pull/5602">junit-team/junit-framework#5602</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/junit-team/junit-framework/compare/r6.1.0-M1...r6.1.0-RC1">https://github.com/junit-team/junit-framework/compare/r6.1.0-M1...r6.1.0-RC1</a></p>
<p>JUnit 6.1.0-M1 = Platform 6.1.0-M1 + Jupiter 6.1.0-M1 + Vintage
6.1.0-M1</p>
<p>See <a href="https://docs.junit.org/6.1.0-M1/release-notes/">Release
Notes</a>.</p>
<h2>New Contributors</h2>
<ul>
<li><a href="https://github.com/vy"><code>@​vy</code></a> made their
first contribution in <a
href="https://redirect.github.com/junit-team/junit-framework/pull/5041">junit-team/junit-framework#5041</a></li>
<li><a href="https://github.com/Pankraz76"><code>@​Pankraz76</code></a>
made their first contribution in <a
href="https://redirect.github.com/junit-team/junit-framework/pull/5006">junit-team/junit-framework#5006</a></li>
<li><a href="https://github.com/arukiidou"><code>@​arukiidou</code></a>
made their first contribution in <a
href="https://redirect.github.com/junit-team/junit-framework/pull/5066">junit-team/junit-framework#5066</a></li>
<li><a href="https://github.com/laeubi"><code>@​laeubi</code></a> made
their first contribution in <a
href="https://redirect.github.com/junit-team/junit-framework/pull/5092">junit-team/junit-framework#5092</a></li>
<li><a href="https://github.com/jihun4452"><code>@​jihun4452</code></a>
made their first contribution in <a
href="https://redirect.github.com/junit-team/junit-framework/pull/5088">junit-team/junit-framework#5088</a></li>
<li><a
href="https://github.com/TWiStErRob"><code>@​TWiStErRob</code></a> made
their first contribution in <a
href="https://redirect.github.com/junit-team/junit-framework/pull/5133">junit-team/junit-framework#5133</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/junit-team/junit-framework/compare/r6.0.0...r6.1.0-M1">https://github.com/junit-team/junit-framework/compare/r6.0.0...r6.1.0-M1</a></p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="0dc3af1cb1"><code>0dc3af1</code></a>
Release 6.1.0</li>
<li><a
href="1d130020c8"><code>1d13002</code></a>
Prepare 6.1.0 release notes</li>
<li><a
href="072b2175bb"><code>072b217</code></a>
Update plugin spotless to v8.5.0 (<a
href="https://redirect.github.com/junit-team/junit-framework/issues/5668">#5668</a>)</li>
<li><a
href="3a53480218"><code>3a53480</code></a>
Update Gradle to v9.5.1 (<a
href="https://redirect.github.com/junit-team/junit-framework/issues/5666">#5666</a>)</li>
<li><a
href="0e18a20a9f"><code>0e18a20</code></a>
Update zizmorcore/zizmor-action action to v0.5.4 (<a
href="https://redirect.github.com/junit-team/junit-framework/issues/5669">#5669</a>)</li>
<li><a
href="0a2634fb9c"><code>0a2634f</code></a>
Update github/codeql-action action to v4.35.5 (<a
href="https://redirect.github.com/junit-team/junit-framework/issues/5671">#5671</a>)</li>
<li><a
href="4dbd5561b0"><code>4dbd556</code></a>
Restructure workflows to have single &quot;status&quot; job (<a
href="https://redirect.github.com/junit-team/junit-framework/issues/5670">#5670</a>)</li>
<li><a
href="f2194cebe3"><code>f2194ce</code></a>
Increase timeout to reduce flakiness</li>
<li><a
href="5c8fdd2df6"><code>5c8fdd2</code></a>
Update dependency org.apache.groovy:groovy to v5.0.6 (<a
href="https://redirect.github.com/junit-team/junit-framework/issues/5659">#5659</a>)</li>
<li><a
href="43c6982324"><code>43c6982</code></a>
Update dependency org.slf4j:slf4j-jdk14 to v2.0.18 (<a
href="https://redirect.github.com/junit-team/junit-framework/issues/5667">#5667</a>)</li>
<li>Additional commits viewable in <a
href="https://github.com/junit-team/junit-framework/compare/r6.0.3...r6.1.0">compare
view</a></li>
</ul>
</details>
<br />

Updates `io.github.oshai:kotlin-logging-jvm` from 8.0.02 to 8.0.03
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/oshai/kotlin-logging/releases">io.github.oshai:kotlin-logging-jvm's
releases</a>.</em></p>
<blockquote>
<h2>8.0.03</h2>
<h2>What's Changed</h2>
<ul>
<li>Fix <a
href="https://redirect.github.com/oshai/kotlin-logging/issues/598">#598</a>:
Allow external configuration of logStartupMessage via Properties and Env
Vars by <a href="https://github.com/oshai"><code>@​oshai</code></a> in
<a
href="https://redirect.github.com/oshai/kotlin-logging/pull/602">oshai/kotlin-logging#602</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/oshai/kotlin-logging/compare/8.0.02...8.0.03">https://github.com/oshai/kotlin-logging/compare/8.0.02...8.0.03</a></p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="b6418566da"><code>b641856</code></a>
bump version to 8.0.04</li>
<li><a
href="3e6096d85f"><code>3e6096d</code></a>
Fix <a
href="https://redirect.github.com/oshai/kotlin-logging/issues/598">#598</a>:
Allow external configuration of logStartupMessage via Properties
an...</li>
<li>See full diff in <a
href="https://github.com/oshai/kotlin-logging/compare/8.0.02...8.0.03">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 <dependency name> major version` will close this
group update PR and stop Dependabot creating any more for the specific
dependency's major version (unless you unignore this specific
dependency's major version or upgrade to it yourself)
- `@dependabot ignore <dependency name> minor version` will close this
group update PR and stop Dependabot creating any more for the specific
dependency's minor version (unless you unignore this specific
dependency's minor version or upgrade to it yourself)
- `@dependabot ignore <dependency name>` will close this group update PR
and stop Dependabot creating any more for the specific dependency
(unless you unignore this specific dependency or upgrade to it yourself)
- `@dependabot unignore <dependency name>` will remove all of the ignore
conditions of the specified dependency
- `@dependabot unignore <dependency name> <ignore condition>` will
remove the ignore condition of the specified dependency and ignore
conditions


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-05-26 18:27:57 +02:00
..
gradle chore(deps): bump the other-dependencies group across 3 directories with 3 updates (#781) 2026-05-26 18:27:57 +02:00
src/main docs: update client and server samples (#598) 2026-03-13 10:23:51 +01:00
build.gradle.kts Add Ktor BOM for dependency management across all modules, run Kotlin-MCP-Server Sample (#367) 2025-11-04 11:44:39 +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 (#753) 2026-05-05 16:03:42 +02:00
gradlew.bat chore(deps): bump the other-dependencies group across 5 directories with 3 updates (#753) 2026-05-05 16:03:42 +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 Client

An interactive CLI client that connects to any MCP server over STDIO and pipes queries through Anthropic's Claude API.

Overview

This sample demonstrates a complete MCP client workflow: launching an MCP server as a subprocess, discovering its tools, converting them to Anthropic's tool format, and running an interactive chat loop where Claude can call server tools on behalf of the user.

Prerequisites

  • JDK 17+
  • An ANTHROPIC_API_KEY environment variable set with a valid Anthropic API key
  • An MCP server script to connect to (.js, .py, or .jar)

Build & Run

Run the client, passing the path to an MCP server:

# Connect to a JVM server
./gradlew run --args="path/to/server.jar"

# Connect to a Python server
./gradlew run --args="path/to/server.py"

# Connect to a Node.js server
./gradlew run --args="path/to/build/index.js"

Note

The client uses STDIO transport, so it launches the MCP server as a subprocess. Ensure the server script is executable and is a valid .js, .py, or .jar file.

MCP Capabilities

From the client perspective, this sample demonstrates:

  • Tool discovery — lists tools from the connected server and converts them to Anthropic's tool format.
  • Tool invocation — when Claude's response requests a tool call, the client invokes the corresponding MCP tool and feeds the result back into the conversation.

Additional Resources