Machai MCP Server 1.4.3-SNAPSHOT API

Machai MCP Server

Machai MCP Server is a synchronous server implementation for the Model Context Protocol (MCP) using the Machai AI framework. It provides integration with GenAI tools and supports HTTP and standard-input/ standard-output (STDIO) interfaces for AI-powered tool execution and orchestration. The project does not publish tools of its own; applications provide libraries implementing functional tools and prompts for exposure through MCP.

Machai MCP Server supports all types of project files, including source code, documentation, project site content, and other relevant files. The configured project directory is passed to invoked tools so that each tool can operate on project content appropriate to its implementation.

Architecture and operation

The shared server infrastructure manages the project directory, configurator, enabled-tool filtering, registration lifecycle, and startup. The optional enabledTools property limits the function tools that are registered; names may be separated by spaces, commas, semicolons, or other whitespace. GenAI adapters translate Machai tool functions and parameter descriptors into MCP tool definitions and JSON Schema, then invoke functions with request arguments, the project directory, and the configurator. An active streamable session identifier is also available to tool functions. Invocation failures are returned as MCP error results.

Prompt adapters expose Machai prompts as MCP prompts and convert string, collection, and other serialized function results into MCP prompt messages. The stateless HTTP resource adapter exposes resource functions and passes each requested resource URI, the project directory, and the configurator to the selected function.

The command-line entry point starts the STDIO server by default. The -n/--name, -v/--version, and -d/--projectDir options provide server metadata and tool context; -c/--config selects a properties file. Supplying -p/--port starts the stateless HTTP server, while -s/--session selects the streamable HTTP server. The HTTP base class centralizes Jetty connector, servlet, thread-pool, port, and startup configuration. STDIO advertises tools, prompts, and logging; stateless HTTP additionally advertises resources; and streamable HTTP advertises tools and prompts. HTTP startup failures are wrapped in the server startup exception, and the STDIO implementation installs a JVM shutdown hook to close its built synchronous server.

Principal types and relationships

The following diagram shows the shared MCP server base classes, the STDIO, stateless HTTP, and streamable HTTP implementations, and the GenAI and prompt adapters that bind configured Machai functions to each transport.

Class diagram showing AbstractMcpServer and AbstractHttpMcpServer, the STDIO, stateless HTTP, and streamable HTTP servers, and their GenAI and prompt adapters.

Packages

org.machanism.machai.mcp.server
Provides the synchronous MCP runtime, command-line launcher, STDIO, stateless HTTP, and streamable HTTP transports. It also provides GenAI, prompt, and stateless-resource adapters that expose configured Machai tools, prompts, and supported resource handlers through MCP. The package includes common project and configuration handling, tool filtering, JSON-Schema generation, function invocation, prompt-message conversion, and HTTP startup support.
Packages
Package
Description
Provides the synchronous Model Context Protocol (MCP) server implementation used to expose Machai function tools and prompts to MCP clients.