Agent skill · Backend & API

spring-ai-mcp-server-patterns

Model Context Protocol (MCP) server implementation patterns with Spring AI. Use when building MCP servers to extend AI capabilities with custom tools, resources, and prompt templates using Spring's official AI framework.

majiayu000github.com/majiayu000GitHub ↗
claude-codecan modify filesMIT
Install
npx skills add majiayu000/claude-skill-registry --skill spring-ai-mcp-server-patterns --agent claude-code

Same command for any agent — swap --agent for codex, cursor, copilot.

Facts
Files in the skill folder: 2
SKILL.md size: 41 KB
Bundled scripts: none
Version: 1.0.0
Allowed tools: ReadWriteBashWebFetch
Path: skills/ai-llm/spring-ai-mcp-server-patterns/SKILL.md
Open the folder on GitHub →
Where it comes from
Stars: 534
Language: HTML

Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.

Review
written from the skill's own SKILL.md · Aug 5, 2026

What it does

This skill provides patterns and code examples to implement Model Context Protocol (MCP) servers using Spring AI. It outlines how to declare callable functions as tools, define prompts, configure transport channels, and wire up MCP server auto-configuration in Spring Boot. It includes basic example components for tools, function callbacks, and prompt templates, plus configuration blocks for Maven/Gradle dependencies and application properties. It also covers security hooks, health indicators, and custom server configuration hooks for advanced behavior.

How it works

  • Uses @Tool to declare methods as callable functions for AI models and @ToolParam/@PromptTemplate to document and structure inputs.
  • Demonstrates a Tool Creation pattern where components expose safe read queries and metadata like table schemas, including input validation (e.g., ensuring only SELECT queries).
  • Shows an Advanced Tool Pattern with a WebClient-based HTTP tool, including URL validation and optional headers parsing from JSON.
  • Provides Prompt Template Pattern examples with @PromptTemplate and @PromptParam to create reusable prompts (e.g., Java code review prompts and test generation prompts).
  • Introduces a FunctionCallback setup to register getCurrentWeather and calculator-like functions, enabling the MCP server to expose these as tools.
  • Details Spring Boot auto-configuration for MCP server, wiring in function callbacks and prompt templates via Spring beans, and optional health indicators.
  • Includes MCP server properties and application properties guidance, with transport types (STDIO, HTTP, SSE) and port/path options.
  • Includes a Custom Server Configuration example demonstrating interceptors, tool execution timing, and basic security hooks.
  • Outlines security patterns using Spring Security foundations to validate authentication and tool permissions before execution.

When to use it

Use this skill when building:

  • AI applications requiring external tool integration with Spring AI
  • Enterprise MCP servers with Spring ecosystem integration
  • Function calling servers with Spring AI's declarative patterns
  • Prompt template servers for standardized AI interactions
  • Spring Boot applications with native MCP integration
  • Production-ready MCP servers with Spring Security and monitoring
  • Microservices that expose AI capabilities via MCP protocol
  • Hybrid systems using both Spring AI and traditional Spring components

What it can touch

  • Tools declared with @Tool in Spring components (e.g., DatabaseTools.executeQuery, ApiTools.callApi).
  • Prompt templates declared with @PromptTemplate (e.g., CodeReviewPrompts).
  • FunctionCallback and PromptTemplate beans registered in McpServer setup.
  • Spring Security context for authentication and authorization during tool execution.
  • MCP server configuration via McpServerProperties, application.yml, and customizers.

Caveats

  • Depicts integration patterns and code examples; actual behavior depends on concrete project setup and environment.
  • Certain sections require real implementations for data access, HTTP requests, and security logic beyond examples.
  • License is MIT per skill metadata; ensure compliance in production.
From the SKILL.md

# Spring AI MCP Server Implementation Patterns Implement Model Context Protocol (MCP) servers with Spring AI to extend AI capabilities with standardized tools, resources, and prompt templates using Spring's native AI abstractions. ## When to Use Use this skill when building: - AI applications requiring external tool integration with Spring AI - Enterprise MCP servers with Spring ecosystem integration - Function calling servers with Spring AI's declarative patterns - Prompt template servers for standardized AI interactions - Spring Boot applications with native MCP integration - Production-ready MCP servers with Spring Security and monitoring - Microservices that expose AI capabilities via MCP protocol - Hybrid systems using both Spring AI and traditional Spring components ## Quick Start ### Basic MCP Server with Spring AI Create a simple MCP server with function calling: ```java @SpringBootApplication @EnableMcpServer public class WeatherMcpApplication { public static void main(String[] args) { SpringApplication.run(WeatherMcpApplication.class, args); } } @Component public class WeatherTools { @Tool(description = "Get current weather for a city") public WeatherData getWeather(@Tool

What's inside
Steps it walks through
  1. When to Use
  2. Quick Start
  3. Basic MCP Server with Spring AI
  4. Function Calling Setup
  5. Build Configuration
  6. Core Concepts
  7. MCP Architecture with Spring AI
  8. Key Spring AI Components
  9. Implementation Patterns
  10. Tool Creation Pattern
  11. Advanced Tool Pattern with Validation
  12. Prompt Template Pattern
  13. Function Callback Pattern
  14. Spring Boot Integration
Ships with 1 file
  • metadata.json
More from claude-skill-registry
All skills →
About this skill
What does the spring-ai-mcp-server-patterns skill do?

Model Context Protocol (MCP) server implementation patterns with Spring AI. Use when building MCP servers to extend AI capabilities with custom tools, resources, and prompt templates using Spring's official AI framework.

How do I install it?

Run `npx skills add majiayu000/claude-skill-registry --skill spring-ai-mcp-server-patterns --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.

Where does this skill come from?

From majiayu000/claude-skill-registry, a repository with 534 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.

Is a popular skill a good skill?

Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.

Keep going