A Quarkus console application that integrates with AI models through Ollama and registers MCP (Model Context Protocol) servers for additional tools and capabilities.
- Chat Interface: Interactive console chat with Ollama LLMs
- MCP Integration: Connect to the Monkey species MCP server via HTTP SSE transport
- Tool Discovery: List and use available tools from MCP servers
- Modular Design: Clean separation of concerns with services and commands
- Java 21 with Maven
- Picocli for console application interface
- LangChain4J for AI chat interactions and MCP client support
- Ollama for local LLM hosting
- Jackson for JSON processing
- Java 21 or later
- Ollama running locally on
http://localhost:11434withllama3.2model - Monkey MCP Server running on
http://localhost:8080/mcp/sse
# Install Ollama (macOS)
brew install ollama
# Start Ollama service
ollama serve
# Pull the llama3.2 model
ollama pull llama3.2Ensure the monkey species MCP server is running at http://localhost:8080/mcp/sse.
# Build
./mvnw verifyShow available commands:
java -jar target/cli-monkey-mcp-client.jar -hList all available MCP tools from registered servers:
java -jar target/cli-monkey-mcp-client.jar toolsStart an interactive chat session with the Ollama LLM:
java -jar target/cli-monkey-mcp-client.jar chatThe application connects to MCP servers defined in mcp.json file located where the application is launched from (working directory):
{
"servers": {
"monkey-species": {
"type": "sse",
"url": "http://localhost:8080/mcp/sse"
}
}
}src/main/java/org/acme/
├── McpClientApplication.java # Main application class
├── client/
│ ├── ChatService.java # Ollama chat service
│ └── ToolsService.java # MCP client service
└── command/
├── ChatCommand.java # Chat command implementation
└── ToolsCommand.java # Tools command implementation
$ java -jar target/cli-monkey-mcp-client.jar chat
═══════════════════════════════════
Java MCP Chat Client
═══════════════════════════════════
→ Starting chat with local Ollama (llama3.2) + MCP Tools
→ Available tools: 2 monkey species tools
💡 Try asking:
• 'What monkey species do you know?'
• 'Tell me about a random monkey'
Type 'exit', 'quit', or 'bye' to end the conversation
───────────────────────────────────
You: Tell me about capuchin monkeys
AI: I can help you with monkey species information! I have access to MCP tools that can provide details about various monkey species, their habitats, and characteristics...
You: List all monkey species
AI: I have access to several MCP tools for monkey species information:
- get_monkey_species: Get detailed information about a specific species
- list_monkey_species: List all available monkey species
- get_monkey_habitat: Get habitat information for a species
You: exit
👋 Goodbye!
$ java -jar target/cli-monkey-mcp-client.jar tools
...
═════ MCP Tools ═════
Tool: get_monkey_species_details
Description: Get detailed information for a specific monkey species by name
Parameters: JsonObjectSchema {description = null, properties = {speciesName=JsonStringSchema {description = null }}, required = [speciesName], additionalProperties = null, definitions = {} }
Tool: get_monkey_species_stats
Description: Get statistics about the monkey species database
Parameters: JsonObjectSchema {description = null, properties = {}, required = [], additionalProperties = null, definitions = {} }
Tool: get_random_monkey_species
Description: Get a random monkey species with full details
Parameters: JsonObjectSchema {description = null, properties = {}, required = [], additionalProperties = null, definitions = {} }
Tool: list_monkey_species
Description: List all available monkey species with their basic information
Parameters: JsonObjectSchema {description = null, properties = {}, required = [], additionalProperties = null, definitions = {} }
───────────────────────────────────
Total: 4 tools available
→ Shutting down MCP tools service...
✓ MCP client monkeymcp closed
✓ All MCP clients closed
- Ollama Connection Issues: Ensure Ollama is running on
localhost:11434 - MCP Server Connection: Verify the monkey MCP server is accessible at
localhost:8080/mcp/sse - Model Not Found: Pull the required model with
ollama pull llama3.2