Extending GitHub Copilot Agents with MCP Servers in VS Code
Visual Studio Codego watch the original →
the gist
Visual Studio Code now supports the Model Context Protocol (MCP), allowing developers to connect AI agents to external tools, datasets, and secure sandboxed environments via a standardized interface.
Integrating MCP Servers into VS Code
The Model Context Protocol (MCP) functions as a standardized interface between AI agents and external data sources or tools. In Visual Studio Code, MCP servers are managed via an mcp.json configuration file, which supports both workspace-specific and global user settings. Developers install these servers through the VS Code extensions marketplace, which provides a registry of available tools. Once installed, these servers are activated within the GitHub Copilot agent mode by selecting them in the tool picker, allowing the model to ground responses in external data, such as specific documentation sets.
Security and Lifecycle Management
VS Code provides granular control over MCP server execution to ensure security. When an agent attempts to execute a tool, the interface prompts the user for authorization. For tools that require higher trust or automation, developers can enable sandboxing by setting sandboxEnabled: true in the configuration. This isolation allows the agent to execute workflows without constant manual approval.
Management of these servers is handled through several interfaces:
- Configuration Files: The
mcp.jsonfile supports IntelliSense for managing server states and credentials. - Command Palette: Users can trigger server management commands or view diagnostic output for debugging.
- Agent Customizations Modal: Located in the chat window, this UI allows users to toggle servers, check status, and browse the marketplace for new integrations.