Skip to main content

MCP Servers & Extensions

Configuring External Tools via MCP

0:00
LearnStep 1/3

Configuring External Tools via MCP

The Model Context Protocol (MCP) allows the Gemini CLI to extend its capabilities by connecting to external tools and data sources. This lesson covers how to configure these connections.

Adding an MCP Server

To connect a new tool, use the gemini mcp add command. You need to specify a name for the server and the command to run it.

Connection Types

  • Local (Stdio): The CLI runs the server process directly and communicates via standard input/output. This is the default and most common for local tools.
  • Remote (SSE): Connects to a server running over HTTP using Server-Sent Events. Use the --url flag instead of command arguments.

Authentication

Some servers require API keys or other secrets. You can pass these as environment variables when adding the server using the --env flag.

Verifying Tools

After adding a server, ensure the tools are recognized and available by listing them:

This command displays all registered servers and the specific tools they provide to the agent.