Connect MCP servers to VS Code by creating a .vscode/mcp.json file in your project root. VS Code uses the key 'servers' (not 'mcpServers' like Claude Desktop and Cursor). Each server entry specifies command, args, and optional env. MCP tools are available to GitHub Copilot chat and other MCP-aware VS Code extensions. Restart VS Code after configuration changes.
Set Up MCP Servers in VS Code
VS Code added native MCP support for GitHub Copilot's agent mode. The key difference from Cursor and Claude Desktop is the configuration format: VS Code uses 'servers' as the top-level key instead of 'mcpServers'. This tutorial shows you the correct configuration format, how to add servers, and how to use them with Copilot. If you are migrating from Cursor, the only change is the config key name.
Prerequisites
- VS Code 1.99 or later installed
- GitHub Copilot extension installed and active
- An MCP server to connect (npm package, local server, or Docker image)
Step-by-step guide
Create the .vscode/mcp.json configuration file
Create the .vscode/mcp.json configuration file
Create a .vscode directory in your project root (if it does not already exist) and add an mcp.json file. The critical difference from Cursor and Claude Desktop is that VS Code uses 'servers' as the top-level key, not 'mcpServers'. Each server entry has a type field (usually 'stdio'), command, args, and optional env.
1// .vscode/mcp.json2{3 "servers": {4 "filesystem": {5 "type": "stdio",6 "command": "npx",7 "args": ["-y", "@modelcontextprotocol/server-filesystem", "/path/to/directory"]8 }9 }10}Expected result: A .vscode/mcp.json file exists with the 'servers' key and at least one server configured.
Add multiple servers with environment variables
Add multiple servers with environment variables
Add additional servers to the configuration. Each server gets a unique key name. Use the env field for API keys and secrets. VS Code launches all configured servers and makes their tools available to Copilot.
1// .vscode/mcp.json2{3 "servers": {4 "filesystem": {5 "type": "stdio",6 "command": "npx",7 "args": ["-y", "@modelcontextprotocol/server-filesystem", "/Users/you/projects"]8 },9 "github": {10 "type": "stdio",11 "command": "docker",12 "args": ["run", "-i", "--rm",13 "-e", "GITHUB_PERSONAL_ACCESS_TOKEN",14 "ghcr.io/github/github-mcp-server"],15 "env": {16 "GITHUB_PERSONAL_ACCESS_TOKEN": "ghp_your_token_here"17 }18 },19 "brave-search": {20 "type": "stdio",21 "command": "npx",22 "args": ["-y", "@modelcontextprotocol/server-brave-search"],23 "env": {24 "BRAVE_API_KEY": "your-brave-api-key"25 }26 }27 }28}Expected result: Multiple servers are configured with environment variables.
Use VS Code settings.json as an alternative
Use VS Code settings.json as an alternative
You can also configure MCP servers in VS Code's settings.json instead of a separate mcp.json file. Use the 'mcp' key in settings.json with the same 'servers' structure. The mcp.json file takes precedence if both exist.
1// .vscode/settings.json2{3 "mcp": {4 "servers": {5 "filesystem": {6 "type": "stdio",7 "command": "npx",8 "args": ["-y", "@modelcontextprotocol/server-filesystem", "/Users/you/projects"]9 }10 }11 }12}Expected result: MCP servers can be configured in either mcp.json or settings.json.
Connect a remote MCP server via HTTP
Connect a remote MCP server via HTTP
For remote servers, use type 'sse' or specify a url field. VS Code supports connecting to MCP servers running on remote machines via Streamable HTTP transport.
1{2 "servers": {3 "remote-api": {4 "type": "sse",5 "url": "https://mcp.your-company.com/api"6 }7 }8}Expected result: VS Code connects to the remote MCP server over HTTP.
Restart VS Code and verify the connection
Restart VS Code and verify the connection
After saving the configuration, reload VS Code (Cmd+Shift+P then 'Developer: Reload Window'). Open the GitHub Copilot chat panel and check the available tools. MCP tools should appear in the tools list when you are in agent mode. You can also check the Output panel (View > Output) and select 'MCP' from the dropdown to see server connection logs.
Expected result: VS Code shows connected MCP servers in the Output panel, and tools are available in Copilot's agent mode.
Use MCP tools in GitHub Copilot chat
Use MCP tools in GitHub Copilot chat
Open GitHub Copilot chat (Cmd+Shift+I or the Copilot icon) and switch to agent mode. Ask a question that would benefit from an MCP tool. Copilot will detect available tools and use them to answer your question. For example, with the filesystem server, ask about your project's file structure.
1// Example prompts for Copilot with MCP tools:2// With filesystem: "What is the folder structure of this project?"3// With GitHub: "Show me recent pull requests on this repository"4// With Brave Search: "Search for the latest MCP protocol documentation"Expected result: Copilot uses MCP tools to answer your question, showing tool calls and results in the chat.
Complete working example
1{2 "servers": {3 "filesystem": {4 "type": "stdio",5 "command": "npx",6 "args": [7 "-y",8 "@modelcontextprotocol/server-filesystem",9 "/Users/you/projects"10 ]11 },12 "github": {13 "type": "stdio",14 "command": "docker",15 "args": [16 "run", "-i", "--rm",17 "-e", "GITHUB_PERSONAL_ACCESS_TOKEN",18 "ghcr.io/github/github-mcp-server"19 ],20 "env": {21 "GITHUB_PERSONAL_ACCESS_TOKEN": "ghp_your_token_here"22 }23 },24 "brave-search": {25 "type": "stdio",26 "command": "npx",27 "args": ["-y", "@modelcontextprotocol/server-brave-search"],28 "env": {29 "BRAVE_API_KEY": "your-brave-api-key"30 }31 },32 "memory": {33 "type": "stdio",34 "command": "npx",35 "args": ["-y", "@modelcontextprotocol/server-memory"]36 },37 "custom-typescript": {38 "type": "stdio",39 "command": "npx",40 "args": ["-y", "tsx", "/absolute/path/to/server/src/index.ts"],41 "env": {42 "API_KEY": "your-api-key"43 }44 },45 "custom-python": {46 "type": "stdio",47 "command": "uv",48 "args": ["run", "--directory", "/path/to/python-server", "server.py"]49 }50 }51}Common mistakes when connecting MCP servers to VS Code
Why it's a problem: Using 'mcpServers' instead of 'servers'
How to avoid: VS Code uses 'servers' as the top-level key. 'mcpServers' is for Claude Desktop and Cursor. Using the wrong key means VS Code ignores all your server configurations with no error message.
Why it's a problem: Missing the 'type' field in server entries
How to avoid: VS Code server entries should include a 'type' field set to 'stdio' for local servers or 'sse' for remote HTTP servers. While some versions may work without it, including type explicitly prevents issues.
Why it's a problem: Expecting MCP tools outside of agent mode
How to avoid: MCP tools are available in GitHub Copilot's agent mode, not in regular inline suggestions or basic chat. Make sure you are using Copilot in agent mode to access MCP tools.
Why it's a problem: Config file in wrong location
How to avoid: Place mcp.json in the .vscode directory at your project root, not in the global VS Code settings directory. For workspace-level config, use .vscode/mcp.json.
Best practices
- Always use 'servers' as the top-level key in .vscode/mcp.json — never 'mcpServers'
- Include the 'type' field in every server entry for explicit transport selection
- Commit .vscode/mcp.json to git so your team shares the same MCP setup (exclude secrets via .env or gitignore)
- Pass API keys via env field, not in args — and consider using VS Code's secret storage for sensitive values
- Always include -y in npx commands to prevent interactive prompts
- Check the Output panel's MCP channel for server connection logs and errors
- Test servers with MCP Inspector before adding them to VS Code configuration
- Use absolute paths for server commands and directory arguments
Still stuck?
Copy one of these prompts to get a personalized, step-by-step explanation.
Show me how to configure MCP servers in VS Code using .vscode/mcp.json. I know it uses 'servers' instead of 'mcpServers'. Show the complete config with filesystem, GitHub (Docker), and a custom TypeScript server. Also show how to verify the connection.
Help me set up MCP in VS Code for my project. I want the filesystem server and Brave Search server. Show the .vscode/mcp.json file with the correct 'servers' key format and how to use the tools in Copilot agent mode.
Frequently asked questions
Why does VS Code use 'servers' instead of 'mcpServers'?
VS Code chose 'servers' for its MCP configuration format, which differs from the 'mcpServers' key used by Claude Desktop, Cursor, and Windsurf. This is a VS Code-specific design choice. When configuring MCP, always check which key format your specific host expects.
Do I need GitHub Copilot for MCP in VS Code?
Currently, MCP tools in VS Code are primarily used through GitHub Copilot's agent mode. Other VS Code extensions may also implement MCP client support, but Copilot is the main consumer of MCP tools in VS Code.
Can I use the same MCP servers in both VS Code and Cursor?
Yes, the same servers work in both editors. You just need separate config files: .vscode/mcp.json with 'servers' key for VS Code and .cursor/mcp.json with 'mcpServers' key for Cursor.
How do I see MCP server logs in VS Code?
Open the Output panel (View > Output or Cmd+Shift+U) and select 'MCP' from the dropdown menu in the top-right corner. This shows server connection status, errors, and JSON-RPC messages.
Can RapidDev help set up MCP across our team's VS Code installations?
Yes. RapidDev helps teams create shared .vscode/mcp.json configurations, build custom MCP servers for internal tools, and establish consistent MCP setups across VS Code, Cursor, and Claude Desktop.
Can I configure MCP servers globally for VS Code?
Yes. Add the MCP configuration to your user-level settings.json under the 'mcp' key. This makes servers available across all VS Code projects. Project-level .vscode/mcp.json takes precedence over user settings.
Talk to an Expert
Our team has built 600+ apps. Get personalized help with your project.
Book a free consultation