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

Google

# เพิ่มเซิร์ฟเวอร์ MCP ใน Gemini CLI

Gemini CLI อ่าน mcpServers จาก settings.json ใน ~/.gemini/ หรือโฟลเดอร์ .gemini/ ของโปรเจกต์

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

## ตัวอย่าง config

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

`.gemini/settings.json`

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

`shell`

```
gemini mcp add -s project -t http github https://api.githubcopilot.com/mcp/
gemini mcp add -s project playwright npx @playwright/mcp@latest
```

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

- ชื่อฟิลด์จะกำหนด transport: httpUrl สำหรับ Streamable HTTP, url สำหรับ SSE และ command สำหรับ stdio
- gemini mcp add จะเพิ่มเซิร์ฟเวอร์ในขอบเขตโปรเจกต์ เว้นแต่จะระบุ -s user
- includeTools และ excludeTools ใช้กรองว่าโมเดลจะเห็นเครื่องมือใดบ้าง
- ระบบบันทึก OAuth token ไว้ใน ~/.gemini/mcp-oauth-tokens.json

[สร้าง config สำหรับ Gemini CLI →](https://dotsagent.io/th/mcp/config#client=gemini-cli)

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

[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)

[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)

[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. [geminicli.com](https://geminicli.com/docs/tools/mcp-server/)/docs/tools/mcp-server/
2. [raw.githubusercontent.com](https://raw.githubusercontent.com/google-gemini/gemini-cli/main/docs/tools/mcp-server.md)/google-gemini/gemini-cli/main/docs/tools/mcp-server.md

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

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