gradle
A Model Context Protocol (MCP) server to enable AI tools to interact with Gradle projects programmatically.
claude mcp add --transport stdio ilyagulya-gradle-mcp-server java -jar <absolute_path_to_home>/mcp-servers/gradle-mcp-server/gradle-mcp-server-all.jar
How to use
The Gradle MCP Server exposes tools that let you inspect a Gradle project's structure, run tasks, and execute tests with detailed results. You can query the server for a structured view of a project (build structure, environment, tasks, and project details), execute Gradle tasks such as clean or build and receive the combined stdout/stderr, and run tests to obtain a hierarchical JSON report of suites, classes, and test methods including outcomes and failure messages. Typical workflows involve pointing the server at a local Gradle project, selecting the information you need, and then using the results to inform your AI-assisted code analysis or automated workflows. The available tools are: get_gradle_project_info, execute_gradle_task, and run_gradle_tests. Use get_gradle_project_info when you want a snapshot of the project, use execute_gradle_task for generic task execution, and use run_gradle_tests when you need structured test results with optional output control for failures.
How to install
Prerequisites:
- JDK 17 or higher
- Linux/macOS: curl installed
- Windows: PowerShell 5+
-
Download the Gradle MCP Server JAR (recommended method): Linux/macOS (requires curl):
# 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+):
# 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):
- Go to the GitHub Releases page and download the gradle-mcp-server-all.jar asset from the latest release.
- Save the downloaded JAR to a stable location, e.g. "~/mcp-servers/gradle-mcp-server/" on macOS/Linux or "%USERPROFILE%\mcp-servers\gradle-mcp-server" on Windows.
-
Prepare the MCP client configuration (example shown in the README):
- In your MCP client settings, add a server entry similar to:
{ "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": [] } } } -
Run the server via the MCP client as needed. The server runs on demand using stdio when the client requests tools.
Prerequisites for running a server from source (optional): ensure you can run a Java 17+ runtime and that the jar is accessible from the path specified in the client configuration.
Additional notes
Tips and common issues:
- Ensure JAVA_HOME points to a Java 17+ JDK installation.
- If the server cannot read a Gradle project, verify that the provided projectPath is an absolute path and that the Gradle project is accessible by the host.
- For execute_gradle_task, you can supply additional Gradle arguments and JVM arguments as needed; environmentVariables are applied for the duration of the task.
- When using run_gradle_tests, you can filter tests with testPatterns (e.g., ["*.MyTestClass"]). You can also adjust includeOutputForPassed and maxLogLines to balance detail vs. verbosity.
- If the client reports that the server is unavailable, verify that the jar path in the MCP client configuration is correct and that the client has permission to execute Java with the specified jar.
- Consider pinning to a specific Gradle version in your project if you rely on features introduced in newer Gradle releases; the server uses the Gradle Tooling API to query project information and execute tasks.
Related MCP Servers
burp-ai-agent
Burp Suite extension that adds built-in MCP tooling, AI-assisted analysis, privacy controls, passive and active scanning and more
FantasyPremierLeague
Fantasy Premier League Kotlin/Compose Multiplatform sample
mcp
MCP Server for Burp
paiml -agent-toolkit
Pragmatic AI Labs MCP Agent Toolkit - An MCP Server designed to make code with agents more deterministic
mcp-kotlin-sdk
Kotlin implementation of the Model Context Protocol (MCP)
k8s-ai
AI-Powered Kubernetes Management System: A platform combining natural language processing with Kubernetes management. Users can perform real-time diagnostics, resource monitoring, and smart log analysis. It simplifies Kubernetes management through conversational AI, providing a modern alternative