MCP 安装教程

如何在 VS Code 中安装 MCP

VS Code MCP 安装教程:配置示例、安装检查和故障排查。

适合谁?

适合想在 VS Code 中使用 MCP 扩展编码、文档、GitHub、数据库或浏览器自动化的用户。

配置路径和示例

VS Code MCP configuration JSON

{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-filesystem", "./"]
    }
  }
}

安装步骤

1

Pick a VS Code-compatible server

Start from servers tagged coding, filesystem, GitHub, docs, or developer.

2

Generate JSON config

Use the config generator or copy a trusted listing configuration.

3

Paste into VS Code MCP config

Keep command and args split correctly.

{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-filesystem", "./"]
    }
  }
}
4

Restart VS Code

Reload the window or restart VS Code so the MCP server is detected.

5

Check the tools list

If it does not appear, test the command in a terminal and check extension logs.

常见问题

Wrong config location

Confirm the extension or client is reading the file you edited.

Runtime missing

Install Node.js, uv, Docker, Python, or the runtime required by the command.

FAQ

Can I reuse Cursor MCP JSON for VS Code?

Often yes, if the VS Code MCP client expects an mcpServers JSON object.

Should I restart VS Code?

Yes. Reload or restart after changing MCP config.