How to add an MCP server to VS Code

Last verified against the official documentation linked below.

VS Code adds MCP servers for its agent through the 'MCP: Add Server' command or the MCP server gallery. This guide follows the official VS Code documentation and uses the Playwright MCP server as the local example.

Before you start

Steps

  1. Run 'MCP: Add Server'

    Open the Command Palette (Ctrl+Shift+P, or Cmd+Shift+P on macOS) and run MCP: Add Server.

    Source: code.visualstudio.com/docs/copilot/customization/mcp-servers

  2. Pick the connection type

    Choose HTTP if the publisher gave you a URL, or Command (stdio) if they gave you a launch command. For Playwright choose Command (stdio) and enter the command below.

    npx -y @playwright/mcp@latest

    Source: code.visualstudio.com/docs/copilot/customization/mcp-servers

  3. Name it

    Enter a server ID that isn't already used, such as playwright.

    Source: code.visualstudio.com/docs/copilot/customization/mcp-servers

  4. Choose where it's saved

    For yourself, choose Global and then Copilot Global, which writes to ~/.copilot/mcp-config.json. To share with a team, use a workspace configuration instead. Portable files use an mcpServers object while the older VS Code format uses servers, so don't copy configs between them unchecked.

    Source: code.visualstudio.com/docs/copilot/customization/mcp-servers

  5. Review trust and sign-in prompts

    Read any trust or authentication prompt before accepting it. Don't paste credentials into chat or commit them to your project.

    Source: code.visualstudio.com/docs/copilot/customization/mcp-servers

  6. Or install from the gallery

    Open the Extensions view (Ctrl+Shift+X), search for @mcp, review the publisher and requirements, and click Install (or Install in Workspace to share it).

    Source: code.visualstudio.com/docs/copilot/customization/mcp-servers

Check it worked

Safety notes

Related listings

More guides

Sources: code.visualstudio.com/docs/copilot/customization/mcp-servers. Menus and file paths change between versions: if a step doesn't match what you see, follow the official page linked for that step.