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),
)
)
相关服务器
Alpha Vantage MCP Server
赞助Access financial market data: realtime & historical stock, ETF, options, forex, crypto, commodities, fundamentals, technical indicators, & more
The Undesirables MCP Server
35+ local AI tools - TCG card grading, Monte Carlo simulation, voice synthesis, 3D mesh, image gen, and autonomous M2M NFT purchase bridge.
Stata MCP
Run Stata commands and execute .do files directly from VS Code and Cursor, with AI assistant integration.
Hyper MCP
A fast, secure, and extensible MCP server using WebAssembly plugins.
Gentoro
Gentoro generates MCP Servers based on OpenAPI specifications.
Celery Flower MCP
MCP server for Celery Flower — monitor workers, manage tasks and queues from any AI assistant
XRPL MCP
An MCP server for the XRP Ledger blockchain, offering tools for wallet operations, token management, NFTs, and DEX trading.
Hoverfly MCP Server
An MCP server exposing Hoverfly as a programmable API simulation tool for AI assistants.
Local MCP Test
A test server for local MCP development and setup.
ToolRank
Score and optimize MCP tool definitions for AI agent discovery. Analyzes Findability, Clarity, Precision, and Efficiency.
Unity3d Game Engine
MCP Server to control and interact with Unity3d Game Engine for game development