What is MCP?
The Model Context Protocol (MCP) is an open protocol that standardizes how applications provide context to Large Language Models (LLMs). MCP provides a standardized way to connect AI models to different data sources and tools, making integration seamless and consistent. It helps you build agents and complex workflows on top of LLMs. LLMs frequently need to integrate with data and tools, and MCP provides:- A growing list of pre-built integrations that your LLM can directly plug into
- The flexibility to switch between LLM providers and vendors
General architecture
At its core, MCP follows a client-server architecture where a host application can connect to multiple servers.
The Spring AI MCP implements a modular architecture with the following components:
- Spring AI Application: Uses Spring AI framework to build Generative AI applications that want to access data through MCP
- Spring MCP Clients: Spring AI implementation of the MCP protocol that maintain 1:1 connections with servers
- MCP Servers: Lightweight programs that each expose specific capabilities through the standardized Model Context Protocol
- Local Data Sources: Your computer’s files, databases, and services that MCP servers can securely access
- Remote Services: External systems available over the internet (e.g., through APIs) that MCP servers can connect to
Getting Started
Spring AI MCP GitHub: https://github.com/spring-projects-experimental/spring-ai-mcpMaven Dependencies
Add one of the following dependecies to your Maven project:spring-ai-mcp-core with additional Spring AI abstractions, such as McpFunctionCallback.
Maven Repository Configuration
Add the Spring Milestones repository:Example Demos
Explore these MCP examples in the spring-ai-examples/model-context-protocol repository:- SQLite Simple - Demonstrates LLM integration with a database
- SQLite Chatbot - Interactive chatbot with SQLite database interaction
- Filesystem - Enables LLM interaction with local filesystem folders and files