lets-learn-mcp-java

microsoft/lets-learn-mcp-java

3.5

If you are the rightful owner of lets-learn-mcp-java and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

The Model Context Protocol (MCP) server is a Java-based implementation designed to facilitate communication between AI assistants and backend services using the HTTP Server-Sent Events (SSE) protocol.

Tools
4
Resources
0
Prompts
0

Learn MCP Java Tutorial

A comprehensive Java tutorial demonstrating Model Context Protocol (MCP) implementation with Quarkus server and LangChain4j client, featuring a monkey species dataset for hands-on learning.

šŸ“š Tutorial Overview

This project showcases a complete MCP ecosystem built in Java, including:

  • MCP Server: Quarkus-based HTTP SSE server with monkey species data tools
  • MCP Client: Interactive CLI client using LangChain4j and Ollama integration
  • Step-by-step Documentation: Complete guides for building MCP applications with GitHub Copilot

šŸš€ Quick Start

Prerequisites

  • Java 21+
  • Maven 3.8+
  • VS Code with Java Extension Pack
  • Ollama (for LLM integration)

Getting Started

  1. Clone the repository

    git clone https://github.com/brunoborges/monkey-mcp-java.git
    cd monkey-mcp-java
    
  2. Start the MCP Server

    cd monkey-mcp-server
    ./mvnw quarkus:dev
    
  3. Run the MCP Client

    cd monkey-mcp-client
    ./mvnw package
    java -jar target/monkey-mcp-client.jar
    

šŸ“– Tutorial Structure

This tutorial is organized into sequential parts:

PartTitleDescription
Project SetupInstall tools, understand MCP, and prepare your environment
MCP ServerBuild a Quarkus-based MCP server with monkey species tools
MCP ClientCreate an interactive CLI client using LangChain4j

šŸ—ļø Architecture

ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”    MCP Protocol    ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”
│   AI Assistant  │ ◄─────────────────►│   MCP Server     │
│ (VS Code, etc.) │    (HTTP SSE)      │ (Java/Quarkus)   │
ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜                    ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜
                                              │
                                              ā–¼
                                       ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”
                                       │  Monkey Services │
                                       │ (Business Logic) │
                                       ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜

šŸ’ Featured Tools

The MCP server provides these monkey species tools:

  • List Species: Get all available monkey species
  • Species Details: Retrieve detailed information about specific species
  • Random Species: Get a random monkey species
  • Statistics: View dataset statistics and access counts

šŸ› ļø Technology Stack

  • Java 21: Modern Java features and performance
  • Quarkus: Supersonic Subatomic Java Framework
  • LangChain4j: Java framework for building LLM applications
  • Ollama: Local LLM runtime
  • Maven: Build and dependency management
  • PicoCLI: Command-line interface framework

šŸŽÆ Learning Objectives

By completing this tutorial, you will:

  • Understand MCP protocol and its benefits
  • Build production-ready MCP servers with Quarkus
  • Create MCP clients using LangChain4j
  • Integrate with local LLMs using Ollama
  • Apply AI-assisted development with GitHub Copilot

šŸ“ Project Structure

monkey-mcp-java/
ā”œā”€ā”€ 00_PROJECT_SETUP.md       # Prerequisites and environment setup
ā”œā”€ā”€ 01_MCP_SERVER.md          # MCP Server implementation guide
ā”œā”€ā”€ 02_MCP_CLIENT.md          # MCP Client implementation guide
ā”œā”€ā”€ monkey-mcp-server/        # Quarkus MCP server project
│   ā”œā”€ā”€ src/main/java/        # Java source code
│   └── pom.xml              # Maven dependencies
└── monkey-mcp-client/        # LangChain4j MCP client project
    ā”œā”€ā”€ src/main/java/        # Java source code
    └── pom.xml              # Maven dependencies

šŸ¤ Contributing

This is an educational project designed to teach MCP implementation in Java. Contributions, suggestions, and improvements are welcome!

šŸ“„ License

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

šŸ”— Useful Links


Start your MCP journey: