Learning objectives
By the end of this lesson you will be able to:- Configure VS Code to find and connect to your MCP server
- Discover server tools through the Copilot Chat tools panel
- Invoke tools via natural-language prompts in Agent mode
- Understand how to pass secrets like API keys to MCP servers
Two ways to control VS Code MCP integration
Visual interface
Edit
.vscode/mcp.json and use the play button in the editor to start/stop servers.Terminal / CLI
Use the
code --add-mcp command to add a server directly from the shell:Exercise: Consuming a server from VS Code
Enable MCP server discovery
- Open File → Preferences → Settings (or
Ctrl+,/Cmd+,). - Search for
MCP. - Enable chat.mcp.discovery.enabled in your
settings.json.
Configure your server
Add a server entry to For a Python server:To prompt the user for an API key at startup, add an input:
.vscode/mcp.json. The command and args tell VS Code how to start the server process.Start the server
Open
mcp.json in the VS Code editor. Locate the play icon (▶) next to your server entry and click it. The server process starts and VS Code connects to it.Once connected, the tools icon in the GitHub Copilot Chat panel shows the number of available tools. Click it to see the list and toggle individual tools on or off.Assignment
Add a server entry to yourmcp.json file and confirm you can start and stop it. Then test communication with your server’s tools through the GitHub Copilot Chat interface.
Key takeaways
- VS Code is a powerful MCP host that lets you consume multiple MCP servers without writing client code.
- GitHub Copilot Chat’s Agent mode is the primary interface for interacting with server tools.
- You can prompt users for inputs like API keys when configuring the server entry in
mcp.json. - The
code --add-mcpcommand lets you register servers directly from the terminal.