> ## Documentation Index
> Fetch the complete documentation index at: https://heygen-1fa696a7.mintlify.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Gemini CLI

> Wire HeyGen into Gemini CLI via MCP. Generate AI avatar videos from natural-language prompts in your terminal as part of any development or content workflow.

## Prerequisites

* Gemini CLI installed (`npm install -g @google/gemini-cli@latest`)
* A HeyGen account with Video Agent access

## Adding the MCP Server

Open your Gemini CLI settings file and add the HeyGen server under the `mcpServers` key.

**Global (all projects):** `~/.gemini/settings.json`

**Project-scoped:** `.gemini/settings.json` in your project root

```json theme={null}
{
  "mcpServers": {
    "heygen": {
      "httpUrl": "https://mcp.heygen.com/mcp/v1/"
    }
  }
}
```

If you already have other MCP servers configured, add `heygen` alongside them inside the existing `mcpServers` block.

Restart Gemini CLI after saving the file.

## Verifying the Connection

Launch Gemini CLI and run:

```text theme={null}
/mcp
```

You should see `heygen` listed under connected MCP servers with its available tools displayed.

## Authentication

On first tool invocation, Gemini CLI will prompt you to authorize access to your HeyGen account through a browser-based OAuth flow. Follow the prompt to complete authentication.

## Usage

Once connected, prompt Gemini CLI with a video generation request:

```text theme={null}
Generate a 60-second explainer video about our new API release using HeyGen.
```

Gemini will call HeyGen's Video Agent to handle scripting, avatar selection, and rendering. Completed videos are accessible from the **Projects** page in your HeyGen dashboard.

### Loading HeyGen Skills (Recommended)

For better prompt structure and higher-quality output, instruct Gemini to reference HeyGen's prompt engineering guidelines before generating:

```text theme={null}
Before writing any video prompts, read the HeyGen skills at:
https://github.com/heygen-com/skills

Follow SKILL.md, references/prompt-optimizer.md, and references/video-agent.md
to structure each prompt with scenes, timing, visual style, and copy rules.
```

## Configuration Scoping

| Scope   | File Location                          | Availability         |
| ------- | -------------------------------------- | -------------------- |
| Global  | `~/.gemini/settings.json`              | All projects         |
| Project | `.gemini/settings.json` (project root) | Current project only |
