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),
)
)
Servidores relacionados
Scout Monitoring MCP
patrocinadorPut performance and error data directly in the hands of your AI assistant.
Alpha Vantage MCP Server
patrocinadorAccess financial market data: realtime & historical stock, ETF, options, forex, crypto, commodities, fundamentals, technical indicators, & more
Code Reaper
CodeReaper is an AI-driven MCP tool for Cursor that finds and removes dead JavaScript by exploring real UIs and capturing V8 coverage
Tailwind Svelte Assistant
Provides documentation and code snippets for SvelteKit and Tailwind CSS.
CODING DevOps
Interact with the CODING DevOps platform for managing projects and work items.
MCP SSE Launcher
A Python management system for MCP servers that wraps stdio-based servers as SSE endpoints and includes a web inspector for testing.
Grafana Loki
A server for querying Loki logs from Grafana.
Advent of Code MCP Server
Interact with the Advent of Code website. Requires a session cookie for authentication.
VSCode Maestro MCP
The most comprehensive MCP server for VS Code — 100+ tools across 25 categories. File ops, terminal, git, LSP providers (hover, completion, definition, references), and more. Free core + premium features.
Recraft AI
Generate and edit raster/vector images, vectorize, remove/replace backgrounds, and upscale using the Recraft AI API.
GDB
A GDB/MI protocol server based on the MCP protocol, providing remote application debugging capabilities with AI assistants.
MCP Server Starter
A starter project for building MCP servers with TypeScript and Bun.