java-test-mcp-server

marcin-sucharski/java-test-mcp-server

3.2

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.

Tools
2
Resources
0
Prompts
0

Java Test MCP Server

This is a Model Context Protocol (MCP) server that provides tools for running Java tests and retrieving test output.

Setup

  1. Install dependencies:
npm install
  1. 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:

  1. Compile code and run the tests
  2. Parse Surefire test reports
  3. Parse Checkstyle reports
  4. 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.