mcp-server-builder

riccardocinti/mcp-server-builder

3.2

If you are the rightful owner of mcp-server-builder and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

The MCP Server Build Project is a Model Context Protocol server designed to automate the build process for software projects using various build tools.

Tools
1
Resources
0
Prompts
0

MCP Server Build Project

A Model Context Protocol (MCP) server that provides build automation capabilities for software projects. This server can analyze, compile, and package projects using various build tools including Maven, Gradle, and NPM.

Features

  • Multi Build Tool Support: Maven, Gradle, NPM
  • Smart Project Analysis: Automatic detection of build tool and configuration
  • Comprehensive Error Handling: Detailed failure analysis and recovery suggestions
  • Rich Build Metadata: Complete artifact information for downstream processes

Tools

buildProject

Analyzes and builds a software project in a specified directory.

Parameters:

  • projectPath (string, required): Absolute path to the project directory

Returns:

{
  "success": true,
  "buildTool": "maven",
  "javaVersion": "21",
  "projectName": "spring-petclinic",
  "projectVersion": "3.3.0",
  "artifacts": [
    {
      "path": "/path/to/project/target/spring-petclinic-3.3.0.jar",
      "type": "executable-jar",
      "size": "45.2MB"
    }
  ],
  "buildDuration": "2m 15s",
  "mainClass": "org.springframework.samples.petclinic.PetClinicApplication",
  "port": "8080",
  "buildCommands": ["mvn clean compile", "mvn package"],
  "dockerHints": {
    "baseImage": "openjdk:21-jre-slim",
    "exposedPort": "8080",
    "healthCheckPath": "/actuator/health"
  }
}

Error Response:

{
  "success": false,
  "errorType": "BUILD_TOOL_DETECTION_FAILED",
  "message": "No supported build tool found in project directory",
  "suggestions": ["Ensure pom.xml, build.gradle, or package.json exists in the project root"]
}

Supported Project Types

Build ToolConfiguration FileJava VersionsNotes
Mavenpom.xml8, 11, 17, 21Spring Boot auto-detection
Gradlebuild.gradle, build.gradle.kts8, 11, 17, 21Kotlin DSL support
NPMpackage.jsonNode 16, 18, 20, 22React, Vue, Angular detection

Prerequisites

  • Java 21 or higher
  • Maven 3.9+ (for Maven projects)
  • Gradle 8.0+ (for Gradle projects)
  • Node.js 18+ and NPM 9+ (for NPM projects)
  • Docker (if using with Docker MCP Server)

Installation

Using Maven

git clone https://github.com/riccardocinti/mcp-server-builder-project.git
cd mcp-server-builder-project
mvn clean install

Configuration

Application Properties

# application.yml
mcp:
  build:
    timeout: 300000  # 5 minutes
    max-concurrent-builds: 3
    temp-directory: "/tmp/mcp-builds"
    preserve-artifacts: true

# Virtual threads configuration  
spring:
  threads:
    virtual:
      enabled: true

Environment Variables

export MCP_BUILD_TIMEOUT=300000
export MCP_BUILD_TEMP_DIR="/tmp/mcp-builds"
export JAVA_HOME="/usr/lib/jvm/java-21-openjdk"
export MAVEN_HOME="/usr/share/maven"
export GRADLE_HOME="/usr/share/gradle"

Usage Example

With MCP Client

{
  "method": "tools/call",
  "params": {
    "name": "buildProject",
    "arguments": {
      "projectPath": "/home/user/projects/spring-petclinic"
    }
  }
}

With Spring AI Integration

@RestController
public class BuildController {
    
    @Autowired
    private ChatClient chatClient;
    
    @PostMapping("/build")
    public ResponseEntity<String> buildProject(@RequestBody BuildRequest request) {
        return chatClient.prompt()
            .user("Build the project at: " + request.getProjectPath())
            .functions("buildProject")
            .call()
            .content();
    }
}

Integration with Other MCP Servers

This Build MCP Server is designed to work seamlessly with:

  • GitHub MCP Server: Clone β†’ Build workflow
  • Docker MCP Server: Build β†’ Containerize workflow
  • Deployment MCP Servers: Build β†’ Deploy workflow

Complete Workflow Example

# 1. Clone with GitHub MCP
curl -X POST http://localhost:8080/mcp/github/clone \
  -d '{"repositoryUrl": "https://github.com/spring-projects/spring-petclinic.git"}'

# 2. Build with Build MCP  
curl -X POST http://localhost:8080/mcp/build/project \
  -d '{"projectPath": "/tmp/spring-petclinic"}'

# 3. Dockerize with Docker MCP
curl -X POST http://localhost:8080/mcp/docker/containerize \
  -d '{"buildResult": "..."}'

Error Handling

The server provides detailed error categorization:

Error TypeDescriptionCommon Causes
PROJECT_DISCOVERY_FAILEDCannot find or access projectInvalid path, permissions
BUILD_TOOL_DETECTION_FAILEDNo supported build tool foundMissing build files
BUILD_ENVIRONMENT_FAILEDBuild environment setup issuesMissing tools, wrong versions
DEPENDENCY_RESOLUTION_FAILEDCannot resolve dependenciesNetwork issues, missing repos
COMPILATION_FAILEDSource code compilation errorsSyntax errors, missing deps
ARTIFACT_DISCOVERY_FAILEDCannot find generated artifactsBuild incomplete, wrong paths

Performance

  • Streaming Output: Real-time build log streaming for long-running builds
  • Resource Management: Automatic cleanup of temporary build artifacts
  • Build Caching: Leverages build tool native caching (Maven local repo, Gradle cache)

License

This project is licensed under the MIT License - see the file for details.

Related Projects

Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   MCP Client    │───▢│  Build MCP       │───▢│ External Tools  β”‚
β”‚  (Spring AI)    β”‚    β”‚    Server        β”‚    β”‚ (Maven/Gradle)  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                              β”‚
                              β–Ό
                       β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                       β”‚  Build Result   β”‚
                       β”‚   Artifacts     β”‚
                       β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜