Gemini CLI に MCP server を追加する方法
Gemini CLI is Google's open-source agent for the terminal. MCP servers are set under mcpServers in settings.json, for your user or for one project.
Gemini CLIにMCPサーバーを追加する
- 1Open
~/.gemini/settings.json, or.gemini/settings.jsonin the project. - 2Paste the server under
mcpServers. - 3Remote servers use
httpUrlfor streamable HTTP. - 4Start
geminiand run/mcpto see the server and its tools.
例: Codebase Memory
{
"mcpServers": {
"codebase-memory-mcp": {
"command": "npx",
"args": [
"-y",
"codebase-memory-mcp"
]
}
}
}Trust and tool filters
trust: trueskips confirmation for every tool of that server; keep it for servers you wrote or know well.includeToolsandexcludeToolstrim what the model sees; when both name a tool, exclude wins.- Sensitive variables from your shell are redacted before they reach a server unless you pass them in
env. - OAuth tokens are kept in
~/.gemini/mcp-oauth-tokens.json;/mcp authsigns in again.
Gemini CLI が MCP server を保存する場所
~/.gemini/settings.jsonuser.gemini/settings.jsonproject
読み込みの確認: /mcp
制限と設定
- The default request timeout is 600,000 ms (10 minutes), set per server with
timeout. includeToolsandexcludeToolsfilter a server's tools; exclude wins.trust: trueskips confirmations for that server; leave it off unless you trust it.- OAuth needs a local browser; tokens are stored in
~/.gemini/mcp-oauth-tokens.json.
Gemini CLI でサーバーが動かないとき
- Run
/mcpin a session to see each server's status and tools. - Start with
--debugfor detailed connection logs. - Use
/mcp authto sign in to an OAuth server again.
Gemini CLIのMCPに関する質問
How do I add an MCP server to Gemini CLI?
Run gemini mcp add <name> <command or URL>, or add an entry under mcpServers in ~/.gemini/settings.json (user) or .gemini/settings.json (project).
Does Gemini CLI support remote MCP servers?
Yes, over SSE and Streamable HTTP, with OAuth sign-in when the server asks for it.
How do I hide some of a server's tools?
List them in excludeTools, or list only the ones you want in includeTools.
Can environment variables be used in the config?
Yes. env values accept $VAR and ${VAR}, and %VAR% on Windows.
Gemini CLI向けの人気MCPサーバー
- 1
Provides a local knowledge graph that connects source code, documentation, and infrastructure to give AI agents structural context.
Gemini CLIの設定
~/.gemini/settings.json{ "mcpServers": { "codebase-memory-mcp": { "command": "npx", "args": [ "-y", "codebase-memory-mcp" ] } } } - 2
Securely execute LLM-generated code in isolated containers or local Linux and Windows sandboxes across multiple programming languages.
Gemini CLIの設定
~/.gemini/settings.json{ "mcpServers": { "llm-sandbox": { "command": "uvx", "args": [ "llm-sandbox" ] } } } - 3
Lets an AI client create, inspect, validate, and save editable 3D building scenes, including walls, rooms, doors, and furnishings.
Gemini CLIの設定
~/.gemini/settings.json{ "mcpServers": { "editor": { "command": "npx", "args": [ "-y", "@pascal-app/mcp" ] } } } - 4
Lets AI agents search, run, and read results from thousands of web scraping and automation Actors on Apify Store.
Gemini CLIの設定
~/.gemini/settings.json{ "mcpServers": { "apify-mcp-server": { "httpUrl": "https://mcp.apify.com/" } } } - 5
Provides AST-based semantic code search for local repositories using incremental re-indexing and natural language queries.
Gemini CLIの設定
~/.gemini/settings.json{ "mcpServers": { "cocoindex-code": { "command": "uvx", "args": [ "cocoindex-code" ] } } } - 6
Lets an AI client read and change Google Ads, Reddit Ads and GA4 campaigns, with a preview shown before every change.
Gemini CLIの設定
~/.gemini/settings.json{ "mcpServers": { "adloop": { "command": "uvx", "args": [ "adloop" ] } } } - 7
An agent meta-harness that provides Claude Code and Codex with specialized agent swarms, self-learning memory, and enterprise security guardrails.
Gemini CLIの設定
~/.gemini/settings.json{ "mcpServers": { "claude-flow": { "command": "npx", "args": [ "-y", "claude-flow" ] } } } - 8
Enables LLMs to interact with web pages through structured accessibility snapshots using Playwright browser automation.
Gemini CLIの設定
~/.gemini/settings.json{ "mcpServers": { "playwright-mcp": { "command": "npx", "args": [ "-y", "@playwright/mcp" ] } } } - 9
Allows an AI client to interact with Bitbucket Data Center repositories and code through the Model Context Protocol.
Gemini CLIの設定
~/.gemini/settings.json{ "mcpServers": { "atlassian-dc-mcp": { "command": "npx", "args": [ "-y", "@atlassian-dc-mcp/bitbucket" ] } } } - 10
Lets an AI agent draw and edit draw.io diagrams on a live browser canvas that you can also edit by hand.
Gemini CLIの設定
~/.gemini/settings.json{ "mcpServers": { "next-ai-drawio": { "command": "npx", "args": [ "-y", "@next-ai-drawio/mcp-server" ] } } } - 11
Packs a local or remote codebase into a single AI-friendly file with token counts so LLMs and coding agents can read or search it.
Gemini CLIの設定
~/.gemini/settings.json{ "mcpServers": { "repomix": { "command": "npx", "args": [ "-y", "repomix" ] } } } - 12
Connects AI agents and IDEs to enterprise databases using prebuilt tools or a custom framework for secure, structured queries.
Gemini CLIの設定
~/.gemini/settings.json{ "mcpServers": { "mcp-toolbox": { "command": "docker", "args": [ "run", "-i", "--rm", "us-central1-docker.pkg.dev/database-toolbox/toolbox/toolbox:1.17.0" ] } } }