| Filename | Latest commit message | Latest commit date |
|---|---|---|
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=" |
||
| .. | ||
| gradle | ||
| src/main | ||
| build.gradle.kts | ||
| gradle.properties | ||
| gradlew | ||
| gradlew.bat | ||
| README.md | ||
| settings.gradle.kts | ||
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_KEYenvironment 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.jarfile.
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.