|
| 1 | +## Step 1: Introduction to MCP and environment setup |
| 2 | + |
| 3 | +Welcome to the **"Integrate Model Context Protocol with GitHub Copilot"** exercise! :robot: |
| 4 | + |
| 5 | +In this exercise, you'll learn how Model Context Protocol (MCP) enhances the way you use GitHub Copilot. |
| 6 | + |
| 7 | +> [!IMPORTANT] |
| 8 | +> This exercise may not explain the basics that were taught in the [Getting Started with Copilot](https://github.com/skills/getting-started-with-github-copilot) exercise. If you are new to Copilot we recommend starting with that one. |
| 9 | +
|
| 10 | + |
| 11 | +### What is Model Context Protocol (MCP)? |
| 12 | + |
| 13 | +[Model Context Protocol (MCP)](https://modelcontextprotocol.io/introduction) is an open standard that bridges AI models with external data sources and tools. It provides a universal interface for connecting AI assistants like GitHub Copilot to various system allowing them to access real-time data, perform actions in external systems, and leverage specialized tools beyond their built-in capabilities. |
| 14 | +### :keyboard: Activity: Get to know your environment |
| 15 | + |
| 16 | +Let's start up our development environment and familiarize with the environment. |
| 17 | + |
| 18 | +We are using the same web application as in the [Getting Started with Copilot](https://github.com/skills/getting-started-with-github-copilot) exercise - the Mergington High School's extracurricular activities website. |
| 19 | + |
| 20 | +1. Right-click the below button to open the **Create Codespace** page in a new tab. Use the default configuration. |
| 21 | + |
| 22 | + [](https://codespaces.new/{{full_repo_name}}?quickstart=1) |
| 23 | + |
| 24 | +1. Validate the Copilot Chat extension is installed |
| 25 | +1. In the left sidebar, select the `Run and Debug` tab and then press the **Start Debugging** icon. |
| 26 | + |
| 27 | + <img width="300" alt="image" src="https://github.com/user-attachments/assets/50b27f2a-5eab-4827-9343-ab5bce62357e" /> |
| 28 | + |
| 29 | +1. Throughout the exercise, you can access the website link from the `ports` tab on port `8000`. |
| 30 | + |
| 31 | +### :keyboard: Activity: Set up a MCP server for your project |
| 32 | + |
| 33 | +1. Inside your codespace, create a new file named `mcp.json` in the `.vscode` directory and paste the following contents: |
| 34 | + |
| 35 | +```json |
| 36 | +// .vscode/mcp.json |
| 37 | +{ |
| 38 | + "servers": { |
| 39 | + "github": { |
| 40 | + "command": "npx", |
| 41 | + "args": ["-y", "@modelcontextprotocol/server-github"], |
| 42 | + "envFile": "${workspaceFolder}/.env" |
| 43 | + } |
| 44 | + } |
| 45 | +} |
| 46 | +``` |
| 47 | + |
| 48 | +1. Save the file and you should see `Start` button show up like so: |
| 49 | + |
| 50 | + <!-- TODO: Add screenshot with start button --> |
| 51 | + |
| 52 | +1. Validate the MCP Server is running. |
| 53 | + 1. The `.vscode/mcp.json` file should show if the server you started is running |
| 54 | + <!-- TODO: Add screenshot --> |
| 55 | + 1. You should see additional tools available in Copilot Agent Mode |
| 56 | + <!-- TODO: Add screenshot --> |
| 57 | + 1. You can use the VSCode command palette `Ctrl+Shift+P` or `Command+Shift+P` on Mac. |
| 58 | + Start typing `> MCP` to see different MCP commands, such as listing active servers. |
| 59 | + <!-- TODO: Add screenshot --> |
| 60 | + |
| 61 | +1. Commit and push the `.vscode/mcp.json` file to the `main` branch |
| 62 | + |
| 63 | + |
| 64 | +<details> |
| 65 | +<summary>Having trouble?</summary><br/> |
| 66 | + |
| 67 | +Make sure you: |
| 68 | + |
| 69 | +- Properly uncommented the contents of `.vscode/mcp.json` file |
| 70 | +- Pushed your changes to the `main` branch |
| 71 | + |
| 72 | +</details> |
0 commit comments