MCP Server Maven Plugin 1.4.3-SNAPSHOT API
MCP Server Maven Plugin
The MCP Server Maven Plugin integrates a Machai Model Context Protocol (MCP) server into a
Maven build through aggregator goals for stateless and streamable HTTP transports. It uses
the current project's name, version, and base directory, loads the configured
PropertiesConfigurator, applies Maven parameters without overriding existing
system properties, registers the configured Machai AI tools, and starts the selected server.
The plugin exposes those tools to MCP clients without a separate launcher, supporting local development, repeatable integration tests, demonstrations, and build-driven automation. Both goals are aggregators, so a multi-module reactor starts one server for the reactor rather than one server per module. The MCP Server Maven Plugin supports all types of project files, including source code, documentation, project site content, and other relevant files exposed through its configured tools.
Architecture
The org.machanism.machai.mcp.maven package provides Maven plugin Mojos and
utilities for managing MCP server lifecycle and configuration. Its abstract and concrete
Mojos share configuration logic for environment variables and credentials. The
AbstractMCPServerMojo is the base class for the concrete server Mojos,
HttpStatelessServerMojo starts a stateless MCP server, and
HttpStreamableMcpServerMojo starts a streamable MCP server.
The org.machanism.machai.mcp.maven.tools package provides function tools and
supporting classes for controlling and managing MCP server lifecycle behavior during Maven
build execution. Its MCPServerTools utility supports MCP server control,
including the stop_mcp_server lifecycle operation.
During execution, the selected Mojo loads the configured server, applies the Maven project context and configuration, registers the configured tools, and starts the selected HTTP transport. MCP clients can then use those tools and request controlled server shutdown.
Packages
- org.machanism.machai.mcp.maven
- Provides Maven plugin Mojos and utilities for managing MCP server lifecycle and configuration, including stateless and streamable server variants and shared support for environment variables and credentials.
- org.machanism.machai.mcp.maven.tools
- Provides function tools and supporting classes for controlling and managing MCP server lifecycle behavior during Maven build execution, including server control operations.
Usage
Configure the plugin with the desired transport, HTTP port, configuration file, and Machai
tool settings, then invoke the stateless or streamable Maven goal.
The selected aggregator goal loads the configuration, applies additional parameters only
when their JVM system properties are absent, and starts one server for the complete reactor.
Connected MCP clients can use the configured tools and request controlled shutdown through
stop_mcp_server when the server is no longer needed.