PostHog MCP serverand Python AI tasks
qbash hosts a PostHog MCP server you can use in Claude, ChatGPT, Codex, Cursor, Grok Bot and Muse. Developers use qbash Tasks to write cloud-hosted Python functions that pair PostHog with models such as Claude and GPT.
Add the qbash MCP
Use PostHog from Claude Code, Codex, Cursor and other MCP clients. Connect PostHog in qbash, and your agent can work with its data and build Tasks that call it.
claude mcp add --transport http qbash https://mcp.qbash.com/mcp
Then run /mcp in Claude Code and sign in with qbash.
- List organizations accessible to the selected key
- List projects in an organization
- Read a project in an organization
- List insights in a project
- Read one insight
- Create one insight
Write a PostHog task in Python
A qbash Task is a Python function hosted in the cloud. Python is the runtime and defines the process, and built-in inline prompts run on leading models such as Claude, GPT, Gemini and Grok.
Run a Task on a schedule, from an HTTP request or when a connected app sends an event. Your agents and chat tools call it over MCP.
Each run is logged with its inputs and results, and you can turn data logging off for any Task. Every Task has version control, and each run is locked to the version it ran.
Review saved insight definitions
List a page of saved insights and ask a prompt to identify gaps in the definitions.
page = qbash.integrations.posthog.list_insights(project_id="123", limit=25)
if page["items"]:
result = qbash.ai.run_prompt(slug="review-posthog-insights", variables={"insights": page["items"]})
qbash.output(result)
else:
qbash.output("No saved insights were returned.")
Sample list_insights response
{
"items": [
{
"id": 42,
"name": "Weekly active users",
"description": "Weekly unique users"
}
],
"next_cursor": null
}
Custom MCP server
Build a custom MCP server with PostHog
Create a hosted MCP server that combines PostHog tools with your other connectors, Tasks and memory folders. You choose each tool it exposes, so a server can share PostHog reads with write tools left off.
Share the server with your team, and each person adds it to the client they already use.
How to set it up
- Connect PostHog on the qbash Connectors page.
- Create an MCP server and add the PostHog tools you want to share.
- Paste the server URL into your client. It connects with OAuth or an access token.
PostHog MCP questions
Does this use the official PostHog MCP server?
No. qbash calls the REST API through native Task methods. The official MCP tools informed the scope. Query execution and bulk exports are not included.
Related analytics connectors
Build a PostHog task
Write it in Python with AI steps, or describe it to your coding agent through the qbash MCP.