MCP Scaffold analyzes your existing Spring Boot application and generates @McpTool-annotated wrapper classes that expose your repositories and services to AI assistants via the Model Context Protocol.
| Guide | Description |
|---|---|
| Getting Started | Step-by-step setup guide |
| Configuration Reference | All YAML options explained |
| How It Works | Architecture and internals |
- Zero manual annotation — Works with your existing code, no changes required
- Smart descriptions — Auto-generated from Javadoc, method names, and entity metadata
- Read-only detection — Automatically identifies safe operations
- Regeneratable — Run again whenever your code changes
<dependencies>
<!-- MCP Annotations (required for generated code) -->
<dependency>
<groupId>org.springaicommunity</groupId>
<artifactId>mcp-annotations</artifactId>
<version>0.7.0</version>
</dependency>
<!-- Spring AI MCP Server -->
<dependency>
<groupId>org.springframework.ai</groupId>
<artifactId>spring-ai-starter-mcp-server-webmvc</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>io.github.arvindand</groupId>
<artifactId>mcp-scaffold-maven-plugin</artifactId>
<version>0.1.1</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>mvn mcp-scaffold:suggest
mv mcp-scaffold-suggested.yaml mcp-scaffold.yamlmvn compileYour MCP tools are generated in target/generated-sources/mcp — ready for AI assistants to use!
Given this repository:
@Repository
public interface OwnerRepository extends JpaRepository<Owner, Long> {
/**
* Find owners by last name (case-insensitive, partial match).
*/
List<Owner> findByLastNameContainingIgnoreCase(String lastName);
}MCP Scaffold generates:
@Component
public class OwnerRepositoryMcpTools {
@McpTool(
name = "owner_find_by_last_name_containing_ignore_case",
description = "Find owners by last name (case-insensitive, partial match). " +
"Returns Owner with: id, firstName, lastName, address, city, telephone. [Read-only]"
)
public List<Owner> findByLastNameContainingIgnoreCase(
@McpToolParam(description = "The last name to search for", required = true)
String lastName
) {
return ownerRepository.findByLastNameContainingIgnoreCase(lastName);
}
}The generated descriptions include:
- Javadoc comments
- Entity field information
- Enum values for enum parameters
- Read-only markers
Create mcp-scaffold.yaml in your project root (or use mvn mcp-scaffold:suggest to generate one):
mcp:
scaffold:
scan:
packages:
- com.example.repository
- com.example.service
filter:
include-patterns:
- "*Repository"
- "*Service"
exclude-methods:
- flush
- deleteAll
descriptions:
include-javadoc: true
include-entity-fields: true
include-enum-values: trueFull configuration reference →
The Petclinic example is a complete working demo you can run:
./mvnw clean install
./mvnw -pl mcp-scaffold-examples/petclinic-mcp spring-boot:runThen connect Claude Desktop or any MCP client to http://localhost:8080/sse.
Full example with testing instructions →
- Java 21 or later
- Maven 3.9+
- Spring Boot 3.x application
- Spring AI 1.1.0+ with MCP server starter
git clone https://github.com/arvindand/mcp-scaffold.git
cd mcp-scaffold
./mvnw clean installApache License 2.0 — see LICENSE for details.
Author: Arvind Menon