Free YouTube Transcribe

Video transcript

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

AI Engineer · 2,747 words · 13 min read

Want to search this transcript, jump the video from any line, or download it as TXT, SRT, or VTT?

Open in the transcript tool

Full transcript

0:00Our

0:01[Music]

0:18focus lately

0:20obviously has been a lot about co-pilot

0:23and how we're really bringing all the AI

0:27development capabilities to you.

0:29Initially code completion that was

0:31really our our first step into this

0:33right and that's the sort of thing that

0:34you interact with at the microcond level

0:37you're writing code you're getting

0:39suggestions as you type full function

0:41completions that sort of thing we moved

0:43on from that into chat and having the

0:48ability to interact usually in more or

0:51less a onehop where you're giving it

0:53perhaps a complex prompt you're getting

0:55it to spit out or change multiple files

0:58uh and then you're moving moving on to

0:59the next thing you want to do. Agent

1:01mode is really all about doing a

1:04complete task and having a deep

1:06interaction with that agent as you are

1:09building. So I'll give it something I

1:11want to do. I will interact with the

1:15agent as it's working, telling it what

1:17it's allowed to do on the command

1:18prompt, allowing it to read responses,

1:20that sort of thing. And at the end, I'm

1:23going to do anything from build a

1:24complete green field app to do a deep

1:27refactoring across a large codebase.

1:29Moderately complex tasks.

1:32To give you a real example of what this

1:35looks like here, I've got a readme, uh,

1:38no code at all, just a read me inside a

1:41repo. It's got a description of what I'm

1:43going to make. It's got the project

1:45structure lined up. It's the usual stuff

1:48I would write to another developer. how

1:49I want to set it up, how I want to

1:51configure the environment variables. Uh,

1:53I might have a database schema in there.

1:55I might describe my specific API

1:57endpoints that I want to use. Um, and I

2:00might even include, you know, some

2:02workflow graphs. Uh, a cool thing about

2:05LLMs nowadays with vision capabilities

2:07is I could include these as an image and

2:09it'll actually be able to read them. If

2:11I'm working with a model that doesn't,

2:12I'll just use mermaid or some other

2:14textbased diraph diagramming. But that

2:17readme is intended to be very complete

2:19so that I can simply go in, I can switch

2:22copilot over to agent mode and pick the

2:25model I want to work with and just say

2:26something like, "Hey, go ahead and

2:28implement this." And it's going to go

2:30ahead and crank through. By the way,

2:32apologies for using videos on this. Uh,

2:34as per yesterday's email, the internet's

2:36a little untrustworthy. Obviously, it's

2:38been untrustworthy for 30 years or so,

2:40but more so locally, right? So, it's

2:42going ahead. It's going to build my data

2:44models. it's gonna spit out um the app

2:47pie. It's going to start working on the

2:49front end, etc. And something to notice

2:51here is whenever those continue boxes

2:53come up, that's when it's wanting to

2:55interact with the terminal. So, it

2:56actually has to ask for my permission

2:58before it's allowed to continue doing

2:59that. But then it'll read the response

3:01from the terminal if something goes

3:02wrong and react to that. So, at the end

3:05of this, and this took in real time

3:07maybe about 8 minutes, um I've actually

3:10got a basic working app. Obviously, not

3:12well styled or anything. I'll do that in

3:14later iterations, but I can interact

3:16with it. I can make travel reservations.

3:18I can pick the rooms I want, etc. Right?

3:20So, that's your basic agent mode

3:22interaction.

3:24Now, let's add MCP into this. If you

3:26haven't heard of MCP yet, uh you

3:29probably haven't been on the internet in

3:30the last year, but a real quick review.

3:33Uh MCP is model context protocol. It's

3:35basically an open protocol. It's kind of

3:37an API for AI, if you will. It allows

3:40LLMs to talk to external data sources,

3:43external references to get information

3:45which might be general, might be

3:47specific to your account if you've added

3:48authentication into it. Uh, or it might

3:51just be advice. So, you can connect to

3:53all kinds of things from this. Um, and

3:56we're just going to go through every

3:57single one of the MCPs out there and

3:59we're going to go in detail. No. Okay.

4:01I'm not There's thousands people. Okay.

4:04So,

4:04github.com/modelcontextprotocol/servers

4:08is a list of it. By the way, this URL in

4:10the bottom right, gh.iofairmcp,

4:14all of these slides and the embedded

4:15videos. So, feel free to take pictures,

4:17but those will all be available to you

4:19immediately. How does this mechanically

4:21work? My IDE, in this case, I'm using VS

4:24Code, has configured in it which MCPs I

4:28want to actually use. I'll show that in

4:30a second. Copilot is aware of those in

4:33the configuration. So when I ask it to

4:35do something, it's going to pick the

4:37right MCP for the job and it's going to

4:39go out to connect to that MCP and get

4:42whatever has to it has to get. That

4:44might be a local MCP server running on

4:47my machine which is going to connect to

4:48like a local database maybe or maybe

4:50dial out to a web API to get something

4:52or it might even be this MCP tomcp

4:55protocol SSE which I'm not super

4:57familiar with where you basically have

4:59that MCP server running on a remote

5:01server so it can be in a protected

5:03environment and then it'll do the work

5:05and return it back to your IDE. Either

5:07way, how you actually use these is

5:09pretty straightforward, right? I'm going

5:10to identify the problem that I'm working

5:12with and what technologies are in that.

5:15So in this particular case, right, I'm

5:17using Postgress. Uh maybe what I want to

5:20do is I want to make tests for this

5:22application and I want to actually use

5:23the data from the local database as my

5:26mock data, right? So I'll go ahead, I'll

5:29find the Postgress MCP. I'll add that in

5:32and then I'll ask C-Ilot to go and do

5:34something with it. So let's take a look

5:35at what that looks like. I head out to

5:37GitHub context protocol/servers.

5:40I search around for one that's going to

5:42do the job. Okie dokie. There's a

5:44Postgress MC PostgresQL MCP I can use. I

5:47could manually install it. There's

5:49instructions here of course, but one

5:50nice thing about using VS Code is a lot

5:52of these have a one-click config where I

5:54can just hit that. It's going to

5:56activate VS Code and then it's going to

5:59say, "Okay, can I install this server?"

6:02So, it goes ahead. I say, "Yep, install

6:04the server." It's going to add that into

6:06my settings JSON. And one thing I didn't

6:08quite detail here in the video, but just

6:10so you know, when it gives it to me

6:12initially, it's just a bare sort of

6:14connection string default, right? I have

6:16to go in fill it out with my specific

6:19information. In this particular case, I

6:20don't need an authentication token

6:22because I'm using local unauthenticated

6:24PostgresQL. But obviously, if it were

6:26remote database or I was in production,

6:28I would be using a proper off here. But

6:30I basically fill that out with the data

6:33that's going to be needed. You can see

6:34my Postgress connection string there.

6:37And then I'm going to start that server.

6:40So there's a little start icon above

6:42that. Sorry, that probably went through

6:43quickly. But what that does is it

6:46basically starts the local MCP server so

6:48that now it's available for me to

6:50connect to. If I ever want to see what I

6:53currently have, I can always hit this

6:55little tools icon down in the chat area.

6:59Sorry, it's small, but it looks like a

7:00little tool, you know, hammer and

7:02whatever next to each other. And that'll

7:03bring up this list of all the MCP

7:06servers that are available to it. I can

7:08enable and disable them there and just

7:10use that as a reference for what I might

7:11be able to do. So knowing that that's

7:14there, I'm going to ask Copilot to do

7:17something with Postgress. And sometimes

7:19I have to be more specific. I tried this

7:21without specifically saying use the

7:22Postgress MCP. And sometimes it

7:24intuitits it and sometimes it doesn't.

7:25So I've taken to just being explicit.

7:27Use the Postgress MCP2. And here what

7:30I'm going to ask it to do is to go to

7:32that Postgress database, pull the data

7:36and then make a mock.json which I can

7:38use as a reference as I build tests. So

7:41I can see it goes ahead, it says am I

7:44allowed to connect to this. So same

7:46thing as when I was working in the

7:47terminal, I actually have to give it

7:49permission to do it because I don't want

7:51it just going and messing around in my

7:52database without it's without my

7:54permission. By the way, one particular

7:57thing about this Postgress MCP, not all

7:59of them. But this one only functions in

8:00readonly mode, which is one of the

8:02reasons I like it because it's very

8:03safe. It can read my data. It can use it

8:05locally in the ID, but it's not going to

8:07mutate my database accidentally, right?

8:10It'll go ahead, it'll run through all of

8:12that, pull the data. There we go. It's

8:14got the actual data. It's put it into a

8:15mock JSON, and then it proceeds with the

8:18rest of the nonMCP agent workflow of I'm

8:21going to actually build out all of your

8:22tests using that, etc. So, that worked

8:25out pretty well.

8:27Let's just take a quick look at what

8:29mechanically actually happened there,

8:31right? Ah, bummer. My little music

8:34repeaton isn't working. I thought that

8:36was cute. Anyway, um, we basically said

8:39to Copilot, hey, go and do something.

8:41Copilot itself parses that prompt and

8:44identifies the fact that it should be

8:46using an MCP for this connection. It

8:49asks for permission from the developer

8:51to actually go and do the connection.

8:53When it gets that, it calls that MCP

8:56server. That MCP then interrogates my

9:00database for whatever it needs. So

9:03basically, Copilot and the MCP are kind

9:06of handshaking and talking here saying,

9:08"All right, you know, the first thing I

9:09want to do, I know we kind of breeze

9:10through it, is get the database schema.

9:12All right, the next thing is I want to

9:14identify and select from the specific

9:16tables. The next thing I want to do is

9:17pull the data from those tables." And

9:18those were those successive steps you

9:20saw. After that, Copilot's parsing all

9:24of those responses and putting something

9:27into my output. In this particular case,

9:29it's creating those files that I asked

9:31it to and then adding it to its

9:33successive context so it can do the rest

9:34of the work. And the reason I say

9:36iterate here is I guarantee your first

9:38prompt will not be right. Right? Which

9:40is one of the reasons I really like

9:41using readme files and also now you can

9:44use copilot instructions and also put

9:45prompt files that you can use

9:47selectively into VS Code. So, just go

9:50ahead and search for those and you'll

9:51find more detail on how to do that. One

9:54last thing I want to leave you with

9:55here, I've got about four minutes it

9:57seems. Um, is that GitHub itself has an

10:00MCP server. And the reason I love this

10:03is because there's a lot of things that

10:05I don't necessarily want to do manually

10:08using, you know, GitHub command line or

10:12Git or even having to go out to the site

10:15and actually click buttons. The MCP

10:17server is pretty powerful and what it

10:20lets me do, same workflow by the way,

10:22although there is a specific URL for

10:24this. I'll give that to you at to the

10:25end. Um, I go down, I find it, I say go

10:28ahead and add it to VS Code. And the

10:30thing I'm going to have to do here is,

10:32of course, I want information specific

10:33to my account. So, you'll see in here

10:35there's a place where you can add your

10:37GitHub personal access token. So, you'll

10:39just go ahead, you'll generate one of

10:41those. You'll drop it in. Yes, John,

10:43remember to blur it. Very good. Um, and

10:46then you will start that MCP server and

10:49that would be connecting as you through

10:51your personal access token. So then I

10:53can tell it something like, okay, you

10:54know, you just went and you did all of

10:56this work. I want to I want to point out

10:58one thing, by the way, which I consider

11:00a best practice. Um, for those of you

11:02that use copilot instructions, um, which

11:05basically is a specially named file in

11:08your ID.github/copilot-instructions.mmd,

11:08github/copilot-instructions.mmd.

11:11You can put in there basically things

11:13that you want to go into every single

11:14prompt. It's kind of pre-injected,

11:16right? One of the things I like to put

11:19in there, aside from all of my standards

11:20about am I using pep 8? Uh, do I want

11:23you to run a security check on the stuff

11:25you just installed? So on so on, all

11:27those good practices, I like to say also

11:30include a change log of everything

11:31you've done. That way when agent does

11:34work even though yes I'm going to be

11:35progressively committing and get sort of

11:37a history that way having it explicitly

11:40add things to the change log gives me a

11:42really good idea of what it did at every

11:44single step. So that's what you're

11:45seeing happen right here, right? But

11:48then following that, I'm just basically

11:50going to say, "All right, now that

11:52you've done all of that work, go ahead

11:54and use the GitHub MCP to commit all of

11:58these changes to a new branch and make a

12:01PR." Right? So one step shot, I can

12:04pretty much just say, "Okay, go ahead

12:06and do the stuff I would normally have

12:08to do either through manipulating git

12:10commands or in VS Code manually or going

12:12out and creating that PR directly." And

12:14I won't show you the whole flow, but

12:16basically it comes up. It says, "All

12:17right, I'm going to make that

12:18connection. Am I allowed to? I'm going

12:20to go ahead create the branch view,

12:21create the PR, etc." All right,

12:25with two minutes to go, I'll leave you

12:28with this slide of references. Um, so

12:31gh.io/fair/mcp

12:34once again is this deck. And the very

12:36last slide in this is all of the things

12:40that you would care to find out about

12:43about how to work with VS Code, how to

12:44install MCPS, etc. And I think I might

12:47have time for like one question before

12:49they drag me off stage. All right, first

12:52hand up.

12:53There's uh something new called Gupil

12:58agent coding agent something like that

13:00where you basically uh assign issues to

13:05uh the web UI.

13:06Yes.

13:08Thank you for how does it play out like

13:09uh do you think this will be like a

13:11unified brother some future or those

13:14like separate

13:15TBA whether it's going to be totally

13:17unified because I think the concerns of

13:19the independent developer versus the

13:21concerns of the enterprise were a little

13:22bit different. So at the time being

13:24we're visualizing that as a little bit

13:26more of an enterprise thing u because of

13:29the way that it does work autonomously

13:31and then you can hand it off and have

13:33other developers of it sort of team-like

13:35interaction. Um that said uh these are

13:39always fluid. We'll find out exactly how

13:40it works. Uh for anyone who hasn't seen

13:43this yet, this is what I informally call

13:45assign issue to copilot where you can go

13:48into GitHub on github.com. You can

13:50create a new issue and then you can pick

13:52copilot as the assenee and copilot will

13:55take off and it'll do a lot of the agent

13:57kind of stuff we just saw, but it does

13:59it in the background, provides you a

14:00session you can refer to on github.com,

14:03but then basically works through a PR

14:05and gives you output there. A quick note

14:07on that, um, MCP is available there as

14:10well and you can configure that in your

14:13repo settings under the copilot subset

14:16and dump in your co your MCP configs

14:18there. Thanks very much for your time.

14:20Cheers.

14:21[Music]

This transcript was generated from the captions YouTube publishes for this video. Get the transcript of any YouTube video atfreeyoutubetranscribe.com: free, unlimited, no sign-up.