https://github.com/alokkusingh/ai-llm-mcp
LLM Model Context Protocol (MCP) demo using Spring AI
https://github.com/alokkusingh/ai-llm-mcp
java lama llm mcp mcp-host mcp-server ollama spring-ai-mcp spring-ai-ollama
Last synced: 4 months ago
JSON representation
LLM Model Context Protocol (MCP) demo using Spring AI
- Host: GitHub
- URL: https://github.com/alokkusingh/ai-llm-mcp
- Owner: alokkusingh
- Created: 2025-04-23T04:38:20.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-04-23T04:42:47.000Z (about 1 year ago)
- Last Synced: 2025-04-23T05:28:26.364Z (about 1 year ago)
- Topics: java, lama, llm, mcp, mcp-host, mcp-server, ollama, spring-ai-mcp, spring-ai-ollama
- Language: Java
- Homepage:
- Size: 0 Bytes
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# AI LLM MCP Demo
## Overview
This project demonstrates an **MCP (Model Context Protocol)** using **Ollama** (a locally hosted LLM) and **Java Spring Boot**.
The demo features a simple chatbot that can answer questions about:
- The current date, time, and month.
- Expenses for the current month.
---
## Prerequisites
- **Java 21**
- **Ollama** installed on your system
---
## Build Instructions
To build the project, run the following command:
```shell
mvn clean package -DskipTests
```
## Ollama Server
### Start
```shell
ollama serve
```
### Stop
```shell
ps -ef | grep "ollama serve" |grep -v "grep"| awk '{print $2}' | xargs kill -9
```
## MCP Host
### Start
```shell
java -jar llm-mcp-host/target/llm-mcp-host-0.0.1-SNAPSHOT.jar
```
### Stop
```shell
ps -ef | grep "llm-mcp-host" |grep -v "grep"| awk '{print $2}' | xargs kill -9
```
## MCP Realworld Server
### Start
```shell
java -jar llm-mcp-realworld-server/target/llm-mcp-realworld-server-0.0.1-SNAPSHOT.jar
```
### Stop
```shell
ps -ef | grep "llm-mcp-realworld-server" |grep -v "grep"| awk '{print $2}' | xargs kill -9
```
## MCP Accounting Server
### Start
```shell
java -jar llm-mcp-accounting-server/target/llm-mcp-accounting-server-0.0.1-SNAPSHOT.jar
```
### Stop
```shell
ps -ef | grep "llm-mcp-accounting-server" |grep -v "grep"| awk '{print $2}' | xargs kill -9
```
## Chat with llm
```shell
curl -X POST http://localhost:8085/api/v1/chatbot/chat -d '{
"question": "What is time now?"
}' -H "Content-Type: application/json"
```
```shell
curl -X POST http://localhost:8085/api/v1/chatbot/chat -d '{
"question": "What date is Today?"
}' -H "Content-Type: application/json"
```
```shell
curl -X POST http://localhost:8085/api/v1/chatbot/chat -d '{
"question": "What Month and Year is Today?"
}' -H "Content-Type: application/json"
```
```shell
curl -X POST http://localhost:8085/api/v1/chatbot/chat -d '{
"question": "What is next Month?"
}' -H "Content-Type: application/json"
```
```shell
curl -X POST http://localhost:8085/api/v1/chatbot/chat -d '{
"question": "What was previous Month?"
}' -H "Content-Type: application/json"
```
```shell
curl -X POST http://localhost:8085/api/v1/chatbot/chat -d '{
"question": "What Month and Year is Today? And, How much did I spend in the current month?"
}' -H "Content-Type: application/json"
```