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),
)
)
関連サーバー
Scout Monitoring MCP
スポンサーPut performance and error data directly in the hands of your AI assistant.
Alpha Vantage MCP Server
スポンサーAccess financial market data: realtime & historical stock, ETF, options, forex, crypto, commodities, fundamentals, technical indicators, & more
Rust Docs MCP Server
Query up-to-date documentation for Rust crates.
Cloudflare MCP Server
An example MCP server designed for easy deployment on Cloudflare Workers, operating without authentication.
WSL Exec
Execute commands securely in Windows Subsystem for Linux (WSL).
Flutter MCP
Provides real-time Flutter/Dart documentation and pub.dev package information to AI assistants, supporting all packages on demand.
Artificial Analysis
An unofficial MCP server for the Artificial Analysis API
JADX-AI-MCP
A JADX decompiler plugin that integrates with MCP to provide live reverse engineering support using LLMs.
Gemma MCP Client
A client for Google's Gemma-3 model that enables function calling through MCP.
MCP RAG Server
A Python server providing Retrieval-Augmented Generation (RAG) functionality. It indexes various document formats and requires a PostgreSQL database with pgvector.
Rossum MCP & Agent
MCP server and AI agent toolkit for intelligent document processing with Rossum.
BlenderMCP
Connects Blender to Claude AI via the Model Context Protocol (MCP), enabling direct interaction and control for prompt-assisted 3D modeling, scene creation, and manipulation.