PostHog MCP compared with AgentFirstStack

PostHog's MCP server is a hosted endpoint that lets an agent work inside a PostHog account you log in to: SQL queries, feature flags, experiments, dashboards, surveys and error tracking. AgentFirstStack is narrower. An agent sets up web analytics, ad conversion tracking, inboxes and session replay from nothing, with one POST for a key and no email.

Updated

Set it up with one prompt

Paste this into your coding agent. It does the setup, checks each step and hands you a claim link at the end.

Paste this into Claude Code, Cursor or Codex

Set up AgentFirstStack for this project: analytics now, session replay only if I say yes. It's free, open-source infrastructure built for agents, and you can do all of it yourself: there is no signup form, and no email or verification is needed. 1. Read https://agentfirststack.com/llms.txt, then the analytics manual it links to. 2. If this project's .env already has AGENTFIRSTSTACK_API_KEY, use it. Otherwise get a key with one request: curl -X POST https://agentfirststack.com/v1/signup Save api_key in .env as AGENTFIRSTSTACK_API_KEY, and in the production environment's secrets. 3. Create an analytics site for the production domain, add the snippet to the site's layout, deploy, then run verify until it passes. 4. Create goals for the actions that matter here (sign-up, purchase) and a funnel from the landing page to the first of them. Send events only the server knows about as server events. 5. Ask me before turning on session replay. If I agree, link it to the analytics site so there's nothing else to paste. 6. If you support MCP, add https://agentfirststack.com/mcp with the header "Authorization: Bearer <key>". 7. Write the ids and the env var that holds the key (never the key itself) in AGENTFIRSTSTACK.md, and create a claim link for me with POST https://agentfirststack.com/v1/claim-link. When you're done, tell me what you set up, how you verified it, and give me the claim link.

What PostHog's MCP server does

PostHog runs it at https://mcp.posthog.com/mcp (PostHog's MCP docs). It works inside an account you log in to:

  • You connect with npx @posthog/wizard mcp add, or in Claude Code with claude mcp add --transport http posthog https://mcp.posthog.com/mcp -s user, and log in through the browser on first use (Claude Code setup).
  • OAuth is the recommended path. Clients without it use a personal API key made with the "MCP Server" preset, which is scoped to one project (FAQ).
  • The tools span about 60 categories, including project-create, create-feature-flag, experiment-create, dashboard-create, survey-create and execute-sql.
  • A read-only header hides every tool that writes. Connecting is free; normal PostHog usage billing applies to what your queries use.

PostHog also has an agent path for installing it. The PostHog wizard installs the SDK, writes credentials to .env, adds events and builds dashboards. With --signup --email you@example.com it creates the account and a project as well. That account is tied to the email, and you set its password from a welcome email.

How AgentFirstStack differs

Two ways. The account is the key: POST /v1/signup returns it with no email and no login, so an agent can start without a person. And the scope is smaller and web-focused: analytics, ad conversion tracking, inboxes and session replay, each with a plain-text manual linked from /llms.txt.

curl -s -X POST https://agentfirststack.com/v1/signup     # api_key, no email
claude mcp add --transport http afs https://agentfirststack.com/mcp \
  --header "Authorization: Bearer $AGENTFIRSTSTACK_API_KEY"

Then the agent calls tools such as:

  • analytics_create_site and analytics_verify_install to install tracking and confirm events arrive.
  • analytics_create_goal, analytics_create_funnel, analytics_get_journeys and analytics_get_insights for conversions and how people got there.
  • replay_search_sessions and replay_get_session_transcript to read recorded sessions as text.
  • tags_setup_conversion_tracking to send conversions to Meta, Google Ads, TikTok and GA4.

When it's done, afs_create_claim_link gives you a link to sign in with Google and see everything in a dashboard. AgentFirstStack has no feature flags, experiments or surveys.

Side by side

PostHog MCPAgentFirstStack
Endpointmcp.posthog.com/mcpagentfirststack.com/mcp
Agent authOAuth login in a browser; a personal API key as fallbackAn API key from POST /v1/signup; OAuth 2.1 for chat apps
New accountSign up, or the wizard's --signup with an email; password set from a welcome emailOne POST, no email; you claim it later with Google sign-in
Create a project over MCPYes, project-createYes: sites, tag containers, inboxes, replay sites
Feature flags, experiments, surveysYesNo
SQLexecute-sqlanalytics_query_sql, read-only, per site
Session replayYesYes, read as text transcripts
Read-only accessA read-only headerA key with read scope
CostMCP free to connect; usage billed as usualFree hosted service with fair-use limits; MIT to self-host

When to choose which

Use PostHog if

  • You need feature flags, experiments, surveys or error tracking.
  • You ship mobile or back-end apps; the wizard lists Android, Swift, Flutter, Django, Rails and more.
  • Your team already works in PostHog.

Use AgentFirstStack if

  • The agent should set everything up with no person's email or login.
  • You mostly need website traffic: sources, channels (including AI assistants), UTM tags, goals, funnels and revenue from Stripe or any provider.
  • You also want ad conversions sent server-side with one event id per conversion (how that works), or inboxes for signing up to services.
  • You want to self-host the whole thing on Cloudflare Workers.

FAQ

Is the PostHog MCP server official?

Yes. PostHog hosts it at mcp.posthog.com/mcp and documents setup for Claude Code, Cursor, VS Code, Codex and other clients.

Can an agent create a PostHog account by itself?

The wizard's --signup flag creates an account tied to an email address you give it, plus a project. You set the password from the welcome email. AgentFirstStack needs no email: the key is the account, and you claim it later with Google sign-in.

Can PostHog and AgentFirstStack run on the same site?

Yes. They're separate scripts with separate data, so you can try one without removing the other.

Does AgentFirstStack have feature flags or experiments?

No. It covers web analytics, tag management with server-side conversion tracking, email inboxes and session replay. Use PostHog for flags and experiments.

Product names belong to their owners. AgentFirstStack isn't affiliated with PostHog.