MCP-scala
A Model Context Protocol server implementation written in Scala 3.
MCP-scala
Model Context Protocol server written in Scala 3
Development stage
This software is currently ALPHA state.
- Automatic derivation of JSON Schema
- Define your tool
- Text content part
- Other content parts
- Notification handling
- Capability handling
- stdio transport
- HTTP transport
- Authorization feature
This implementation needs your attention and contribution.
Feel free to open Issue / PR to contribute this project.
Demo
First, build server into JS:
sbt example/fastLinkJS
Then, utilize server in your MCP client:
// Example for Cline
{
"mcpServers": {
"mcpscala": {
"disabled": false,
"timeout": 30,
"command": "sh",
"args": ["/path/to/run.sh"],
"transportType": "stdio"
}
}
}
You can run some tool:
randomNumber- generate random number between
mintomax.
- generate random number between
iota- generate a sequence of numbers from
mintomax.
- generate a sequence of numbers from
sum- calculate the sum of a sequence of numbers.
Implement your tool
See Main.scala for details.
//> using scala 3
//> using toolkit typelevel:default
//> using dep dev.capslock::mcpscala:0.1.0
package dev.capslock.mcpscala
import cats.effect.IO
import cats.effect.IOApp
import dev.capslock.mcpscala.transport.StdioServer
import dev.capslock.mcpscala.mcp.ContentPart
import sttp.tapir.Schema.annotations.description
case class RandomNumberInput(
@description("Minimum value (inclusive)") min: Int,
@description("Maximum value (exclusive)") max: Int
) derives io.circe.Decoder,
sttp.tapir.Schema
def randomNumber(input: RandomNumberInput): IO[Seq[ContentPart]] = IO {
val random = scala.util.Random.between(input.min, input.max)
Seq(ContentPart.TextContentPart(random.toString))
}
/** Entry point for the Stdio server.
*/
object StdioMain extends McpIOApp(
name = "random-number",
header = "Generate a random number",
):
val handlers = Handler.methodHandlers(
Map(
"randomNumber" -> server.Tool(randomNumber),
)
)
Related Servers
Infisical
Manage secrets and environment variables with Infisical's official MCP server.
bevy_brp_mcp
An MCP server for AI coding assistants to control, inspect, and modify Bevy applications using the Bevy Remote Protocol (BRP).
mcp4eda
A collection of MCP servers for Electronic Design Automation (EDA) workflows, including tools for die yield calculation and Verilog/SystemVerilog analysis.
Azure DevOps
Integrate with Azure DevOps services to manage work items, repositories, and pipelines.
Sensei MCP
Expert guidance for Dojo and Cairo development on Starknet, specializing in the Dojo ECS framework for building onchain worlds.
Web3 MCP
Interact with multiple blockchains including Solana, Ethereum, THORChain, XRP Ledger, TON, Cardano, and UTXO chains.
nUR MCP Server
An intelligent robot control middleware for natural language interaction with industrial robots, powered by LLMs. It integrates with Universal Robots and supports real-time, multi-robot control.
MCP Server Starter
A starter project for building MCP servers with TypeScript and Bun.
Reports MCP Server
Manages penetration testing reports and vulnerabilities via a REST API.
Accordo MCP Server
Provides dynamic YAML-driven workflow guidance for AI coding agents with structured development workflows, progression control, and decision points.