---
title: "config MCP ของ VS Code (GitHub Copilot): path ไฟล์, key และตัวอย่าง · DotsAgent"
description: "เพิ่มเซิร์ฟเวอร์ MCP ของ Microsoft ใน VS Code (GitHub Copilot): ตำแหน่งไฟล์ config, key และรูปแบบระดับบนสุด, การรองรับ OAuth สำหรับเซิร์ฟเวอร์ remote และตัวอย่าง config"
url: https://dotsagent.io/th/mcp/clients/vscode-copilot
---

Microsoft

# เพิ่มเซิร์ฟเวอร์ MCP ใน VS Code (GitHub Copilot)

VS Code อ่าน .vscode/mcp.json ใน workspace, mcp.json ในโปรไฟล์ผู้ใช้ หรือไฟล์ .mcp.json แบบพกพารูปแบบใหม่

- **macOS**: `User profile mcp.json (open via 'MCP: Open User Configuration'); portable: ~/.copilot/mcp-config.json`
- **Windows**: `User profile mcp.json (open via 'MCP: Open User Configuration'); portable: ~/.copilot/mcp-config.json`
- **Linux**: `User profile mcp.json (open via 'MCP: Open User Configuration'); portable: ~/.copilot/mcp-config.json`
- **ไฟล์โปรเจกต์**: `.vscode/mcp.json (key 'servers') or portable .mcp.json (key 'mcpServers')`
- **Key ระดับบนสุด**: `servers`
- **รูปแบบ**: json
- **OAuth สำหรับเซิร์ฟเวอร์ remote**: 

## ตัวอย่าง config

ตัวอย่างนี้เพิ่มเซิร์ฟเวอร์ที่ GitHub โฮสต์ไว้และ Playwright เป็นเซิร์ฟเวอร์ local โดยใช้รูปแบบที่ไคลเอนต์นี้รองรับ

`.vscode/mcp.json`

```
{
  "servers": {
    "github": {
      "type": "http",
      "url": "https://api.githubcopilot.com/mcp/"
    },
    "playwright": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "@playwright/mcp@latest"
      ]
    }
  }
}
```

`shell`

```
code --add-mcp '{"name":"github","type":"http","url":"https://api.githubcopilot.com/mcp/"}'
code --add-mcp '{"name":"playwright","command":"npx","args":["@playwright/mcp@latest"]}'
```

## หมายเหตุและข้อควรระวัง

- .vscode/mcp.json ใช้คีย์ servers ส่วนไฟล์ .mcp.json แบบพกพาและ ~/.copilot/mcp-config.json ใช้ mcpServers
- อาร์เรย์ inputs ระดับบนสุดจะแจ้งให้คุณป้อน secrets เพื่อไม่ให้คีย์อยู่ในไฟล์
- ขณะนี้ขั้นตอนเพิ่มเซิร์ฟเวอร์แบบมีคำแนะนำระบุว่าไม่แนะนำให้ใช้ .vscode/mcp.json และไฟล์ในโปรไฟล์ผู้ใช้แล้ว โดยให้ใช้ไฟล์แบบพกพาแทน แต่ทั้งสองแบบยังใช้งานได้
- VS Code ยังตรวจหาเซิร์ฟเวอร์ที่ตั้งค่าไว้แล้วสำหรับ Claude Desktop, Copilot CLI, Cursor และ Windsurf ด้วย
- code --add-mcp เพิ่มเซิร์ฟเวอร์จากสตริง JSON

[สร้าง config สำหรับ VS Code (GitHub Copilot) →](https://dotsagent.io/th/mcp/config#client=vscode-copilot)

## ไคลเอนต์อื่น

[Claude Desktop](https://dotsagent.io/th/mcp/clients/claude-desktop)

[Claude Code](https://dotsagent.io/th/mcp/clients/claude-code)

[Cursor](https://dotsagent.io/th/mcp/clients/cursor)

[Windsurf / Devin Desktop](https://dotsagent.io/th/mcp/clients/windsurf)

[Zed](https://dotsagent.io/th/mcp/clients/zed)

[OpenAI Codex CLI](https://dotsagent.io/th/mcp/clients/codex-cli)

[Gemini CLI](https://dotsagent.io/th/mcp/clients/gemini-cli)

[ChatGPT](https://dotsagent.io/th/mcp/clients/chatgpt)

[OpenClaw](https://dotsagent.io/th/mcp/clients/openclaw)

[Cline](https://dotsagent.io/th/mcp/clients/cline)

[Continue](https://dotsagent.io/th/mcp/clients/continue)

[JetBrains AI Assistant](https://dotsagent.io/th/mcp/clients/jetbrains-ai)

## แหล่งที่มา

1. [code.visualstudio.com](https://code.visualstudio.com/docs/copilot/reference/mcp-configuration)/docs/copilot/reference/mcp-configuration
2. [code.visualstudio.com](https://code.visualstudio.com/docs/copilot/customization/mcp-servers)/docs/copilot/customization/mcp-servers

แหล่งอ้างอิงอิสระสำหรับผู้สร้าง AI agent ไม่มีส่วนเกี่ยวข้องกับผู้ให้บริการที่กล่าวถึง

© 2026 DotsAgent · ตรวจสอบข้อมูลเมื่อ 1 ตุลาคม 2569
