Class AbstractMcpServer

java.lang.Object
org.machanism.machai.mcp.server.AbstractMcpServer
Direct Known Subclasses:
AbstractHttpMcpServer, StdioMcpServer

public abstract class AbstractMcpServer extends Object
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
  • Field Details

    • MACHAI_MACHANISM_HOMEPAGE

      public static final String MACHAI_MACHANISM_HOMEPAGE
      The homepage URL for the Machai MCP server.
      See Also:
    • MACHAI_MACHANISM_ICON

      public static final String MACHAI_MACHANISM_ICON
      The icon URL for the Machai MCP server.
      See Also:
  • Constructor Details

    • AbstractMcpServer

      public AbstractMcpServer()
      Constructs a new AbstractMcpServer.
  • 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

      protected abstract void start() throws Exception
      Starts the MCP server.

      Subclasses must implement this method to provide server startup logic.

      Throws:
      Exception - if the server fails to start
    • setProjectDir

      public void setProjectDir(File projectDir)
    • getProjectDir

      public File getProjectDir()