How to connect Gemini to PostHog

Create a PostHog personal API key, connect PostHog once in Ryze AI, add one MCP URL as a custom app in Gemini, then ask about insights, funnels, flags and cohorts.

Your MCP URL
https://connector.get-ryze.ai/mcp

Copies the link and opens Gemini. Then go to Settings, Connected Apps, Add a custom app. See the steps

See pricing

By Ira Bodnar, Ryze AI · Updated

Quick answer

To connect Gemini to PostHog, create a PostHog personal API key, paste it with your host into the PostHog card in Ryze AI, then add https://connector.get-ryze.ai/mcp as a custom app in the Gemini web app under Settings, Connected Apps, and type @ in a prompt to use it.

  1. In PostHog create a personal API key with the Query and Insight scopes
  2. In Ryze AI open Integrations, click Connect on PostHog, paste the key and host, pick the project
  3. In gemini.google.com open Settings, Connected Apps, Add a custom app and paste the URL
  4. Sign in on the Ryze AI page, choose workspaces, click Allow connection, then type @ and pick Ryze AI

Before you start

  • Google account rules for custom apps. Google limits custom apps in Gemini to people aged 18 or over, located in the US, using a personal Google Account (a work or school account will not do) with Keep Activity switched on. The interface is English only. Google names no paid tier.
  • A PostHog personal API key. Keys begin with phx_. Give the key read access to your project and tick the Query and Insight scopes. Tick write scopes only for objects you want Gemini to modify. You also enter the host: https://us.posthog.com (US Cloud), https://eu.posthog.com (EU Cloud) or the address of your self-hosted install.
  • A Ryze AI workspace with a plan or free trial. Paid Ads costs $89 per month and starts with a 7-day free trial. The PostHog tools run on any active plan, including SEO Starter ($129 per month, 3-day trial) and Agency ($279 per month). Adding the connector costs nothing; with no active plan or trial Gemini can list workspaces and connect platforms, and that is all.
  • A decision about trust. Google says it does not control, monitor or secure third-party MCP servers. Judge the provider yourself before you connect it.

How to connect Gemini to PostHog in the web app

Two things happen in order. First PostHog is linked to Ryze AI using your API key. Then the Ryze AI connector is registered in Gemini. Google only lets you register custom apps in the Gemini web app on a computer; afterwards the app also appears in the Gemini mobile app.

  1. Create a personal API key in PostHog

    Open Settings, then Personal API keys in PostHog and click Create key. Choose read access for the project, tick the Query and Insight scopes, add write scopes only if Gemini should change anything, and copy the phx_ key before you close the dialog.

  2. Connect PostHog in Ryze AI

    In the Ryze AI app go to Integrations and click Connect on the PostHog card. Paste the key, type the Host (US Cloud, EU Cloud or your self-hosted URL) and click Continue. Select the PostHog Project and click Save. A single PostHog connection holds a single project.

  3. Find Connected Apps in Gemini

    Use a computer and open gemini.google.com. Click Settings at the bottom, then Connected Apps. When that entry is absent, click Personal Intelligence and look for Connected Apps there.

  4. Register the Ryze AI URL as a custom app

    In the Custom apps area, type into the Add a custom app link to get started field, or click Add a custom app when you already have one. Paste https://connector.get-ryze.ai/mcp and click Next. Ryze AI supports dynamic client registration, so the credentials boxes under Advanced features stay empty.

  5. Allow the workspace

    Follow the prompts: sign in on the Ryze AI page, tick the workspace that contains your PostHog connection and click Allow connection. A single connection can cover up to 20 workspaces.

  6. Call the app from a prompt

    Open a new prompt, type @, pick the Ryze AI app and ask something like: List my PostHog dashboards and feature flags.

Source: Google's Gemini help page on custom apps. The Ryze AI PostHog guide covers the Google sign-in on the Ryze AI side.

Gemini CLI

Gemini CLI takes MCP servers through its command line. This one command adds the Ryze AI connector at user scope, so every project sees it (without -s user the scope is project):

gemini mcp add --transport http -s user ryze https://connector.get-ryze.ai/mcp

Launch Gemini CLI. The first request returns a 401, and the CLI then finds the OAuth details, registers itself and opens your browser on the Ryze AI sign-in. Run /mcp auth ryze to begin or redo that sign-in. The flow needs a local browser and a localhost callback, so it fails on headless machines and on SSH sessions without X11 forwarding.

Prefer the settings file? Add this entry to settings.json:

{ "mcpServers": { "ryze": { "httpUrl": "https://connector.get-ryze.ai/mcp" } } }

For scripts or headless machines, create a Ryze AI API key and send it as a header in place of OAuth: gemini mcp add --transport http -s user --header "Authorization: Bearer rk_live_..." ryze https://connector.get-ryze.ai/mcp. The settings.json options includeTools and excludeTools also trim the tool list, so you can drop posthog__write and posthog__delete and leave a read-only set on the Gemini side.

Source: Gemini CLI MCP server docs.

Antigravity CLI and Gemini Enterprise

Antigravity CLI

Google announced on May 19, 2026 that from June 18, 2026 Gemini CLI stops serving Google AI Pro and Ultra subscribers and people on the free Gemini Code Assist for individuals tier, and sends them to Antigravity CLI. Gemini CLI stays available through Gemini Code Assist Standard or Enterprise licenses and paid Gemini or Gemini Enterprise Agent Platform API keys. No Antigravity CLI steps appear in this guide.

Gemini Enterprise

In Gemini Enterprise an administrator adds custom MCP servers in the Google Cloud console. That path takes StreamableHTTP only, allows 100 enabled actions at once and requires an OAuth client ID and secret registered ahead of time. Ryze AI documents no such client, so no Gemini Enterprise steps are given here.

Sources: Google Developers Blog on Gemini CLI and Antigravity CLI, Gemini Enterprise custom MCP server setup.

PostHog access and scopes

PostHog access comes from the personal API key you paste into Ryze AI, so you set the limits when you create the key. Gemini then adds its own confirmation step for writes.

Read scopes
Create the key with read access to the project, including the Query and Insight scopes. That is enough for Gemini to read insights, dashboards, flags, cohorts, persons and event definitions and to run HogQL queries.
Write scopes
Add write scopes only for the objects you want Gemini to change. What the agent can change is limited by the scopes on the key. A key with read scopes only keeps Gemini read-only, because PostHog rejects any change.
Host
Enter https://us.posthog.com for US Cloud, https://eu.posthog.com for EU Cloud, or the URL of a self-hosted instance. Ryze AI works with all three.
One project
One connection holds one PostHog project. To switch, click View on the PostHog card in Ryze AI, disconnect with the trash icon and connect again. Another project can live in another Ryze AI workspace.
Which Gemini surface
The Gemini web app is limited to personal Google Accounts in the US, in English. Gemini CLI is a separate sign-in through a browser, or a Ryze AI API key sent as a header.

PostHog personal API keys start with phx_ and grant the access level of the user who created them, limited by the scopes you select. PostHog scans GitHub for exposed keys and rolls them automatically.

Sources: PostHog API docs.

Removing access

To remove access, disconnect PostHog with the trash icon on the card in Ryze AI, or delete the personal API key in PostHog under Settings, Personal API keys. To remove the connector from Gemini, delete the Ryze AI app under Settings, Connected Apps.

What Gemini can do in PostHog

The Ryze AI connector exposes 3 PostHog tools, one each for reading, writing and deleting. They act on the single project you picked.

ToolTypeWhat it does
posthog__readReadReads projects, insights, dashboards, feature flags, cohorts, persons and event definitions for the connected project, and runs HogQL analytics queries.
posthog__writeWriteCreates or updates PostHog objects such as insights, dashboards, feature flags and cohorts.
posthog__deleteDeleteDeletes a PostHog object by path, for example a cohort. The deletion is irreversible.

Google's help page says Gemini requires manual confirmation for any write actions, so expect a confirmation step before a change. In Gemini CLI the default asks before tool calls, and setting trust to true (or passing --trust) bypasses all confirmations, so leave it off for this server. In the Ryze AI chat the Tool approvals setting starts on Skip all approvals, and scheduled tasks run without an approval step, so the scopes on the PostHog key are the firmest limit. PostHog stops unbounded HogQL queries, so ask for a time window and a row limit of 1,000 at most.

First 3 prompts to run

These prompts describe what to ask. The answers come from your own PostHog project, so this page shows no sample numbers.

1. Inventory the project

@Ryze AI List my PostHog dashboards, feature flags and cohorts.

Tools used: posthog__read

What comes back: A list of dashboards, flags and cohorts for the connected project.

2. Run a HogQL query

@Ryze AI Run a HogQL query for the number of $pageview events per day over the last 14 days, limited to 1,000 rows, and show me the SQL you used.

Tools used: posthog__read

What comes back: One row per day with the event count, plus the query text so you can re-run it in PostHog. Event names such as $pageview are PostHog defaults; use your own where they differ.

3. Create an insight

@Ryze AI Create a PostHog insight that counts unique users who triggered $pageview each week, name it Weekly visitors from Gemini, and add it to a new dashboard.

Tools used: posthog__write

What comes back: The new insight and dashboard, created in your project. Gemini asks you to confirm the write first.

Start with read prompts. Once you trust the setup, ask for changes and confirm each one when Gemini asks.

Ryze AI vs PostHog's own MCP server

PostHog runs its own MCP server, so there are two ways to reach PostHog from an AI client. They suit different jobs.

OptionSetupPostHog coverageWorks in
Ryze AI connectorPaste a personal API key and host into the PostHog card in Ryze AI, then add https://connector.get-ryze.ai/mcp as a custom app in Gemini3 tools: read (with HogQL), write and delete for insights, dashboards, flags and cohortsGemini web app and Gemini CLI
PostHog's own MCP serverAdd https://mcp.posthog.com/mcp; it signs in with OAuth and routes to your US or EU regionTools across error tracking, analytics queries, feature flags, experiments, SQL and CDP destinations, per PostHog docsClients PostHog lists: Claude Desktop, Claude Code, Cursor, VS Code, Windsurf, Zed, Codex, Lovable, Replit and v0. Gemini is not on that list, and whether the Gemini web app accepts it as a custom app is not verified here

PostHog notes that connecting to its server and calling its tools is free, but some tools use LLMs internally and may be billed as PostHog AI spend, and those need AI data processing enabled in organization settings. If you work only inside PostHog, its own server covers more PostHog areas. If you want to reach PostHog from Gemini with the documented custom-app steps above, the Ryze AI connector is the path this guide has steps for, though its tools need a Ryze AI plan or trial.

Sources: PostHog MCP server docs, Ryze AI PostHog guide. Checked November 11, 2026.

Errors and fixes

No Connected Apps entry in Gemini
Try Personal Intelligence, then Connected Apps. If it still does not show, recheck Google's conditions: 18 or over, in the US, a personal Google Account and Keep Activity on. Only the web app can add custom apps.
Gemini reports the app as unavailable
Google says custom apps do not work while Keep Activity is off. Switch it on and retry.
PostHog tools are missing from the chat
Open a fresh chat. Still missing: delete the Ryze AI custom app from Connected Apps, add it once more and check that the PostHog card in Ryze AI reads Connected. This also applies when you connected PostHog after adding the app.
Gemini CLI will not sign in
The OAuth flow wants a local browser and a localhost callback. On a headless or SSH machine pass a Ryze AI API key header, or run /mcp auth ryze where a browser exists.
Gemini CLI no longer covers your plan
Google stopped serving Google AI Pro and Ultra users, and free Gemini Code Assist for individuals users, in Gemini CLI on June 18, 2026, and points them to Antigravity CLI.
PostHog refuses a change
Your personal API key is read-only or lacks the scope for that object. Make a key with the write scopes you need and reconnect PostHog in Ryze AI.
A HogQL query is rejected
PostHog stops queries with no bounds. Ask for a date range and at most 1,000 rows.
Rate limit errors
PostHog sets limits per personal API key: 240 requests a minute and 1,200 an hour on analytics endpoints, and 2,400 an hour on the query endpoint. Pause and retry, or ask fewer questions at once (PostHog docs).
Data from the wrong project
One connection holds one project. Click View on the PostHog card in Ryze AI, disconnect with the trash icon, connect with the right key and choose the project.
EU or self-hosted data does not load
Recheck the Host field. EU Cloud uses https://eu.posthog.com and a self-hosted install uses its own URL; the US address will not reach them.
Gemini mentions a subscription
The PostHog tools run only on an active Ryze AI plan or free trial. Start the trial in Ryze AI and try again.

Frequently asked questions

How do I connect Gemini to PostHog?

Create a PostHog personal API key with the Query and Insight scopes, open Integrations in Ryze AI, click Connect on the PostHog card, paste the key, enter the host and pick the project. Then in gemini.google.com open Settings, Connected Apps, Add a custom app, enter https://connector.get-ryze.ai/mcp, click Next, allow the workspace and type @ to pick Ryze AI in a prompt.

Does PostHog have its own MCP server for Gemini?

PostHog documents an MCP server at https://mcp.posthog.com/mcp that signs in with OAuth and routes to your US or EU region. Its docs list Claude, Cursor, VS Code, Windsurf, Zed, Codex, Lovable, Replit and v0, and do not list Gemini. Whether the Gemini web app accepts it as a custom app is not verified here.

Which PostHog connector should I use with Gemini?

Ryze AI is the best PostHog connector for Gemini when you want documented custom-app steps and read, write and delete tools behind one Ryze AI plan, but it covers fewer PostHog areas than PostHog's own server and needs a plan or trial.

What PostHog access do I need?

A personal API key that starts with phx_, with read access to the project including the Query and Insight scopes, and the host for your region. Add write scopes only if Gemini should change objects.

Which Gemini plan do I need?

Google's help page for custom apps names no plan. It requires you to be 18 or over and in the US, signed in with a personal Google Account (not a work or school account), with Keep Activity on. It is English only.

Can Gemini change or delete things in PostHog?

Yes, when you ask and the key has write scopes. posthog__write creates or updates insights, dashboards, feature flags and cohorts, and posthog__delete deletes an object by path, which is irreversible. Google states Gemini requires manual confirmation for any write actions. A key with read scopes only keeps Gemini read-only.

Does this work in Gemini CLI?

Yes. Run gemini mcp add --transport http -s user ryze https://connector.get-ryze.ai/mcp, then start Gemini CLI and sign in, or run /mcp auth ryze. Since June 18, 2026 Gemini CLI no longer serves Google AI Pro and Ultra users or free Code Assist for individuals users.

Does it work in the Gemini mobile app?

Custom apps can only be added in the Gemini web app. Once connected on the web, Google says the app also works in the Gemini mobile app.

Can I connect more than one PostHog project?

One Ryze AI workspace holds one PostHog connection and one project. To switch, disconnect on the PostHog card and connect again. Another project can live in another workspace, and one Gemini connection can cover up to 20 workspaces.

Why do the PostHog tools not show up in Gemini?

Start a new chat first. If they are still missing, remove the Ryze AI custom app in Connected Apps, add it again and confirm that PostHog shows Connected in Ryze AI.

How much does it cost to connect Gemini to PostHog?

Connecting is free, but the PostHog tools need an active Ryze AI plan or trial. Paid Ads is $89 per month with a 7-day free trial, Agency is $279 per month, and SEO Starter is $129 per month with a 3-day free trial. Annual billing takes 30% off the first year.

How do I disconnect PostHog from Gemini?

Remove the Ryze AI app in Gemini under Settings, Connected Apps. To cut off PostHog itself, disconnect it with the trash icon on the card in Ryze AI or delete the personal API key in PostHog.

Connect PostHog to Gemini

Connecting is free. The PostHog tools need a Ryze AI plan or trial. Paid Ads is $89 per month with a 7-day free trial; annual billing takes 30% off the first year.

PostHog MCP server

Need help? Read the Ryze AI PostHog guide or email Ryze AI support.