mcp-kotlin-sdk
Kotlin implementation of the Model Context Protocol (MCP)
claude mcp add --transport stdio jetbrains-mcp-kotlin-sdk java -jar path/to/server.jar \ --env MCP_LOG_LEVEL="INFO (e.g., DEBUG, INFO, WARN, ERROR)"
How to use
The Kotlin MCP SDK provides both client and server capabilities for the Model Context Protocol (MCP). It supports creating MCP servers that expose resources, prompts, and tools, and it includes transport options such as stdio, SSE, and WebSocket to connect with MCP clients. You can define resources that respond to ReadResource and similar protocol messages, and you can wire up tools or prompts that assist LLMs by providing contextual data and actions. The server sample demonstrates how to register a resource (with a URI, name, description, and MIME type) and how to start a server using a stdio transport, making it easy to test locally or integrate into larger Kotlin-based ecosystems.
To use the client and server together, you would typically run the server (exposing resources and tools) and then instantiate a Kotlin MCP client that connects via a chosen transport (stdio, SSE, or WebSocket). The client can list resources, read specific resources, and invoke resource logic defined on the server. The documentation highlights sample code for creating both a client and a server, illustrating how to connect, discover resources, and provide content or responses to MCP requests.
How to install
Prerequisites:
- Java Development Kit (JDK 11 or higher)
- Gradle or Maven build system (as used by Kotlin projects)
- Basic Kotlin development environment (optional but recommended)
Installation steps:
- Clone the repository or add the Kotlin MCP SDK as a dependency in your Kotlin project. If you’re consuming the SDK in your own app, include the Kotlin MCP SDK from the JetBrains maven repository as described in the README's installation snippet:
repositories { maven(url = "https://maven.pkg.jetbrains.space/public/p/kotlin-mcp-sdk/sdk") }
dependencies { implementation("org.jetbrains.kotlinx:kotlinx-mcp-sdk:0.1.0") }
- Build the project (if you’re running the server from source) using Gradle:
./gradlew build
- Run or deploy the server. If you have a pre-built JAR, you can start it with:
java -jar path/to/server.jar
- If you prefer to run from source with your own configuration, ensure the built artifacts are available in your classpath and use your Kotlin main entry point to initialize the server as demonstrated in the samples.
Note: The repository has moved to a new location. For the Kotlin SDK, refer to the new repository at https://github.com/modelcontextprotocol/kotlin-sdk for the latest release and instructions.
Additional notes
Notes and tips:
- This Kotlin MCP SDK provides both client and server capabilities and supports stdio, SSE, and WebSocket transports as shown in the samples.
- The original repository has been moved; references in this README point to the new Kotlin SDK repository for up-to-date usage and versions.
- When configuring the server, you can expose resources with URIs, names, descriptions, and MIME types. Implement the ReadResource and similar handlers to return content or results.
- If you’re integrating into an existing Kotlin project, add the maven/gradle dependency as shown in the installation section and follow the sample patterns to create a Server, add resources, and start a transport.
- Common environment variable you might customize: MCP_LOG_LEVEL to control the verbosity of logs (e.g., DEBUG, INFO, WARN, ERROR).
Related MCP Servers
inspector
Test & Debug MCP servers, ChatGPT apps, and MCP Apps (ext-apps)
kotlin-sdk
The official Kotlin SDK for Model Context Protocol servers and clients. Maintained in collaboration with JetBrains
web-eval-agent
An MCP server that autonomously evaluates web applications.
mcp-bsl-platform-context
MCP сервер для AI-ассистентов (справка по синтаксису и объектной модели 1С:Предприятие)
fhir
FHIR MCP Server – helping you expose any FHIR Server or API as a MCP Server.
unitree-go2
The Unitree Go2 MCP Server is a server built on the MCP that enables users to control the Unitree Go2 robot using natural language commands interpreted by a LLM.