Microsoft Developer, joined by Bruno Borges and Sandra Ahlgrimm, demonstrates how to build an MCP server using Quarkus and GitHub Copilot, streamlining the process of creating intelligent, AI-integrated API servers.

MCP and Java Apps: Building a Server

Episode Hosts: Ayan Gupta, Bruno Borges, Sandra Ahlgrimm

This episode provides a hands-on demonstration of building a Model Context Protocol (MCP) server using Quarkus—a modern Java framework—and GitHub Copilot for automated code generation.

What is MCP?

MCP (Model Context Protocol) extends AI applications by allowing direct integration with external tools, APIs, and services. Analogous to a barista who understands recipes and manages brewing, the MCP server orchestrates communication between AI models and third-party services.

Key Topics Covered

  • Starting with a Quarkus Project: Set up a Java project suited for cloud applications and rapid development.
  • Using MCP to Simplify API Changes: Learn how MCP abstracts complex integrations by defining protocols and attributes.
  • Leveraging GitHub Copilot: Use Copilot’s agent mode and custom instructions to scaffold most of the server, significantly reducing manual code creation.
  • Building a Sample ‘Monkey Species’ API: Implement endpoints to list species, get details, and handle statistics—demonstrating MCP attributes and Quarkus best practices.
  • Testing and Troubleshooting:
    • Test your server using MCP Inspector
    • Resolve port conflicts
    • Prepare for client integration
    • Connect and list MCP tools

Practical Insights

  • Service annotations with MCP-specific attributes
  • Endpoint configuration using server-sent events
  • Best practices in Java records and API development
  • Steps for automated scaffolding and understanding generated code

Applicability

While demonstrated with a “monkey species” example, these design patterns are adaptable to customer data, inventory, finance, and more. The approach benefits any domain requiring dynamic AI-powered integrations.

Resources

Session Timeline

  • 0:00 Introduction & Analogy
  • 0:47 What Is MCP?
  • 1:05 Setting up Quarkus Project
  • 2:11 GitHub Copilot Instructions
  • 3:00 Automatic Server Scaffolding
  • 5:38 Building and Testing
  • 7:35 Testing with MCP Inspector
  • 9:01 Connecting & Listing Tools
  • 10:23 Recap

For a deeper dive, review the timestamps and check out the provided resources.