Real world MCPs in GitHub Copilot Agent Mode — Jon Peck, Microsoft

Channel: aiDotEngineer

Published at: 2025-07-19

YouTube video id: RkVILz06y08

Source: https://www.youtube.com/watch?v=RkVILz06y08

Our
[Music]
focus lately
obviously has been a lot about co-pilot
and how we're really bringing all the AI
development capabilities to you.
Initially code completion that was
really our our first step into this
right and that's the sort of thing that
you interact with at the microcond level
you're writing code you're getting
suggestions as you type full function
completions that sort of thing we moved
on from that into chat and having the
ability to interact usually in more or
less a onehop where you're giving it
perhaps a complex prompt you're getting
it to spit out or change multiple files
uh and then you're moving moving on to
the next thing you want to do. Agent
mode is really all about doing a
complete task and having a deep
interaction with that agent as you are
building. So I'll give it something I
want to do. I will interact with the
agent as it's working, telling it what
it's allowed to do on the command
prompt, allowing it to read responses,
that sort of thing. And at the end, I'm
going to do anything from build a
complete green field app to do a deep
refactoring across a large codebase.
Moderately complex tasks.
To give you a real example of what this
looks like here, I've got a readme, uh,
no code at all, just a read me inside a
repo. It's got a description of what I'm
going to make. It's got the project
structure lined up. It's the usual stuff
I would write to another developer. how
I want to set it up, how I want to
configure the environment variables. Uh,
I might have a database schema in there.
I might describe my specific API
endpoints that I want to use. Um, and I
might even include, you know, some
workflow graphs. Uh, a cool thing about
LLMs nowadays with vision capabilities
is I could include these as an image and
it'll actually be able to read them. If
I'm working with a model that doesn't,
I'll just use mermaid or some other
textbased diraph diagramming. But that
readme is intended to be very complete
so that I can simply go in, I can switch
copilot over to agent mode and pick the
model I want to work with and just say
something like, "Hey, go ahead and
implement this." And it's going to go
ahead and crank through. By the way,
apologies for using videos on this. Uh,
as per yesterday's email, the internet's
a little untrustworthy. Obviously, it's
been untrustworthy for 30 years or so,
but more so locally, right? So, it's
going ahead. It's going to build my data
models. it's gonna spit out um the app
pie. It's going to start working on the
front end, etc. And something to notice
here is whenever those continue boxes
come up, that's when it's wanting to
interact with the terminal. So, it
actually has to ask for my permission
before it's allowed to continue doing
that. But then it'll read the response
from the terminal if something goes
wrong and react to that. So, at the end
of this, and this took in real time
maybe about 8 minutes, um I've actually
got a basic working app. Obviously, not
well styled or anything. I'll do that in
later iterations, but I can interact
with it. I can make travel reservations.
I can pick the rooms I want, etc. Right?
So, that's your basic agent mode
interaction.
Now, let's add MCP into this. If you
haven't heard of MCP yet, uh you
probably haven't been on the internet in
the last year, but a real quick review.
Uh MCP is model context protocol. It's
basically an open protocol. It's kind of
an API for AI, if you will. It allows
LLMs to talk to external data sources,
external references to get information
which might be general, might be
specific to your account if you've added
authentication into it. Uh, or it might
just be advice. So, you can connect to
all kinds of things from this. Um, and
we're just going to go through every
single one of the MCPs out there and
we're going to go in detail. No. Okay.
I'm not There's thousands people. Okay.
So,
github.com/modelcontextprotocol/servers
is a list of it. By the way, this URL in
the bottom right, gh.iofairmcp,
all of these slides and the embedded
videos. So, feel free to take pictures,
but those will all be available to you
immediately. How does this mechanically
work? My IDE, in this case, I'm using VS
Code, has configured in it which MCPs I
want to actually use. I'll show that in
a second. Copilot is aware of those in
the configuration. So when I ask it to
do something, it's going to pick the
right MCP for the job and it's going to
go out to connect to that MCP and get
whatever has to it has to get. That
might be a local MCP server running on
my machine which is going to connect to
like a local database maybe or maybe
dial out to a web API to get something
or it might even be this MCP tomcp
protocol SSE which I'm not super
familiar with where you basically have
that MCP server running on a remote
server so it can be in a protected
environment and then it'll do the work
and return it back to your IDE. Either
way, how you actually use these is
pretty straightforward, right? I'm going
to identify the problem that I'm working
with and what technologies are in that.
So in this particular case, right, I'm
using Postgress. Uh maybe what I want to
do is I want to make tests for this
application and I want to actually use
the data from the local database as my
mock data, right? So I'll go ahead, I'll
find the Postgress MCP. I'll add that in
and then I'll ask C-Ilot to go and do
something with it. So let's take a look
at what that looks like. I head out to
GitHub context protocol/servers.
I search around for one that's going to
do the job. Okie dokie. There's a
Postgress MC PostgresQL MCP I can use. I
could manually install it. There's
instructions here of course, but one
nice thing about using VS Code is a lot
of these have a one-click config where I
can just hit that. It's going to
activate VS Code and then it's going to
say, "Okay, can I install this server?"
So, it goes ahead. I say, "Yep, install
the server." It's going to add that into
my settings JSON. And one thing I didn't
quite detail here in the video, but just
so you know, when it gives it to me
initially, it's just a bare sort of
connection string default, right? I have
to go in fill it out with my specific
information. In this particular case, I
don't need an authentication token
because I'm using local unauthenticated
PostgresQL. But obviously, if it were
remote database or I was in production,
I would be using a proper off here. But
I basically fill that out with the data
that's going to be needed. You can see
my Postgress connection string there.
And then I'm going to start that server.
So there's a little start icon above
that. Sorry, that probably went through
quickly. But what that does is it
basically starts the local MCP server so
that now it's available for me to
connect to. If I ever want to see what I
currently have, I can always hit this
little tools icon down in the chat area.
Sorry, it's small, but it looks like a
little tool, you know, hammer and
whatever next to each other. And that'll
bring up this list of all the MCP
servers that are available to it. I can
enable and disable them there and just
use that as a reference for what I might
be able to do. So knowing that that's
there, I'm going to ask Copilot to do
something with Postgress. And sometimes
I have to be more specific. I tried this
without specifically saying use the
Postgress MCP. And sometimes it
intuitits it and sometimes it doesn't.
So I've taken to just being explicit.
Use the Postgress MCP2. And here what
I'm going to ask it to do is to go to
that Postgress database, pull the data
and then make a mock.json which I can
use as a reference as I build tests. So
I can see it goes ahead, it says am I
allowed to connect to this. So same
thing as when I was working in the
terminal, I actually have to give it
permission to do it because I don't want
it just going and messing around in my
database without it's without my
permission. By the way, one particular
thing about this Postgress MCP, not all
of them. But this one only functions in
readonly mode, which is one of the
reasons I like it because it's very
safe. It can read my data. It can use it
locally in the ID, but it's not going to
mutate my database accidentally, right?
It'll go ahead, it'll run through all of
that, pull the data. There we go. It's
got the actual data. It's put it into a
mock JSON, and then it proceeds with the
rest of the nonMCP agent workflow of I'm
going to actually build out all of your
tests using that, etc. So, that worked
out pretty well.
Let's just take a quick look at what
mechanically actually happened there,
right? Ah, bummer. My little music
repeaton isn't working. I thought that
was cute. Anyway, um, we basically said
to Copilot, hey, go and do something.
Copilot itself parses that prompt and
identifies the fact that it should be
using an MCP for this connection. It
asks for permission from the developer
to actually go and do the connection.
When it gets that, it calls that MCP
server. That MCP then interrogates my
database for whatever it needs. So
basically, Copilot and the MCP are kind
of handshaking and talking here saying,
"All right, you know, the first thing I
want to do, I know we kind of breeze
through it, is get the database schema.
All right, the next thing is I want to
identify and select from the specific
tables. The next thing I want to do is
pull the data from those tables." And
those were those successive steps you
saw. After that, Copilot's parsing all
of those responses and putting something
into my output. In this particular case,
it's creating those files that I asked
it to and then adding it to its
successive context so it can do the rest
of the work. And the reason I say
iterate here is I guarantee your first
prompt will not be right. Right? Which
is one of the reasons I really like
using readme files and also now you can
use copilot instructions and also put
prompt files that you can use
selectively into VS Code. So, just go
ahead and search for those and you'll
find more detail on how to do that. One
last thing I want to leave you with
here, I've got about four minutes it
seems. Um, is that GitHub itself has an
MCP server. And the reason I love this
is because there's a lot of things that
I don't necessarily want to do manually
using, you know, GitHub command line or
Git or even having to go out to the site
and actually click buttons. The MCP
server is pretty powerful and what it
lets me do, same workflow by the way,
although there is a specific URL for
this. I'll give that to you at to the
end. Um, I go down, I find it, I say go
ahead and add it to VS Code. And the
thing I'm going to have to do here is,
of course, I want information specific
to my account. So, you'll see in here
there's a place where you can add your
GitHub personal access token. So, you'll
just go ahead, you'll generate one of
those. You'll drop it in. Yes, John,
remember to blur it. Very good. Um, and
then you will start that MCP server and
that would be connecting as you through
your personal access token. So then I
can tell it something like, okay, you
know, you just went and you did all of
this work. I want to I want to point out
one thing, by the way, which I consider
a best practice. Um, for those of you
that use copilot instructions, um, which
basically is a specially named file in
your ID.github/copilot-instructions.mmd,
github/copilot-instructions.mmd.
You can put in there basically things
that you want to go into every single
prompt. It's kind of pre-injected,
right? One of the things I like to put
in there, aside from all of my standards
about am I using pep 8? Uh, do I want
you to run a security check on the stuff
you just installed? So on so on, all
those good practices, I like to say also
include a change log of everything
you've done. That way when agent does
work even though yes I'm going to be
progressively committing and get sort of
a history that way having it explicitly
add things to the change log gives me a
really good idea of what it did at every
single step. So that's what you're
seeing happen right here, right? But
then following that, I'm just basically
going to say, "All right, now that
you've done all of that work, go ahead
and use the GitHub MCP to commit all of
these changes to a new branch and make a
PR." Right? So one step shot, I can
pretty much just say, "Okay, go ahead
and do the stuff I would normally have
to do either through manipulating git
commands or in VS Code manually or going
out and creating that PR directly." And
I won't show you the whole flow, but
basically it comes up. It says, "All
right, I'm going to make that
connection. Am I allowed to? I'm going
to go ahead create the branch view,
create the PR, etc." All right,
with two minutes to go, I'll leave you
with this slide of references. Um, so
gh.io/fair/mcp
once again is this deck. And the very
last slide in this is all of the things
that you would care to find out about
about how to work with VS Code, how to
install MCPS, etc. And I think I might
have time for like one question before
they drag me off stage. All right, first
hand up.
There's uh something new called Gupil
agent coding agent something like that
where you basically uh assign issues to
uh the web UI.
Yes.
Thank you for how does it play out like
uh do you think this will be like a
unified brother some future or those
like separate
TBA whether it's going to be totally
unified because I think the concerns of
the independent developer versus the
concerns of the enterprise were a little
bit different. So at the time being
we're visualizing that as a little bit
more of an enterprise thing u because of
the way that it does work autonomously
and then you can hand it off and have
other developers of it sort of team-like
interaction. Um that said uh these are
always fluid. We'll find out exactly how
it works. Uh for anyone who hasn't seen
this yet, this is what I informally call
assign issue to copilot where you can go
into GitHub on github.com. You can
create a new issue and then you can pick
copilot as the assenee and copilot will
take off and it'll do a lot of the agent
kind of stuff we just saw, but it does
it in the background, provides you a
session you can refer to on github.com,
but then basically works through a PR
and gives you output there. A quick note
on that, um, MCP is available there as
well and you can configure that in your
repo settings under the copilot subset
and dump in your co your MCP configs
there. Thanks very much for your time.
Cheers.
[Music]