Gemini CLI is Google’s open-source terminal-based tool that brings Gemini’s capabilities directly to your command line. Unlike web-based interfaces, Gemini CLI operates entirely in your terminal and has access to your current project folder, offering a lightweight and efficient way to interact with Gemini models from within your project.
When combined with Model Context Protocol (MCP) servers, Gemini CLI becomes even more useful. Using MCP servers, you can give Gemini access to your tools and infrastructure, allowing it to work with your APIs, databases, and other services through built-in MCP support.
This guide shows you how to connect Gemini CLI to a Gram-hosted MCP server using Taskmaster, a full-stack CRUD application for task and project management. Taskmaster includes a web UI for managing projects and tasks, a built-in HTTP API, OAuth 2.0 authentication, and a Neon PostgreSQL database for storing data. Try the demo app to see it in action.
You’ll learn how to set up the connection, test it, and use natural language to manage tasks, projects, and workflows through Gemini CLI.
Use one of the following two options to install Gemini CLI:
Run it directly with npx.
npx https://github.com/google-gemini/gemini-cli
Install it globally.
npm install -g @google/gemini-cli
Verifying the installation
Test that Gemini CLI is working:
gemini --help
If the installation was successful, you’ll see Gemini CLI’s available commands and options.
Authenticating with Gemini CLI
When you first run gemini, you’re prompted to authenticate. Sign in with your personal Google account to get free access to Gemini 2.5 Pro with generous usage limits (60 requests per minute, 1,000 requests per day).
Creating an MCP server
Before connecting Gemini CLI to a Taskmaster MCP server, you first need to create one. Follow our guide to creating a Taskmaster MCP server.
Connecting Gemini CLI to your Gram-hosted MCP server
Now let’s connect Gemini CLI to your Taskmaster MCP server.
Gemini CLI uses a settings.json configuration file to manage MCP servers. You can configure MCP servers in one of two files:
Globally at ~/.gemini/settings.json.
For a specific project at .gemini/settings.json in your project root.
Copy your public or authenticated MCP server configuration from Gram and add it to the .gemini/settings.json file.
For Pass-through Authentication, the configuration looks like this: