Skip to main content

Posts

Showing posts from August 4, 2026

Spring AI: Building an MCP Server and Client with Spring AI

Greetings! In the previous article, we learned the concepts behind Model Context Protocol (MCP). In this article, we'll focus on Spring AI and see how easily it can expose Java methods as MCP tools and consume remote MCP servers. Architecture Part 1 - MCP Server Dependency Note that we don't need AI models in the MCP server. gradle implementation "org.springframework.ai:spring-ai-starter-mcp-server-webmvc" Configuration yaml server : port : 8080 spring : application : name : movie-mcp-server ai : mcp : server : name : movie-mcp-server version : 1.0.0 type : SYNC protocol : STREAMABLE instructions : > Provides tools for listing, finding, searching, and filtering movies. streamable-http : mcp-endpoint : /mcp Repository java public record Movie ( Long id, String title, String director, int releaseYear, String genre, ...

Understanding Model Context Protocol (MCP)

Greetings! Large Language Models (LLMs) are excellent at reasoning and generating responses. However, they don't automatically know about your files, databases, GitHub repositories, internal APIs, or enterprise applications. This is where Model Context Protocol (MCP) comes in. In this article, we'll explore the core concepts behind MCP without using any specific framework. In the next article, we'll build an MCP server and client using Spring AI. Why Do We Need MCP? Modern AI applications often need to interact with many external systems. For example, an AI assistant may need to: Search a GitHub repository Read local files Query a database Send emails Create Jira tickets Access internal REST APIs Without MCP, every AI application would need to build custom integrations for every service. Every framework would repeatedly solve the same integration problem. There was no common standard. MCP solves this by defining a standard protocol that AI applications can...