Model Context Protocol (MCP) Explained in 5 Minutes
Model Context Protocol, or MCP, is a topic gaining significant traction in the development world. You might be wondering what these MCP servers are, why they matter, and how they can enhance your development workflow for better, faster results. This article will provide a high-level breakdown of MCPs, their benefits, and a step-by-step guide to configuring Visual Studio Code to use them with GitHub Copilot.
What is Model Context Protocol (MCP)?
At a very high level, think of MCP as a standardized middle layer. Numerous services like your computer's file system, OneDrive, Google Drive, Figma, and GitHub all have unique APIs for commands such as getting files, managing pull requests, or creating issues. For an AI agent or a Large Language Model (LLM) to interact with all of them, it would need to understand each specific API.
MCP solves this by creating a standardized protocol. It allows LLM models to call different services or other agents that can perform actions. It's a middle layer that sits between the APIs of services like GitHub and AI models like GitHub Copilot agents, enabling them to execute a wide range of commands.
These MCPs have servers that can run on your local machine or elsewhere, which agents can communicate with. For instance, within GitHub Copilot, you can talk to various MCP servers configured to your preferences. This is like adding more specialized tools to your development toolbox.
While you can already perform actions like creating pull requests in VS Code through extensions, MCP servers empower agents to do more for you, such as creating multiple issues in real-time, pulling in data from different services, or attaching files automatically.
Getting Started with MCP in VS Code
The best place to start is the Model Context Protocol GitHub organization. This repository contains everything you need, including documentation, specifications, SDK access, and more. It also features a list of maintained servers.
You'll find a variety of reference servers, some developer-focused and others for general use in any LLM tool. Examples include:
- File System
- GitHub
- Google Drive
- Google Maps
- Puppeteer
- Redis
- Sentry
- Slack
There are also numerous community-driven servers for services like Airbnb, Airtable, AWS, Azure, BigQuery, and even Ghost CMS.
Setting Up Your First MCP Server
Let's walk through setting up an MCP server in VS Code. This guide uses the Insiders build of Visual Studio Code, which provides the latest features.
In the GitHub Copilot chat window, you'll notice different modes like Ask, Edit, and Agent. In Agent mode, a "tools" button reveals the tools currently in use by Copilot. By default, these are internal tools for interacting with the VS Code API, handling terminal commands, fetching webpages, and more. MCP servers appear here as additional tools.
- Open Settings: Go to your VS Code settings and search for "MCP".
- Enable Auto Discovery: You can enable "Auto Discovery" to automatically find MCP servers, especially if you use other tools that run them.
- Add a Server: To add one manually, edit your
settings.json
file. Clicking the "Edit in settings.json" link for MCP servers will often add a default example, like thetime
server.
Initially, the configuration might point to a Python script:
"mcp.servers": [
{
"name": "time",
"command": "python",
"args": [
"-m",
"mcp.server.time"
]
}
]
If you don't have Python installed, this will fail. MCP servers are available through various mechanisms, including Python, .NET, TypeScript, and Docker. For this example, we'll use Docker.
On the MCP GitHub page for the time
server, you'll find installation options. Copy the Docker configuration and replace the existing one in your settings.json
:
"mcp.servers": [
{
"name": "time",
"command": "docker",
"args": [
"run",
"--rm",
"-i",
"ghcr.io/model-context-protocol/mcp-server-time:latest"
]
}
]
After saving the file, a notification will appear in the status bar indicating a new tool is available. You can start the server directly from there. Once running, this command starts the mcp-server-time
Docker container.
Now, you can interact with it in the Copilot chat:
User: What is the current time?
Copilot will identify that the time
tool can fulfill this request and ask for permission to run it. After you approve, it will return the current UTC time. You can ask follow-up questions like:
User: What is that in Pacific Time Zone?
User: What time is it in Australia?
This simple server demonstrates how an agent can offload specific tasks to a specialized tool.
A More Powerful Example: The GitHub MCP Server
Let's integrate a more complex tool: the GitHub MCP server. This server provides a vast API with capabilities to:
- Create, update, and push files
- Search repositories
- Create repositories, issues, and pull requests
- List issues and branches
- And much more.
It's available as a Docker container or a simple Node application. If you have Node.js installed, you can add it to your settings.json
:
"mcp.servers": [
// ... other servers
{
"name": "github",
"command": "npx",
"args": [
"mcp-server-github"
],
"env": {
"GITHUB_TOKEN": "YOUR_PERSONAL_ACCESS_TOKEN"
}
}
]
Note on Security: You must provide a GitHub Personal Access Token (PAT) with the appropriate scopes (e.g., creating issues, managing pull requests). Pasting secrets directly into settings.json
is not recommended. A better practice is to use input variables or launch configurations to manage secrets securely and avoid checking them into source control.
Once the server is running, you can perform powerful actions.
User: Are there any pull requests open on the App-Coffee-Tracker repo for the owner
your-username
?
Copilot will use the listPullRequests
tool from the GitHub server and summarize the open pull requests for you. While you could find this information manually, the power lies in the conversational interface and the summarization provided by the LLM.
The real magic happens when you combine the agent's intelligence with the tool's actions.
User: Create a new issue for a feature to add a camera option in the app. The feature should let users take a photo of a coffee bag to identify the roaster. Add details about how to implement this in a .NET MAUI app.
Here, the agent doesn't just retrieve information; it generates a detailed feature request and then uses the createIssue
tool to post it directly to your GitHub repository. You can continue the conversation to refine the issue further.
User: Can you update the issue you just created to outline the specific files that need to be changed in a table?
The agent will now amend the issue with a detailed plan, potentially referencing the existing files in your workspace for context. With this detailed plan in place, you can take the final step:
User: Let's implement this feature from the issue we created.
The agent will then switch into implementation mode, using the context and plan it developed to start writing the code.
Managing Servers and Creating Your Own
You can manage your MCP servers from the VS Code command palette. Type MCP
to see options like List Servers
, Add Server
, and Reset Cache
.
Furthermore, you can create your own MCP servers. The protocol is open, and SDKs are available for different languages. The .NET team recently released an official C# SDK for creating both servers and clients, allowing you to integrate any custom tool or service into your AI-assisted workflow.
Integrating MCP servers, especially the GitHub server, is a great way to enhance your productivity. By combining the intelligence of LLM agents with the specialized capabilities of these tools, you can create a more efficient and powerful development environment.
Join the 10xdev Community
Subscribe and get 8+ free PDFs that contain detailed roadmaps with recommended learning periods for each programming language or field, along with links to free resources such as books, YouTube tutorials, and courses with certificates.