Last active
February 3, 2026 20:19
-
-
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/d40b8baf304b3c0e54701a77793c2bc2db018f63
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // summary : dummy mcp server | |
| // keywords : artificial-intelligence, generative-ai, llm, ai, mcp, mcp-server, @testable | |
| // publish : gist | |
| // authors : David Crosson | |
| // license : Apache License Version 2.0 (https://www.apache.org/licenses/LICENSE-2.0.txt) | |
| // 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