﻿# PostHog MCP for Codex - Docs

Copy page

# PostHog MCP for Codex - Docs

The PostHog [MCP server](https://modelcontextprotocol.io/introduction) enables Codex to directly interact with your PostHog data – managing feature flags, querying analytics, investigating errors, and more.

## Server URL

`https://mcp.posthog.com/mcp`

The PostHog authentication server automatically routes you to the correct data region (US or EU) based on the account you log in with.

## Quick install

The [PostHog Wizard](https://github.com/PostHog/wizard) can install the MCP server directly into Codex:

Terminal

PostHog AI

```bash
npx @posthog/wizard mcp add
```

## Codex plugin

You can also install PostHog as a [Codex plugin](https://github.com/PostHog/ai-plugin):

Terminal

PostHog AI

```bash
codex plugin marketplace add PostHog/ai-plugin
```

After adding the plugin, run `codex` in your terminal and select **PostHog** from the `/plugins` menu to install and enable.

Terminal

PostHog AI

```bash
codex
# Then run /plugins, select PostHog, and install
```

## Manual MCP setup

Run the following command in your shell. [Codex](https://openai.com/index/introducing-codex/) supports native OAuth, so you'll be prompted to log in to PostHog when you first use the MCP.

Terminal

PostHog AI

```bash
codex mcp add posthog --url https://mcp.posthog.com/mcp
```

> Be mindful of prompt injection – LLMs can be tricked into following untrusted commands, so always review tool calls before executing them.

## What's next

-   **[Use cases](/docs/model-context-protocol/use-cases.md)** – 20+ example prompts and multi-step recipes for the most useful MCP workflows
-   **[Tools reference](/docs/model-context-protocol/tools.md)** – every tool the MCP server exposes, grouped by category
-   **[FAQ and advanced setup](/docs/model-context-protocol/faq.md)** – auth, scoping, filtering, safety, and other operational details

### Community questions

Ask a question

### Was this page useful?

HelpfulCould be bet