# How to connect Instagram to Gemini CLI

> One gemini mcp add command and an API key: Gemini CLI reads your Instagram insights and comments, and publishes the pages it builds.

Source: https://saypage.ai/integrations/gemini-cli · Updated December 2, 2026

Gemini CLI can't reach Instagram by itself. Saypage is an MCP server that gives it Instagram tools, through the official Instagram API: your insights, your comments, posting, Reels, your pages on `yourname.saypage.page` and your comment-to-DM automations. One `gemini mcp add` command and an API key add it, in every project or just one.

## What you need

- **Gemini CLI**, installed and signed in.
- **An Instagram professional account**, Business or Creator, connected to Saypage.
- **A Saypage account and an API key.** [Create your account](https://saypage.ai/sign-up), connect Instagram, then create a key on your account's [API keys](https://saypage.ai/account/api-keys) page.

## Step 1: create an API key

On your Saypage account, open **API keys** and create one:

- **Read only** for questions and reports: insights, posts, comments, pages and their statistics. It can't post, reply or send anything.
- **Full access** to let Gemini publish pages, reply to comments and post, always after you approve it.

Copy the key (it starts with `sp_`): Saypage shows it once. More in [Saypage API keys](https://saypage.ai/docs/api-keys).

## Step 2: add Saypage

With the key in a `SAYPAGE_API_KEY` variable, run:

```bash
gemini mcp add --transport http --scope user \
  --header "Authorization: Bearer $SAYPAGE_API_KEY" \
  saypage https://api.saypage.ai/mcp
```

`--scope user` writes it in `~/.gemini/settings.json`, for every project. Without it, Gemini CLI writes it in the current project's `.gemini/settings.json`: don't commit that file with a key in it.

The entry it writes looks like this; you can also add it by hand:

```json
{
  "mcpServers": {
    "saypage": {
      "httpUrl": "https://api.saypage.ai/mcp",
      "headers": { "Authorization": "Bearer sp_…" }
    }
  }
}
```

Use `httpUrl`, not `url`: in Gemini CLI, `url` means the older SSE transport.

## Step 3: check that it works

Start Gemini CLI and run `/mcp`: **saypage** shows as connected, with its tools. Then ask **"Get started with Saypage."** and try:

- "Which of my last 20 Instagram posts did best, and why?"
- "Build a link-in-bio page in this folder, then show me a Saypage preview."

## Why a key and not a sign-in?

Saypage's sign-in registers apps with a client ID metadata document, as the latest MCP specification recommends, and doesn't offer the older dynamic client registration. Gemini CLI's `/mcp auth` signs in by dynamic registration or with a client ID you set yourself, so an API key is the reliable way, and you choose exactly what it may do.

## What Gemini CLI does well with Saypage

- **Pages from your folder.** Gemini writes the HTML next to your files and sends it to Saypage: a private preview first, online on your address once you approve it.
- **Reports in one line.** `gemini -p "Summarize last week on my Instagram"` runs without a chat, so a scheduled job can send you your numbers with a read-only key.
- **Batches.** "For each of my last ten Reels, tell me its reach, saves and shares, and which hook worked."

## What Gemini CLI can do with your Instagram

What it can do depends on your Saypage plan, and on the key: a read-only key only reads, on any plan.

| Ask Gemini CLI to… | Saypage plan |
|---|---|
| Read your posts, Reels and insights, and say what to post next | Free and every plan |
| Find the comments you haven't answered, draft replies, hide spam | Creator ($19 a month) and Premium |
| Publish photo posts, carousels, Reels and stories, once you turn publishing on | Creator and Premium |
| Build pages and put them online on your address | Creator and Premium |
| Send a link by DM to everyone who comments a keyword | Creator and Premium |

Each paid plan starts with a 7-day free trial. The full list of tools is in the [MCP tools reference](https://saypage.ai/docs/tools).

## What it can't do

Saypage only does what the official Instagram API allows. Gemini CLI can't read or answer your DM inbox, message your followers in bulk, change your bio, delete a published post, or act on someone else's account.

## Questions

### Does it work in the Gemini app?

This guide is for Gemini CLI, the command-line agent. Saypage isn't available in the Gemini app yet.

### Is it free?

Adding Saypage is free, and on Saypage's Free plan Gemini CLI reads your posts and insights. Comments, posting, pages and DM automations start with Creator, at $19 a month, with 7 days free. See [Plans and limits](https://saypage.ai/docs/plans).

### /mcp shows saypage as disconnected. What's wrong?

Check that the entry uses `httpUrl` with `https://api.saypage.ai/mcp`, and the key: a revoked key, or one pasted with a space, gets `401 Unauthorized`.

### What if my key leaks?

Revoke it on your account's API keys page: it stops working at once. Then create a new one and update the entry. See [Saypage API keys](https://saypage.ai/docs/api-keys).

### Is it safe for my Instagram account?

Saypage connects to Instagram through its official login and passed Meta App Review for every permission it uses. It never sees your Instagram password and never reads your DMs. See [Privacy and safety](https://saypage.ai/docs/privacy-and-safety).

## Next

- [How to connect Instagram to Claude Code](https://saypage.ai/integrations/claude-code)
- [How to connect Instagram to OpenAI Codex](https://saypage.ai/integrations/codex)
- [Instagram MCP server](https://saypage.ai/integrations/instagram-mcp-server)
