home / mcp / python mcp server
Provides a Python-based MCP server that coordinates test discovery, skeleton test generation, Maven test execution, and report analysis for Java/Maven projects.
Configuration
View docs{
"mcpServers": {
"amyfan7-se333-final-mcp": {
"command": "python",
"args": [
"server.py"
]
}
}
}You are running an MCP server that exposes tools to automate test generation, analyze test coverage, and check code style for Java/Maven projects. It is designed to be driven by an MCP-aware client, enabling you to discover public methods, generate skeleton tests, execute tests with Maven, and review coverage and style results in an iterative loop until your goals are met.
You use an MCP client to connect to the MCP server and orchestrate a workflow that discovers public methods, generates tests, runs tests, analyzes coverage, and checks style. The client repeatedly calls the server tools to improve test coverage and code quality, updating tests and code as needed and then re-running checks.
Prerequisites you need to have before starting:
Clone or obtain the project files, then set up the Python environment and verify tool availability.
Install Python dependencies
pip install fastmcpVerify required tools are available
java -version
mvn -vStart the MCP server from the project root
python server.pyConfigure your MCP client to connect to the server via SSE transport (the server starts with an SSE transport).
Create a skeleton JUnit test class for a given Java source file by extracting class and public method names and writing a corresponding test class to the tests directory.
Recursively scan a Java project to collect all lines that begin with the keyword public, returning a list of raw method signatures, constructors, or public fields.
Parse JaCoCo XML to identify methods with less than 100% instruction coverage, returning a structured summary of uncovered methods with counts.
Execute the Maven build to generate JaCoCo and Checkstyle reports and capture the stdout for review.
Parse the Checkstyle XML to list style violations with file, line, column, severity, and message.
Run the test suite (Maven) and return the resulting output.
Stage all changes in the repository for commit.
Create a commit with a descriptive message detailing changes made during the iteration.
Open or update a pull request to integrate the changes into the target branch.
Push the committed changes to the remote repository.
Display the current Git status showing modified, added, and untracked files.