A Klerk plugin to expose a Klerk-based application as a Model Context Protocol (MCP) API.
The Klerk MCP plugin allows you to expose your Klerk-based application as an MCP API, enabling seamless integration with other systems and services.
- JDK 17 or higher
- Gradle 8.0 or higher (or use the included Gradle wrapper)
# On Windows
.\gradlew build
# On Linux/macOS
./gradlew build
# On Windows
.\gradlew test
# On Linux/macOS
./gradlew test
Add the Klerk MCP plugin to your Klerk-based application:
import com.github.klerkframework.mcp.McpPlugin
// Initialize the MCP plugin
val mcpPlugin = McpPlugin()
mcpPlugin.initialize()
// Start the MCP server
mcpPlugin.startServer(port = 8080, host = "0.0.0.0")
// Register handlers for your models
mcpPlugin.registerHandler("YourModelType", yourModelHandler)
// When shutting down your application
mcpPlugin.stopServer()
- Expose Klerk models via a standardized API
- Query models with filtering and pagination
- Execute commands on models
- Retrieve individual models by ID
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.