Skip to content

Instantly share code, notes, and snippets.

@dacr
Created December 15, 2025 17:29
Show Gist options
  • Select an option

  • Save dacr/f56d10e8e439350dee0ebb2d20e5f831 to your computer and use it in GitHub Desktop.

Select an option

Save dacr/f56d10e8e439350dee0ebb2d20e5f831 to your computer and use it in GitHub Desktop.
dummy mcp server / published by https://github.com/dacr/code-examples-manager #dd4efaa5-f30c-4bb2-98bd-df2ace4601c1/195a9ae363b1731a0f365c23b9596c1fe8c461c
// summary : dummy mcp server
// keywords : artificial-intelligence, generative-ai, llm, ai, mcp, mcp-server, @testable
// publish : gist
// authors : David Crosson
// license : Apache NON-AI License Version 2.0 (https://raw.githubusercontent.com/non-ai-licenses/non-ai-licenses/main/NON-AI-APACHE2)
// id : dd4efaa5-f30c-4bb2-98bd-df2ace4601c1
// created-on : 2025-07-18T14:52:24+02:00
// managed-by : https://github.com/dacr/code-examples-manager
// run-with : scala-cli $file
//> using scala 3.7.1
//> using dep org.slf4j:slf4j-api:2.0.17
//> using dep org.slf4j:slf4j-simple:2.0.17
//> using dep com.tjclp::fast-mcp-scala:0.1.1
//> using options -Xcheck-macros -experimental
/*
{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"protocolVersion": "2024-11-05"}}
{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"hello"}}
*/
import com.tjclp.fastmcp.core.*
import com.tjclp.fastmcp.macros.RegistrationMacro.*
import com.tjclp.fastmcp.server.{FastMcpServer, FastMcpServerSettings}
import zio.*
object ExampleServer extends ZIOAppDefault {
object Example {
@Tool(name = Some("hello"), description = Some("Say hello"))
def hello(): String = "Hello, world!"
}
override def run = {
val settings = FastMcpServerSettings(
debug=true,
logLevel="DEBUG",
)
for {
server <- ZIO.succeed(FastMcpServer(name = "hello-mcp-server", settings = settings))
_ <- ZIO.attempt(server.scanAnnotations[Example.type])
_ <- ZIO.log("Starting stdio server...")
_ <- server
.runStdio()
.tapError(error => ZIO.log(s"Error running stdio: $error"))
.onInterrupt(ZIO.log("Server interrupted"))
} yield ()
}
}
ExampleServer.main(args)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment