MCP Catalogs
Homemcp4k screenshot

mcp4k

by ondrsh·69·Score 46

Kotlin Multiplatform framework for building MCP clients and servers with compile-time type safety.

developer-toolsai-llm
4
Forks
0
Open issues
1 mo ago
Last commit
2d ago
Indexed

Overview

mcp4k is a comprehensive Kotlin framework that implements the vast majority of the MCP specification. It provides a compiler-driven approach that enforces correct parameter typing at compile time rather than runtime. The framework supports both client and server implementations with features for tools, resources, prompts, and sampling. It uses a clean API with annotations like @McpTool and @McpPrompt to define server capabilities. The framework currently supports stdio transport with other transports planned for future releases.

Try asking AI

After installing, here are 5 things you can ask your AI assistant:

you:Building Kotlin-based MCP servers for custom tools
you:Creating Kotlin clients to interact with MCP servers
you:Developing cross-platform MCP applications using Kotlin Multiplatform
you:What Kotlin versions are compatible with mcp4k?
you:Does mcp4k support transports other than stdio?

When to choose this

Choose mcp4k when building MCP servers/clients in Kotlin Multiplatform projects and you need compile-time type safety and automatic JSON-RPC handling.

When NOT to choose this

Not for projects requiring transports beyond stdio, or when you need to use a language other than Kotlin.

Tools this server exposes

7 tools extracted from the README
  • reverseStringinput: String

    Reverses an input string

  • sendEmailrecipients: List<String>, email: Email

    Sends an email with specified recipients and email content

  • setUserNamename: String

    Sets the username in the server context

  • greetUser

    Greets the user whose name is stored in the server context

  • toolThatAddsSecondTool

    A tool that adds another tool to the server at runtime

  • codeReviewPromptcode: String

    Generates a code review prompt based on the provided code

  • slowToolOperationiterations: Int = 10

    Performs a slow operation with specified iterations

Comparable tools

mcp-tsmcp-pythonmcp-js

Installation

Installation

Add mcp4k to your build:

plugins {
  kotlin("multiplatform") version "2.3.21" // or kotlin("jvm")
  kotlin("plugin.serialization") version "2.3.21"

  id("sh.ondr.mcp4k") version "0.4.10" // <-- Add this
}

Usage in Claude Desktop

Add to your claude_desktop_config.json:

{
  "mcpServers": {
    "mcp4k-example": {
      "command": "java",
      "args": ["-jar", "path/to/your/mcp4k-server.jar"]
    }
  }
}

FAQ

What Kotlin versions are compatible with mcp4k?
Each mcp4k version is hard-linked to a specific Kotlin version. For example, version 0.4.10 requires Kotlin 2.3.21. Check the README for the full compatibility table.
Does mcp4k support transports other than stdio?
Currently, mcp4k only supports stdio transport, but HTTP-Streaming and other transports are planned for future releases.

Compare mcp4k with

GitHub →

Last updated · Auto-generated from public README + GitHub signals.