Skip to content

Gemini CLI

Gemini CLI reads MCP servers from settings.json and can add them with gemini mcp add. It handles OAuth automatically when a server asks for it.

Setup

  1. Run the command below (-s user makes it global), or edit ~/.gemini/settings.json.
  2. Start gemini and run /mcp auth linear to sign in.
  3. Run /mcp inside Gemini CLI to list the server's tools.
Terminal
gemini mcp add -s user -t http linear https://mcp.linear.app/mcp
~/.gemini/settings.json
{  "mcpServers": {    "linear": {      "httpUrl": "https://mcp.linear.app/mcp"    }  }}

Prefer read-only? Use https://mcp.linear.app/mcp/readonly.

  1. Run the command below (-s user makes it global), or edit ~/.gemini/settings.json.
  2. Run /mcp inside Gemini CLI to confirm it's connected.
Terminal
gemini mcp add -s user filesystem npx -y @modelcontextprotocol/server-filesystem /path/to/allowed/folder
~/.gemini/settings.json
{  "mcpServers": {    "filesystem": {      "command": "npx",      "args": [        "-y",        "@modelcontextprotocol/server-filesystem",        "/path/to/allowed/folder"      ]    }  }}

Replace the path. You can pass several folders, and the server can't access anything outside them.

Good to know

  • Use httpUrl for Streamable HTTP servers. url is for legacy SSE servers only.
  • gemini mcp add writes to the project by default. Add -s user to make a server available everywhere.
  • Run /mcp to list servers and tools, and /mcp auth <name> to sign in.
  • Filter tools per server with includeTools / excludeTools. Set trust: true only for servers you fully trust.
Config file:~/.gemini/settings.json.gemini/settings.json

Works with 74 servers

Other apps

Esc
↑↓ navigate↵ open