MCP Maven Server
The MCP Maven Server allows AI assistants like Claude to interact with Maven and Spring Boot projects, returning structured JSON output instead of raw build logs.
Build Operations
compileProject– Compile a project and get structured error output (file, line, column, message)getCompilationErrors– Run compile and return only the error listverifyProject– Runmvn verify(compile + test + integration checks)packageProject– Build a JAR/WAR artifact (skips tests by default)cleanProject– Clean build artifactsexecuteMavenCommand– Execute any arbitrary Maven command with custom arguments
Test Operations
runTests– Run all tests and get structured resultsrunSingleTest– Run a single test class by namerunSingleMethod– Run a single test method within a classgetFailedTests– Read existing test reports and return only failed/errored tests (no re-run)getTestReports– Read all existing test reports from disk without re-running tests
Spring Boot Lifecycle
springBootRun– Start the application, detecting port and capturing logsspringBootStop– Stop the app gracefully (actuator shutdown first, SIGTERM fallback)springBootRestart– Restart the applicationspringBootStatus– Check current status (port, PID, uptime, health endpoint)springBootLogs– Retrieve recent log lines from the running application
Project & Environment Info
getProjectInfo– Detect project structure, modules, and Java version frompom.xmlgetJavaInfo– Identify which JDK is in usegetMavenInfo– Get Maven version and installation pathping– Health check to verify the server is alive and responding
Provides tools to manage Spring Boot application lifecycle: start, stop, restart, check status, and view logs.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@MCP Maven Serverrun all tests in the project"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
MCP Maven Server
An MCP (Model Context Protocol) server that wraps Maven and Spring Boot operations for Claude Code. Provides structured JSON output instead of raw build logs — saving tokens and allowing Claude to focus on code fixes.
Prerequisites
Node.js 18+ (with npm)
Maven 3.6+ (in PATH or configured via
MCP_MAVEN_COMMAND)Java 8–21+ (detected automatically)
Related MCP server: Cursor Agent MCP Server
Installation
# Clone
cd C:\Java
git clone https://github.com/Christian-Carminati/mcp-maven-server.git
cd mcp-maven-server
# Install and build
npm install
npm run buildIntegration with Claude Code
1. MCP Server Configuration
Add to ~\.claude.json:
{
"mcpServers": {
"mcp-maven": {
"type": "stdio",
"command": "node",
"args": ["C:\\Java\\mcp-maven-server\\dist\\index.js"],
"env": {
"MCP_MAVEN_TIMEOUT_MS": "300000",
"MCP_MAVEN_MAX_LOG_LINES": "500",
"MCP_MAVEN_COMMAND": "C:\\Program Files\\JetBrains\\IntelliJ IDEA 2025.3.6\\plugins\\maven\\lib\\maven3\\bin\\mvn.cmd"
}
}
}
}
MCP_MAVEN_COMMANDis optional — set it ifmvnis not in your system PATH. Omitting it makes the server look formvnvia PATH.
2. Block Maven via Bash (Permissions)
Add to ~\.claude\settings.json:
{
"permissions": {
"deny": ["Bash(mvn *)", "Bash(./mvnw *)", "Bash(java -jar *)"]
}
}3. PreToolUse Hook (Bash Interception)
Add to ~\.claude\settings.json:
{
"hooks": {
"PreToolUse": [
{
"matcher": "Bash",
"hooks": [
{
"type": "command",
"command": "C:\\Java\\mcp-maven-server\\hooks\\maven-intercept.bat"
}
]
}
]
}
}4. CLAUDE.md Instruction
Add to ~\.claude\CLAUDE.md:
## Maven MCP Server
For ALL Maven operations (compile, test, verify, package, clean, spring-boot)
use ONLY the `mcp-maven` MCP tools. Available:
compileProject, runTests, runSingleTest, runSingleMethod, getFailedTests,
verifyProject, packageProject, cleanProject, executeMavenCommand,
getCoverageReport,
springBootRun, springBootStop, springBootRestart, springBootStatus, springBootLogs,
getProjectInfo, getJavaInfo, getMavenInfo, ping,
getCacheInfo, clearCache.
The Bash tool is blocked for mvn/java commands by permission rules.
Do not attempt to run mvn via Bash — it will be denied.
### Example
- ❌ "Run `mvn test` in the terminal"
- ✅ "Run tests using mcp-maven's runTests tool"
- ❌ "Compile with `mvn compile` via Bash"
- ✅ "Compile using mcp-maven's compileProject tool"
- ❌ "Start Spring Boot with `mvn spring-boot:run`"
- ✅ "Start Spring Boot using mcp-maven's springBootRun tool"Available Tools
Build
Tool | Description | Key Parameters |
| Compile with structured error output (file, line, column, message) |
|
| Compile + test + integration-check |
|
| Build JAR/WAR artifact (skips tests by default) |
|
| Clean build artifacts |
|
| Run arbitrary Maven with parsed error output |
|
Test
Tool | Description | Key Parameters |
| Execute tests with build cache (second call is instant) |
|
| Run one test class |
|
| Run one test method |
|
| Read failed tests without re-running |
|
| Read existing reports from disk |
|
runTestscaching: By default, checks if any source/test files changed since the last run. If nothing changed, returns cached results instantly — no Maven execution. Useforce: trueto bypass cache and re-run all tests. Useparallel: true(default) for parallel execution (-T 2 -DforkCount=2). Response includes_cached: trueflag when served from cache.
Cache Management
Tool | Description |
| Show which modules are cached and how old |
| Invalidate cache for a module (or all) |
Coverage
Tool | Description | Key Parameters |
| Read JaCoCo coverage report (lines, branches, methods per package) |
|
Spring Boot
Tool | Description | Key Parameters |
| Start the application (detects port, captures logs) |
|
| Stop gracefully (actuator shutdown first, SIGTERM fallback) |
|
| Restart the app |
|
| Check status, port, PID, health endpoint |
|
| View recent log lines |
|
Project Info
Tool | Description | Key Parameters |
| Detect project structure, modules, Java version |
|
| Detect JDK version and vendor |
|
| Get Maven version and home | — |
| Health check | — |
projectPath: all build/test/project tools accept an optionalprojectPathparameter. Use it to target a specific module without changing Claude Code's working directory. Example:runTests({ projectPath: "C:/Java/BancomatPay/be-bancomatpay" })
Configuration
All settings are optional and configured via environment variables (set in the MCP server env block):
Variable | Default | Description |
| 300000 | Build timeout in milliseconds |
| 500 | Max stdout lines to keep |
| 500 | Spring Boot log ring buffer size |
| 120000 | Max wait for Spring Boot startup |
| true | Enable/disable build caching |
| — | Default Maven profile |
| — | Override JDK path |
|
| Full path to |
|
| Enable/disable build cache |
Project Structure
src/
├── index.ts # Entry point
├── core/ # Server setup, types, config
│ ├── server.ts # MCP server init, tool registration
│ ├── config.ts # Environment variable loader
│ └── types.ts # Shared TypeScript interfaces
├── project/ # Project discovery
│ ├── discovery.ts # pom.xml upward scan, module resolution
│ ├── pom-parser.ts # XML parser for pom.xml
│ └── java-env.ts # JDK version detection (all sources)
├── maven/ # Maven execution
│ ├── runner.ts # mvn process spawn with execa
│ ├── parser.ts # Javac error parser (JDK 8–21)
│ ├── reports.ts # Surefire/Failsafe XML reader
│ └── process-manager.ts # Process queue, cancel, timeout
├── tools/ # MCP tool implementations
│ ├── index.ts # Tool registry
│ ├── compile.ts # compileProject, getCompilationErrors
│ ├── test.ts # runTests, runSingleTest, getFailedTests
│ ├── build.ts # verifyProject, packageProject, cleanProject
│ ├── project.ts # getProjectInfo, getJavaInfo, getMavenInfo, ping
│ └── spring-boot.ts # Spring Boot lifecycle tools
└── utils/
└── spring-boot-manager.ts # Long-running process managementLicense
MIT
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/Christian-Carminati/mcp-maven-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server