kotlin-mcp-server-generator

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

By github · 8,729 installs

npx skills add github/awesome-copilot --skill kotlin-mcp-server-generator

Source repository · Upstream listing

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 build.gradle.kts Template settings.gradle.kts Template Main.kt Template Server.kt Template Config.kt Template Tool1.kt Template tools/ToolRegistry.kt Template ServerTest.kt Template README.md Template Generation Instructions When generating a Kotlin MCP server: 1. Gradle Setup : Create proper build.gradle.kts with all dependencies 2. Package Structure : Follow Kotlin package conventions 3. Type Safety : Use data classes and kotlinx.serialization 4. Coroutines : All operations should be suspending functions 5. Error Handling : Use Kotlin exceptions and validation 6. JSON Schemas : Use buildJsonObject for tool schemas 7. Testing : Include coroutine test utilities 8. Logging : Use kotlin logging for structured logging 9. Configuration : Use data classes and environment variables 10. Documentation : KDoc comments for public APIs Best Practices Use suspending functions for all async operations Leverage Kotlin's null safety and type system Use data classes for structured data Apply kotlinx.serialization for JSON handling Use sealed classes for result types Implement proper error handling with Result/Either patterns Write tests using kotlinx coroutines test Use dependency injection for testability Follow Kotlin coding conventions Use meaningful names and KDoc comments Transport Options Stdio Transport SSE Transport (Ktor) Multiplatform Configuration For multiplatform projects, add to build.gradle.kts :