Spring AI & MCP Architecture: Technical Feasibility Study
A proof-of-concept implementing Model Context Protocol (MCP) in Java Spring ecosystem, enabling a modular AI architecture where LLM intelligence is decoupled from backend execution tools.
Executive Summary
This research validates the feasibility of integrating Model Context Protocol (MCP) within an existing Java Spring Boot–based backend supporting a regulated virtual asset exchange environment. The system operates under enterprise-grade security, auditability, and compliance constraints typical of financial platforms affiliated with large telecom ecosystems. The technical objective was to establish a modular AI architecture where Intelligence (LLM) is fully decoupled from Execution (backend tools and services), enabling a secure, governable, and scalable agentic system suitable for production-grade virtual asset operations.
Core Validation Outcomes
- Feasibility Confirmed: Successfully deployed a functional PoC using Spring AI 1.1.0 with MCP support.
- Security Compliance: Validated a token-forwarding strategy that maintains Row-Level Security (RLS) context, addressing a key enterprise constraint.
- Architectural Efficiency: Established a “Dual-Mode” strategy where existing backend services serve both Frontend (REST) and AI Agents (MCP) simultaneously.
Architectural Strategy
High-Level Flow
The architecture introduces an MCP Client (router) that sits between the LLM and the backend services (MCP Servers).

“Dual-Mode” Server Strategy
A critical finding from this study is the ability to leverage existing microservices without significant refactoring. The backend operates in two simultaneous modes:
- Standard REST API: Continues to serve mobile/web CLI requests via HTTP.
- MCP Server: Exposes selected service methods as “tools” to the AI Agent via MCP protocol.
Impact: This eliminates the need to build a separate “AI Backend” layer, significantly reducing infrastructure duplicated effort.
Security Implementation
The Authentication Challenge
Standard MCP implementations often assume a trusted local environment (e.g., Claude Desktop). For enterprise deployment, we needed to propagate user identity from the client app through the AI agent to the backend.
Token Forwarding Solution
We implemented a Token Forwarding pattern where the JWT is passed along the chain:
// Logic on MCP Client (Agri-Service) to forward token
var tools = toolService.discoverTools(transport, authToken);
- User Request: Client sends JWT in
Authorizationheader. - Context Extraction: MCP Client extracts the
sub(User ID). - Tool Execution: When the LLM invokes a tool (e.g.,
get_deposit), the original JWT is forwarded in the MCP request headers. - RLS Enforcement: The backend (Bank-Service) validates the token and enforces
@PreAuthorizerules, ensuring the AI agent can only access data belonging to the authenticated user.
Component Architecture
| Component | Technology | Role |
|---|---|---|
| MCP Client | Spring AI (Java 21) | Router: Maintains conversation state, handles LLM context window, and routes tool calls. |
| MCP Server | Spring Boot 3.4+ | Toolbox: Stateless service exposing business logic as discovery-ready tools. |
| Transport | SSE + JSON-RPC | Protocol: Standardized communication channel for tool discovery and execution. |
Technical Validation
1. Transport Layer Verification
We verified the Server-Sent Events (SSE) handshake which establishes the persistent connection required for the MCP protocol. The trace below shows the JSON-RPC initialization:

2. End-to-End Execution Flow
The sequence diagram below details the verified flow: User Request → Tool Discovery → LLM Reasoning → Secure Tool Execution → Response.

3. Functional Proof (Evidence)
To validate the full loop, we executed a “Check Deposit” intent.
- Input: User asks about deposit status.
- Process: System identifies
get_deposittool -> Executes SQL query. - Result: LLM formulates natural language response based on DB data.

4. Data Consistency Check
Database state before and after execution proves the tool actually interacted with the persistence layer (H2 In-Memory DB for PoC).
State Before:

State After:

Conclusion
This experiment confirms that Spring AI’s MCP implementation is viable for building modular AI systems in Java. By abstracting tool execution behind the MCP standard, we can build backend services that are “AI-ready” without tightly coupling them to a specific LLM provider.