The Model Context Protocol (MCP) has become the standard way for AI assistants and agents to call external tools and read external data. If your company runs Spring Boot services, MCP is how those services become something an AI assistant can use — safely, through an interface you control.

Spring AI 2.0, released on June 12, 2026 for Spring Boot 4, makes this remarkably small. The Spring team maintains the official MCP Java SDK, Spring AI 2.0 ships with MCP Java SDK 2.0 (compliant with the 2025-11-25 MCP specification), and exposing a Spring service as an MCP tool is now one annotation.

Think of it like this
Think of MCP as USB-C for AI integrations. Before USB-C, every device needed its own cable. Before MCP, every AI app needed its own custom integration for every tool. Build one MCP server, and any MCP-compatible assistant can plug into it.

What an MCP server exposes

An MCP server offers three kinds of things. Tools are actions the model can call, like "get loan status." Resources are data the model can read, like a policy document. Prompts are reusable prompt templates. Spring AI 2.0 maps these to @McpTool, @McpResource and @McpPrompt.

Step 1: add the MCP server starter

Create a Spring Boot 4 project and add Spring AI's MCP server starter for Spring MVC (search for "MCP Server" on start.spring.io to get the exact artifact for your Spring AI version). Then give the server a name and version:

application.properties
spring.ai.mcp.server.name=loan-status-server spring.ai.mcp.server.version=1.0.0

In Spring AI 2.0, Streamable HTTP is the default transport, replacing the deprecated SSE transport. A stateless variant is available when you need to scale horizontally, and STDIO remains available for local, process-based integrations.

Step 2: turn a Spring service into a tool

LoanStatusTools.java
@Service public class LoanStatusTools { private final LoanRepository loans; public LoanStatusTools(LoanRepository loans) { this.loans = loans; } @McpTool(name = "get_loan_status", description = "Returns the current status and next required step for a loan application. " + "Use when a user asks where their loan application stands.") public LoanStatus getLoanStatus( @McpToolParam(description = "Loan application ID, for example LN-2026-00042", required = true) String loanId) { return loans.findStatus(loanId) .orElseThrow(() -> new IllegalArgumentException("No loan application found with ID " + loanId)); } }

That's the whole integration. Spring AI discovers the annotated method, generates the tool's input schema from the parameters, and serves it over MCP. Tools can also accept an automatically injected McpSyncRequestContext for logging, progress reporting, sampling and elicitation.

Step 3: connect a client

Any MCP-compatible client — an AI assistant, an IDE agent, or your own Spring AI application using the MCP client starter — can connect to the server's endpoint and discover the tool. On the Spring AI client side, 2.0 moved the tool-calling loop into the advisor chain, so tool calls, retries and structured-output validation all compose cleanly.

What production MCP servers need (that demos skip)
Descriptions are your API docs for the model — say what the tool does, when to use it and what the inputs look like; vague descriptions produce wrong calls. Validate every input as if it came from the public internet, because effectively it did. Start with read-only tools and add write actions only with explicit authorization. Secure the server — the spring-ai-community mcp-security project adds OAuth 2.0 and API-key security. Never return more data than the task needs, especially personal or financial data. And use the built-in Micrometer spans and metrics, so when an assistant "did something weird", you can see exactly which tool it called with which arguments.
An MCP tool is a public API whose most frequent caller is a language model. Design it with the same care — and the same error messages — you'd give any other client.
— Lessons from the support side of integrations

Frequently asked questions

What is an MCP server in Java?

An MCP server is a service that exposes tools, resources and prompts over the Model Context Protocol so AI assistants and agents can use them. In Java, Spring AI provides auto-configuration and annotations such as @McpTool to build MCP servers on Spring Boot.

Does Spring AI 2.0 support MCP?

Yes. Spring AI 2.0 ships with MCP Java SDK 2.0, supports the 2025-11-25 MCP specification, includes annotation-based tools, resources and prompts, and uses Streamable HTTP as the default transport.

Which transport should a Spring AI MCP server use?

Streamable HTTP for remote servers (with the stateless variant for easier horizontal scaling) and STDIO for local, process-based integrations. The older SSE transport is deprecated.

MCP is the standard protocol for connecting AI assistants to tools and data.
Spring AI 2.0 turns a Spring bean method into an MCP tool with @McpTool.
Streamable HTTP is the default transport; SSE is deprecated.
Treat tools as public APIs: clear descriptions, strict validation, least privilege, observability.