:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
CLI mode commands
In CLI mode, the default for most clients, the MCP server registers a single exec tool instead of one tool per endpoint. Agents pass it CLI-style command strings to list, search, inspect, and call the tools above on demand, which keeps context usage small.
help [command] — list commands or show usage for one command
learn <topic...> - load one or more learning topics
tools — list available tool names
search <words or regex_pattern> — find tools by name, title, or description
info [--json] <tool_name> — show tool name, description, and input schema (summarized if too large). Pass `--json` for raw JSON output.
schema <tool_name> [field_path] — drill into a specific field schema (supports dot-notation, e.g. series, breakdownFilter.breakdowns)
call [--json] [--confirm] <tool_name> [json_input] — call a tool with JSON input (--json returns JSON instead of optimized output in supported tools. Informational responses remain tagged and escaped in both MCP and the agent CLI. --confirm is required by the CLI for destructive tools.)
One command per request. exec has no batch syntax. A request that stacks several commands on separate lines is rejected before any of them run. To run several commands, send several exec calls. You can issue them in parallel.
Namespaced references (posthog:<tool-name>): strip the posthog: prefix and route through exec. Run info <name> to inspect, then call <name> <json>. E.g. posthog:insights-list → posthog:exec({ "command": "info insights-list" }) then posthog:exec({ "command": "call insights-list {}" }). If the bare name isn't found, fall back to search <pattern> — it may have been renamed.
The learn command is only registered on hosts that use the guided help catalog (currently Claude web and desktop). On hosts that support MCP apps, CLI mode also registers a separate render-ui tool for rendering interactive visualizations.
How agents use these commands
# 1. Find unknown tools
posthog:exec({ "command": "search <regex>" })
posthog:exec({ "command": "tools" }) # fallback: list all
# 2. Inspect once if the schema is missing
posthog:exec({ "command": "info <tool_name>" })
# 3. Drill into complex fields — REQUIRED for any field with a `hint`
posthog:exec({ "command": "schema <tool_name> <field_path>" })
# 4. Call; reuse the schema
posthog:exec({ "command": "call <tool_name> <json_input>" })
posthog:exec({ "command": "call --json <tool_name> <json_input>" })
Tips
- Run
info <tool_name>once when a schema isn't already in context, then reuse it. Running it before every call wastes context, and guessing a schema instead fails the call. - When
inforeturns fields carrying ahint, drill into each one withschema <tool_name> <field_path>before building that field's value. searchmatches tool names, titles, and descriptions, not input schemas. Search for the tool, then inspect its schema.