An MCP server is a Spring AI application component that exposes reusable tools, prompts, or resources through the Model Context Protocol. It connects an MCP client to capabilities such as a database, filesystem, or API, allowing an LLM-powered application to use them without embedding every implementation locally. section 7.0 section 7.1
Figure 7.1 Interactions between MCP Servers and MCP Clients
Shows how an MCP client discovers server tools, supplies them to a prompt, and invokes them on behalf of an LLM. section 7.1
An MCP server can provide:
- Tools that perform operations against databases, filesystems, APIs, or other Java-accessible capabilities. section 7.1 section 7.3.3
- Prompts that define reusable templates and arguments for applications with structured user interfaces. section 7.5 section 7.5.1
- Resources that return textual or binary domain data to the client. section 7.5 section 7.5.1
A custom Spring AI server starts as a Spring Boot application with the MCP Server dependency and whatever integration it needs, such as Spring Data JDBC, a PostgreSQL driver, and Docker Compose support. It does not need an LLM dependency when it only exposes data-oriented tools. section 7.3.1
Methods annotated with @Tool become the implementation layer. A ToolCallbackProvider bean, commonly built with MethodToolCallbackProvider, registers those methods as MCP tools; Spring AI auto-configuration supplies the remaining server components. section 7.3.3
Board-game recommendation server
A server backed by a board-game database can expose gameCount, findGamesForPlayerCount, and findGamesForPlayingTime. An MCP client can then answer questions such as which games suit five players or fit within thirty minutes. section 7.3 section 7.3.5
STDIO is convenient for a sidecar server: the client starts the executable JAR and communicates through standard input and output. Because ordinary output is protocol traffic, logging and the Spring Boot banner must be redirected or disabled. HTTP+SSE separates deployment, scaling, logging, and debugging, allowing the server to run on another reachable host. section 7.3.3 section 7.4
For HTTP+SSE, Spring AI provides MVC and WebFlux server starters. The client uses Spring configuration with the server URL rather than Claude Desktop configuration. The MCP Inspector can list and invoke tools before a full client is configured. section 7.4.1 section 7.4.3 section 7.3.4











