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.
- Java 21
- Ollama installed on your system
To build the project, run the following command:
mvn clean package -DskipTests
ollama serve
ps -ef | grep "ollama serve" |grep -v "grep"| awk '{print $2}' | xargs kill -9
java -jar llm-mcp-host/target/llm-mcp-host-0.0.1-SNAPSHOT.jar
ps -ef | grep "llm-mcp-host" |grep -v "grep"| awk '{print $2}' | xargs kill -9
java -jar llm-mcp-realworld-server/target/llm-mcp-realworld-server-0.0.1-SNAPSHOT.jar
ps -ef | grep <
723B
span class="pl-pds">"llm-mcp-realworld-server" |grep -v "grep"| awk '{print $2}' | xargs kill -9
java -jar llm-mcp-accounting-server/target/llm-mcp-accounting-server-0.0.1-SNAPSHOT.jar
ps -ef | grep "llm-mcp-accounting-server" |grep -v "grep"| awk '{print $2}' | xargs kill -9
curl -X POST http://localhost:8085/api/v1/chatbot/chat -d '{
"question": "What is time now?"
}' -H "Content-Type: application/json"
curl -X POST http://localhost:8085/api/v1/chatbot/chat -d '{
"question": "What date is Today?"
}' -H "Content-Type: application/json"
curl -X POST http://localhost:8085/api/v1/chatbot/chat -d '{
"question": "What Month and Year is Today?"
}' -H "Content-Type: application/json"
curl -X POST http://localhost:8085/api/v1/chatbot/chat -d '{
"question": "What is next Month?"
}' -H "Content-Type: application/json"
curl -X POST http://localhost:8085/api/v1/chatbot/chat -d '{
"question": "What was previous Month?"
}' -H "Content-Type: application/json"
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"