Package org.machanism.machai.mcp.server
Class McpServer
java.lang.Object
org.machanism.machai.mcp.server.McpServer
Entry point for starting the MCP (Model Context Protocol) server.
Supports both STDIO and Remote (network) server modes, configurable via command-line options.
- STDIO mode: Default, starts a server that communicates via standard input/output.
- Remote mode: If the
-por--portoption is specified, starts a server that listens on the given port.
Command-line options:
-h,--help: Show help message and exit.-n,--name: Specify the MCP server name (default: mcp-machai-server).-d,--projectDir: Specify the project directory path.-v,--version: Specify the MCP server version (default: implementation version or "latest").-p,--port: Specify the port number for Remote MCP Server mode.-s,--session: Use streamable MCP server mode (only for Http MCP Server).
- Since:
- 1.2.0
- Author:
- Viktor Tovstyi
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final org.slf4j.Loggerstatic final StringDefault Ghostwriter properties file name. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic PropertiesConfiguratorgetConfigurator(String configFile) Creates a configurator and loads the requested properties file.static voidMain entry point for the MCP server application.
-
Field Details
-
log
private static final org.slf4j.Logger log -
MCP_CONFIG_FILE_NAME
Default Ghostwriter properties file name.This is the name of the configuration properties file that can be used as one of the configuration data sources.
It can be overridden by the
MCP_CONFIG_FILE_NAMEproperty.- See Also:
-
-
Constructor Details
-
McpServer
public McpServer()
-
-
Method Details
-
main
Main entry point for the MCP server application.Parses command-line arguments to determine server mode and configuration, then starts the appropriate server.
- Parameters:
args- command-line arguments- Throws:
Exception- if an error occurs during server startup
-
getConfigurator
Creates a configurator and loads the requested properties file. If no file is specified, a missing default file is tolerated.- Parameters:
configFile- configuration file path, ornullto useMCP_CONFIG_FILE_NAME- Returns:
- configured properties reader
- Throws:
IOException- if an explicitly requested file cannot be loaded
-