marcin-sucharski/java-test-mcp-server
If you are the rightful owner of java-test-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
This is a Model Context Protocol (MCP) server designed to facilitate running Java tests and retrieving test outputs efficiently.
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 build
Usage
Start the server:
npm start
The 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
showAlways
parameter, 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.