Sponsored by Deepsite.site

Spring Ai Mcp

Created By
rifatcakir6 months ago
AI-powered chat assistant for banking microservices using Spring AI and Model Context Protocol (MCP). Interact with your microservices through natural language chat, view accounts, personal details, and transactions—all in one unified interface.
Content

Spring AI MCP (Model Context Protocol)

This project demonstrates how to implement a chat-based interface for communicating with microservices using Spring AI and MCP (Model Context Protocol). The system allows users to interact with various microservices through natural language chat, making it easier to perform operations across different services by providing contextual understanding and model-driven interactions.

Project Structure

The project consists of the following components:

  • chat-client: A Spring Boot application that provides the chat interface for users to interact with microservices
  • person-mcp-service: Microservice for managing person-related operations
  • account-mcp-service: Microservice for handling account-related operations
  • transaction-mcp-service: Microservice for processing transaction-related operations

Prerequisites

  • Java 21
  • Maven 3.8+
  • Spring Boot 3.5.0
  • Spring AI 1.0.0

Getting Started

  1. Clone the repository:
git clone https://github.com/yourusername/spring-ai-mcp.git
cd spring-ai-mcp
  1. Build the project:
mvn clean install
  1. Start the services:
# Start each service in separate terminals
mvn spring-boot:run -pl person-mcp-service
mvn spring-boot:run -pl account-mcp-service
mvn spring-boot:run -pl transaction-mcp-service
mvn spring-boot:run -pl chat-client

Architecture

The project follows a microservices architecture where:

  1. Each microservice (person, account, transaction) implements the Model Context Protocol (MCP)
  2. The chat client uses Spring AI to:
    • Process natural language input
    • Convert user requests into appropriate model context calls
    • Handle responses from microservices
    • Present results in a user-friendly format
    • Maintain context across multiple interactions

Features

  • Natural language processing for service interactions
  • Unified chat interface for all microservices
  • Real-time communication with multiple services
  • Seamless integration of new microservices

Usage

  1. Access the chat interface through the chat-client application
  2. Type your request in natural language
  3. The system will:
    • Parse your request
    • Identify the relevant microservice(s)
    • Execute the necessary operations
    • Return the results in a conversational format

Sample Chat Interactions

Below are some example conversations with the AI Assistant, demonstrating how the Model Context Protocol enables seamless, contextual banking operations through chat:

1. Viewing Personal Details

Sample: Show personal details for John Smith

The user requests personal details for John Smith. The assistant provides the ID, first name, and last name.

2. Querying Accounts for a Person

Sample: Show accounts for John Smith

The user asks to see accounts belonging to John Smith. The assistant lists all accounts with their balances.

3. Viewing Transactions for Accounts

Sample: Show transactions for accounts

The user asks to see transactions for the previously listed accounts. The assistant responds with account and transaction details, maintaining context from earlier messages.

Development

Adding a New Microservice

  1. Create a new module in the project
  2. Implement the MCP protocol
  3. Add the module to the parent pom.xml
  4. Update the chat client to handle the new service's operations

Configuration

Each service can be configured through its respective application.properties or application.yml file. Common configurations include:

  • Service ports
  • Database connections
  • AI model settings
  • Model Context Protocol settings
  • Context management parameters

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Commit your changes
  4. Push to the branch
  5. Create a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Support

For support, please open an issue in the GitHub repository or contact the development team.

Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.
Context7Context7 MCP Server -- Up-to-date code documentation for LLMs and AI code editors
Zhipu Web SearchZhipu Web Search MCP Server is a search engine specifically designed for large models. It integrates four search engines, allowing users to flexibly compare and switch between them. Building upon the web crawling and ranking capabilities of traditional search engines, it enhances intent recognition capabilities, returning results more suitable for large model processing (such as webpage titles, URLs, summaries, site names, site icons, etc.). This helps AI applications achieve "dynamic knowledge acquisition" and "precise scenario adaptation" capabilities.
Serper MCP ServerA Serper MCP Server
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
WindsurfThe new purpose-built IDE to harness magic
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.
BlenderBlenderMCP connects Blender to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Blender. This integration enables prompt assisted 3D modeling, scene creation, and manipulation.
ChatWiseThe second fastest AI chatbot™
Playwright McpPlaywright MCP server
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.
DeepChatYour AI Partner on Desktop
TimeA Model Context Protocol server that provides time and timezone conversion capabilities. This server enables LLMs to get current time information and perform timezone conversions using IANA timezone names, with automatic system timezone detection.
CursorThe AI Code Editor
Tavily Mcp
Howtocook Mcp基于Anduin2017 / HowToCook (程序员在家做饭指南)的mcp server,帮你推荐菜谱、规划膳食,解决“今天吃什么“的世纪难题; Based on Anduin2017/HowToCook (Programmer's Guide to Cooking at Home), MCP Server helps you recommend recipes, plan meals, and solve the century old problem of "what to eat today"
Amap Maps高德地图官方 MCP Server
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.