Nesta seção
How to Add a New MCP Server to VS Code
MCP integrations allow for the extension of AI capabilities by providing them with tools they can take action on, and this new paradigm doesn’t skip VS Code developers.
Initially, MCP started with Anthropic’s announcement and followed significant adoption by the developer community, startups making MCP Servers available to interact with, and the new era of developer IDEs that embraced MCPs to augment developer workflows.
VS Code isn’t left behind. Although many different AI Coding extensions exist for VS Code, such as Qodo Gen, Cline, and others, the GitHub Copilot team adopted early preview support for MCP in its agent mode for VS Code.
VS Code supports process-based STDIO locally running MCP Servers and MCP Servers running over a (remote) HTTP / SSE network.
How to add a new MCP Server
Listing or adding MCP servers can be easily accessed via the command palette if you open it up with CMD + SHIFT + P and then type in “MCP”, you’ll likely see a similar list of action items you can choose from:

The method of defining new MCP servers follows how you add new MCP Servers to Cursor and other agentic AI tools – by defining the JSON configuration in a dedicated MCP configuration file.
For VS Code, the MCP configuration file is at .vscode/mcp.json
. Let’s add GitHub’s MCP Server via their Docker method of spinning up the process. To get it to work, you’ll need:
Docker installed and running
A personal access token (PAT) created from your GitHub account page
Now that you have those, we’ll define a new MCP server entry in `.vscode/mcp.json:
{
"inputs": [
{
"type": "promptString",
"id": "github_token",
"description": "GitHub Personal Access Token",
"password": true
}
],
"servers": {
"github": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-e",
"GITHUB_PERSONAL_ACCESS_TOKEN",
"ghcr.io/github/github-mcp-server"
],
"env": {
"GITHUB_PERSONAL_ACCESS_TOKEN": "${input:github_token}"
}
}
}
}
GitHub Copilot AI agent interacts with MCP Servers
Once the GitHub MCP Server has been defined to execute with the .vscode/mcp.json
file, we can switch to Agent mode in GitHub Copilot and inspect all the tools available in the chat.
In the chat text box, there’s an icon that says “36”. If you click it, you’ll be presented with the following command window that shows all the available tools exposed through MCP Server integrations:

Setting the GitHub personal access token for the MCP server
Before we can interact with the GitHub MCP Server, we need to provide it with our personal access token.
You might have noticed that the mcp.json
configuration file for MCPs has a dedicated field for inputs
, and it maps the identifier github_token
from that JSON key into the environment variable GITHUB_PERSONAL_ACCESS_TOKEN
that is defined within the servers
property for the github
entry.
To avoid leaking credentials and API tokens in configuration files as plain text by placing them in a mcp.json
file, the VS Code integration for MCPs works in a way that allows it to interactively request input for the GitHub PAT when the server starts.
If the MCP server is already running, you should click the Stop link in the inline code suggestion of the mcp.json
file and then click Start again. Now you’ll see the input box asking for the GitHub PAT:

List GitHub repository issues via GitHub Copilot MCP Server integration
Now, we can get back to the development workflow where we prompt in the chat to list any open issues or pull requests in the GitHub repository for this project and the LLM will execute tools to understand what exactly “this project” means, and then follow with calling the relevant tools available in the GitHub MCP Server we defined to respond to our prompt:

Want to learn more about AI Security?
Read up on How is AI being used in cybersecurity?
Concerned about ChatGPT usage in your company? ChatGPT Coding Security For Enterprises
Did you hear about Shadow AI?
Controle a segurança da IA com a Snyk
Descubra como a Snyk ajuda a proteger o código gerado por IA das equipes de desenvolvimento, oferecendo a elas visibilidade e controles completos.