Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Generate a complete Kotlin MCP server project with proper structure, dependencies, and implementation using the official io.modelcontextprotocol:kotlin-sdk library.
.claude/skills/kotlin-mcp-server-generator/SKILL.md| Model | Eval pass | Runs |
|---|---|---|
| gemini-3.6-flash | 100% | 4 |
| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-02 | ✗→✓ | ▲ Improved | — | — |
| case-08 | ✗→✓ | ▲ Improved | — | — |
| case-07 | ✗→✓ | ▲ Improved | — | — |
| case-04 | ✗→✓ | ▲ Improved | — | — |
| case-14 | ✗→✓ | ▲ Improved | — | — |
Generate a complete, production-ready Model Context Protocol (MCP) server project in Kotlin.
You will create a Kotlin MCP server with:
myserver/
├── build.gradle.kts
├── settings.gradle.kts
├── gradle.properties
├── src/
│ ├── main/
│ │ └── kotlin/
│ │ └── com/example/myserver/
│ │ ├── Main.kt
│ │ ├── Server.kt
│ │ ├── config/
│ │ │ └── Config.kt
│ │ └── tools/
│ │ ├── Tool1.kt
│ │ └── Tool2.kt
│ └── test/
│ └── kotlin/
│ └── com/example/myserver/
│ └── ServerTest.kt
└── README.mdkotlinplugins { kotlin("jvm") version "2.1.0" kotlin("plugin.serialization") version "2.1.0" application } group = "com.example" version = "1.0.0" repositories { mavenCentral() } dependencies { implementation("io.modelcontextprotocol:kotlin-sdk:0.7.2") // Ktor for transports implementation("io.ktor:ktor-server-netty:3.0.0") implementation("io.ktor:ktor-client-cio:3.0.0") // Serialization implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.7.3") // Coroutines implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.9.0") // Logging implementation("io.github.oshai:kotlin-logging-jvm:7.0.0") implementation("ch.qos.logback:logback-classic:1.5.12") // Testing testImplementation(kotlin("test")) testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.9.0") } application { mainClass.set("com.example.myserver.MainKt") } tasks.test { useJUnitPlatform() } kotlin { jvmToolchain(17) }
kotlinrootProject.name = "{{PROJECT_NAME}}"
kotlinpackage com.example.myserver import io.modelcontextprotocol.kotlin.sdk.server.StdioServerTransport import kotlinx.coroutines.runBlocking import io.github.oshai.kotlinlogging.KotlinLogging private val logger = KotlinLogging.logger {} fun main() = runBlocking { logger.info { "Starting MCP server..." } val config = loadConfig() val server = createServer(config) // Use stdio transport val transport = StdioServerTransport() logger.info { "Server '${config.name}' v${config.version} ready" } server.connect(transport) }
kotlinpackage com.example.myserver import io.modelcontextprotocol.kotlin.sdk.server.Server import io.modelcontextprotocol.kotlin.sdk.server.ServerOptions import io.modelcontextprotocol.kotlin.sdk.Implementation import io.modelcontextprotocol.kotlin.sdk.ServerCapabilities import com.example.myserver.tools.registerTools fun createServer(config: Config): Server { val server = Server( serverInfo = Implementation( name = config.name, version = config.version ), options = ServerOptions( capabilities = ServerCapabilities( tools = ServerCapabilities.Tools(), resources = ServerCapabilities.Resources( subscribe = true, listChanged = true ), prompts = ServerCapabilities.Prompts(listChanged = true) ) ) ) { config.description } // Register all tools server.registerTools() return server }
kotlinpackage com.example.myserver.config import kotlinx.serialization.Serializable @Serializable data class Config( val name: String = "{{PROJECT_NAME}}", val version: String = "1.0.0", val description: String = "{{PROJECT_DESCRIPTION}}" ) fun loadConfig(): Config { return Config( name = System.getenv("SERVER_NAME") ?: "{{PROJECT_NAME}}", version = System.getenv("VERSION") ?: "1.0.0", description = System.getenv("DESCRIPTION") ?: "{{PROJECT_DESCRIPTION}}" ) }
kotlinpackage com.example.myserver.tools import io.modelcontextprotocol.kotlin.sdk.server.Server import io.modelcontextprotocol.kotlin.sdk.CallToolRequest import io.modelcontextprotocol.kotlin.sdk.CallToolResult import io.modelcontextprotocol.kotlin.sdk.TextContent import kotlinx.serialization.json.buildJsonObject import kotlinx.serialization.json.put import kotlinx.serialization.json.putJsonObject import kotlinx.serialization.json.putJsonArray fun Server.registerTool1() { addTool( name = "tool1", description = "Description of what tool1 does", inputSchema = buildJsonObject { put("type", "object") putJsonObject("properties") { putJsonObject("param1") { put("type", "string") put("description", "First parameter") } putJsonObject("param2") { put("type", "integer") put("description", "Optional second parameter") } } putJsonArray("required") { add("param1") } } ) { request: CallToolRequest -> // Extract and validate parameters val param1 = request.params.arguments["param1"] as? String ?: throw IllegalArgumentException("param1 is required") val param2 = (request.params.arguments["param2"] as? Number)?.toInt() ?: 0 // Perform tool logic val result = performTool1Logic(param1, param2) CallToolResult( content = listOf( TextContent(text = result) ) ) } } private fun performTool1Logic(param1: String, param2: Int): String { // Implement tool logic here return "Processed: $param1 with value $param2" }
kotlinpackage com.example.myserver.tools import io.modelcontextprotocol.kotlin.sdk.server.Server fun Server.registerTools() { registerTool1() registerTool2() // Register additional tools here }
kotlinpackage com.example.myserver import kotlinx.coroutines.test.runTest import kotlin.test.Test import kotlin.test.assertEquals import kotlin.test.assertFalse class ServerTest { @Test fun `test server creation`() = runTest { val config = Config( name = "test-server", version = "1.0.0", description = "Test server" ) val server = createServer(config) assertEquals("test-server", server.serverInfo.name) assertEquals("1.0.0", server.serverInfo.version) } @Test fun `test tool1 execution`() = runTest { val config = Config() val server = createServer(config) // Test tool execution // Note: You'll need to implement proper testing utilities // for calling tools in the server } }
markdown# {{PROJECT_NAME}} A Model Context Protocol (MCP) server built with Kotlin. ## Description {{PROJECT_DESCRIPTION}} ## Requirements - Java 17 or higher - Kotlin 2.1.0 ## Installation Build the project: \`\`\`bash ./gradlew build \`\`\` ## Usage Run the server with stdio transport: \`\`\`bash ./gradlew run \`\`\` Or build and run the jar: \`\`\`bash ./gradlew installDist ./build/install/{{PROJECT_NAME}}/bin/{{PROJECT_NAME}} \`\`\` ## Configuration Configure via environment variables: - `SERVER_NAME`: Server name (default: "{{PROJECT_NAME}}") - `VERSION`: Server version (default: "1.0.0") - `DESCRIPTION`: Server description ## Available Tools ### tool1 {{TOOL1_DESCRIPTION}} **Input:** - `param1` (string, required): First parameter - `param2` (integer, optional): Second parameter **Output:** - Text result of the operation ## Development Run tests: \`\`\`bash ./gradlew test \`\`\` Build: \`\`\`bash ./gradlew build \`\`\` Run with auto-reload (development): \`\`\`bash ./gradlew run --continuous \`\`\` ## Multiplatform This project uses Kotlin Multiplatform and can target JVM, Wasm, and iOS. See `build.gradle.kts` for platform configuration. ## License MIT
When generating a Kotlin MCP server:
build.gradle.kts with all dependenciesbuildJsonObject for tool schemaskotlinval transport = StdioServerTransport() server.connect(transport)
kotlinembeddedServer(Netty, port = 8080) { mcp { Server(/*...*/) { "Description" } } }.start(wait = true)
For multiplatform projects, add to build.gradle.kts:
kotlinkotlin { jvm() js(IR) { nodejs() } wasmJs() sourceSets { commonMain.dependencies { implementation("io.modelcontextprotocol:kotlin-sdk:0.7.2") } } }
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-02 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-15 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-22 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-08 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-07 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-04 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-14 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-10 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-13 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-05 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-06 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-19 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-12 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-09 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-18 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-01 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-20 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-03 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-11 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-21 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-17 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-16 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted. The headline lift of +68 percentage points is the difference between those two pass rates over the 22 comparable cases.
The per-case answers from this run were removed by the retention sweep, so the case table below shows the verdicts without the text either arm produced. The counts above were recorded at the time and are unaffected. Answers are now kept for 180 days.
Other measured skills in the registry, with their headline benchmark lift.