SP

Spring Initializr MCP Server Generate Spring Boot Projects

Generate Spring Boot projects with custom dependencies, Java versions, and structures using the MCP server, ask your AI assistant to create them instantly.

Quick Install
npx -y @hpalma/springinitializr-mcp

Overview

This MCP (Model Context Protocol) server wraps Spring Initializr and exposes it as an MCP-compatible service so AI assistants and other automation agents can request Spring Boot projects programmatically. Instead of manually clicking through the Spring Initializr UI, you can ask your assistant to generate projects with custom group/artifact IDs, dependency selections, build tools, Java versions and packaging — and retrieve a ready-to-use archive.

The server is useful when you want reproducible, on-demand project scaffolding from a bot, CI job, or tooling pipeline. It translates high-level project requests into Spring Initializr archive exports and returns metadata and ZIP artifacts that are ready for build and development.

Features

  • MCP-compatible API for programmatic project generation
  • Create Spring Boot projects with custom:
    • Dependencies (Spring starters and community libs)
    • Java versions (e.g., 8, 11, 17, 21)
    • Build tools (Maven or Gradle)
    • Packaging (jar or war)
    • Language (Java, Kotlin, Groovy)
  • Returns project metadata and downloadable ZIP archives
  • Intended for integration with chat assistants and automation flows
  • Can be run locally or containerized for deployment

Installation / Configuration

Clone the repository, build and run locally, or use Docker for quick startups.

Clone and build with Maven:

git clone https://github.com/hpalma/springinitializr-mcp.git
cd springinitializr-mcp
./mvnw -DskipTests package
java -jar target/springinitializr-mcp-*.jar

Run with Docker:

# Build the image
docker build -t springinitializr-mcp .

# Run the container on port 8080
docker run -p 8080:8080 springinitializr-mcp

Configuration

  • The server uses Spring Boot configuration (application.yml / application.properties). You can override settings with environment variables (SPRING_*) when running in containers.
  • Typical configuration keys you may want to set:
    • server.port — network port the HTTP service listens on
    • spring.initializr.* — Spring Initializr-specific defaults (Java version, boot version)
  • Check the repository’s application.yml for the exact property names used by this project.

Note: API paths and exact configuration keys are available in the repository. Adapt host, port and endpoints to your deployment.

Available Tools / Resources

The MCP server exposes a small set of HTTP endpoints compatible with MCP-style tooling. Typical resources provided:

  • Metadata endpoint (provides available dependencies, versions and configuration options)
  • Generate endpoint (accepts a project descriptor and returns a ZIP archive or download link)
  • Health / info endpoints (standard Spring Boot endpoints may be enabled)

Example request fields (common across Spring Initializr integrations):

FieldDescription
groupIdJava package group ID (e.g., com.example)
artifactIdProject artifact name
nameProject display name
descriptionShort description
packageNameBase package name
dependenciesComma-separated list of dependency IDs (e.g., web, data-jpa)
javaVersionJava version (11, 17, etc.)
packagingjar or war
buildToolmaven or gradle
languagejava, kotlin or groovy

Example curl (generate project ZIP)

curl -X POST "http://localhost:8080/generate" \
  -H "Content-Type: application/json" \
  -o my-app.zip \
  -d '{
    "groupId":"com.example",
    "artifactId":"demo",
    "name":"demo",
    "description":"Demo project",
    "packageName":"com.example.demo",
    "dependencies":"web,data-jpa",
    "javaVersion":"17",
    "packaging":"jar",
    "buildTool":"maven",
    "language":"java"
  }'

Adjust the URL path (/generate) if your deployment uses a different route — see the repository for exact endpoints.

Use Cases

  • Assistant-driven project creation
    • Ask an AI assistant inside your chat environment to scaffold a service: “Create a Spring Boot microservice using Java 17 with Spring Web, Spring Data JPA and H2.” The assistant formats an MCP request and pulls a ZIP created by this server.
  • CI/CD project templates
    • Automatically scaffold starter projects in a repository creation pipeline with a predefined set of dependencies and build tooling.
  • Training and workshops
    • Generate multiple starter projects for students with different stacks (e.g., Spring Web + Thymeleaf vs WebFlux + R2DBC) using scripted MCP requests.
  • Multi-module or custom structures
    • Use the server to produce base modules (API, service, common) by making consecutive generation requests and assembling them into a multi-module layout in automation scripts.

Getting Help and Contributing

  • Source code and issues: https://github.com/hpalma/springinitial
Tags:ai-ml