About Spring Boot MCP Starter
Spring Boot MCP Starter is an MCP server published by rameshreddy-adutla in the Files category: 将 Spring Boot 微服务快速转换为支持 Streamable HTTP 传输协议的 MCP Server。支持WebMVC和WebFlux.
The repository has 1 stars and 0 forks, with the last commit 7 months ago. Six months or more without a commit doesn't mean the server is broken, but check the open issues before depending on it in production.
Install
git clone https://github.com/rameshreddy-adutla/spring-boot-mcp-starterThis server has no ConduID identity, so agent calls to it are not receipted. Pin the version you install and review the source before granting it credentials.
Ask AI
Ask AI about Spring Boot MCP Starter
Powered by Claude · Grounded in docs
Security checks
- ✓README presentThe repository ships documentation.
5 checks have not been run yet.
README
Spring Boot MCP Starter
A lightweight Spring Boot starter for building Model Context Protocol (MCP) servers in Java. Define tools, resources, and prompts with annotations — no boilerplate.
Why?
MCP is the open standard for connecting AI assistants to external tools and data. Most implementations are in Python or TypeScript. If you're a Java/Spring Boot engineer, there's no easy way to build an MCP server that fits into your existing stack.
This starter fixes that. Drop it into any Spring Boot app, annotate your methods, and you have a working MCP server.
Quick Start
1. Add the dependency
<dependency>
<groupId>dev.ramesh</groupId>
<artifactId>spring-boot-mcp-starter</artifactId>
<version>0.1.0</version>
</dependency>
2. Define a tool
@McpTool(name = "get_weather", description = "Get current weather for a city")
public class WeatherTool {
@ToolMethod
public String execute(@ToolParam(name = "city", description = "City name") String city) {
// Your logic here
return "Sunny, 22°C in " + city;
}
}
3. Run
mvn spring-boot:run
Your Spring Boot app is now an MCP server. Connect it to Claude Desktop, GitHub Copilot, or any MCP client.
Features
@McpTool— Turn any Spring bean into an MCP tool@McpResource— Expose data sources (databases, APIs, files) as MCP resources@McpPrompt— Define reusable prompt templates- Stdio & HTTP transports — Works with local CLI tools (stdio) and remote clients (SSE/HTTP)
- Auto-discovery — Tools, resources, and prompts are auto-registered via component scanning
- Spring Boot native — Constructor injection,
application.ymlconfig, actuator health checks - JSON Schema generation — Tool parameters automatically generate JSON Schema from Java types
Configuration
mcp:
server:
name: my-mcp-server
version: 1.0.0
transport: stdio # or 'sse' for HTTP
sse:
port: 8080
endpoint: /mcp
Architecture
┌─────────────────────────────────────────────┐
│ Spring Boot Application │
│ │
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ │
│ │ @McpTool │ │@McpResource│ │@McpPrompt│ │
│ └────┬─────┘ └────┬──────┘ └────┬─────┘ │
│ │ │ │ │
│ ┌────▼─────────────▼─────────────▼────┐ │
│ │ McpServerAutoConfiguration │ │
│ │ (auto-discovers & registers all) │ │
│ └────────────────┬────────────────────┘ │
│ │ │
│ ┌────────────────▼────────────────────┐ │
│ │ Transport Layer │ │
│ │ ┌─────────┐ ┌──────────┐ │ │
│ │ │ Stdio │ │ SSE/HTTP │ │ │
│ │ └─────────┘ └──────────┘ │ │
│ └─────────────────────────────────────┘ │
└─────────────────────────────────────────────┘
Examples
Database query tool
@McpTool(name = "query_users", description = "Search users by name")
@RequiredArgsConstructor
public class UserQueryTool {
private final UserRepository userRepository;
@ToolMethod
public List<User> execute(
@ToolParam(name = "name", description = "Name to search for") String name,
@ToolParam(name = "limit", description = "Max results", required = false) Integer limit) {
return userRepository.findByNameContaining(name, PageRequest.of(0, limit != null ? limit : 10));
}
}
REST API resource
@McpResource(
uri = "api://orders/{orderId}",
name = "order",
description = "Fetch order details by ID"
)
@RequiredArgsConstructor
public class OrderResource {
private final OrderService orderService;
@ResourceMethod
public Order fetch(@ResourceParam("orderId") String orderId) {
return orderService.getById(orderId);
}
}
Prompt template
@McpPrompt(name = "code_review", description = "Review code for common issues")
public class CodeReviewPrompt {
@PromptMethod
public String generate(
@PromptParam(name = "language") String language,
@PromptParam(name = "code") String code) {
return """
Review this %s code for bugs, security issues, and performance problems.
Be specific and actionable. Only flag things that matter.
```%s
%s
```
""".formatted(language, language, code);
}
}
Transport Options
| Transport | Use Case | Config |
|---|---|---|
| Stdio | CLI tools, local AI assistants (Copilot, Claude Desktop) | mcp.server.transport=stdio |
| SSE | Remote clients, web-based integrations | mcp.server.transport=sse |
Roadmap
- Auto-generate JSON Schema from records and POJOs
- Streaming responses for long-running tools
- OAuth2 authentication for SSE transport
- Spring Boot Actuator endpoint for MCP server health
- GraalVM native image support
- Publish to Maven Central
Contributing
Contributions welcome. Open an issue first to discuss what you'd like to change.
License
README copy captured when this server was indexed; it may lag the repository. The original is authoritative.