[Home](/index.md) › [MCP servers](/mcp.md) › PostHog MCP server

# PostHog MCP server

MCP server

- 1+ callable tools
- 5 capabilities

[Installation guide](https://github.com/PostHog/posthog/tree/master/services/mcp)

## Overview

PostHog's hosted MCP server lets AI clients work with PostHog data, including feature flags, product analytics, experiments, error tracking, session replay and SQL. It runs at mcp.posthog.com and connects through OAuth or a personal API key.

### Capabilities

- Manage feature flags and experiments
- Query product analytics and run SQL
- Investigate and triage error tracking issues
- Build and update dashboards and insights
- Review session replays and logs

## Works with

The products your agent can work with through this server.

- [PostHog](/tools/posthog.md): Open-source product analytics

## Tools

The callable functions your agent uses to work with this server.

### `exec`

Single CLI-style tool that wraps PostHog's MCP tools in cli mode, the default mode for most clients.

## Installation

Follow the installation guide for supported clients, authentication and required permissions.

### Add PostHog MCP server to Claude Code

Run this in your terminal:

```sh
claude mcp add --transport http posthog https://mcp.posthog.com/mcp
```

If the server asks you to sign in, run `/mcp` in Claude Code and follow the browser prompt.

### Add PostHog MCP server to Cursor

Add it with the Add to Cursor button below, or add it to `.cursor/mcp.json` in your project (`~/.cursor/mcp.json` for every project):

[Add to Cursor](cursor://anysphere.cursor-deeplink/mcp/install?name=posthog&config=eyJ1cmwiOiJodHRwczovL21jcC5wb3N0aG9nLmNvbS9tY3AifQ%3D%3D)

```json
{
  "mcpServers": {
    "posthog": {
      "url": "https://mcp.posthog.com/mcp"
    }
  }
}
```

### Add PostHog MCP server to VS Code

Add it to `.vscode/mcp.json` in your workspace. VS Code uses `servers` rather than `mcpServers`. Or run MCP: Add Server from the Command Palette and choose HTTP.

```json
{
  "servers": {
    "posthog": {
      "type": "http",
      "url": "https://mcp.posthog.com/mcp"
    }
  }
}
```

### Add PostHog MCP server to Codex

Run this in your terminal:

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

Or add it to `~/.codex/config.toml`:

```toml
[mcp_servers.posthog]
url = "https://mcp.posthog.com/mcp"
```

If the server uses OAuth, sign in with `codex mcp login posthog`.

### Add PostHog MCP server to Claude

Add it as a custom connector with this URL:

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

1. Open Customize, then Connectors.
2. Click + Add, then Add custom connector.
3. Name it, paste the URL and click Continue.
4. Choose how to sign in, then click Add.

On Team and Enterprise plans, an Owner adds it in Organization settings first, then members connect it.

### Add PostHog MCP server to other clients

For any other client that connects to remote MCP servers over HTTP, use this URL:

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

[Read the installation guide](https://github.com/PostHog/posthog/tree/master/services/mcp)

## Sources

Documentation and source code reviewed on 10 November 2026.

- [posthog.com/docs/model-context-protocol/codex.md](https://posthog.com/docs/model-context-protocol/codex.md)
- [posthog.com/docs/model-context-protocol/claude-code.md](https://posthog.com/docs/model-context-protocol/claude-code.md)
- [github.com/PostHog/posthog/tree/master/services/mcp](https://github.com/PostHog/posthog/tree/master/services/mcp)
- [github.com/PostHog/ai-plugin](https://github.com/PostHog/ai-plugin)
- [posthog.com/docs/model-context-protocol/tools.md](https://posthog.com/docs/model-context-protocol/tools.md)
- [posthog.com/docs/model-context-protocol/tools](https://posthog.com/docs/model-context-protocol/tools)
- [posthog.com/docs/model-context-protocol/faq.md](https://posthog.com/docs/model-context-protocol/faq.md)
