Build Type-Safe Model Context Protocol Servers in Scala 3 with Chimp
Chimp is a Scala 3 SDK for building type-safe, boilerplate-free Model Context Protocol servers and clients. It integrates with Tapir and sttp, supporting bidirectional streaming and multiple concurrency backends like Ox and ZIO.
Impact: Medium
Why it matters
Build type-safe Model Context Protocol servers in Scala without hand-writing transport JSON schemas or HTTP boilerplate.
TL;DR
- 01Accelerate JVM-based MCP development using Tapir and sttp.
- 02Leverage Scala 3's type system to auto-generate schema constraints for coding agents.
- 03Integrate Ox or ZIO for seamless streaming and bidirectional client-server logic.
Key facts
- Language
- Scala 3
- Transports
- stdio, HTTP (via Tapir & sttp)
- Concurrency Libraries
- Ox, ZIO
Type-Safe Declarative Tools
Chimp eliminates boilerplate code when defining Model Context Protocol (MCP) tools. Instead of manual JSON validation, developers can leverage Scala 3's derives Codec, Schema capabilities to automatically construct input payloads. This ensures strict compile-time checks for all arguments passed to your LLM-exposed functions.
Streamable Transports and Integrations
The SDK supports both ServerStdioTransport (ideal for local subprocess execution) and HTTP-based transports like Netty. For advanced workflows, Chimp offers dedicated modules like chimp-server-ox and chimp-client-ox to facilitate asynchronous bidirectional communication, such as streaming real-time progress updates back to the client.
Try it in 2 minutes
// Run a basic MCP server using stdio transport in Scala 3
//> using dep com.softwaremill.chimp::chimp-server:0.4.0
import chimp.server.transport.ServerStdioTransport
case class EchoInput(message: String) derives Codec, Schema
val echo = tool("echo").description("Echoes message").input[EchoInput]
.handle(i => ToolResult.text(i.message))
ServerStdioTransport().serve(McpServer(tools = List(echo)))scala
✓ When to use
- Building production-grade, type-safe MCP servers within the JVM/Scala ecosystem.
- Implementing bidirectional streaming tools that need to report progress to LLM clients.
✕ When NOT to use
- Light scripting where Node.js or Python MCP SDKs provide faster initial bootstrapping.
- Non-JVM native deployments unless utilizing Scala Native (which may have limited library compatibility here).
What to do today
- Add chimp-server dependency to your Scala CLI project.
- Define a basic tool endpoint using the tool() DSL.
- Test locally using stdio transport mapped to Claude Desktop config.
Sources