MCPServer

org.llm4s.mcp.MCPServer
class MCPServer(options: MCPServerOptions, tools: Seq[ToolFunction[_, _]])

A generic, reusable Model Context Protocol (MCP) Server.

This server hosts a list of llm4s ToolFunctions and exposes them via the MCP protocol (HTTP Transport 2025-06-18 only).

NOTE: This server is intended for LOCAL DEVELOPMENT use only. It does not implement authentication or strict security sandboxing.

val tools = Seq(myTool1, myTool2)
val options = MCPServerOptions(8080, "/mcp", "MyServer", "1.0")
val server = new MCPServer(options, tools)
server.start()

Value parameters

options

Server configuration

tools

List of tools to expose

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

def boundPort: Int
def getPort: Int
def start(): Either[Exception, Unit]
def stop(delay: Int): Unit