MCP Server Maven Plugin
Introduction
MCP Server Maven Plugin is a Maven plugin for launching the Machai MCP Server directly from a Maven build. It makes Machai AI tools available through the Model Context Protocol (MCP) over HTTP so that MCP-compatible clients can connect to a locally started server during development, testing, demonstrations, or integration workflows.
The plugin is especially useful when a project already uses Maven as its primary build tool and needs a simple way to start an MCP endpoint without introducing a separate launcher or runtime wrapper. By packaging server startup as Maven goals, the plugin fits naturally into existing developer workflows and multi-module builds.
Overview
The plugin starts an HTTP-based Machai MCP Server using metadata from the current Maven project, including the project name, version, and base directory. During execution, it applies configured system properties, optionally resolves credentials from Maven settings.xml, discovers available Machai tools, and starts the selected HTTP transport on the configured port.
It supports two transport styles:
- Stateless HTTP via
mcp-server:stateless, where each request is handled independently. - Streamable HTTP via
mcp-server:streamable, where responses can be delivered incrementally over an HTTP connection.
Both goals are aggregator goals, so they are intended to run once from the execution root in a multi-module build. In both cases, the plugin blocks while the server is running, allowing external MCP clients to connect to the exposed endpoint.

Goals
| Goal | Description | Key parameters |
|---|---|---|
mcp-server:stateless |
Starts the Machai MCP Server in stateless HTTP mode using the current Maven project name and version. | port, params, serverId |
mcp-server:streamable |
Starts the Machai MCP Server in streamable HTTP mode using the current Maven project name and version. | port, params, serverId |
Getting Started
Prerequisites
- Java 17 or later.
- Apache Maven.
- An available TCP port for the MCP HTTP server.
- Access to any required AI provider credentials, either through system properties, environment-driven runtime configuration, or a Maven
settings.xml<server>entry referenced byserverId. - An MCP-compatible client if you plan to connect interactively, such as Claude Desktop or another MCP HTTP client.
Basic Usage
Configure the plugin in your pom.xml:
<plugin>
<groupId>org.machanism.machai</groupId>
<artifactId>mcp-server-maven-plugin</artifactId>
<version>1.2.0-SNAPSHOT</version>
<configuration>
<port>45000</port>
</configuration>
</plugin>
Run the stateless HTTP server:
mvn mcp-server:stateless
Run the streamable HTTP server:
mvn mcp-server:streamable
Override the configured port from the command line:
mvn mcp-server:stateless -Dmcp.port=8080
Typical Workflow
- Add the plugin to the Maven project that should host the MCP server.
- Configure the required
portvalue in the plugin configuration or provide it with-Dmcp.port=.... - If needed, supply additional runtime properties through
paramsand configureserverIdto load credentials from Mavensettings.xml. - Start either
mcp-server:statelessormcp-server:streamable. - Connect your MCP client to the running HTTP endpoint, typically
http://localhost:<port>/mcp. - Stop the server by terminating the Maven process or by using the exposed shutdown tool when appropriate.
Configuration
| Parameter | Property | Description | Default |
|---|---|---|---|
port |
mcp.port |
Port used by the HTTP MCP server. This value is required. | (none) |
params |
— | Map of system properties to apply before server startup when they are not already set. | (none) |
serverId |
mcp.ai.serverid |
Maven settings.xml server identifier used to load credentials and custom configuration properties for AI providers. |
(none) |
basedir |
— | Maven project base directory passed to the server as the project directory. Resolved automatically from Maven. | ${basedir} |
project |
— | Current Maven project used to supply the project name and version. Resolved automatically from Maven. | ${project} |
settings |
— | Maven settings object used internally to resolve the configured serverId. |
${settings} |

