Build MCP servers with Spring AI using declarative tools, prompt templates, and native Spring integration patterns.
Works with
Exposes Spring components as AI-callable tools via @Tool annotation, with parameter documentation through @ToolParam for AI model understanding
Supports three transport modes (stdio, HTTP, SSE) with built-in Spring Security integration for role-based access control and audit logging
Includes reusable prompt templates using @PromptTemplate , dynamic tool registration, mu
AI-first code editor with Composer
Before installing skills in Cursor, ensure your development environment meets these requirements:
node --versionspring-ai-mcp-server-patternsExecute the skills CLI command in your project's root directory to begin installation:
Fetches spring-ai-mcp-server-patterns from giuseppe-trisciuoglio/developer-kit and configures it for Cursor.
The CLI shows a list of agents. Use arrow keys and space to select Cursor:
Confirm successful installation by checking the skill directory location:
Restart Cursor to activate spring-ai-mcp-server-patterns. Access via /spring-ai-mcp-server-patterns in your agent's command palette.
We perform automated surface-level scans (Gen AI Scanner, Socket, Snyk) during installation. These checks detect common vulnerabilities but do not guarantee complete security. Always review skill source code and verify the publisher's reputation before production use.
Skills execute code in your environment. Always review source, verify the publisher, and test in isolation before production.
Submit your Claude Code skill and start earning
Automate repetitive workflows and reduce manual effort
Example
Generate reports, summarize documents, draft communications
Save 3-5 hours per week on routine tasks
Learn new skills, understand complex topics, get expert guidance
Example
Explain concepts, provide examples, suggest learning resources
Accelerate learning and skill development by 2x
Enhance output quality through reviews, suggestions, and refinements
Example
Review drafts, suggest improvements, catch errors
Improve work quality by 30-40% with less effort
0
total installs
0
this week
194
GitHub stars
0
upvotes
Run in your terminal
0
installs
0
this week
194
stars
Implements MCP servers with Spring AI for AI function calling, tool handlers, and MCP transport configuration.
Production-ready MCP server patterns: @Tool functions, @PromptTemplate resources, and stdio/HTTP/SSE transports with Spring AI security.
MCP servers, Spring AI function calling, AI tools, tool calling, custom tool handlers, Spring Boot MCP, resource endpoints, or MCP transport configuration.
| Annotation | Target | Purpose |
|---|---|---|
@EnableMcpServer |
Class | Enable MCP server auto-configuration |
@Tool(description) |
Method | Declare AI-callable tool |
@ToolParam(value) |
Parameter | Document tool parameter for AI |
@PromptTemplate(name) |
Method | Declare reusable prompt template |
@PromptParam(value) |
Parameter | Document prompt parameter |
| Transport | Use Case | Config |
|---|---|---|
stdio |
Local process / Claude Desktop | Default |
http |
Remote HTTP clients | port, path |
sse |
Real-time streaming clients | port, path |
<!-- Maven -->
<dependency>
<groupId>org.springframework.ai</groupId>
<artifactId>spring-ai-mcp-server</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>org.springframework.ai</groupId>
<artifactId>spring-ai-starter-model-openai</artifactId>
<version>1.0.0</version>
</dependency>
// Gradle
implementation 'org.springframework.ai:spring-ai-mcp-server:1.0.0'
implementation 'org.springframework.ai:spring-ai-starter-model-openai:1.0.0'
Add Spring AI MCP dependencies (see Quick Reference above), configure the AI model in application.properties, and enable MCP with @EnableMcpServer:
@SpringBootApplication
@EnableMcpServer
public class MyMcpApplication {
public static void main(String[] args) {
SpringApplication.run(MyMcpApplication.class, args);
}
}
spring.ai.openai.api-key=${OPENAI_API_KEY}
spring.ai.mcp.enabled=true
spring.ai.mcp.transport.type=stdio
Annotate methods with @Tool inside @Component beans. Use @ToolParam to document parameters:
@Component
public class WeatherTools {
@Tool(description = "Get current weather for a city")
public WeatherData getWeather(@ToolParam("City name") String city) {
return weatherService.getCurrentWeather(city);
}
@Tool(description = "Get 5-day forecast for a city")
public ForecastData getForecast(
@ToolParam("City name") String city,
@ToolParam(value = "Unit: celsius or fahrenheit", required = false) String unit) {
return weatherService.getForecast(city, unit != null ? unit : "celsius");
}
}
See references/implementation-patterns.md for database tools, API integration tools, and the FunctionCallback low-level pattern.
@Component
public class CodeReviewPrompts {
@PromptTemplate(
name = "java-code-review",
description = "Review Java code for best practices and issues"
)
public Prompt createCodeReviewPrompt(
@PromptParam("code") String code,
@PromptParam(value = "focusAreas", required = false) List<String> focusAreas) {
String focus = focusAreas != null ? String.join(", ", focusAreas) : "general best practices";
return Prompt.builder()
.system("You are an expert Java code reviewer with 20 years of experience.")
.user("Review the following Java code for " + focus + ":\n```java\n" + code + "\n```")
.build();
}
}
See references/implementation-patterns.md for additional prompt template patterns.
spring:
ai:
mcp:
enabled: true
transport:
type: stdio # stdio | http | sse
http:
port: 8080
path: /mcp
server:
name: my-mcp-server
version: 1.0.0
@Configuration
public class McpSecurityConfig {
@Bean
public ToolFilter toolFilter(SecurityService securityService) {
return (tool, context) -> {
User user = securityService.getCurrentUser();
if (tool.name().startsWith("admin_")) {
return user.hasRole("ADMIN");
}
return securityService.isToolAllowed(user, tool.name());
};
}
}
Use @PreAuthorize("hasRole('ADMIN')") on tool methods for method-level security. See references/implementation-patterns.md for full security patterns.
@SpringBootTest
class WeatherToolsTest {
@Autowired
private WeatherTools weatherTools;
@MockBean
private WeatherService weatherService;
@Test
void testGetWeather_Success() {
when(weatherService.Prerequisites
Time Estimate
15-45 minutes depending on use case complexity
Steps
Common Pitfalls
✓ Do
✗ Don't
💡 Pro Tips
✓ Use when
Use when skill capabilities match your task, clear ROI on time saved, and you can validate outputs. Best for repetitive tasks, learning, and quality improvement.
✗ Avoid when
Avoid when task requires deep expertise you can't validate, involves sensitive decisions, or when learning process is more valuable than speed of completion.
giuseppe-trisciuoglio/developer-kit
jwynia/agent-skills
mindrally/skills
github/awesome-copilot
kostja94/marketing-skills
wispbit-ai/skills
Useful defaults in spring-ai-mcp-server-patterns — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.
spring-ai-mcp-server-patterns is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.
Keeps context tight: spring-ai-mcp-server-patterns is the kind of skill you can hand to a new teammate without a long onboarding doc.
spring-ai-mcp-server-patterns reduced setup friction for our internal harness; good balance of opinion and flexibility.
We added spring-ai-mcp-server-patterns from the explainx registry; install was straightforward and the SKILL.md answered most questions upfront.
spring-ai-mcp-server-patterns has been reliable in day-to-day use. Documentation quality is above average for community skills.
Useful defaults in spring-ai-mcp-server-patterns — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.
spring-ai-mcp-server-patterns reduced setup friction for our internal harness; good balance of opinion and flexibility.
Keeps context tight: spring-ai-mcp-server-patterns is the kind of skill you can hand to a new teammate without a long onboarding doc.
Registry listing for spring-ai-mcp-server-patterns matched our evaluation — installs cleanly and behaves as described in the markdown.
showing 1-10 of 30