MCP (Model Context Protocol) servers connect AI agents in VS Code to external tools. Once configured, the agent can query databases, browse the web, and call APIs through the server's tools.
You do not need to write glue code. The MCP standard handles the connection.
This article covers adding and configuring MCP servers in Stable VS Code.
Quickstart: install a server and use it
The fastest way to add an MCP server is through the Extensions view.
The workflow and schema below follow the official VS Code MCP guide and MCP configuration reference.
Find an MCP server
Open the Extensions view (Ctrl+Shift+X / Cmd+Shift+X) and type @mcp in the search field. This filters to show only MCP servers available in the gallery.
Install it
Open the server details and review its publisher, source repository, configuration, and requested access. For this example, select the Playwright server linked from the official VS Code guide, then select Install.
To install in your workspace instead of your profile, right-click the server and select Install in Workspace. This updates .vscode/mcp.json instead of your user configuration.
Trust the server
VS Code shows a trust dialog the first time you start a server. Review the server configuration, then confirm. The server starts and VS Code discovers its tools.
Use the server's tools in chat
Open the Chat view and send a prompt that uses the server's tools. For Playwright:
Go to code.visualstudio.com, decline the cookie banner, and take a screenshot of the homepage.
The agent invokes the Playwright tools, opens a browser, and returns the screenshot. You may be asked to confirm each tool invocation.
Select Configure Tools in the chat input to see all tools the server provides. You can toggle individual tools on or off.
Configure servers in mcp.json
For more control, edit the mcp.json file directly. There are two locations:
| Scope | Path | Shared? |
|---|---|---|
| Workspace | .vscode/mcp.json | Yes, commit to version control |
| User profile | Run MCP: Open User Configuration | No, personal |
VS Code provides IntelliSense for mcp.json, including auto-completion for server types, commands, and configuration fields.
Server types
| Type | When to use | Example |
|---|---|---|
| stdio | The server runs as a local command | npx, python, node |
| http | The server is a remote URL | GitHub Copilot MCP API |
Example: remote server (http)
Connect to a hosted MCP server over HTTP. This server runs on GitHub's infrastructure:
{
"servers": {
"github": {
"type": "http",
"url": "https://api.githubcopilot.com/mcp"
}
}
}Example: local server (stdio)
Run a local process as an MCP server. This example uses npx to start the Playwright browser automation server:
{
"servers": {
"playwright": {
"command": "npx",
"args": ["-y", "@microsoft/mcp-server-playwright"]
}
}
}This command matches the official VS Code example. Because -y accepts the package without an install prompt, review the package source and publisher before starting it. For shared configuration, pin an approved package version.
Sensitive data: use input variables
Never hardcode API keys in mcp.json, especially in workspace files that get committed. Use input variables instead:
{
"inputs": [
{ "type": "promptString", "id": "apiKey", "description": "API key", "password": true }
],
"servers": {
"my-api": {
"command": "node",
"args": ["server.js"],
"env": {
"API_KEY": "${input:apiKey}"
}
}
}
}VS Code prompts you for the value when the server starts. The value is not stored in the configuration file.
The first value is stored securely for later use. Rotate the credential at its provider if it is exposed.
Sandbox MCP servers
On macOS and Linux, you can sandbox a local MCP server. Add sandboxEnabled to the server and a top-level sandbox with file system and network rules:
{
"servers": {
"myServer": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@example/mcp-server"],
"sandboxEnabled": true
}
},
"sandbox": {
"filesystem": { "allowWrite": ["${workspaceFolder}"] },
"network": { "allowedDomains": ["api.example.com"] }
}
}With sandboxing enabled, tool calls from the server are auto-approved because they run in a controlled environment. Sandboxing is not available on Windows.
Beyond tools: resources, prompts, and apps
MCP servers can provide more than tools:
| Capability | What it does | How to access |
|---|---|---|
| Resources | Read-only data like files or database rows attached as context | Add Context > MCP Resources in chat |
| Prompts | Pre-built prompt templates from the server | Type /<server>.<prompt> in chat |
| MCP Apps | Interactive UI components rendered in chat | Appears inline when the server supports it |
For example, a database MCP server might expose table schemas as resources and provide a /db.explain-query prompt template.
MCP prompts come from the server. For repository-owned slash commands, use /vscode/how-to-create-and-use-reusable-prompt-md-files-in-vs-code instead.
Manage servers
Manage installed servers from several places:
- Extensions view: right-click a server in the MCP SERVERS section for start, stop, uninstall, and log options.
- Command Palette: run MCP: List Servers, select a server, and choose an action.
- mcp.json editor: inline code lens actions appear above each server definition.
To disable a server without uninstalling it, right-click it in the Extensions view and select Disable. Disabled servers do not start and their tools are excluded from chat.
Enable chat.mcp.autoStart (Experimental) to automatically restart servers when their configuration changes, instead of restarting them manually.
MCP server trust
When you add a server or change its configuration, VS Code asks you to confirm that you trust it. Review the server configuration before accepting. If you decline, the server does not start and its tools are unavailable.
Reset trust for all servers by running MCP: Reset Trust from the Command Palette.
Local MCP servers run arbitrary code on your machine. Only add servers from publishers you trust. Review the server's source repository before installing, especially for servers that request network access or file system write permissions.
Synchronize across devices
Enable Settings Sync and run Settings Sync: Configure. Check the MCP Servers option. Your user-level MCP server configurations now sync across devices.
MCP servers can also be included in custom agents. Learn how to create agents that use MCP tools in /vscode/how-to-create-custom-agents-in-vs-code-with-agent-md-files.
Rune AI
Key Insights
- Install MCP servers from the Extensions view by searching @mcp, or write them manually in mcp.json.
- Workspace servers go in .vscode/mcp.json (team-shared). User servers go in your profile (personal).
- Two server types: stdio (runs a local command) and http (connects to a remote URL).
- MCP servers provide tools, resources, prompts, and interactive apps to AI agents.
- Enable sandboxing on macOS/Linux with sandboxEnabled: true to restrict file system and network access.
- Use input variables for sensitive data instead of hardcoding API keys in mcp.json.
Frequently Asked Questions
What is the difference between a workspace and user MCP server?
Are MCP servers safe to install?
Can I use MCP servers when connected to a remote machine via SSH?
Conclusion
MCP servers extend what AI agents can do in VS Code. Install a server from the MCP gallery or configure it in mcp.json, review its source and permissions, and verify its tools in chat. Start with one trusted server that solves a specific problem.
More in this topic
How to Use VS Code with WSL 2 on Windows
Run VS Code connected to Windows Subsystem for Linux so you can develop in a full Linux environment with native tools, terminals, and debugging, all from Windows.
20 Best VS Code Extensions for Web Developers in 2026
Twenty carefully chosen VS Code extensions every web developer should know. Covers formatting, linting, frameworks, debugging, Git, and developer experience.
How to Install, Disable, Update, and Uninstall VS Code Extensions
Learn how to install, disable, update, and uninstall VS Code extensions from the Marketplace and the command line. Step-by-step instructions for every action.