Member-only story
How to build MCP Server with Spring Boot 4.1 and Spring AI 2.0
How to expose your Java business logic as AI-callable tools using Spring AI’s MCP starters?
Two weeks ago I was trying to connect an internal Spring Boot service to Claude Desktop so it could answer questions using live data from our order database. Every tutorial I found used Python. Every “official” example assumed I wanted to rewrite my backend in TypeScript.
That felt wrong. I already had a working Spring Boot service. I just needed the LLM to talk to it.
Then Spring AI 2.0 shipped alongside Spring Boot 4.1 in June 2026, with full annotation-driven MCP server support built in. No custom protocol handling. No separate runtime. Just @McpTool on a method you already wrote.
This article walks through building a real MCP server from scratch, the exact steps, the exact code, and the mistakes I made along the way.
What MCP Actually Solves
The Model Context Protocol (MCP) is an open standard that lets AI applications, Claude Desktop, ChatGPT, your own agent discover and call tools exposed by a separate server, without custom integration code for each one.
Before MCP, every tool integration was bespoke. You wrote a custom function-calling schema for OpenAI, a different one…
