The Gradle MCP Server enables AI assistants to build, test, and manage Gradle projects through automated execution, real-time monitoring, and configuration management.
Core Capabilities:
Project & Task Management: Discover all Gradle projects in the workspace, list available tasks with optional filtering by group and descriptions, and execute single or multiple tasks with full argument support using standard Gradle path notation (e.g., ':app:build')
Safe Build Operations: Run any Gradle task while protecting against accidental deletion through a dedicated clean tool for removing build artifacts
Daemon Control: Monitor running Gradle daemons (PID, status, memory usage) and stop daemons to free resources or resolve issues
Configuration Inspection: View detailed Gradle settings including JVM arguments, memory configuration, daemon status, parallel execution, caching, maximum worker count, distribution URL, and version information
Real-Time Monitoring: Access a web dashboard at localhost:3333 for live build progress, daemon status, active builds, and searchable build logs with WebSocket updates
Structured Error Reporting: Receive LLM-optimized error responses with concise summaries, failed task details, and deduplicated compilation errors with clean file paths
Environment Configuration: Customize behavior through environment variables for project root, wrapper location, and JVM options
Use Cases: Building and testing projects conversationally, troubleshooting build failures with structured analysis, managing dependencies and configurations, monitoring build performance and daemon health, and automating development workflows.
Provides tools for interacting with Gradle projects, including listing projects and tasks, executing build tasks, running tests, and cleaning build artifacts through the Gradle Wrapper.
Gradle MCP Server
A Model Context Protocol (MCP) server for seamless Gradle integration with AI assistants
Empower your AI coding assistant to build, test, and manage Gradle projects with real-time monitoring
Features • Installation • Quick Start • Web Dashboard • API Reference • Contributing
✨ Features
🛠️ Build Automation
Project Discovery — Automatically detect and list all Gradle projects in your workspace
Task Management — Browse and execute any Gradle task with full argument support
Multi-Task Execution — Run multiple tasks in a single command
Safe Cleaning — Dedicated clean tool prevents accidental artifact deletion
📊 Real-Time Monitoring
Live Progress Tracking — Visual progress updates during task execution
Web Dashboard — Browser-based monitoring with WebSocket updates
Daemon Management — Monitor and control Gradle daemon processes
Build Logs — Searchable, real-time build log viewer
🔧 Configuration & Diagnostics
Config Inspection — View JVM args, daemon settings, and Gradle version
Memory Monitoring — Track daemon memory usage and health
Structured Error Output — LLM-friendly error responses with deduplicated compilation errors and task failure summaries
📸 Web Dashboard
The Gradle MCP Server includes a powerful web dashboard for real-time build monitoring. The dashboard starts automatically when the server runs and is accessible at http://localhost:3333.
Dashboard Overview
The main dashboard provides:
Daemon Status — Real-time view of running Gradle daemons with PID, status, and memory usage
Active Builds — Live tracking of currently executing tasks
Quick Actions — One-click daemon management (stop all, refresh status)
Auto-Refresh — WebSocket-powered updates without manual refresh
Build Logs Viewer
The logs viewer offers:
Real-Time Streaming — Watch build output as it happens
Log Filtering — Search and filter through build history
Clear Logs — One-click log clearing for fresh sessions
Persistent History — Logs persist across page refreshes during a session
📦 Installation
Requirements
Python 3.10+
Gradle project with wrapper (
gradlew/gradlew.bat)MCP-compatible client (e.g., Claude Desktop, Cursor, VS Code with Copilot)
Install from Source
🚀 Quick Start
1. Start the Server
The server will:
Auto-detect the Gradle wrapper in the current directory
Start the web dashboard at
http://localhost:3333(or higher if port already occupied)Begin listening for MCP client connections
2. Configure Your MCP Client
Add the server to your MCP client configuration. For example, in Claude Desktop's claude_desktop_config.json:
3. Start Building!
Your AI assistant can now execute Gradle commands:
🔧 Configuration
Environment Variables
Variable | Description | Default |
| Root directory of the Gradle project | Current directory |
| Path to Gradle wrapper script | Auto-detected |
| JVM options for Gradle client | — |
| General Java options | — |
Example Configuration
📚 MCP Tools API
Project & Task Management
list_projects()
List all Gradle projects in the workspace.
Returns: List of projects with name, path, and description
list_project_tasks(project, include_descriptions, group)
List available tasks for a project, optionally filtered by group.
Parameter | Type | Description |
|
| Project path (e.g., |
|
| Include task descriptions (default: |
|
| Filter by task group (e.g., |
Returns: Grouped list of tasks
run_task(task, args)
Execute one or more Gradle tasks.
Parameter | Type | Description |
|
| Task(s) to run. Examples: |
|
| Additional Gradle arguments (e.g., |
Returns: TaskResult with:
success: bool— Whether the task completed successfullyerror: ErrorInfo | None— Structured error information (see Structured Error Output)
⚠️ Note: Cleaning tasks are blocked — use the
cleantool instead.
clean(project)
Clean build artifacts for a project.
Parameter | Type | Description |
|
| Project path (e.g., |
Returns: TaskResult with:
success: bool— Whether clean completed successfullyerror: ErrorInfo | None— Structured error information (see Structured Error Output)
Daemon Management
daemon_status()
Get status of all running Gradle daemons.
Returns: Running status, list of daemon info (PID, status, memory), and any errors
stop_daemon()
Stop all Gradle daemons. Useful for freeing memory or resolving daemon issues.
Returns: Success status and error message if failed
Configuration
get_gradle_config()
Get current Gradle configuration including memory settings.
Returns: Configuration object with:
jvm_args— JVM arguments from gradle.propertiesdaemon_enabled— Whether daemon is enabledparallel_enabled— Whether parallel execution is enabledcaching_enabled— Whether build caching is enabledmax_workers— Maximum worker countdistribution_url— Gradle distribution URLgradle_version— Gradle version
💡 Usage Examples
With MCP Client
As Python Library
🏗️ Architecture
Safety by Design
Separated Cleaning — The
run_tasktool blocks all cleaning operations (clean,cleanBuild, etc.). Use the dedicatedcleantool for artifact removal.Gradle Wrapper — Always uses the project's Gradle wrapper for version consistency
Progress Reporting — Real-time progress via MCP protocol
Structured Error Output
The run_task and clean tools return structured error information optimized for LLM consumption:
Example response:
Key features:
Deduplication — Identical errors from multiple targets (e.g., iOS Arm64 + Simulator) are merged
Clean paths —
file://prefix is stripped from file pathsConcise summaries — Human-readable summary with task/error/file counts
Token efficient — Structured data instead of raw build output
🧪 Development
Setup Development Environment
Run Tests
Code Quality
Project Structure
🤝 Contributing
Contributions are welcome! Here's how you can help:
Fork the repository
Create a feature branch (
git checkout -b feature/amazing-feature)Commit your changes (
git commit -m 'Add amazing feature')Push to the branch (
git push origin feature/amazing-feature)Open a Pull Request
Ideas for Contribution
Additional build system support (Maven, Bazel)
Enhanced error visualization in dashboard
Build statistics and history
Custom task presets
📄 License
This project is licensed under the MIT License — see the LICENSE file for details.
Built with ❤️ for the Gradle and AI community