kotlin-sdk/samples/kotlin-mcp-client
Repository files (latest commit first)
Filename Latest commit message Latest commit date
dependabot[bot] 52fc8878cd
chore(deps): bump the other-dependencies group across 3 directories with 2 updates (#974)
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/kotlin-mcp-server directory:
[gradle-wrapper](https://github.com/gradle/gradle).
Bumps the other-dependencies group with 1 update in the
/samples/weather-stdio-server directory:
[gradle-wrapper](https://github.com/gradle/gradle).

Updates `com.anthropic:anthropic-java` from 2.57.0 to 2.59.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.59.0</h2>
<h2>2.59.0 (2026-08-27)</h2>
<p>Full Changelog: <a
href="https://github.com/anthropics/anthropic-sdk-java/compare/v2.58.0...v2.59.0">v2.58.0...v2.59.0</a></p>
<h3>Features</h3>
<ul>
<li><strong>api:</strong> beta files/skills namespaces use GA shapes;
drop dated beta header pins (<a
href="e4e0e25fec">e4e0e25</a>)</li>
</ul>
<h3>Bug Fixes</h3>
<ul>
<li><strong>aws,bedrock:</strong> don't consume the request body while
SigV4 signing (<a
href="https://redirect.github.com/anthropics/anthropic-sdk-java/issues/257">#257</a>)
(<a
href="95238b1cdc">95238b1</a>)</li>
<li><strong>client:</strong> page backward via before_id and stop on
has_more=false (<a
href="81f16e718b">81f16e7</a>)</li>
<li><strong>webhooks:</strong> require headers to be passed to
<code>unwrap()</code> (<a
href="4b43e22ce0">4b43e22</a>)</li>
</ul>
<h3>Documentation</h3>
<ul>
<li><strong>api:</strong> clarify pagination on the organization
rate-limit list endpoints (<a
href="1d0e9877c2">1d0e987</a>)</li>
</ul>
<h2>v2.58.0</h2>
<h2>2.58.0 (2026-08-26)</h2>
<p>Full Changelog: <a
href="https://github.com/anthropics/anthropic-sdk-java/compare/v2.57.0...v2.58.0">v2.57.0...v2.58.0</a></p>
<h3>Features</h3>
<ul>
<li><strong>api:</strong> add <code>updates</code> thinking display mode
(beta) (<a
href="792b318a9b">792b318</a>)</li>
<li><strong>api:</strong> add missing anthropic-beta values (<a
href="60cc62afc6">60cc62a</a>)</li>
<li><strong>api:</strong> add support for Organization API endpoints (<a
href="3adde69133">3adde69</a>)</li>
</ul>
<h3>Bug Fixes</h3>
<ul>
<li><strong>bedrock:</strong> stop clobbering body anthropic_beta with
header betas (<a
href="https://redirect.github.com/anthropics/anthropic-sdk-java/issues/58">#58</a>)
(<a
href="e2609a9346">e2609a9</a>)</li>
<li><strong>client:</strong> let explicit and ANTHROPIC_BASE_URL base
URLs override profile base_url (<a
href="https://redirect.github.com/anthropics/anthropic-sdk-java/issues/241">#241</a>)
(<a
href="7486e65be4">7486e65</a>)</li>
<li><strong>client:</strong> resolve base URL in ClientOptions instead
of the transport (<a
href="https://redirect.github.com/anthropics/anthropic-sdk-java/issues/242">#242</a>)
(<a
href="a3e988ac85">a3e988a</a>)</li>
<li><strong>tools:</strong> keep the tool runner going on pause_turn (<a
href="https://redirect.github.com/anthropics/anthropic-sdk-java/issues/196">#196</a>)
(<a
href="557c72df30">557c72d</a>)</li>
</ul>
<h3>Chores</h3>
<ul>
<li><strong>docs:</strong> clarify skill version <code>latest</code>
support and memory version retention (<a
href="cc7fc00777">cc7fc00</a>)</li>
<li><strong>internal:</strong> cancel superseded CI runs (<a
href="ae7cc8f98e">ae7cc8f</a>)</li>
<li><strong>internal:</strong> minor workflow reformat (<a
href="36b5b98a15">36b5b98</a>)</li>
</ul>
<h3>Documentation</h3>
<!-- 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.59.0 (2026-08-27)</h2>
<p>Full Changelog: <a
href="https://github.com/anthropics/anthropic-sdk-java/compare/v2.58.0...v2.59.0">v2.58.0...v2.59.0</a></p>
<h3>Features</h3>
<ul>
<li><strong>api:</strong> beta files/skills namespaces use GA shapes;
drop dated beta header pins (<a
href="e4e0e25fec">e4e0e25</a>)</li>
</ul>
<h3>Bug Fixes</h3>
<ul>
<li><strong>aws,bedrock:</strong> don't consume the request body while
SigV4 signing (<a
href="https://redirect.github.com/anthropics/anthropic-sdk-java/issues/257">#257</a>)
(<a
href="95238b1cdc">95238b1</a>)</li>
<li><strong>client:</strong> page backward via before_id and stop on
has_more=false (<a
href="81f16e718b">81f16e7</a>)</li>
<li><strong>webhooks:</strong> require headers to be passed to
<code>unwrap()</code> (<a
href="4b43e22ce0">4b43e22</a>)</li>
</ul>
<h3>Documentation</h3>
<ul>
<li><strong>api:</strong> clarify pagination on the organization
rate-limit list endpoints (<a
href="1d0e9877c2">1d0e987</a>)</li>
</ul>
<h2>2.58.0 (2026-08-26)</h2>
<p>Full Changelog: <a
href="https://github.com/anthropics/anthropic-sdk-java/compare/v2.57.0...v2.58.0">v2.57.0...v2.58.0</a></p>
<h3>Features</h3>
<ul>
<li><strong>api:</strong> add <code>updates</code> thinking display mode
(beta) (<a
href="792b318a9b">792b318</a>)</li>
<li><strong>api:</strong> add missing anthropic-beta values (<a
href="60cc62afc6">60cc62a</a>)</li>
<li><strong>api:</strong> add support for Organization API endpoints (<a
href="3adde69133">3adde69</a>)</li>
</ul>
<h3>Bug Fixes</h3>
<ul>
<li><strong>bedrock:</strong> stop clobbering body anthropic_beta with
header betas (<a
href="https://redirect.github.com/anthropics/anthropic-sdk-java/issues/58">#58</a>)
(<a
href="e2609a9346">e2609a9</a>)</li>
<li><strong>client:</strong> let explicit and ANTHROPIC_BASE_URL base
URLs override profile base_url (<a
href="https://redirect.github.com/anthropics/anthropic-sdk-java/issues/241">#241</a>)
(<a
href="7486e65be4">7486e65</a>)</li>
<li><strong>client:</strong> resolve base URL in ClientOptions instead
of the transport (<a
href="https://redirect.github.com/anthropics/anthropic-sdk-java/issues/242">#242</a>)
(<a
href="a3e988ac85">a3e988a</a>)</li>
<li><strong>tools:</strong> keep the tool runner going on pause_turn (<a
href="https://redirect.github.com/anthropics/anthropic-sdk-java/issues/196">#196</a>)
(<a
href="557c72df30">557c72d</a>)</li>
</ul>
<h3>Chores</h3>
<ul>
<li><strong>docs:</strong> clarify skill version <code>latest</code>
support and memory version retention (<a
href="cc7fc00777">cc7fc00</a>)</li>
<li><strong>internal:</strong> cancel superseded CI runs (<a
href="ae7cc8f98e">ae7cc8f</a>)</li>
<li><strong>internal:</strong> minor workflow reformat (<a
href="36b5b98a15">36b5b98</a>)</li>
</ul>
<h3>Documentation</h3>
<ul>
<li><strong>api:</strong> clarify session thread agent and
usage.iterations compaction descriptions (beta) (<a
href="2283253bf6">2283253</a>)</li>
<li><strong>examples:</strong> use adaptive thinking in thinking
examples (<a
href="da9aabae51">da9aaba</a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="8722270844"><code>8722270</code></a>
release: 2.59.0</li>
<li><a
href="bc1e1995f1"><code>bc1e199</code></a>
docs(api): clarify pagination on the organization rate-limit list
endpoints</li>
<li><a
href="4da20e1818"><code>4da20e1</code></a>
fix(client): page backward via before_id and stop on has_more=false</li>
<li><a
href="b7046bca8d"><code>b7046bc</code></a>
feat(api): beta files/skills namespaces use GA shapes; drop dated beta
header...</li>
<li><a
href="6531a27dc1"><code>6531a27</code></a>
fix(webhooks): require headers to be passed to
<code>unwrap()</code></li>
<li><a
href="8786a4500d"><code>8786a45</code></a>
fix(aws,bedrock): don't consume the request body while SigV4 signing (<a
href="https://redirect.github.com/anthropics/anthropic-sdk-java/issues/257">#257</a>)</li>
<li><a
href="accd19e373"><code>accd19e</code></a>
codegen metadata</li>
<li><a
href="51bd4922ec"><code>51bd492</code></a>
release: 2.58.0</li>
<li><a
href="82b254480b"><code>82b2544</code></a>
codegen metadata</li>
<li><a
href="7bec4e1e67"><code>7bec4e1</code></a>
feat(api): add support for Organization API endpoints</li>
<li>Additional commits viewable in <a
href="https://github.com/anthropics/anthropic-sdk-java/compare/v2.57.0...v2.59.0">compare
view</a></li>
</ul>
</details>
<br />

Updates `gradle-wrapper` from 9.7.0 to 9.7.1
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/gradle/gradle/releases">gradle-wrapper's
releases</a>.</em></p>
<blockquote>
<h2>9.7.1</h2>
<p>The Gradle team is excited to announce Gradle 9.7.1.</p>
<p>This is a patch release for 9.7.0. We recommend using 9.7.1 instead
of 9.7.0.</p>
<p>Here are the highlights of 9.7.0 release:</p>
<ul>
<li>Isolated Projects graduates to incubating</li>
<li>Broader Configuration Cache compatibility</li>
<li>Resilient Sync helps you fix broken builds</li>
<li>More source locations in problem reports</li>
</ul>
<p><a href="https://docs.gradle.org/9.7.1/release-notes.html">Read the
Release Notes</a></p>
<p>We would like to thank the following community members for their
contributions to this release of Gradle:
<a href="https://github.com/aSemy">Adam</a>,
<a href="https://github.com/Gautam-aman">Aman Gautam</a>,
<a href="https://github.com/YukiCodepth">Aman Kumar</a>,
<a href="https://github.com/adubrouski">Anton Dubrouski</a>,
<a href="https://github.com/liutikas">Aurimas</a>,
<a href="https://github.com/gbhavya07">gbhavya07</a>,
<a href="https://github.com/joshfriend">Josh Friend</a>,
<a href="https://github.com/nicklauslittle-gov">nicklauslittle-gov</a>,
<a href="https://github.com/psoni674">Pragati</a>,
<a href="https://github.com/Project516">project516</a>,
<a href="https://github.com/Uomocapra">Qin Mi</a>,
<a href="https://github.com/rkdfx">Ravi</a>,
<a href="https://github.com/sk-reddy17">sk-reddy17</a>,
<a href="https://github.com/Suvrat1629">Suvrat Acharya</a>,
<a href="https://github.com/ShreckYe">Yongshun Ye</a>.</p>
<h2>Upgrade instructions</h2>
<p>Switch your build to use Gradle 9.7.1 by updating your wrapper:</p>
<pre><code>./gradlew :wrapper --gradle-version=9.7.1 &amp;&amp;
./gradlew :wrapper
</code></pre>
<p>See the Gradle <a
href="https://docs.gradle.org/9.7.1/userguide/upgrading_version_9.html">9.x
upgrade guide</a> to learn about deprecations, breaking changes and
other considerations when upgrading.</p>
<p>For Java, Groovy, Kotlin and Android compatibility, see the <a
href="https://docs.gradle.org/9.7.1/userguide/compatibility.html">full
compatibility notes</a>.</p>
<h2>Reporting problems</h2>
<p>If you find a problem with this release, please file a bug on <a
href="https://github.com/gradle/gradle/issues">GitHub Issues</a>
adhering to our issue guidelines.
If you're not sure you're encountering a bug, please use the <a
href="https://discuss.gradle.org/c/help-discuss">forum</a>.</p>
<p>We hope you will build happiness with Gradle, and we look forward to
your feedback via <a href="https://twitter.com/gradle">Twitter</a> or on
<a href="https://github.com/gradle">GitHub</a>.</p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="92f0512e7f"><code>92f0512</code></a>
update fixed issues for 9.7.1 (<a
href="https://redirect.github.com/gradle/gradle/issues/38892">#38892</a>)</li>
<li><a
href="820ee75a99"><code>820ee75</code></a>
update fixed issues for 9.7.1</li>
<li><a
href="82c23f9bd2"><code>82c23f9</code></a>
Fix annotation parameter ordering problem in KTS (<a
href="https://redirect.github.com/gradle/gradle/issues/38878">#38878</a>)</li>
<li><a
href="ef11a7268f"><code>ef11a72</code></a>
Fix annotation parameter ordering issue</li>
<li><a
href="bb0d8a974a"><code>bb0d8a9</code></a>
Make relevant tests polyglot (run for multiple DSLs)</li>
<li><a
href="336e129d7f"><code>336e129</code></a>
Update signing configuration (<a
href="https://redirect.github.com/gradle/gradle/issues/38874">#38874</a>)</li>
<li><a
href="4bdf0da2da"><code>4bdf0da</code></a>
Update signing configuration</li>
<li><a
href="cd9b92c1b8"><code>cd9b92c</code></a>
List issues resolved in 9.7.1 (<a
href="https://redirect.github.com/gradle/gradle/issues/38839">#38839</a>)</li>
<li><a
href="5f4e381964"><code>5f4e381</code></a>
List issues resolved in 9.7.1</li>
<li><a
href="1e08ab5513"><code>1e08ab5</code></a>
Keep type-use annotations in extracted ABI classes (<a
href="https://redirect.github.com/gradle/gradle/issues/38810">#38810</a>)</li>
<li>Additional commits viewable in <a
href="https://github.com/gradle/gradle/compare/v9.7.0...v9.7.1">compare
view</a></li>
</ul>
</details>
<br />

Updates `gradle-wrapper` from 9.7.0 to 9.7.1
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/gradle/gradle/releases">gradle-wrapper's
releases</a>.</em></p>
<blockquote>
<h2>9.7.1</h2>
<p>The Gradle team is excited to announce Gradle 9.7.1.</p>
<p>This is a patch release for 9.7.0. We recommend using 9.7.1 instead
of 9.7.0.</p>
<p>Here are the highlights of 9.7.0 release:</p>
<ul>
<li>Isolated Projects graduates to incubating</li>
<li>Broader Configuration Cache compatibility</li>
<li>Resilient Sync helps you fix broken builds</li>
<li>More source locations in problem reports</li>
</ul>
<p><a href="https://docs.gradle.org/9.7.1/release-notes.html">Read the
Release Notes</a></p>
<p>We would like to thank the following community members for their
contributions to this release of Gradle:
<a href="https://github.com/aSemy">Adam</a>,
<a href="https://github.com/Gautam-aman">Aman Gautam</a>,
<a href="https://github.com/YukiCodepth">Aman Kumar</a>,
<a href="https://github.com/adubrouski">Anton Dubrouski</a>,
<a href="https://github.com/liutikas">Aurimas</a>,
<a href="https://github.com/gbhavya07">gbhavya07</a>,
<a href="https://github.com/joshfriend">Josh Friend</a>,
<a href="https://github.com/nicklauslittle-gov">nicklauslittle-gov</a>,
<a href="https://github.com/psoni674">Pragati</a>,
<a href="https://github.com/Project516">project516</a>,
<a href="https://github.com/Uomocapra">Qin Mi</a>,
<a href="https://github.com/rkdfx">Ravi</a>,
<a href="https://github.com/sk-reddy17">sk-reddy17</a>,
<a href="https://github.com/Suvrat1629">Suvrat Acharya</a>,
<a href="https://github.com/ShreckYe">Yongshun Ye</a>.</p>
<h2>Upgrade instructions</h2>
<p>Switch your build to use Gradle 9.7.1 by updating your wrapper:</p>
<pre><code>./gradlew :wrapper --gradle-version=9.7.1 &amp;&amp;
./gradlew :wrapper
</code></pre>
<p>See the Gradle <a
href="https://docs.gradle.org/9.7.1/userguide/upgrading_version_9.html">9.x
upgrade guide</a> to learn about deprecations, breaking changes and
other considerations when upgrading.</p>
<p>For Java, Groovy, Kotlin and Android compatibility, see the <a
href="https://docs.gradle.org/9.7.1/userguide/compatibility.html">full
compatibility notes</a>.</p>
<h2>Reporting problems</h2>
<p>If you find a problem with this release, please file a bug on <a
href="https://github.com/gradle/gradle/issues">GitHub Issues</a>
adhering to our issue guidelines.
If you're not sure you're encountering a bug, please use the <a
href="https://discuss.gradle.org/c/help-discuss">forum</a>.</p>
<p>We hope you will build happiness with Gradle, and we look forward to
your feedback via <a href="https://twitter.com/gradle">Twitter</a> or on
<a href="https://github.com/gradle">GitHub</a>.</p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="92f0512e7f"><code>92f0512</code></a>
update fixed issues for 9.7.1 (<a
href="https://redirect.github.com/gradle/gradle/issues/38892">#38892</a>)</li>
<li><a
href="820ee75a99"><code>820ee75</code></a>
update fixed issues for 9.7.1</li>
<li><a
href="82c23f9bd2"><code>82c23f9</code></a>
Fix annotation parameter ordering problem in KTS (<a
href="https://redirect.github.com/gradle/gradle/issues/38878">#38878</a>)</li>
<li><a
href="ef11a7268f"><code>ef11a72</code></a>
Fix annotation parameter ordering issue</li>
<li><a
href="bb0d8a974a"><code>bb0d8a9</code></a>
Make relevant tests polyglot (run for multiple DSLs)</li>
<li><a
href="336e129d7f"><code>336e129</code></a>
Update signing configuration (<a
href="https://redirect.github.com/gradle/gradle/issues/38874">#38874</a>)</li>
<li><a
href="4bdf0da2da"><code>4bdf0da</code></a>
Update signing configuration</li>
<li><a
href="cd9b92c1b8"><code>cd9b92c</code></a>
List issues resolved in 9.7.1 (<a
href="https://redirect.github.com/gradle/gradle/issues/38839">#38839</a>)</li>
<li><a
href="5f4e381964"><code>5f4e381</code></a>
List issues resolved in 9.7.1</li>
<li><a
href="1e08ab5513"><code>1e08ab5</code></a>
Keep type-use annotations in extracted ABI classes (<a
href="https://redirect.github.com/gradle/gradle/issues/38810">#38810</a>)</li>
<li>Additional commits viewable in <a
href="https://github.com/gradle/gradle/compare/v9.7.0...v9.7.1">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-09-01 13:26:31 +02:00
..
gradle chore(deps): bump the other-dependencies group across 3 directories with 2 updates (#974) 2026-09-01 13:26:31 +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 (#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
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