Kotlin SDK

v1.0.0Developer Toolsstable

The official Kotlin SDK for Model Context Protocol servers and clients. Maintained in collaboration with JetBrains

kotlin-multiplatformmcp
Share:
1,360
Stars
0
Downloads
0
Weekly
0/5

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

Build MCP servers and clients using the official Kotlin SDK.
Leverage JetBrains' maintained Kotlin implementation.
LicenseNOASSERTION
Languagekotlin
Versionv1.0.0
UpdatedMay 22, 2026
Statushealthy
Maintenanceactive

Works with

ClaudeOpenAIwindowsmacoslinux

Installation

Manual Installation

npx kotlin-sdk

Configuration

Configuration Details

Config File

claude_desktop_config.json

Performance

Response Metrics

Response Time< 200ms
ThroughputMedium

Resource Usage

Memory UsageLow
CPU UsageLow

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'
1

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")
}
2

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!")))
}
3

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)
4

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()
5

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 })
6

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/inspector

Kotlin 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.

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.

Quick Config Preview

{ "mcpServers": { "kotlin-sdk": { "command": "npx", "args": ["-y", "kotlin-sdk"] } } }

Add this to your claude_desktop_config.json or .cursor/mcp.json

Read the full setup guide →

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.

33,000+ ServersFree & Open SourceStep-by-Step Guides