Last active
February 3, 2026 20:25
-
-
Save dacr/8035f68b4fe921492fce80ce82e05697 to your computer and use it in GitHub Desktop.
dummy java mcp server / published by https://github.com/dacr/code-examples-manager #f6ab2228-9d0c-48e3-8d3a-b11c46152484/33abcedaefc9c34c7f63fc076d8b17a174a7cc82
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 java 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 : f6ab2228-9d0c-48e3-8d3a-b11c46152484 | |
| // created-on : 2025-07-18T15:24:45+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 io.modelcontextprotocol.sdk:mcp:0.10.0 | |
| import io.modelcontextprotocol.server.McpServer | |
| import io.modelcontextprotocol.server.transport.StdioServerTransportProvider | |
| import io.modelcontextprotocol.spec.McpSchema.ServerCapabilities | |
| import io.modelcontextprotocol.spec.McpServerTransportProvider | |
| /* | |
| {"jsonrpc":"2.0","id":0,"method":"initialize","params":{"protocolVersion": "2024-11-05"}} | |
| {"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}} | |
| */ | |
| object ExampleServer { | |
| def main(args: Array[String]): Unit = { | |
| val transportProvider = StdioServerTransportProvider() | |
| val capabilities = ServerCapabilities | |
| .builder() | |
| .resources(false, true) | |
| .tools(true) | |
| .prompts(true) | |
| .logging() | |
| .build() | |
| val helloServer = | |
| McpServer | |
| .sync(transportProvider) | |
| .serverInfo("hello-server", "1.0.0") | |
| .capabilities(capabilities) | |
| .build() | |
| Thread.sleep(60000) | |
| helloServer.close() | |
| } | |
| } | |
| ExampleServer.main(args) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment