Kotlin SDK
The official Kotlin SDK for Model Context Protocol servers and clients. Maintained in collaboration with JetBrains
What is Kotlin SDK?
Kotlin SDK is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to official kotlin sdk for model context protocol servers and clients. maintained in collaboration with jetbrains
The official Kotlin SDK for Model Context Protocol servers and clients. Maintained in collaboration with JetBrains
This server falls under the Developer Tools category on MCPgee, the world's largest MCP server directory with 33,000+ servers.
Features
- The official Kotlin SDK for Model Context Protocol servers a
Use Cases
Maintainer
Works with
Installation
Manual Installation
npx kotlin-sdkConfiguration
Configuration Details
claude_desktop_config.json
Performance
Response Metrics
Resource Usage
How to Set Up and Use Kotlin SDK
The MCP Kotlin SDK is the official, JetBrains-maintained implementation of the Model Context Protocol for Kotlin and JVM-based projects. It provides idiomatic Kotlin APIs for building both MCP servers (which expose tools, resources, and prompts) and MCP clients (which connect to and invoke those capabilities). The SDK supports Kotlin Multiplatform, enabling deployment targets including JVM, Native, JavaScript, and WebAssembly, and integrates with Ktor for HTTP and WebSocket transports. Developers building AI-powered tooling in the JVM ecosystem — IntelliJ plugins, Spring Boot services, Android apps, or Kotlin CLI tools — use this SDK to add MCP capabilities without writing protocol boilerplate.
Prerequisites
- Kotlin 2.2+ and JVM 11+ (or a Kotlin Multiplatform project targeting other platforms)
- Gradle 8+ with the Kotlin DSL (build.gradle.kts) or Maven
- Ktor client or server engine dependency added explicitly (e.g. ktor-client-cio or ktor-server-netty)
- An MCP inspector or compatible client for testing: 'npx -y @modelcontextprotocol/inspector'
Add the SDK dependency to your Gradle build
Add the MCP Kotlin SDK from Maven Central to your build.gradle.kts. Use the full artifact for projects that need both client and server, or use the split client/server artifacts for leaner dependencies.
repositories {
mavenCentral()
}
dependencies {
implementation("io.modelcontextprotocol:kotlin-sdk:0.4.0")
// Add a Ktor engine — required, not included transitively
implementation("io.ktor:ktor-client-cio:3.1.3")
implementation("io.ktor:ktor-server-netty:3.1.3")
}Create an MCP server with tools
Instantiate a Server, declare its capabilities, and register tools using the addTool builder. Each tool receives a typed request and returns a CallToolResult.
import io.modelcontextprotocol.kotlin.sdk.*
val server = Server(
serverInfo = Implementation(name = "my-server", version = "1.0.0"),
options = ServerOptions(
capabilities = ServerCapabilities(
tools = ServerCapabilities.Tools(listChanged = true)
)
)
)
server.addTool(
name = "greet",
description = "Returns a greeting for the given name"
) { request ->
val name = request.arguments["name"]?.jsonPrimitive?.content ?: "World"
CallToolResult(content = listOf(TextContent("Hello, $name!")))
}Expose the server over HTTP with Ktor
Use the mcpStreamableHttp() Ktor helper to mount the server on an HTTP port. This is the recommended transport for remote or multi-client deployments.
import io.ktor.server.cio.*
import io.ktor.server.engine.*
import io.modelcontextprotocol.kotlin.sdk.server.*
embeddedServer(CIO, port = 3000) {
mcpStreamableHttp { server }
}.start(wait = true)Or run the server over stdio
For CLI tools and editor plugins, use stdio transport so the client process launches the server as a subprocess.
import io.modelcontextprotocol.kotlin.sdk.server.*
server.runStdio()Create an MCP client to connect
Build a Client, connect it via StreamableHttpClientTransport, and call listTools() or callTool() to interact with any MCP server.
import io.ktor.client.*
import io.ktor.client.plugins.sse.*
import io.modelcontextprotocol.kotlin.sdk.client.*
val httpClient = HttpClient { install(SSE) }
val client = Client(clientInfo = Implementation(name = "my-client", version = "1.0.0"))
val transport = StreamableHttpClientTransport(client = httpClient, url = "http://localhost:3000/mcp")
client.connect(transport)
val tools = client.listTools()?.tools ?: emptyList()
println(tools.map { it.name })Test with the MCP Inspector
Run the MCP Inspector to explore and test your server's tools, resources, and prompts interactively in a browser UI.
npx -y @modelcontextprotocol/inspectorKotlin SDK Examples
Client configuration
Example MCP client config to connect to a Kotlin SDK server running over stdio. Replace 'my-mcp-server' with your built JAR or executable.
{
"mcpServers": {
"kotlin-mcp-server": {
"command": "java",
"args": ["-jar", "/path/to/my-mcp-server.jar"]
}
}
}Prompts to try
Questions and tasks to ask an AI assistant connected to a custom Kotlin MCP server.
- "List all tools available on the connected MCP server."
- "Call the 'greet' tool with the name 'Alice'."
- "Fetch the resource at 'file:///data/config.json' from the server."
- "Use the 'search-database' tool to find all records matching 'invoice'."
- "What prompts are registered on this server?"Troubleshooting Kotlin SDK
Build fails with 'No engine found' or Ktor engine errors
The SDK does not include a Ktor engine transitively. Explicitly add one: 'implementation("io.ktor:ktor-client-cio:$ktorVersion")' for clients, or 'implementation("io.ktor:ktor-server-netty:$ktorVersion")' for HTTP servers. Check the Ktor release notes to match versions.
Client receives 'method not found' when calling tools
Verify that the server was started with 'tools = ServerCapabilities.Tools(listChanged = true)' in its capabilities. Also confirm that 'addTool()' calls happen before 'runStdio()' or the server start call.
Kotlin Multiplatform: missing platform-specific implementations
Use the platform-specific Ktor engine for each target — CIO works on JVM and native; use js() engines for JS targets. Ensure your commonMain only references multiplatform-compatible APIs from the SDK.
Frequently Asked Questions about Kotlin SDK
What is Kotlin SDK?
Kotlin SDK is a Model Context Protocol (MCP) server that official kotlin sdk for model context protocol servers and clients. maintained in collaboration with jetbrains It connects AI assistants to external tools and data sources through a standardized interface.
How do I install Kotlin SDK?
Follow the installation instructions on the Kotlin SDK GitHub repository. Clone the repo, install dependencies, and add the server config to your AI client.
Which AI clients work with Kotlin SDK?
Kotlin SDK works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.
Is Kotlin SDK free to use?
Yes, Kotlin SDK is open source and available under the NOASSERTION license. You can use it freely in both personal and commercial projects.
Kotlin SDK Alternatives — Similar Developer Tools Servers
Looking for alternatives to Kotlin SDK? Here are other popular developer tools servers you can use with Claude, Cursor, and VS Code.
Ecc
★ 188.2kThe agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.
Javaguide
★ 155.8kJava 面试 & 后端通用面试指南,覆盖计算机基础、数据库、分布式、高并发、系统设计与 AI 应用开发
Gemini CLI
★ 104.5kA secure MCP server that wraps the Google Gemini CLI, allowing clients to query Gemini models using local OAuth sessions without requiring an API key. It provides tools for model interaction and diagnostics with built-in protection against command in
Awesome MCP Servers
★ 87.3k⭐ Curated list of Model Context Protocol (MCP) servers - tools that extend Claude Desktop, Cursor, Windsurf, and other MCP clients with custom capabilities.
MCP Servers
★ 86.0kModel Context Protocol Servers
CC Switch
★ 77.5kA cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Gemini CLI & Hermes Agent. Only official website: ccswitch.io
Browse More Developer Tools MCP Servers
Explore all developer tools servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.
Set Up Kotlin SDK in Your Editor
Choose your AI client for step-by-step setup instructions.
Quick Config Preview
Add this to your claude_desktop_config.json or .cursor/mcp.json
Ready to use Kotlin SDK?
Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.