Connectors

PostHog

Let Lyna AI query your PostHog analytics, manage feature flags and experiments, and triage errors while it builds.

Connect your PostHog account so Lyna AI can read how people really use your app, ship a feature flag, and look into the errors they hit.

What it lets you do

  • Run analytics queries, including SQL.
  • Create and manage feature flags and experiments.
  • Rank errors by how often they happen and how many people they affect.
  • Read the stack trace and details of an error, and suggest a code change.
  • Change the status of an issue and create an assignment rule.
  • Reuse the metric definitions of your PostHog project.
ItemDetail
What it asks forA sign-in on PostHog's page.
Who pays the providerYou. Connecting and calling tools is free, but tools that use AI inside PostHog may be billed as PostHog AI spend.
Do actions change real data?Yes. It reads and writes across PostHog: a flag or an issue status changes for real.
Where it runsOn PostHog's servers.
Who uses itLyna AI while it builds, in Build mode. Your published app can use it too: Use a connector in your app.

What you need before you start

  • A PostHog account and a project in the organization you want to use.
  • For the tools that use AI inside PostHog: AI data processing turned on in your organization settings.
  • Edit access to your Lyna project.

Permissions in PostHog

One connection signs in as one account, with one active organization and one active project. PostHog gives you three ways to narrow it: a read-only mode, a pinned project and a filtered tool list, all set on the address (see Ways to connect). Inside PostHog, access levels apply to your account.

TaskWhat you need
Read a resource such as a flag or a dashboardViewer on it
Change that resourceEditor on it
Work in a project with restricted accessMember or Admin on that project
Remove every tool that creates, updates or deletesThe address with readonly=true
Use the AI toolsAI data processing on for your organization

Access controls come with the Boost, Scale and Enterprise plans. The Free and Pay-as-you-go plans do not offer them. See PostHog's access control.

Ways to connect

On the connector's page. A sign-in on PostHog's own page. Lyna stores it encrypted. Only the owner can sign in again.

Who owns the account? The person who signed in. Every call goes out as that person's PostHog account, whoever typed the request.

Who can use it? Only you, in the projects you link it to, until you change it. On the connector's page, Who can use it also offers Only this project and The whole workspace. See Who can use a connection.

A read-only address. In Connectors, choose Add custom, then Custom server. Give it a name, paste https://mcp.posthog.com/mcp?readonly=true in Server address, keep Sign in under How it signs in, and choose Add and test. The tools that create, update or delete go away.

One project. Add &project_id=YOUR_PROJECT_ID to that address. PostHog warns that switching projects by hand can send a write to the wrong one.

Only some tools. Add &features=flags,insights to that address.

Set it up

  1. Open the connector

    Open the + menu of the chat and choose Connectors. Find PostHog with the search field or under Analytics, then open its page.

  2. Connect

    Choose Connect. The New connection page opens and reads "Sign in with your PostHog account to connect." Choose Connect at the bottom of the page. Sharing, just above, sets who can use it.

  3. Sign in

    A new window opens on PostHog's own page. If your browser blocks the window, the page goes to the sign-in in the same tab and brings you back after. Sign in and approve the access. PostHog routes you to the US or EU data region from your login, with nothing to choose.

  4. Read the result

    The page tests the connection and shows the result. Connected means Lyna can use it.

This connector shows no field to fill in: everything you give, you give on PostHog's own page.

Check it works

After you choose Connect, the page tests the connection and shows the result. Run it again at any time with Test connection. Connected proves that PostHog's server answered, accepted your sign-in and listed its tools. A pass does not prove access to every piece of data. One connection signs in as one account, with one active organization and one active project.

To check for real, ask for something you know exists:

  • "Which PostHog project am I connected to? List its 3 most used events."

What to ask Lyna AI

Type these in the chat, in Build mode, and adjust the names to yours. Once it is connected, Use PostHog on its page starts a message for you.

What you build or doWhat to typeWhat happens
Fix what hurts most"What are the top 5 errors in my project this week? Fix the first one in the code."Lyna AI ranks the errors, reads the stack trace and changes the code.
Read a funnel"How many people finished the sign-up funnel last week, and where do they drop out?"It runs the query and answers in the chat.
Ship behind a flag"Create a feature flag for the new checkout at 10% of users, and use it in the app."After your approval, the flag exists and the code reads it.
Reuse your metrics"Build a dashboard page from the metric definitions of my PostHog project."It reads the definitions and builds the page.
Run a SQL question"Run a SQL query for daily sign-ups over the last 30 days and chart the result."It runs the query and builds a chart in your project.
Close the loop on an issue"Mark the checkout error as resolved."After your approval, the status changes in PostHog.
Start an experiment"Create an experiment on the pricing page with two variants."After your approval, the experiment exists in your project.

Approvals and tool switches

Before a call, Lyna AI shows the tool and what it asks. You choose Deny, Allow once, Always allow this tool or Always allow this connector. A tool its server marks as read-only does not ask. A changed or new tool asks again, and Ask again on the connector's page takes a choice back.

Under What Lyna AI can use, each tool has a switch. Lyna AI stops using a tool you turn off, in your chats in this project.

Stay safe

What a connector answers reaches the AI as data, never as instructions. Read each approval before you accept it.

Limits

  • PostHog's AI tools only work when AI data processing is on for your organization.
  • Accounts in different regions need separate connections.
  • See PostHog MCP and its FAQ.
  • Connector tools run in Build mode. Plan and Ask do not run them.

Troubleshooting

What you seeWhat it means and what to do
Needs sign-inYour sign-in ended, or you revoked it at PostHog. Choose Connect and sign in again.
The sign-in window does not openYour browser blocked it, so the page goes to the sign-in in the same tab. If nothing happens, allow pop-ups for Lyna and choose Connect again.
No answer from the sign-in window yetIf the window is still open, finish there. If you closed it, choose Connect again.
The sign-in was cancelled.You closed or declined PostHog's page. Choose Connect and approve the access.
The service refused the sign-in.Check that you used the right account and that your organization allows this access, then choose Connect.
The sign-in took too long. Start it again.Choose Connect and sign in again.
The sign-in worked, but the server did not answer.Choose Test connection.
Not tested yetNo test has answered. Choose Test connection.
Connection failedThe page says why next to it. If the server did not answer, choose Test connection.
A call fails with a permission errorConnected does not prove access to every piece of data. PostHog refused the call with the rights of the account you connected. Check Permissions in PostHog above, then try again.
New tools to reviewThe server changed its list of tools, so Lyna stops using it until you decide. Read the list, then choose Approve new tools.
Turned offLyna AI does not use it. Choose Turn on.
It needs a new sign-in. Only the person who connected it can give one.Someone else connected it, and that sign-in ended. Ask that person to choose Connect.
The person who connected it left the workspaceThe connection holds no key or sign-in. Choose Connect to use it again.
A tool says AI is not availableTurn on AI data processing in your PostHog organization settings.
You see the wrong projectAsk Lyna to switch project, or pin the project as above.

Disconnect

Turn off stops Lyna from using the connector and keeps your settings. Remove from this project, under More options, takes it out of this project only, and shows when another project uses it. Delete connection, in the same menu, removes it from every project, with what it stored, and says first how many projects lose it. If PostHog lists Lyna among the authorized applications of your account, you can remove it there too.

Need help?

Ask the team, read what changed, or learn from the blog.