- add a simple streamable http server example with auth - update readme: replace quickstart example from sse server to streamable server - add readme files for samples, simple-streamable-server, notebooks closes #170 ## How Has This Been Tested? knit and inspector ## Breaking Changes NaN ## Types of changes - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) - [x] Documentation update ## Checklist - [x] I have read the [MCP Documentation](https://modelcontextprotocol.io) - [x] My code follows the repository's style guidelines - [x] New and existing tests pass locally - [ ] I have added appropriate error handling - [x] I have added or updated documentation as needed
50 lines
1.6 KiB
Markdown
50 lines
1.6 KiB
Markdown
# 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:
|
|
|
|
```shell
|
|
# 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
|
|
|
|
- [MCP Specification](https://modelcontextprotocol.io/specification/latest)
|
|
- [Kotlin MCP SDK](https://github.com/modelcontextprotocol/kotlin-sdk)
|
|
- [Anthropic Java SDK](https://github.com/anthropics/anthropic-sdk-java)
|