VS Code and Copilot MCP Setup
Configure MCP servers in Visual Studio Code with GitHub Copilot for AI-powered editor workflows
MCPgee Team
MCP Expert
VS Code and Copilot MCP Setup
Introduction
Visual Studio Code has built-in support for MCP servers through GitHub Copilot's agent mode. This means you can connect any MCP server to your editor and use AI-powered tools directly in your development workflow, from querying databases to managing files to running custom operations.
This tutorial walks you through configuring MCP servers in VS Code, using them with Copilot Chat, and building productive AI-assisted workflows. For background on MCP, see our What is MCP tutorial.
Prerequisites
Before starting, ensure you have:
- VS Code 1.99 or later (MCP support was added in this version)
- GitHub Copilot extension installed and signed in
- An MCP server ready to connect (see building your first MCP server or Python MCP server)
Configuring MCP Servers in VS Code
Method 1: Workspace Settings (Recommended)
Create a .vscode/mcp.json file in your project root:
This approach keeps MCP configuration scoped to your project, making it easy to share with team members.
Method 2: User Settings
For servers you want available across all projects, add them to your VS Code user settings (settings.json):
Method 3: Command Palette
- Open the Command Palette (
Ctrl+Shift+P/Cmd+Shift+P) - Search for "MCP: Add Server"
- Follow the prompts to configure your server
Connecting to Different Server Types
Local stdio Servers
Most MCP servers use stdio transport for local communication:
Remote Streamable HTTP Servers
For remote MCP servers deployed with Streamable HTTP transport:
Docker-Based Servers
Run MCP servers in Docker containers:
Using MCP Tools with Copilot Chat
Agent Mode
Once configured, MCP tools are available in Copilot Chat's Agent mode:
- Open Copilot Chat (
Ctrl+Shift+I/Cmd+Shift+I) - Switch to Agent mode using the dropdown at the top
- Ask questions that involve your MCP tools
For example, if you have a database MCP server connected:
Tool Approval
By default, VS Code asks for approval before executing MCP tools. You can:
- Approve once for the current session
- Always allow for trusted tools
- Deny if the operation looks wrong
This aligns with MCP security best practices.
Viewing Available Tools
To see what MCP tools are available:
- Open the Command Palette
- Search for "MCP: List Servers"
- View connected servers and their available tools
Practical Workflows
Workflow 1: Database-Assisted Development
Now you can ask Copilot:
- "Show me the schema of the orders table"
- "Write a migration to add an email column to users"
- "Find all orders placed in the last 24 hours"
Workflow 2: File System Operations
Ask Copilot:
- "Find all TODO comments in the project"
- "List all TypeScript files that import React"
- "Show me the project structure"
Workflow 3: Custom Project Tools
Build a project-specific MCP server with tools tailored to your workflow:
Then configure in .vscode/mcp.json:
Managing Multiple Servers
Server Lifecycle
VS Code manages MCP server lifecycle automatically:
- Starts servers when needed (on first tool request or at workspace open)
- Restarts servers if they crash
- Stops servers when you close the workspace
Monitoring Servers
Check server status in the Output panel:
- Open Output panel (
Ctrl+Shift+U) - Select "MCP" from the dropdown
- View connection logs and errors
Disabling Servers Temporarily
To disable a server without removing its configuration:
Team Collaboration
Sharing MCP Configurations
Since .vscode/mcp.json is a workspace file, you can commit it to your repository:
Use VS Code variables for portability:
${workspaceFolder}for project-relative paths- Environment variables for secrets (never commit tokens)
Environment-Specific Configuration
Use .env files for secrets and environment-specific values:
Troubleshooting VS Code MCP
Server Not Starting
- Check the Output panel for error messages
- Verify the command exists and is in your PATH
- Test the server manually in a terminal first
- Ensure all environment variables are set
Tools Not Appearing in Copilot
- Confirm you are in Agent mode in Copilot Chat
- Check that the server is running (MCP: List Servers)
- Restart the MCP server from the Command Palette
- Verify your VS Code version is 1.99+
Performance Issues
If MCP tools are slow:
- Check the server for performance bottlenecks
- Consider using async tools for long operations
- Review performance optimization strategies
Conclusion
VS Code's native MCP support through GitHub Copilot makes it easy to enhance your editor with AI-powered tools. By configuring MCP servers in your workspace, you can create powerful development workflows that combine Copilot's intelligence with custom tools tailored to your project.
For more on building MCP servers to use with VS Code, check out our first MCP server tutorial or explore the full clients directory for detailed VS Code integration documentation.
Code Examples
Key Takeaways
- VS Code 1.99+ has built-in MCP support through GitHub Copilot agent mode
- Configure servers via .vscode/mcp.json for project-scoped setup or user settings for global access
- MCP tools work in Copilot Chat Agent mode with approval-based execution
- Use VS Code variables like \${workspaceFolder} for portable configurations
- Team configurations can be shared by committing .vscode/mcp.json to version control
Troubleshooting
MCP tools do not appear in Copilot Chat
Make sure you are using Agent mode in Copilot Chat, not the default chat mode. Also verify your VS Code is version 1.99 or later, and check MCP: List Servers to confirm the server is connected.
Server fails to start with command not found
The MCP server command must be in your PATH. For npx commands, ensure Node.js is installed. For Python servers, verify the Python binary path. You can use absolute paths in the command field if needed.
Environment variables not being passed to the server
Check that you are using the correct syntax in mcp.json. For system environment variables, use the \${env:VARIABLE_NAME} syntax. Make sure the variables are actually set in your shell environment.
Next Steps
- Build a custom MCP server for your project workflow
- Explore remote MCP server connections for team tools
- Add database and API MCP servers to your editor
- Learn about security best practices for MCP in editors
Was this helpful?
Stay Updated with MCP Insights
Join 5,000+ developers and get weekly insights on MCP development, new server releases, and implementation strategies delivered to your inbox.
We respect your privacy. Unsubscribe at any time.
MCPgee Team
We write in-depth guides, tutorials, and reviews to help developers get the most out of the Model Context Protocol ecosystem.
Frequently Asked Questions
Related Tutorials
Setting Up Your First MCP Server
Step-by-step guide to creating and running your first MCP server
Integrating with Claude Desktop
Complete guide to connecting your MCP servers with Claude Desktop
MCP with ChatGPT and OpenAI
Connect MCP servers to ChatGPT and OpenAI applications using bridge adapters and function calling
Recommended MCP Servers
Popular servers related to this tutorial that you can start using right away.
n8n-mcp
A comprehensive MCP server that provides full control over n8n automation workflows through natural language. It offers
Dify MCP Server
Production-ready platform for agentic workflow development.
gemini-cli-mcp
A secure MCP server that wraps the Google Gemini CLI, allowing clients to query Gemini models using local OAuth sessions
Awesome Mcp Servers MCP Server
⭐ Curated list of Model Context Protocol (MCP) servers - tools that extend Claude Desktop, Cursor, Windsurf, and other M
Slack MCP Server
Enables interaction with Slack workspaces through comprehensive channel management, messaging, user management, file upl
Servers MCP Server
Model Context Protocol Servers
Explore MCP Servers
Browse our directory of 33,000+ MCP servers. Find the perfect tools for your AI-powered workflows.