Skip to content

rnett/gradle-mcp

Repository files navigation

Maven Central Version Maven snapshots Documentation GitHub License

Gradle MCP server

A MCP server for Gradle. Tools include introspecting projects, running tasks, and running tests.

Features
  • Token-efficient context use. Tools use token efficient formats (i.e. not JSON) and only include the minimum relevant information. Details are relegated to specialized lookup tools.
  • Access to full test output, which is not typically possible when running from a terminal.
  • Supports publishing Develocity Build Scans, using elicitation to get permission to publish to the public instance.
  • Tools for running and managing Gradle builds in the background. Helpful for running dev servers, etc.
  • Customization of JVM args, environment variables, and system properties. Plus, the ability to source environment variables from the shell instead of inheriting them - useful on macOS where IntelliJ or Gradle may not start with the right env vars.

Configuration

The GRADLE_MCP_PROJECT_ROOT environment variable can be set to provide a default Gradle project root. This is used if no project root is specified in a tool call and there isn't exactly one MCP root configured.

Getting started

Important

JDK 17 or higher is required to run gradle-mcp. You can use JBang to install JDKs too: docs.

Use jbang:

jbang run --fresh dev.rnett.gradle-mcp:gradle-mcp:+ stdio
{
  "mcpServers": {
    "gradle": {
      "command": "jbang",
      "args": [
        "run",
        "--fresh",
        "dev.rnett.gradle-mcp:gradle-mcp:+",
        "stdio"
      ]
    }
  }
}

See the documentation for more details.