Skip to main content
Glama
Diffblue Cover MCP Server

Diffblue Cover MCP Server

Official
by diffblue

MCP Server for Diffblue Cover CLI

This repository provides a Model Context Protocol (MCP) Server for the Diffblue Cover CLI tool (dcover), making it callable and manageable by various AI development environments that adhere to the MCP specification (like the Gemini CLI).

Core Component: The MCP Server covermcp/server.py

The Python script serves as the universal adapter for the dcover create command.

Related MCP server: Databricks Code Execution MCP

Prerequisites

Before configuring the server with any host environment, ensure you have the following installed:

  1. Diffblue Cover CLI: Thedcover command must be installed and accessible in your system's PATH.

    • You can verify this by running dcover version in your terminal.

  2. uv: A Python project and package manager (https://docs.astral.sh/uv/)

Installing the MCP server

The project uses FastMCP to develop and deploy the MCP server. To install this server, you can use uv run fastmcp install claude-code --server-spec main.py (for example), other LLM tools are supported out of the box:

$ uv run fastmcp install --help
Usage: fastmcp install COMMAND

Install MCP servers in various clients and formats.

╭─ Commands ─────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ claude-code     Install an MCP server in Claude Code.                                                                  │
│ claude-desktop  Install an MCP server in Claude Desktop.                                                               │
│ cursor          Install an MCP server in Cursor.                                                                       │
│ gemini-cli      Install an MCP server in Gemini CLI.                                                                   │
│ mcp-json        Generate MCP configuration JSON for manual installation.                                               │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

This command will install the MCP server for all projects, which you may not want. If this is the case, then you can be targeted in your installation if you use the mcp-json option to augment a .mcp.json file in the project:

{
  "mcpServers": {
    "Diffblue Cover": {
      "command": "uv",
      "args": [
        "run",
        "--with",
        "fastmcp",
        "fastmcp",
        "run",
        "/path/to/cover-mcp/main.py"
      ]
    }
  }
}

This also allows you to specify environment variables. Currently, there are two that you can specify:

  • DIFFBLUE_COVER_CLI : the location of the installed dcover command line

  • DIFFBLUE_COVER_OPTIONS : use these dcover options as well as those supplied by the LLM

To use these variables in the .mcp.json file above, you would do so like this:

{
  "mcpServers": {
    "Diffblue Cover": {
      "command": "uv",
      "args": [
        "run",
        "--with",
        "fastmcp",
        "fastmcp",
        "run",
        "/path/to/cover-mcp/main.py"
      ],
      "env": {
        "DIFFBLUE_COVER_CLI": "/path/to/dcover",
        "DIFFBLUE_COVER_OPTIONS": "--verbose --active-profiles=test"
      }
    }
  }
}

This will run the equivalent to /path/to/dcover --batch create <entry points provided by the LLM> --verbose --active-profiles=test

Note: No attempt is made to disambiguate the options provided options.

Developmental Notes

FastMCP contains a tool called "MCP Inspector" which can be used to interact with the MCP server without needing the LLM interaction. To run this developmental server, you can use uv run fastmcp dev. The configuration lives in the file fastmcp.json which provides (among other things) the entry point for the server.

$ uv run fastmcp dev --help    
Usage: fastmcp dev [OPTIONS] [ARGS]

Run an MCP server with the MCP Inspector for development.

╭─ Parameters ────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ SERVER-SPEC --server-spec  Python file to run, optionally with :object suffix, or None to auto-detect fastmcp.json      │
│ --with-editable            Directory containing pyproject.toml to install in editable mode (can be used multiple times) │
│ --with                     Additional packages to install (can be used multiple times)                                  │
│ --inspector-version        Version of the MCP Inspector to use                                                          │
│ --ui-port                  Port for the MCP Inspector UI                                                                │
│ --server-port              Port for the MCP Inspector Proxy server                                                      │
│ --python                   Python version to use (e.g., 3.10, 3.11)                                                     │
│ --with-requirements        Requirements file to install dependencies from                                               │
│ --project                  Run the command within the given project directory                                           │
╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

Project Layout

The project and the dependencies are managed by uv, see the documentation for the usage instructions.

Running Tests

There are unit tests (in the test directory) which you can run with uv run coverage run -m pytest and then get a coverage report with uv run coverage report --omit "test/*" (python includes the coverage of the test files by default -- not that useful).

Linting/Formatting

To run the linter, run uv run ruff check. If successful, you will see a message "All checks passed!". If not, you should address the issues picked up. More information can be found at the Ruff Linter Documentation

To format the code, run uv run ruff format, this should be run before committing any changes. More information can be found at the Ruff Formatter Documentation.

References

Available Tools

3 tools
createA

Invoke Diffblue Cover to generate unit tests for Java code.

This tool executes the dcover CLI to automatically generate JUnit tests for the specified Java classes, methods, or packages. It supports various configuration options to control the test generation process.

Args: path: Path to the dcover executable. If not provided, searches system PATH and the DIFFBLUE_COVER_CLI environment variable. working_directory: Root directory of the Java project to test. Defaults to the current working directory. dcover_timeout: Maximum execution time in seconds. Defaults to 600. Set to None for no timeout (not recommended). entry_points: List of fully-qualified Java targets (packages, classes, or methods) to generate tests for. Examples: ['com.example.MyClass', 'com.example.MyClass.myMethod']. If None, tests entire project. args: Additional arguments to pass to dcover. Defaults to None. ctx: MCP server context for logging and progress reporting (auto-injected by FastMCP).

Returns: dict: Execution result containing: - return_code (int): Exit code (0 for success) - status (str): "success" if completed without errors - output (str): Complete stdout/stderr from dcover - command (list[str]): The exact command that was executed - working_directory (Path): Directory where command was run

Raises: ToolError: If dcover executable not found, command fails, or timeout exceeded. The error includes the partial output collected before failure.

Note: If DIFFBLUE_COVER_OPTIONS environment variable is set, it overrides all option parameters (batch, skip_verification, etc.) except path, working_directory, timeout, and entry_points.

This tool requires a valid Diffblue Cover license. See:
https://docs.diffblue.com/features/cover-cli/commands-and-arguments#create-tests

Inputs: args, path, entry_points, dcover_timeout, +1 more. Returns: result

issuesA

Invoke Diffblue Cover to identify project issues.

This tool executes the dcover issues command to output a prioritized list of project issues that may prevent test generation.

Args: path: Path to the dcover executable. If not provided, searches system PATH and the DIFFBLUE_COVER_CLI environment variable. working_directory: Root directory of the Java project to test. Defaults to the current working directory. dcover_timeout: Maximum execution time in seconds. Defaults to 600. Set to None for no timeout (not recommended). limit: Limit the number of issues to output. skip: Skip the first N issues from the report. prompt: If True, outputs a suggested prompt for each actionable issue. cover_json: Location of the JSON-formatted test-writing summary report. dry_run: If True, passes the '--dry-run' flag to check for readiness. args: Additional arguments to pass to dcover. Defaults to None. ctx: MCP server context for logging and progress reporting (auto-injected by FastMCP).

Returns: dict: Execution result containing: - return_code (int): Exit code (0 for success) - status (str): "success" if completed without errors - output (str): Complete stdout/stderr from dcover - command (list[str]): The exact command that was executed - working_directory (Path): Directory where command was run

Raises: ToolError: If dcover executable not found, command fails, or timeout exceeded. The error includes the partial output collected before failure.

Inputs: args, path, skip, limit, +5 more. Returns: result

refactorA

Invoke Diffblue Cover to refactor the project (aliased as 'fix-build').

This tool executes the dcover refactor command to apply automated refactorings, such as fixing build issues or adding missing dependencies.

Args: path: Path to the dcover executable. If not provided, searches system PATH and the DIFFBLUE_COVER_CLI environment variable. working_directory: Root directory of the Java project to test. Defaults to the current working directory. dcover_timeout: Maximum execution time in seconds. Defaults to 600. Set to None for no timeout (not recommended). dry_run: If True, passes the '--dry-run' flag to check for readiness without applying changes. args: Additional arguments to pass to dcover. Defaults to None. ctx: MCP server context for logging and progress reporting (auto-injected by FastMCP).

Returns: dict: Execution result containing: - return_code (int): Exit code (0 for success) - status (str): "success" if completed without errors - output (str): Complete stdout/stderr from dcover - command (list[str]): The exact command that was executed - working_directory (Path): Directory where command was run

Raises: ToolError: If dcover executable not found, command fails, or timeout exceeded. The error includes the partial output collected before failure.

Inputs: args, path, dry_run, dcover_timeout, +1 more. Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4/5.0

    Scored across 3 tools

    Disambiguation5/5

    Each tool maps to a distinct dcover subcommand: create for test generation, refactor for build fixes, and issues for diagnosing problems. There is no meaningful overlap in their purposes, and the descriptions clearly differentiate them.

    Naming Consistency4/5

    Two tools use imperative verbs (create, refactor) while the third uses a noun (issues), creating a slight inconsistency. However, the names are short, memorable, and directly correspond to CLI commands, so the deviation is minor.

    Tool Count4/5

    Three tools is minimal but appropriate for a focused wrapper around the Diffblue Cover CLI. Each tool covers a real workflow stage, leaving little room for redundancy, though the server might feel slightly thin for broader use cases.

    Completeness4/5

    The tool surface covers the core workflow: diagnose issues, generate tests, and refactor/fix problems. Minor gaps exist, such as lack of explicit status or configuration tools, but these are not essential and can be worked around via the 'args' parameters.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers