kotlin-sdk/samples/kotlin-mcp-client
Repository files (latest commit first)
Filename Latest commit message Latest commit date
dependabot[bot] 6ce534dba9
chore(deps): bump com.anthropic:anthropic-java from 2.19.0 to 2.24.0 in /samples/kotlin-mcp-client in the other-dependencies group across 1 directory (#685)
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).

Updates `com.anthropic:anthropic-java` from 2.19.0 to 2.24.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.24.0</h2>
<h2>2.24.0 (2026-04-09)</h2>
<p>Full Changelog: <a
href="https://github.com/anthropics/anthropic-sdk-java/compare/v2.23.0...v2.24.0">v2.23.0...v2.24.0</a></p>
<h3>Features</h3>
<ul>
<li><strong>api:</strong> add beta advisor tool (<a
href="346aba2c45">346aba2</a>)</li>
<li>vertex eu region (<a
href="https://redirect.github.com/anthropics/anthropic-sdk-java/issues/1127">#1127</a>)
(<a
href="f8bd149bcf">f8bd149</a>)</li>
</ul>
<h2>v2.23.0</h2>
<h2>2.23.0 (2026-04-09)</h2>
<p>Full Changelog: <a
href="https://github.com/anthropics/anthropic-sdk-java/compare/v2.22.0...v2.23.0">v2.22.0...v2.23.0</a></p>
<h3>Features</h3>
<ul>
<li><strong>api:</strong> Add beta advisor tool (<a
href="17d360c1a8">17d360c</a>)</li>
</ul>
<h3>Chores</h3>
<ul>
<li><strong>client:</strong> add Models enum as option in Managed Agents
(<a
href="ebd7983d17">ebd7983</a>)</li>
</ul>
<h2>v2.22.0</h2>
<h2>2.22.0 (2026-04-08)</h2>
<p>Full Changelog: <a
href="https://github.com/anthropics/anthropic-sdk-java/compare/v2.21.0...v2.22.0">v2.21.0...v2.22.0</a></p>
<h3>Features</h3>
<ul>
<li><strong>api:</strong> add support for Claude Managed Agents (<a
href="f410797766">f410797</a>)</li>
<li><strong>bedrock:</strong> Create Bedrock Mantle client (<a
href="https://redirect.github.com/anthropics/anthropic-sdk-java/issues/1066">#1066</a>)
(<a
href="100dfb577c">100dfb5</a>)</li>
</ul>
<h3>Bug Fixes</h3>
<ul>
<li><strong>client:</strong> fix examples for agents (<a
href="7c11a93028">7c11a93</a>)</li>
<li><strong>internal:</strong> run formatter (<a
href="a2aa0c8645">a2aa0c8</a>)</li>
</ul>
<h2>v2.21.0</h2>
<h2>2.21.0 (2026-04-07)</h2>
<p>Full Changelog: <a
href="https://github.com/anthropics/anthropic-sdk-java/compare/v2.20.0...v2.21.0">v2.20.0...v2.21.0</a></p>
<h3>Features</h3>
<ul>
<li><strong>api:</strong> Add support for claude-mythos-preview (<a
href="b9ea13c123">b9ea13c</a>)</li>
<li><strong>vertex:</strong> add support for US multi-region endpoint
(<a
href="8e32b5fe85">8e32b5f</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.24.0 (2026-04-09)</h2>
<p>Full Changelog: <a
href="https://github.com/anthropics/anthropic-sdk-java/compare/v2.23.0...v2.24.0">v2.23.0...v2.24.0</a></p>
<h3>Features</h3>
<ul>
<li><strong>api:</strong> add beta advisor tool (<a
href="346aba2c45">346aba2</a>)</li>
<li>vertex eu region (<a
href="https://redirect.github.com/anthropics/anthropic-sdk-java/issues/1127">#1127</a>)
(<a
href="f8bd149bcf">f8bd149</a>)</li>
</ul>
<h2>2.23.0 (2026-04-09)</h2>
<p>Full Changelog: <a
href="https://github.com/anthropics/anthropic-sdk-java/compare/v2.22.0...v2.23.0">v2.22.0...v2.23.0</a></p>
<h3>Features</h3>
<ul>
<li><strong>api:</strong> Add beta advisor tool (<a
href="17d360c1a8">17d360c</a>)</li>
</ul>
<h3>Chores</h3>
<ul>
<li><strong>client:</strong> add Models enum as option in Managed Agents
(<a
href="ebd7983d17">ebd7983</a>)</li>
</ul>
<h2>2.22.0 (2026-04-08)</h2>
<p>Full Changelog: <a
href="https://github.com/anthropics/anthropic-sdk-java/compare/v2.21.0...v2.22.0">v2.21.0...v2.22.0</a></p>
<h3>Features</h3>
<ul>
<li><strong>api:</strong> add support for Claude Managed Agents (<a
href="f410797766">f410797</a>)</li>
<li><strong>bedrock:</strong> Create Bedrock Mantle client (<a
href="https://redirect.github.com/anthropics/anthropic-sdk-java/issues/1066">#1066</a>)
(<a
href="100dfb577c">100dfb5</a>)</li>
</ul>
<h3>Bug Fixes</h3>
<ul>
<li><strong>client:</strong> fix examples for agents (<a
href="7c11a93028">7c11a93</a>)</li>
<li><strong>internal:</strong> run formatter (<a
href="a2aa0c8645">a2aa0c8</a>)</li>
</ul>
<h2>2.21.0 (2026-04-07)</h2>
<p>Full Changelog: <a
href="https://github.com/anthropics/anthropic-sdk-java/compare/v2.20.0...v2.21.0">v2.20.0...v2.21.0</a></p>
<h3>Features</h3>
<ul>
<li><strong>api:</strong> Add support for claude-mythos-preview (<a
href="b9ea13c123">b9ea13c</a>)</li>
<li><strong>vertex:</strong> add support for US multi-region endpoint
(<a
href="8e32b5fe85">8e32b5f</a>)</li>
</ul>
<h2>2.20.0 (2026-04-01)</h2>
<p>Full Changelog: <a
href="https://github.com/anthropics/anthropic-sdk-java/compare/v2.19.0...v2.20.0">v2.19.0...v2.20.0</a></p>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="227a6ed7d6"><code>227a6ed</code></a>
chore: release main (<a
href="https://redirect.github.com/anthropics/anthropic-sdk-java/issues/319">#319</a>)</li>
<li><a
href="2cc9f205a3"><code>2cc9f20</code></a>
chore: release main (<a
href="https://redirect.github.com/anthropics/anthropic-sdk-java/issues/318">#318</a>)</li>
<li><a
href="52273b435e"><code>52273b4</code></a>
chore: release main (<a
href="https://redirect.github.com/anthropics/anthropic-sdk-java/issues/317">#317</a>)</li>
<li><a
href="3014518df6"><code>3014518</code></a>
chore: release main (<a
href="https://redirect.github.com/anthropics/anthropic-sdk-java/issues/314">#314</a>)</li>
<li><a
href="87d86d9733"><code>87d86d9</code></a>
chore: release main (<a
href="https://redirect.github.com/anthropics/anthropic-sdk-java/issues/313">#313</a>)</li>
<li>See full diff in <a
href="https://github.com/anthropics/anthropic-sdk-java/compare/v2.19.0...v2.24.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-04-13 14:46:26 +02:00
..
gradle chore(deps): bump com.anthropic:anthropic-java from 2.19.0 to 2.24.0 in /samples/kotlin-mcp-client in the other-dependencies group across 1 directory (#685) 2026-04-13 14:46:26 +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 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
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