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

Anthropic

# เพิ่มเซิร์ฟเวอร์ MCP ใน Claude Code

Claude Code รับเซิร์ฟเวอร์จากคำสั่ง claude mcp add หรือไฟล์ .mcp.json ที่ root ของ repository

- **macOS**: `~/.claude.json`
- **Windows**: `~/.claude.json`
- **Linux**: `~/.claude.json`
- **ไฟล์โปรเจกต์**: `.mcp.json`
- **Key ระดับบนสุด**: `mcpServers`
- **รูปแบบ**: json
- **OAuth สำหรับเซิร์ฟเวอร์ remote**: 

## ตัวอย่าง config

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

`.mcp.json`

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

`shell`

```
claude mcp add --transport http --scope project github https://api.githubcopilot.com/mcp/
claude mcp add --scope project playwright -- npx @playwright/mcp@latest
```

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

- การตั้งค่าขอบเขต local ซึ่งเป็นค่าเริ่มต้น และขอบเขต user จะเก็บไว้ใน ~/.claude.json ส่วนขอบเขต project จะอยู่ใน .mcp.json
- ทุกรายการที่มี url ต้องระบุ type ด้วย เช่น http; หากมี url เพียงอย่างเดียวจะเกิดข้อผิดพลาด
- ค่าในไฟล์รองรับการแทนค่า ${VAR} และ ${VAR:-default}
- เรียกใช้ /mcp ในเซสชันเพื่อเข้าสู่ระบบเซิร์ฟเวอร์ OAuth สำหรับแอป OAuth ที่ลงทะเบียนไว้ล่วงหน้า ให้ส่ง --client-id, --client-secret และ --callback-port

[สร้าง config สำหรับ Claude Code →](https://dotsagent.io/th/mcp/config#client=claude-code)

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

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

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

[VS Code (GitHub Copilot)](https://dotsagent.io/th/mcp/clients/vscode-copilot)

[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.claude.com](https://code.claude.com/docs/en/mcp)/docs/en/mcp

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

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