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:
```bash
git clone https://github.com/yourusername/spring-ai-mcp.git
cd spring-ai-mcp
```
2. Build the project:
```bash
mvn clean install
```
3. Start the services:
```bash
# 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
<img src="resources/11.jpg" alt="Sample: Show personal details for John Smith" width="400"/>
*The user requests personal details for John Smith. The assistant provides the ID, first name, and last name.*
### 2. Querying Accounts for a Person
<img src="resources/22.jpg" alt="Sample: Show accounts for John Smith" width="400"/>
*The user asks to see accounts belonging to John Smith. The assistant lists all accounts with their balances.*
### 3. Viewing Transactions for Accounts
<img src="resources/33.jpg" alt="Sample: Show transactions for accounts" width="400"/>
*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.
Connection Info
You Might Also Like
Vibe-Trading
Vibe-Trading: Your Personal Trading Agent
ai-berkshire
Berkshire in the AI Era: A Value Investment Research Framework Based on...
hexstrike-ai
HexStrike AI is an AI-powered MCP cybersecurity automation platform with 150+ tools.
valuecell
Valuecell is a Python project for efficient data management.
tradingview-mcp
AI-assisted TradingView chart analysis — connect Claude Code to your...
tradingview-mcp
TradingView MCP Server offers real-time market analysis for crypto and stocks.