Package org.machanism.machai.mcp.server
Class AbstractMcpServer
java.lang.Object
org.machanism.machai.mcp.server.AbstractMcpServer
- Direct Known Subclasses:
AbstractHttpMcpServer,StdioMcpServer
Abstract base class for MCP (Model Context Protocol) server implementations.
Provides constants for the Machai MCP server homepage and icon, and defines
the AbstractMcpServer.ToolSpecificationBuilder interface for constructing tool and tool
specification objects for MCP servers. Subclasses must implement the
tools() and start() methods to provide tool registration
and server startup logic.
- Since:
- 1.2.0
- Author:
- Viktor Tovstyi
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static interfaceInterface for building tool and tool specification objects for MCP servers. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidsetProjectDir(File projectDir) protected abstract voidstart()Starts the MCP server.abstract voidtools()Registers or defines the available tools for this MCP server.
-
Field Details
-
MACHAI_MACHANISM_HOMEPAGE
The homepage URL for the Machai MCP server.- See Also:
-
MACHAI_MACHANISM_ICON
The icon URL for the Machai MCP server.- See Also:
-
-
Constructor Details
-
AbstractMcpServer
public AbstractMcpServer()Constructs a newAbstractMcpServer.
-
-
Method Details
-
tools
public abstract void tools()Registers or defines the available tools for this MCP server.Subclasses must implement this method to provide tool registration logic.
-
start
Starts the MCP server.Subclasses must implement this method to provide server startup logic.
- Throws:
Exception- if the server fails to start
-
setProjectDir
-
getProjectDir
-