Package org.machanism.machai.mcp.server
Class HttpStatelessMcpServer
java.lang.Object
org.machanism.machai.mcp.server.AbstractMcpServer
org.machanism.machai.mcp.server.AbstractHttpMcpServer
org.machanism.machai.mcp.server.HttpStatelessMcpServer
HttpStatelessMcpServer sets up and runs a Model Context Protocol (MCP) server
that listens for HTTP requests on a specified port.
This server loads GenAI tools, configures server capabilities, and exposes the MCP API over HTTP using Jetty.
- Since:
- 1.2.0
- Author:
- Viktor Tovstyi
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassNested classes/interfaces inherited from class org.machanism.machai.mcp.server.AbstractMcpServer
AbstractMcpServer.ToolSpecificationBuilder<TExchange> -
Field Summary
Fields inherited from class org.machanism.machai.mcp.server.AbstractMcpServer
MACHAI_MACHANISM_HOMEPAGE, MACHAI_MACHANISM_ICON -
Constructor Summary
ConstructorsConstructorDescriptionHttpStatelessMcpServer(String name, String version) Constructs a new HttpStatelessMcpServer with the given name and version. -
Method Summary
Methods inherited from class org.machanism.machai.mcp.server.AbstractHttpMcpServer
getPort, getTransportProvider, setPort, setTransportProviderMethods inherited from class org.machanism.machai.mcp.server.AbstractMcpServer
getProjectDir, setProjectDir
-
Constructor Details
-
HttpStatelessMcpServer
Constructs a new HttpStatelessMcpServer with the given name and version.- Parameters:
name- the server name to report in the MCP APIversion- the server version to report in the MCP API
-
-
Method Details
-
tools
public void tools()Loads and registers GenAI tools with the MCP server.This method uses a
FunctionToolsLoaderto apply tools to the server using aGenericGenaiAdapter.- Specified by:
toolsin classAbstractMcpServer
-
start
Starts the HTTP server and listens for incoming MCP requests on the specified port.- Overrides:
startin classAbstractHttpMcpServer- Throws:
Exception- if the server fails to start
-