Skip to content

Conversation

@pcrane
Copy link
Contributor

@pcrane pcrane commented Oct 29, 2025

JIRA Link (if applicable)

TG-23867

Description

Productionise the Cover MCP server by migrating from custom implementation to FastMCP framework and adding
production-ready infrastructure:

  • Architecture: Migrate to FastMCP with modular covermcp package (server.py, executor.py)
  • Testing: Add comprehensive test suite achieving 98% coverage (19 tests)
  • Tooling: Implement uv package manager with locked dependencies
  • CI/CD: Add GitHub Actions workflow with security scanning, linting, formatting, and testing
  • Governance: Add CODEOWNERS requiring review from @pcrane and @peterschrammel
  • Documentation: Update README.md with FastMCP installation instructions

Decision References (if applicable)

Third-party software additions:

QA Notes (How can this be tested?)

Local testing:

# Clone and setup
uv sync --all-extras

# Run quality checks (all should pass)
uv run ruff check
uv run ruff format --check
uv run pytest -v
uv run coverage report  # Should show 98%

# Test MCP server locally
uv run fastmcp dev  # Opens MCP Inspector

# Test installation
uv run fastmcp install claude-code

Integration testing:

  • Install in LLM client (Claude Code/Desktop recommended)
  • Verify create tool appears in MCP tools list
  • Test with Java project: invoke tool to generate tests

CI/CD verification:

  • GitHub Actions workflow runs automatically on PR
  • All checks must pass (linting, formatting, security, tests)

Are there any changes to user messages or documentation that need review by Technical Writing Team?

Yes - README.md was significantly rewritten with:

  • New installation instructions using FastMCP
  • Environment variable documentation
  • Development workflow guide
  • Removal of legacy manual configuration instructions

Is there a chance that this PR will break unattended customer installations?

Yes - Breaking changes:

  1. Installation method changed: Old manual MCP configuration no longer works. Users must:
  • Uninstall old configuration
  • Reinstall using: uv run fastmcp install main.py
  1. Legacy server removed: src/mcp_diffblue_server.py deleted. Any direct references will break.
  2. Dependency changes: Now requires uv package manager and FastMCP framework.

Set up project configuration using uv as the package manager.
Define dependencies (fastmcp) and dev dependencies (pytest, coverage, ruff).
Configure Ruff linter with Google-style docstrings.
Target Python 3.14.
@pcrane pcrane self-assigned this Oct 29, 2025
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR productionizes the Cover MCP server by migrating from a custom implementation to the FastMCP framework, adding comprehensive testing infrastructure, and implementing modern Python tooling with locked dependencies.

Key changes:

  • Migration to FastMCP framework with modular covermcp package architecture
  • Addition of comprehensive test suite achieving 98% coverage across 19 tests
  • Implementation of GitHub Actions CI/CD pipeline with security scanning, linting, and testing

Reviewed Changes

Copilot reviewed 14 out of 16 changed files in this pull request and generated no comments.

Show a summary per file
File Description
test/test_server.py Tests for server module covering tool invocation, environment variable handling, and error scenarios
test/test_executor.py Tests for executor module covering process execution, timeout handling, and output streaming
test/__init__.py Test package initialization with copyright header
src/mcp_diffblue_server.py Removal of legacy custom MCP server implementation
pyproject.toml Project configuration with FastMCP dependencies and Ruff tooling setup
main.py New entry point for running the FastMCP server
fastmcp.json FastMCP configuration specifying server entry point
covermcp/server.py New FastMCP-based server implementation with create tool
covermcp/executor.py Process execution module with streaming output and timeout handling
covermcp/__init__.py Package initialization exporting server components
README.md Updated documentation with FastMCP installation instructions and development workflow
CODEOWNERS Code ownership assignment to pcrane and peterschrammel
.python-version Python version specification (3.14)
.github/workflows/PullRequest.yml CI/CD workflow for quality checks and testing
Comments suppressed due to low confidence (1)

test/test_executor.py:1

  • Missing docstring for public function cleanup_process. Add a docstring explaining that this function kills a process and waits for it to terminate with a timeout.
#  Copyright 2025 Diffblue

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@pcrane pcrane requested review from a team and JohnLBergqvist October 29, 2025 12:02
@pcrane pcrane force-pushed the pcrane/feature/productionise-cover-mcp-server branch from 7a1f008 to a7e2c4a Compare October 29, 2025 12:13
@pcrane pcrane requested a review from Copilot October 29, 2025 12:13
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 14 out of 16 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

@roxspring roxspring left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM in principle but I can't really comment on python specific idioms and best practice

@pcrane pcrane force-pushed the pcrane/feature/productionise-cover-mcp-server branch 2 times, most recently from 32259d0 to 7c86c4c Compare October 29, 2025 12:36
Replace custom MCP server with FastMCP-based implementation.
Create covermcp package with modular architecture:
- server.py: FastMCP tool definitions and dcover executable discovery
- executor.py: Process execution with real-time streaming and timeout handling

Implement 'create' tool with support for entry points, custom paths,
and environment variable configuration (DIFFBLUE_COVER_CLI, DIFFBLUE_COVER_OPTIONS).
Create main.py to run the FastMCP server, allowing LLMs to interact
with the Diffblue Cover tools defined in covermcp.server.
@pcrane pcrane force-pushed the pcrane/feature/productionise-cover-mcp-server branch from 7c86c4c to d2e3a66 Compare October 31, 2025 14:30
@peterschrammel peterschrammel changed the title [TG-23867] Productionise Cover MCP Server [TG-23867] Productize Cover MCP Server Oct 31, 2025
@pcrane pcrane force-pushed the pcrane/feature/productionise-cover-mcp-server branch 8 times, most recently from 433cde0 to 7c2981c Compare November 4, 2025 12:21
Implement unit tests for server and executor modules using pytest.
Configure coverage reporting to track test coverage.
Rewrite README to focus on FastMCP installation and usage.
Add sections for:
- Installation via fastmcp install for multiple LLM clients
- Environment variable configuration
- Development workflow with MCP Inspector
- Testing and linting instructions

Remove outdated manual MCP configuration instructions.
Delete old custom MCP server implementation (src/mcp_diffblue_server.py).
Fix typo in .gitignore (*.py[codz] -> *.py[cod]).
Add PyCharm IDE directory (.idea) to .gitignore.
Add uv.lock to ensure reproducible builds with pinned dependency versions.
Exclude .claude/ directory from version control as it contains
local IDE configuration and settings specific to individual
developer environments.
Define code ownership for automated review assignment.
All changes require review from @pcrane and @peterschrammel.
Implement automated testing and quality checks for pull requests and
main branch pushes. The pipeline includes:

- Dependency installation with uv
- Security vulnerability scanning with uv-secure
- Code linting with ruff
- Code formatting verification with ruff
- Test execution with pytest
- Coverage reporting

All checks must pass before code can be merged, ensuring consistent quality standards.
Add regex pattern to remove ANSI escape sequences from dcover output
lines. This ensures clean, readable output in MCP clients that don't
properly handle terminal control codes.

Changes:
- Import re module
- Define ANSI_ESCAPE pattern for matching escape sequences
- Strip escape codes before yielding output lines
Implement 'write tests' prompt that provides LLMs with contextual
guidance for writing Java unit tests. The prompt establishes the
assistant's role as a skilled test writer, improving the quality
of test generation suggestions.

This prompt can be invoked by LLM clients to get specialized
instructions before using the create tool.
Expose comprehensive dcover configuration documentation through
an MCP resource (data://config). This allows LLM clients to query
available dcover options and their descriptions, enabling intelligent
tool usage and better test generation configurations.

The resource includes 50+ dcover CLI options covering:
- Test framework selection
- Mocking strategies (Mockito, Spring)
- Coverage options
- Build system preferences
- Output customization
- Security and sandbox settings

Marked as read-only and idempotent for efficient caching.
Enable LLMs to pass arbitrary dcover CLI options through a new 'args'
parameter in the create tool. This provides maximum flexibility for
advanced test generation configurations without requiring predefined
parameters for every possible option.

Changes:
- Add 'args' parameter to create() function signature
- Document parameter in function docstring
- Add logic to append args to command before environment options
- Log args when provided for debugging

Order of precedence for options:
1. Base command with --batch
2. LLM-provided args (new)
3. Environment variable DIFFBLUE_COVER_OPTIONS
4. Entry points

This allows LLMs to leverage the comprehensive dcover options
documented in the MCP resource while maintaining backward
compatibility.
@pcrane pcrane force-pushed the pcrane/feature/productionise-cover-mcp-server branch from 7c2981c to fd679e9 Compare November 4, 2025 12:24
@yumibagge yumibagge self-requested a review November 5, 2025 16:22
Copy link

@yumibagge yumibagge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

QA review 🆗

Happy path confirmed - but will explorer a bit more

https://diffblue.atlassian.net/browse/TG-23925?focusedCommentId=72102

@pcrane pcrane merged commit 155f3d1 into main Nov 5, 2025
1 check passed
@pcrane pcrane deleted the pcrane/feature/productionise-cover-mcp-server branch November 6, 2025 11:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants