Skip to content
Skillpedia
APIs & servers (backend)40k Β· #7264

kotlin-mcp-server-generator

What it does

This agent creates a complete Kotlin server project for using the Model Context Protocol (MCP). It sets up the project structure, adds necessary libraries, and prepares the server to run.

When to use it

  • βœ“When you want to create a new MCP server in Kotlin.
  • βœ“When you need a base project with all the structure ready.
  • βœ“To quickly start developing an MCP server.

Skill link

https://github.com/github/awesome-copilot/blob/main/skills/kotlin-mcp-server-generator/SKILL.md

Copy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.

How to use

The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.

Ready-to-paste message

Use this skill to help me: https://github.com/github/awesome-copilot/blob/main/skills/kotlin-mcp-server-generator/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
Want your AI to find skills like this on its own?Install the free Skillpedia MCP: one line, and it searches 15,000+ skills before each task.Install in 1 minute β†’

Example of what to ask your AI

β€œCreate a Kotlin MCP server project named 'my-server'.”

5 new skills a week. 1 minute to read.

How it works

It uses Gradle to manage the project, adds libraries like Ktor and the official MCP SDK. It also includes basic tools, error handling, and tests.

Technical content (original SKILL.md)

Original text by the author, straight from GitHub.

Kotlin MCP Server Project Generator

Generate a complete, production-ready Model Context Protocol (MCP) server project in Kotlin.

Project Requirements

You will create a Kotlin MCP server with:

  1. Project Structure: Gradle-based Kotlin project layout
  2. Dependencies: Official MCP SDK, Ktor, and kotlinx libraries
  3. Server Setup: Configured MCP server with transports
  4. Tools: At least 2-3 useful tools with typed inputs/outputs
  5. Error Handling: Proper exception handling and validation
  6. Documentation: README with setup and usage instructions
  7. Testing: Basic test structure with coroutines

Template Structure

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

build.gradle.kts Template

plugins {
    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)
}

settings.gradle.kts Template

rootProject.name = "{{PROJECT_NAME}}"

Main.kt Template

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

Server.kt Template

package 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
}

Config.kt Template

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

…
FAQ

What is the Model Context Protocol (MCP)?

It's a protocol for communication between different parts of a system, allowing them to exchange information and call each other's functionalities in a standardized way.

What are Ktor and Kotlinx?

Ktor is a framework for building web applications and services in Kotlin. Kotlinx are additional libraries for Kotlin, such as those for serialization (to convert data to and from text) and coroutines (for handling asynchronous tasks).

What are 'tools' in this context?

These are specific functions that your MCP server can offer to be called by other systems. This generator already includes a template for you to add your own tools.

Details

Original description by the author

Generate a complete Kotlin MCP server project with proper structure, dependencies, and implementation using the official io.modelcontextprotocol:kotlin-sdk library.

repo: github/awesome-copilot

Popularity

GitHub stars
40k
Ranking position
#7264
License
MIT
Updated
10/15/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills