liveBook · Manning

MCP server

As explained in Spring AI in Action

An MCP server is an application component that communicates through the Model Context Protocol to expose capabilities or contextual information to an MCP client.

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
figure

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:

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

How Spring AI in Action covers it

How deep it goes
Builds servers from Spring Boot setup through tool registration, inspection, client integration, transports, prompts, and resources; defers Streamable HTTP.
Examples
Uses filesystem access, board-game database queries, MCP Inspector invocations, and structured game prompts and resources.
What you can do after
Build it from scratch with Spring AI, test it with MCP Inspector, and connect it to an LLM application over STDIO or HTTP+SSE.
How it connects
Connects MCP clients, LLMs, tools, prompts, resources, databases, Spring Boot, and STDIO or HTTP+SSE transports.

Also explained in

Compare how 12 books explain MCP server →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Spring AI in Action. The section links point to the parts of the book it draws on.