This a MCP on top of JUnit Api
Config is the same across clients — only the file and path differ.
{
"mcpServers": {
"junit": {
"args": [
"-jar",
"/absolute/path/to/junit-mcp-server-1.0-SNAPSHOT.jar",
"/absolute/path/to/your/project"
],
"command": "java"
}
}
}Are you the author?
Add this badge to your README to show your security score and help users find safe servers.
An MCP (Model Context Protocol) server that exposes JUnit test discovery and execution as tools, allowing AI coding agents to run tests directly without relying on shell commands.
No automated test available for this server. Check the GitHub README for setup instructions.
Five weighted categories — click any category to see the underlying evidence.
No known CVEs.
No package registry to scan.
Click any tool to inspect its schema.
Be the first to review
Have you used this server?
Share your experience — it helps other developers decide.
Sign in to write a review.
Others in other
Pi Coding Agent extension (CLI-first) — routes bash/read/grep/find/ls through lean-ctx CLI for strong token savings. Optional MCP bridge can register advanced tools.
Compress tool outputs, logs, files, and RAG chunks before they reach the LLM. 60-95% fewer tokens, same answers. Library, proxy, MCP server.
97% token reduction for AI coding sessions — zero deps, 21 languages, MCP server
Autonomous spec-to-product coding-agent CLI with an MCP server exposing 34 tools over stdio.
MCP Security Weekly
Get CVE alerts and security updates for Junit Mcp Server and similar servers.
Start a conversation
Ask a question, share a tip, or report an issue.
Sign in to join the discussion.
An MCP (Model Context Protocol) server that exposes JUnit test discovery and execution as tools, allowing AI coding agents to run tests directly without relying on shell commands.
When an LLM needs to run tests today, it typically shells out to mvn test or ./gradlew test,
captures the raw terminal output, parses it as plain text, and forwards that interpretation to the
user. This approach has three problems: the output is verbose and wastes tokens, text parsing is
fragile and error-prone, and the result leaves room for misinterpretation.
junit-mcp-server connects the LLM directly to the JUnit Platform API instead of going through the command line. Test results come back as structured JSON with exact pass/fail counts, failure causes, and stack traces — nothing more.
The benefits:
On startup the server detects the build tool (Gradle or Maven), extracts the full
testRuntimeClasspath by invoking the build tool once, loads everything into a URLClassLoader,
and registers MCP tools backed by the JUnit Platform Launcher API.
The agent never needs to call gradle test or mvn test — it calls the MCP tools instead.
Check the ARCHITECTURE.md for more.
./gradlew testClasses or mvn test-compile)mvn package
This produces a fat/shaded jar at target/junit-mcp-server-1.0-SNAPSHOT.jar.
| Tool | Description | Parameters |
|---|---|---|
list_tests_classes | Discovers all test classes in the project | — |
list_tests_in_classes | Lists all test methods in a given class | fullClassName |
run_tests_in_class | Runs all tests in a given class and returns a report | fullClassName |
run_test_method_in_class | Runs a single test method and returns a report | fullClassName, methodName |
All run tools return a JSON report:
[{
"className": "com.example.CalculatorTest",
"total": 3,
"passed": 2,
"failed": 1,
"skipped": 0,
"tests": [
{ "name": "shouldAdd", "status": "passed" },
{ "name": "shouldSubtract", "status": "passed" },
{ "name": "shouldDivide", "status": "failed", "failure": { "cause": "/ by zero", "stackTrace": "..." } }
]
}]
Replace /absolute/path/to/your/project with the actual path to the Gradle or Maven project
you want the agent to test, and /absolute/path/to/junit-mcp-server.jar with the path to the
built jar.
Add to your project's .claude/mcp.json or to the global ~/.claude/mcp.json:
{
"mcpServers": {
"junit": {
"command": "java",
"args": [
"-jar",
"/absolute/path/to/junit-mcp-server-1.0-SNAPSHOT.jar",
"/absolute/path/to/your/project"
]
}
}
}
Or via the CLI:
claude mcp add junit -- java -jar /absolute/path/to/junit-mcp-server-1.0-SNAPSHOT.jar /absolute/path/to/your/project
Edit ~/Library/Application Support/Claude/claude_desktop_config.json (macOS)
or %APPDATA%\Claude\claude_desktop_config.json (Windows):
{
"mcpServers": {
"junit": {
"command": "java",
"args": [
"-jar",
"/absolute/path/to/junit-mcp-server-1.0-SNAPSHOT.jar",
"/absolute/path/to/your/project"
]
}
}
}
Open Settings → MCP and add a new server entry, or edit ~/.cursor/mcp.json:
{
"mcpServers": {
"junit": {
"command": "java",
"args": [
"-jar",
"/absolute/path/to/
... [View full README on GitHub](https://github.com/clarenced/junit-mcp-server#readme)