java-test-mcp-server
v0.0.8
Published
MCP server for running Java tests
Maintainers
Readme
Java Test MCP Server
This is a Model Context Protocol (MCP) server that provides tools for running Java tests and retrieving test output.
Setup
- Install dependencies:
npm install- Build the project:
npm run buildUsage
Start the server:
npm startThe server provides two tools:
run-tests
Runs Java tests in the project.
Parameters:
projectRoot(optional): Override project root. If there are multiple projects in the root, specify the subdirectory.showAlways(optional): Array of test names (method names in Java) to include in output even upon success.
The tool will:
- Compile code and run the tests
- Parse Surefire test reports
- Parse Checkstyle reports
- Return a formatted report that includes:
- Checkstyle violations (if any)
- Failed tests with failure reasons and stack traces
- Tests specified in
showAlwaysparameter, even if they passed
If all tests pass and there are no violations, a simple success message is shown.
get-test-output
Retrieves the detailed output (stdout/stderr) of a specific test.
Parameters:
projectRoot(optional): Override project root. If there are multiple projects in the root, specify the subdirectory.className(required): Name of the class to get output for.testName(required): Name of the test to get output for.
If the specified test is not found, a list of available tests will be returned.
