By Ira Bodnar, Ryze AI · Updated
Quick answer
To connect Codex to PostHog, save a PostHog personal API key in the PostHog card in Ryze AI, then run codex mcp add ryze --url https://connector.get-ryze.ai/mcp and codex mcp login ryze. The Codex CLI, the ChatGPT desktop app and the IDE extension share one MCP configuration.
- In PostHog create a personal API key with the Query and Insight scopes
- In Ryze AI open Integrations, click Connect on PostHog, paste the key, enter the host and pick the project
- In Codex run codex mcp add ryze --url https://connector.get-ryze.ai/mcp
- Run codex mcp login ryze, sign in on the Ryze AI page and click Allow connection
Before you start
- An OpenAI plan that includes Codex. OpenAI lists Codex in ChatGPT Free, Go, Plus, Pro, Business, Edu and Enterprise. Its pricing page shows Free and Go with Codex in the desktop app only, subject to rollout, so on those plans use the desktop app steps. Plus and higher add the CLI and the IDE extension. Codex also runs with an OpenAI API key in the CLI, SDK or IDE extension, billed at API pricing. OpenAI's MCP page names no extra plan for MCP servers.
- A PostHog personal API key. It starts with phx_ and needs read access to the project, including the Query and Insight scopes. Add write scopes only if Codex should change objects. You also need the host of your instance: https://us.posthog.com, https://eu.posthog.com or a self-hosted URL.
- A Ryze AI workspace on a plan or free trial. Paid Ads is $89 per month with a 7-day free trial; SEO Starter is $129 per month with a 3-day free trial and Agency is $279 per month. Adding the connector is free, but the PostHog tools need an active plan or trial.
How to connect Codex to PostHog with the CLI
Two steps happen in PostHog and Ryze AI, three in Codex. The server URL is the same for every user.
Create a personal API key in PostHog
In PostHog go to Settings, Personal API keys and click Create key. Grant read access to the project with the Query and Insight scopes, add write scopes only for objects Codex should change, and copy the phx_ key.
Connect PostHog in Ryze AI
Create a Ryze AI account or sign in, open Integrations, click Connect on the PostHog card, paste the key, enter the Host (US Cloud, EU Cloud or your self-hosted URL) and click Continue. Pick the Project and click Save.
Add the Ryze AI server to Codex
Run codex mcp add ryze --url https://connector.get-ryze.ai/mcp. In the ChatGPT desktop app or the IDE extension, use the MCP servers settings instead (see the sections below). All three share one MCP configuration.
Sign in and allow the connection
Run codex mcp login ryze, sign in on the Ryze AI page and click Allow connection. Without a local browser, add --no-browser, open the printed URL and paste the full redirect URL back into the terminal.
Check the server and ask your first question
Run codex mcp list, or type /mcp inside the Codex TUI, to see the ryze server. If the connector was added before PostHog was connected, remove and re-add it first. Then ask: List my PostHog dashboards and feature flags.
codex mcp add ryze --url https://connector.get-ryze.ai/mcpcodex mcp login ryzeThe CLI is the shortest route. The first command registers the server and the second starts the OAuth sign-in. Run codex mcp list afterwards, or /mcp inside the codex TUI, to confirm the server is registered. The PostHog key stays in Ryze AI; Codex never sees it.
The Ryze AI help article for PostHog covers the PostHog side of the connection, and the Ryze AI agent API help page covers API keys.
ChatGPT desktop app and IDE extension
The ChatGPT desktop app, the Codex CLI and the IDE extension share one MCP configuration, so a server added in one place shows up in the others. The app and the extension use a form instead of commands.
ChatGPT desktop app (Codex)
- Open Settings, then select MCP servers.
- Select Add server, enter the name ryze, choose Streamable HTTP and enter https://connector.get-ryze.ai/mcp.
- Save, then select Restart.
- Select Authenticate next to ryze and complete the Ryze AI sign-in. Type /mcp in the composer to view connected servers.
Codex IDE extension
- Open the gear menu, then select MCP servers.
- Select Add server, enter the name ryze, choose Streamable HTTP and enter https://connector.get-ryze.ai/mcp.
- Save, then select Restart extension.
- Select Authenticate and complete the Ryze AI sign-in.
config.toml
To keep the server in a file, edit ~/.codex/config.toml, or a project .codex/config.toml in a trusted project. OAuth is the default for an HTTP server; run codex mcp login ryze to sign in. HogQL results can be large, so the example below raises the per-call timeout and sets an output budget for the read tool.
[mcp_servers.ryze]
url = "https://connector.get-ryze.ai/mcp"
# Optional: raise the defaults (10 and 60 seconds)
startup_timeout_sec = 20
tool_timeout_sec = 120
[mcp_servers.ryze.tools.posthog__read]
output_token_limit = 20000For a Ryze AI API key instead of OAuth, add bearer_token_env_var = "RYZE_API_KEY" to the same table and set that environment variable to your rk_live_ key. Do not paste the key into the file. The Ryze AI key is separate from the PostHog phx_ key.
Codex cloud tasks are not covered by OpenAI's MCP page that this guide is based on, so this page does not say the connector works there. The Ryze AI connector was also not tested end to end in Codex when this page was written.
Claude, ChatGPT and Cursor
The same URL works in other MCP clients. PostHog is connected once in Ryze AI, so nothing changes on the PostHog side.
Claude and ChatGPT
In Claude, add https://connector.get-ryze.ai/mcp as a custom connector under Customize, Connectors. In ChatGPT, add it as an app under Settings, Apps. Pick the workspaces and start a new chat. If the connector was added before PostHog was connected, remove and re-add it so the tool list refreshes.
Cursor
Add the server to .cursor/mcp.json with the same URL.
{ "mcpServers": { "ryze": { "url": "https://connector.get-ryze.ai/mcp" } } }PostHog access
Three things decide what Codex can reach in PostHog.
- Which key and host
- Ryze AI stores a PostHog personal API key (phx_) and the host you enter: https://us.posthog.com for US Cloud, https://eu.posthog.com for EU Cloud or your self-hosted URL. The key needs read access to the project, including the Query and Insight scopes.
- Which project
- One connection holds one PostHog project, picked after you connect. PostHog is not on the Ryze AI list of platforms that support several accounts. To switch, click View on the card, disconnect with the trash icon and connect again, or use another workspace for another project. One Claude or ChatGPT connection can cover up to 20 workspaces.
- Read or write
- What Codex can change is limited by the scopes on the key. A key with read scopes only keeps it read-only, because PostHog rejects any change. Add write scopes only for the insights, dashboards, feature flags or cohorts you want Codex to edit.
Sources: PostHog's API documentation and the Ryze AI PostHog guide.
Removing access
To remove access, click View on the PostHog card in Ryze AI and disconnect with the trash icon, delete the personal API key in PostHog, or run codex mcp list and remove the ryze server from your Codex MCP settings.
What Codex can do in PostHog
The Ryze AI connector exposes 3 PostHog tools: 1 read, 1 write and 1 delete. Codex calls them by these names through the ryze server, against the one project you picked.
| Tool | Type | What it does |
|---|---|---|
| posthog__read | Read | Reads projects, insights, dashboards, feature flags, cohorts, persons and event definitions, and runs HogQL analytics queries. |
| posthog__write | Write | Creates or updates PostHog objects such as insights, dashboards, feature flags and cohorts. |
| posthog__delete | Delete | Deletes a PostHog object by path, for example a cohort. The deletion is irreversible. |
PostHog stops unbounded HogQL queries, so ask for a time window and a row limit of 1,000 or fewer. The tools need an active Ryze AI plan or free trial; without one, the connector can only list workspaces and connect platforms.
Approvals in Codex
Codex lets you set approvals per server. In config.toml, default_tools_approval_mode can be auto, prompt, writes or approve; writes prompts for tools that are not marked read-only. Per-tool overrides use tools.<tool>.approval_mode, and enabled_tools and disabled_tools work as allow and deny lists. For PostHog, a deny list on posthog__write and posthog__delete keeps the server read-only in Codex. The Ryze AI chat itself starts on Skip all approvals, so the agent runs PostHog tools on its own by default; pick Approve write & delete or Manual approve in its Tool approvals picker if you use it too. Scheduled tasks in Ryze AI run without an approval step.
[mcp_servers.ryze]
url = "https://connector.get-ryze.ai/mcp"
default_tools_approval_mode = "writes"
disabled_tools = ["posthog__delete"]First 3 prompts to run
Each answer comes from your own project, so this page describes what comes back instead of showing sample numbers.
1. A bounded HogQL query
Run a HogQL query on my PostHog project: count $pageview events per day for the last 14 days, with a LIMIT of 100.
Tools used: posthog__read
What comes back: A table with one row per day and its pageview count, printed in the Codex session. Keep a time window and a row limit of 1,000 or fewer.
2. Inventory of flags and dashboards
List my PostHog feature flags and dashboards, and tell me which flags have no description.
Tools used: posthog__read
What comes back: Lists of flags and dashboards for the connected project, with the flags that lack a description called out. Useful before a refactor that touches flag names in your code.
3. Create a cohort
Create a PostHog cohort of persons who triggered the signup event in the last 30 days, then show me its definition.
Tools used: posthog__write, posthog__read
What comes back: A new cohort and its definition. This needs a key with write scopes; with a read-only key PostHog rejects the change.
Deleting is a separate tool, so ask for it by name and object. The Ryze AI help center describes deleting insights, dashboards, feature flags and cohorts when explicitly asked. Disable posthog__delete in config.toml if Codex should never do it.
Ryze AI vs PostHog's own MCP server
PostHog publishes its own hosted MCP server and documents a Codex setup for it. It is a different route from the Ryze AI connector.
| Option | Setup | Coverage | Other platforms |
|---|---|---|---|
| Ryze AI connector | PostHog key and host saved once in Ryze AI, then codex mcp add ryze --url https://connector.get-ryze.ai/mcp and codex mcp login ryze | 3 PostHog tools (read, write, delete) for one project: insights, dashboards, flags, cohorts, persons, event definitions and HogQL queries | The same URL carries the other platforms connected in your Ryze AI workspace |
| PostHog MCP server (PostHog) | codex mcp add posthog --url https://mcp.posthog.com/mcp, then log in to PostHog with OAuth. PostHog also lists npx @posthog/wizard mcp add and a Codex plugin from codex plugin marketplace add PostHog/ai-plugin. It routes to your US or EU region from the account you log in with | PostHog's own tool set; see its tools reference for the current list | PostHog only |
PostHog's server needs no Ryze AI plan, and PostHog says some of its tools use LLMs internally, need AI data processing enabled in the organization settings and may be billed as PostHog AI spend. Choose it if you want PostHog's full tool set in Codex. Choose the Ryze AI connector if you want a small read, write and delete set for one project and one URL for your other connected platforms; it needs a Ryze AI plan or trial, and your PostHog data passes through Ryze AI. PostHog also warns that LLMs can be tricked by untrusted input, so review tool calls before they run. This page has not tested either server in Codex.
Sources: PostHog MCP server, PostHog MCP in Codex, PostHog API rate limits, OpenAI Codex MCP docs, OpenAI Codex pricing, Ryze AI PostHog integration. Checked November 13, 2026.
Errors and fixes
- PostHog rejects the key when you connect
- The host may not match where the account lives, or the key lacks the Query and Insight scopes. Use https://us.posthog.com or https://eu.posthog.com to match the account, or your self-hosted URL, and create the key again with those scopes.
- codex mcp login opens no browser
- Run codex mcp login ryze --no-browser, open the printed URL on another device and paste the full redirect URL back into the terminal.
- The server times out on start or on a call
- Codex waits 10 seconds to start a server and 60 seconds per tool call by default. Raise startup_timeout_sec or tool_timeout_sec in the [mcp_servers.ryze] table.
- PostHog tools do not appear in Codex
- If the connector was added before PostHog was connected in Ryze AI, remove the ryze server, add it again, sign in and start a new session.
- A HogQL query is refused or returns nothing useful
- PostHog stops unbounded queries. Ask for a time window and a LIMIT of 1,000 or fewer.
- Output is cut off
- Set tools.posthog__read.output_token_limit in config.toml to give the read tool a larger output budget, or ask for fewer columns and rows.
- Queries are rate limited
- PostHog documents limits per personal API key: 240 requests per minute and 1,200 per hour on analytics endpoints, and 2,400 per hour on the HogQL query endpoint. Wait and retry, or spread the questions out.
- Changes fail
- The key probably has read scopes only. Create a key with write scopes for the objects you want changed, and save it again in the PostHog card in Ryze AI.
- The one-time connection link is refused
- Ryze AI refuses it while PostHog is already connected in the workspace. Change the project or the key in the Ryze AI app instead.
- A tool replies that a subscription is required
- The PostHog tools need an active Ryze AI plan or free trial. Start the trial, then retry.
- No CLI or IDE extension on a Free or Go plan
- OpenAI lists Codex on those plans in the desktop app only, subject to rollout. Use the desktop app steps.
Frequently asked questions
How do I connect Codex to PostHog?
Save a PostHog personal API key and host in the PostHog card in Ryze AI. Then run codex mcp add ryze --url https://connector.get-ryze.ai/mcp, run codex mcp login ryze, sign in on the Ryze AI page and click Allow connection.
Does PostHog have its own MCP server for Codex?
Yes. PostHog documents a hosted server at https://mcp.posthog.com/mcp and a Codex setup: codex mcp add posthog --url https://mcp.posthog.com/mcp, or a plugin from codex plugin marketplace add PostHog/ai-plugin. The Ryze AI connector is a separate route with 3 PostHog tools.
Which PostHog connector should I use with Codex?
Ryze AI is the best PostHog connector for Codex when you want one URL that also carries your other connected platforms, but it covers one project and 3 tools and needs a Ryze AI plan. PostHog's own server needs no Ryze AI plan and offers PostHog's wider tool set.
Which Codex plan do I need?
OpenAI lists Codex in ChatGPT Free, Go, Plus, Pro, Business, Edu and Enterprise. Free and Go get Codex in the desktop app only, subject to rollout. Plus and higher add the CLI and the IDE extension. OpenAI's MCP page names no extra plan for MCP servers.
Can Codex change my PostHog project?
Yes, within the key's scopes. The connector has a write tool for insights, dashboards, feature flags and cohorts and a delete tool. A key with read scopes only keeps Codex read-only, because PostHog rejects any change. Set default_tools_approval_mode to writes in config.toml if you want Codex to ask before it changes anything.
Which PostHog host do I enter?
Enter https://us.posthog.com for US Cloud, https://eu.posthog.com for EU Cloud, or the URL of your self-hosted instance. A host that does not match where the account lives can make PostHog reject the key.
Can I connect more than one PostHog project?
Not in one workspace. Ryze AI holds one PostHog connection per workspace, with one project picked after connecting. To switch, disconnect and connect again, or keep another project in another workspace.
Does this work in Codex cloud tasks?
This page does not claim it does. The OpenAI MCP page it is based on covers the CLI, the desktop app and the IDE extension, and the connector was not tested in Codex cloud.
Do I need to configure the CLI, the app and the IDE extension separately?
No. The ChatGPT desktop app, the Codex CLI and the IDE extension share one MCP configuration. Restart the app or the extension after you add the server.
What are PostHog's API rate limits?
PostHog lists 240 requests per minute and 1,200 per hour on analytics endpoints for a personal API key, and 2,400 per hour on the HogQL query endpoint. Most of its limits count per personal API key, not per team.
How much does it cost to connect Codex to PostHog?
Adding the connector is free, but the PostHog tools need an active Ryze AI plan or free trial. Paid Ads is $89 per month with a 7-day free trial, SEO Starter is $129 per month with a 3-day free trial, and Agency is $279 per month. Annual billing takes 30% off the first year. Codex itself is billed under your OpenAI plan or API pricing.