Loading video player...
[Music]
A cafe doesn't run itself. You need a
barista, the one who knows the recipes
and handles the brewing and serves the
drinks. In MCP, that barista is the
server. Hi, I'm a cloud advocate here at
Microsoft. And I've always loved seeing
how abstract concepts like protocols
suddenly click once you connect them to
something real. And servers are where it
all begins. Today I'm joined by Bruno
and Sandra, both of whom share over 30
years of experience as developers. Today
Bruno and Sandra are going to be our
expert barista team, showing us what it
means to build an MCP server that does
the brewing behind the scenes. Guys,
over to you.
>> Thank you, Wy. So, um yeah, hello
everyone. Thank you for uh joining us.
Today, we're going to um talk about MCP
servers. Um, and we're going to show you
a project that we actually built a
couple months ago for another event. So,
if you're on this video, it's going to
be short. If you want more details, you
can go into the repo and learn more and
watch the recording from the previous um
event. So, here we have um how you can
build an MCP server using uh Quarks. And
uh we're going to perform this task um
straight away and see how how if
everything still works since the time
that we built this thing the first time.
Sra, as we create Quarkus project here,
what is uh uh what is the one thing that
you like about MCP servers and and how
are you using it today on on your
development?
>> So I like to put them in front of my
APIs. So like if an API changed like in
previous life we need to keep in mind
you know how the APR call is performed
and if something changes it was kind of
easy to break your code afterwards. And
now when I have an uh MCP server for
this it will make it just more efficient
and even handles if my API API call
specifications will change.
So that's one of the things I really
like doing here. Awesome.
>> And Bruno, are you preparing to create
the whole MCP server? Is is that a
instruction for GitHub copilot?
>> So yes, this is exactly what I'm doing.
So instead of us going and creating the
MCP server manually, we're going to
actually set a context here so that the
LLM can create for us. So we have this
prompt here which is a Quarkus MCP
server instructions file. We're going to
use the GitHub copiling instructions
feature in Visual Studio Code. Uh we
could going to put this in this this
file inside the instructions folder. And
um we going to make sure that this um
also applies to everyone
applies to.
And uh once we have that, we're going to
use this prompt here.
I hope this works. I hope still works.
>> Yeah, welcome folks to 2025. That's how
you can develop your apps nowadays.
>> So, it it did use uh as we can see here,
it did read the Quarkus MCP server
instructions.m MD file. Um, this file
here has lots of instructions. Number
one, we're going to use Java 21. We're
going to create an MCP server using the
server sentent events. We're going to
use CDI for dependency injection. We're
going to have the MCP endpoint on this
URL here. Uh, and this is the structure
that we have. We're going to use some
MCP tools if available. Uh, this is the
architecture you're going to have and
some common issues to avoid. Now, the
prompt that we gave was this one.
Implement an MCP server with these
capabilities.
We're going to have the least monkey
species capability, get monkey details,
get random monkey species, and get
statistics. Um, and then a monkey
species has the following data. Uh,
species name, location, details,
population, latitude, longitude, and how
many times this species has been
accessed on that MCP server, including
include a data of set of monkey species
in the code, and add a few fictional
species with different attributes. So,
you're going to have some examples of
species that the LLM has in its training
model that are actually uh real and it's
going to create us a few fake ones. Last
time we ran this thing, we had a quantum
monkey species of radioactive
uh capabilities. I don't I don't know,
but it was quantum something was quite
funny. So, what
>> uh we're still using the same models
like last time. I see you have your
cloud set something.
>> So, last time we did use sonet 3.7. And
now we using sonet cord
>> that was that's the main difference
between the last time we did this thing.
>> So it it is going forward and creating
everything. So it created a species
document species file. Let's take a look
at that. So here it created our record
and with incremented access for
statistics. As we know records are
immutable. Um so that's why there is
this method here to increment the access
count. not the best way to implement
such thing but it's how the LLM figured
out.
Um it's also implementing a test and now
the readme file for the server.
>> I really love records. It's making the
whole discussion about Lombok so
obsolate.
>> Yeah, true. If folks still want to use
it, go for it. But I think I think if we
want to keep progressing and moving
forward with Java development, there's a
lots of features in the Java language
now that you don't really need uh um
APIs or libraries like Lombok to do
that. But for certain things, Lombok is
still quite helpful.
>> If you are not using 16 or above if I
remember correctly, so with 17 there for
sure and 21 as well obviously, but yeah,
I think with
>> older versions might not be possible.
>> Absolutely. So, okay. So, it created a
bunch of file for us. Let's open a
terminal and see
if everything works.
Uhoh, wrong terminal.
This one.
CD
monkey
and MVW
compile. Oh, actually, let's run from
here. Uh,
>> yeah, there is a terminal in the in VS
Code as well, right? Yeah, you have
copilot.
>> Oh, you could also ask copilot to do it
for you.
>> Yeah. So, let's
>> you know, I always wanted to be a
manager and now with copilot can always
just tell what to do and it does it so
perfectly. And then if you have the next
to allow, you can even use the arrow and
then it does it without you even
confirming
>> which is risky but also somewhat cool.
And you please make sure you only allow
it for like things that are safe to use
such as compile and test.
>> Okay, cool. So, it did compile. It did
run the test. Now let's use this MCP
inspector project here that is on on
npm. We're going to
going to copy and drive.
>> Oh, what happened? Could not be found.
>> I guess it's starting the project.
No, no. The uh Oh, because I pasted
twice. There you go.
>> Okay.
>> Okay. Let's allow
uh sure.
So, it's building.
So, it's it's trying to figure out if
the project is up and running. That's
the thing here.
>> Uh let's skip this thing. And no, let's
pause. Let's keep we don't want it to
test. This is an interesting structure.
Don't try to test after building things.
Let me do the test manually. So, Maven
compile package purpose dev.
>> Yeah, we are on recording. We want to
show it live here.
So, uh, we going to do SSE
and
let's see if it's up and running.
>> What was the port
>> 8080? Yeah.
>> Okay. Because it says 3001 here.
>> Oh, it's Oh, it's already up and
running. That's That's why
it was already up and running somewhere
else. H.
Let's change the port. Yeah, good eyes.
Thank you for that, Sandra.
>> Yeah, that's what P programming is for.
>> So, now we have Oh, we have a new
readme. We have a bunch of files that we
don't need to look into right now.
And
what is the URL? mcp SSE. This is the
URL.
Connect.
>> And voila, we are connected.
And we can list the tools. Now we can
get a random Oh, list monkey species.
Run tool. There you go. So, we got uh a
bunch of species here. Uh let's see.
There's a probosis monkey. Uh Mandreal
Aurora tail monkey. This is a fictional
one. Look at that fictional northern mis
lens. So this is an example of creating
an MCP server using quarkus but using
the lln. You give instructions. You give
a copilot GitHub copilot instructions
file on how to create an MCP server. And
then you tell hey create me an MCP
server with this scenario this use case.
And it generates everything for you. All
you have to do is quirkus dev and voila
you have your project up and running.
Now once we have the MCP server up and
running, now it comes to how do I
configure this MCP server in clients. So
I can use this MCP server um within my
my development tool or within my chat
TPT window and so on or a cloud desktop
uh or even other other AI agents um um
tools that you have in your in your
environment. But we are done with the
MCP server. So we can um you can join us
on the next talk for MCP clients where
we're going to learn how to configure
this MCP server to be accessed. So
thanks for having us.
>> Thank you so much Bruno and Sandra for
this amazing session. The only thing
better than one cloud advocate is two
and we had both of you today to lead us
on this amazing journey. For those of
you who followed along or would like to
learn more, you can find resources at
aka.ms/java
and AI for beginners. Link is also in
the description of this video. We hope
you stick around and we'll see you in
the next episode.
In this episode, Ayan Gupta is joined by Bruno Borges and Sandra Ahlgrimm, two seasoned developers with over 30 combined years of experience, who will show you how to build an MCP (Model Context Protocol) server. Think of a café, you need a barista who knows the recipes and handles the brewing. In MCP, that barista is the server, and this episode shows you how to create one! The Model Context Protocol is a powerful way to extend AI applications by allowing them to interact with external tools, APIs, and services. In this hands-on session, Bruno and Sandra demonstrate how to build an MCP server using Quarkus, a modern Java framework, combined with the intelligence of GitHub Copilot to generate most of the code automatically. Rather than manually writing boilerplate code, you'll learn how to leverage GitHub Copilot's agent mode with custom instructions to scaffold an entire MCP server. Bruno and Sandra create a "monkey species" API server that demonstrates real MCP capabilities: listing species, getting details, retrieving random entries, and tracking statistics. The best part? They use Copilot to write the implementation, including both real and fictional monkey species data! You'll see how to annotate services with MCP-specific attributes, configure endpoints using server-sent events, test your server using the MCP Inspector tool, and prepare it for client integration. This example may use monkey species, but the patterns apply to any business domain, customer data, inventory systems, financial APIs, and more. Resources: aka.ms/JavaAndAIForBeginners 0:00 - Introduction: MCP Servers as Baristas 0:47 - What Is MCP and Why Use It? 1:05 - Starting with a Quarkus Project 1:37 - Using MCP to Simplify API Changes 2:11 - Leveraging GitHub Copilot Instructions 3:00 - Creating the MCP Server Automatically 3:47 - Understanding the Generated Code 4:30 - Exploring Java Records and Best Practices 5:38 - Building and Testing the Server 6:43 - Starting the MCP Server 7:35 - Testing with MCP Inspector 8:10 - Resolving Port Conflicts 9:01 - Connecting and Listing Tools 9:37 - Running Tool Queries Successfully 10:23 - Session Recap: What We Built 11:04 - Preview of Session 107: Building Clients 11:25 - Wrap-Up and Resources #MCP #ModelContextProtocol #Quarkus #JavaDevelopment #GitHubCopilot #AIServers #JavaApps #ServerDevelopment #APIIntegration #CloudDevelopment #QuarkusJav