Gradle MCP Server

Gradle MCP Server

MCP server for programmatic Gradle project inspection and task execution.

38
Stars
4
Forks
38
Watchers
3
Issues
Gradle MCP Server acts as a Model Context Protocol (MCP) server enabling AI tools to interact with Gradle projects through structured APIs. It allows clients to inspect project details, execute Gradle tasks, and run tests while retrieving detailed results in JSON format. This server supports both information querying and task orchestration, designed to integrate with platforms like VSCode extensions and Claude Desktop. It leverages the Gradle Tooling API to provide comprehensive build and test insights.

Key Features

Structured inspection of Gradle project metadata
Retrieval of build structure and environment details
Querying available tasks
Remote execution of any Gradle task with custom arguments
Hierarchical test execution with detailed JSON reporting
Filtering and truncating of test output logs
Support for test selection via patterns
Configurable output inclusion and log line limits
Integration guidance for VSCode and Claude Desktop clients
Cross-platform installation and usage

Use Cases

Programmatically inspecting the structure of Gradle-based projects
Enabling AI assistants to recommend or execute Gradle tasks
Automating the retrieval of environment and project information
Remote task execution in continuous integration or development workflows
Hierarchical and detailed test result reporting for test analytics
Facilitating code review or analysis by exposing build and test info
Enhancing developer IDEs or extensions with Gradle management features
Debugging and troubleshooting build/test failures via detailed logs
Custom tooling that requires interaction with Gradle projects at scale
Integrating Gradle project insights into chat-based or agent-powered developer workflows

README

Gradle MCP Server

A Model Context Protocol (MCP) server that enables AI tools to interact with Gradle projects programmatically. It uses the Gradle Tooling API to query project information and execute tasks.

Features

Provides tools for:

  • Inspecting Projects: Retrieve detailed, structured information about a Gradle project, including:
    • Build structure (root project, subprojects)
    • Available tasks (in the root project)
    • Build environment details (Gradle version, Java version, JVM args)
    • Root project details (name, path, description, build script path)
    • Allows selective querying of information categories.
  • Executing Tasks: Run specific Gradle tasks (e.g., clean, build, assemble) with custom arguments, JVM arguments, and environment variables. Returns formatted text output including stdout/stderr and status.
  • Running Tests Hierarchically: Execute Gradle test tasks (e.g., test) and receive detailed, structured results in a hierarchical JSON format (Suite -> Class -> Method). Includes:
    • Outcome (passed, failed, skipped) for each node.
    • Failure messages and filtered/truncated output lines (stdout/stderr) primarily for failed tests (configurable).
    • Support for test filtering via patterns (--tests).
    • Options to control output inclusion and log line limits.

Requirements

  • JDK 17 or higher
  • For command-line installation:
    • Linux/macOS: curl
    • Windows: PowerShell 5+

Installation

Recommended Method: Command-Line Download

This method downloads the server JAR to a standard location in your home directory.

Linux / macOS (requires curl):

bash
# Downloads gradle-mcp-server-all.jar to ~/mcp-servers/gradle-mcp-server/
TARGET_DIR="$HOME/mcp-servers/gradle-mcp-server" && mkdir -p "$TARGET_DIR" && curl -fSL -o "$TARGET_DIR/gradle-mcp-server-all.jar" "https://github.com/IlyaGulya/gradle-mcp-server/releases/latest/download/gradle-mcp-server-all.jar" && echo "Downloaded to '$TARGET_DIR'." || echo "Download failed."

Windows (PowerShell 5+):

powershell
# Downloads gradle-mcp-server-all.jar to %USERPROFILE%\mcp-servers\gradle-mcp-server\
$targetDir = Join-Path $env:USERPROFILE "mcp-servers\gradle-mcp-server"; if (-not (Test-Path $targetDir)) { New-Item -ItemType Directory -Path $targetDir -Force | Out-Null }; $outFile = Join-Path $targetDir "gradle-mcp-server-all.jar"; Write-Host "Downloading..."; Invoke-WebRequest -Uri "https://github.com/IlyaGulya/gradle-mcp-server/releases/latest/download/gradle-mcp-server-all.jar" -OutFile $outFile -ErrorAction Stop; Write-Host "Downloaded to '$targetDir'."

Alternative Method: Manual Download

  1. Go to the GitHub Releases page.
  2. Download the gradle-mcp-server-all.jar asset from the latest release.
  3. Save the downloaded JAR file to a stable location. We recommend:
    • macOS / Linux: ~/mcp-servers/gradle-mcp-server/
    • Windows: %USERPROFILE%\mcp-servers\gradle-mcp-server\ (Create the directory if it doesn't exist).

MCP Client Configuration

To use this server with an MCP client (like the VSCode extension or Claude Desktop app), you need to add its configuration to the client's settings file.

  1. Locate the settings file:

    • VSCode Extension (Example for macOS): /Users/<YourUsername>/Library/Application Support/VSCodium/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json (Adjust path for standard VSCode or other OS).
    • Claude Desktop App (Example for macOS): ~/Library/Application Support/Claude/claude_desktop_config.json (Adjust path for other OS).
  2. Add the server configuration: Edit the JSON file and add the following entry inside the mcpServers object. Replace <absolute_path_to_home> with the actual absolute path to your home directory.

    json
    {
      "mcpServers": {
        "gradle-mcp-server": {
          "command": "java",
          "args": [
            "-jar",
            "<absolute_path_to_home>/mcp-servers/gradle-mcp-server/gradle-mcp-server-all.jar"
          ],
          "env": {},
          "disabled": false,
          "autoApprove": []
        }
      }
    }
    

Usage

  1. After adding the configuration, restart your MCP client (e.g., reload the VSCode window or restart the Claude app).
  2. The "Gradle MCP Server" and its tools (listed below) should now be available for use within the client. The server runs automatically via stdio when needed by the client.

Available Tools

The server exposes the following tools via the Model Context Protocol:

  1. get_gradle_project_info

    • Description: Retrieves specific details about a Gradle project, returning structured JSON. Allows requesting only necessary information categories (buildStructure, tasks, environment, projectDetails). If requestedInfo is omitted, all categories are fetched.
    • Key Inputs:
      • projectPath (string, required): Absolute path to the Gradle project root.
      • requestedInfo (array of strings, optional): List of categories to retrieve (e.g., ["tasks", "environment"]).
    • Output: JSON object (GradleProjectInfoResponse) containing the requested data fields and potential errors.
  2. execute_gradle_task

    • Description: Executes general Gradle tasks (like build, clean). Not recommended for running tests if detailed results are needed (use the test tool instead). Returns formatted text output summarizing execution and including captured stdout/stderr.
    • Key Inputs:
      • projectPath (string, required): Absolute path to the Gradle project root.
      • tasks (array of strings, required): List of task names to execute (e.g., ["clean", "assemble"]).
      • arguments (array of strings, optional): Gradle command-line arguments (e.g., ["--info", "-PmyProp=value"]).
      • jvmArguments (array of strings, optional): JVM arguments for Gradle (e.g., ["-Xmx4g"]).
      • environmentVariables (object, optional): Environment variables for the build (e.g., {"CI": "true"}).
    • Output: Formatted text response with execution summary, final status (Success/Failure), and combined stdout/stderr.
  3. run_gradle_tests

    • Description: Executes Gradle test tasks and returns results as a structured JSON hierarchy (Suite > Class > Test). Filters/truncates output lines by default, focusing on failures. Provides options to include output for passed tests and control log limits.
    • Key Inputs:
      • projectPath (string, required): Absolute path to the Gradle project root.
      • gradleTasks (array of strings, optional): Test tasks to run (defaults to ["test"]).
      • arguments (array of strings, optional): Additional Gradle arguments (verbose flags like --info/--debug are filtered out).
      • environmentVariables (object, optional): Environment variables for the test execution.
      • testPatterns (array of strings, optional): Test filter patterns passed via --tests (e.g., ["*.MyTestClass"]).
      • includeOutputForPassed (boolean, optional): Set to true to include output for passed tests (default false).
      • maxLogLines (integer, optional): Override the default limit on output lines per test (0 for unlimited).
      • defaultMaxLogLines (integer, optional): Set the default output line limit (defaults internally to 100).
    • Output: JSON object (GradleHierarchicalTestResponse) containing execution details, overall build success status, informative notes, and the test_hierarchy tree. Each node includes display name, type, outcome, failure message (if any), filtered/truncated output lines, and children.

Development

Building from Source

If you want to build the server yourself:

  1. Clone the repository.
  2. Ensure you have JDK 17 or higher installed.
  3. Run the build command:
    bash
    ./gradlew shadowJar
    
  4. The self-contained JAR (gradle-mcp-server-<version>-all.jar) will be created in the build/libs/ directory. You can then configure your MCP client to use this JAR (remember to use the correct absolute path and version in the configuration).

Running Locally (for Testing)

You can run the built JAR directly from the command line for testing purposes. The server communicates over stdio by default.

bash
# Run the packaged JAR in stdio mode
java -jar build/libs/gradle-mcp-server-<version>-all.jar

# Run with specific arguments (see Configuration section)
java -jar build/libs/gradle-mcp-server-<version>-all.jar --sse 8080 --debug

Configuration (Command-Line Arguments)

When running the server JAR directly (primarily for testing/development), its behavior can be controlled via command-line arguments:

  • --stdio: (Default) Use standard input/output for MCP communication.
  • --sse [port]: Run as an SSE server on the specified port (defaults to 3001 if port is omitted). Connect MCP clients (like the Anthropic Console Inspector) to http://localhost:<port>/sse.
  • --debug: Enable verbose logging on the server console.

Dependencies

Star History

Star History Chart

Repository Owner

IlyaGulya
IlyaGulya

User

Repository Details

Language Kotlin
Default Branch master
Size 150 KB
Contributors 2
License MIT License
MCP Verified Nov 12, 2025

Programming Languages

Kotlin
100%

Tags

Join Our Newsletter

Stay updated with the latest AI tools, news, and offers by subscribing to our weekly newsletter.

We respect your privacy. Unsubscribe at any time.

Related MCPs

Discover similar Model Context Protocol servers

  • Maven Tools MCP Server

    Maven Tools MCP Server

    Universal Maven Central dependency intelligence server for JVM build tools via the Model Context Protocol.

    Maven Tools MCP Server provides an MCP-compliant API delivering rich Maven Central dependency intelligence for JVM build tools like Maven, Gradle, SBT, and Mill. It enables AI assistants to instantly analyze, interpret, and recommend updates, health checks, and maintenance insights by reading maven-metadata.xml directly from Maven Central. With Context7 integration, it supports orchestration and documentation, enabling bulk analysis, stable version filtering, risk assessment, and rapid cached responses. Designed for seamless integration into AI workflows via the Model Context Protocol.

    • 14
    • MCP
    • arvindand/maven-tools-mcp
  • MCP Claude Code

    MCP Claude Code

    Claude Code-like functionality via the Model Context Protocol.

    Implements a server utilizing the Model Context Protocol to enable Claude Code functionality, allowing AI agents to perform advanced codebase analysis, modification, and command execution. Supports code understanding, file management, and integration with various LLM providers. Offers specialized tools for searching, editing, and delegating tasks, with robust support for Jupyter notebooks. Designed for seamless collaboration with MCP clients including Claude Desktop.

    • 281
    • MCP
    • SDGLBL/mcp-claude-code
  • MCP Language Server

    MCP Language Server

    Bridge codebase navigation tools to AI models using MCP-enabled language servers.

    MCP Language Server implements the Model Context Protocol, allowing MCP-enabled clients, such as LLMs, to interact with language servers for codebase navigation. It exposes standard language server features—like go to definition, references, rename, and diagnostics—over MCP for seamless integration with AI tooling. The server supports multiple languages by serving as a proxy to underlying language servers, including gopls, rust-analyzer, and pyright.

    • 1,256
    • MCP
    • isaacphi/mcp-language-server
  • MCP Server for Asana

    MCP Server for Asana

    Bridge Asana's API with Model Context Protocol tools for seamless task management.

    MCP Server for Asana provides a Model Context Protocol (MCP) compliant interface to the Asana API, enabling direct interaction with Asana from MCP clients such as Claude Desktop. It offers tools to list, search, retrieve, and create tasks and projects within Asana workspaces, with options for both read and write operations. The server supports advanced task filtering, project searching, and read-only modes for secure testing. Integration facilitates automation and streamlined project management within AI-powered environments.

    • 107
    • MCP
    • roychri/mcp-server-asana
  • Gitingest-MCP

    Gitingest-MCP

    An MCP server for extracting GitHub repository summaries, structure, and file content.

    Gitingest-MCP serves as a Model Context Protocol (MCP) server compatible with context-aware AI tools. It enables MCP clients such as Claude Desktop, Cline, Cursor, and others to quickly and efficiently extract key information from GitHub repositories, including summaries, the directory tree, and individual file contents. It supports installation via Smithery or manual configuration and is designed for seamless integration into the MCP client ecosystem. Documentation provides guidance on installation, configuration, and debugging.

    • 131
    • MCP
    • puravparab/Gitingest-MCP
  • GhidrAssistMCP

    GhidrAssistMCP

    Bringing Model Context Protocol server connectivity to Ghidra for AI-assisted reverse engineering.

    GhidrAssistMCP is a Ghidra extension providing a Model Context Protocol (MCP) server that allows AI assistants and other tools to interact programmatically with Ghidra's reverse engineering platform. It offers a standardized API for querying program data, managing tool interactions, and enabling real-time analysis features. The extension features a configurable UI, built-in logging, and dynamic management of 31 specialized analysis tools.

    • 337
    • MCP
    • jtang613/GhidrAssistMCP
  • Didn't find tool you were looking for?

    Be as detailed as possible for better results