MCP: experiment-results-get response too large due to step_sessions data
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 39.9k
- Forks
- 3.4k
- Avg merge
- 6h 51m
- Merged PRs (30d)
- 232
Description
Problem
The experiment-results-get MCP tool (via mcp.posthog.com) returns responses that are 80K+ characters, making it unusable for LLM-based MCP clients. The response gets truncated before the statistical summaries (probability, credible_intervals, significant) appear.
The root cause is that the raw API response includes step_sessions arrays inside each metric's variant data. These arrays contain individual user-level session records (event_uuid, person_id, session_id, timestamp) — thousands of rows per funnel step, per variant, per metric.
For an experiment with 7 funnel metrics, the step_sessions data for just one metric's control baseline consumes ~75K characters. The actual stats that MCP consumers need (probability, credible intervals, significance) appear after all the session data and are always truncated.
Example
Metric 0 baseline data starts with useful info:
baseline:
key: control
number_of_samples: 8945
step_counts[6]: 1970,155,101,66,41,20
step_sessions[7]: <-- 75K+ of session data starts here
- [100]:
- event_uuid: 019c7179-...
person_id: f89116cb-...
timestamp: "2026-02-18 07:58:30.522000"
... (thousands more rows)
The statistical summaries (probability, credible_intervals, significant) come after ALL metrics' session data, so they never make it through.
Suggested fix
Strip step_sessions from the experiment-results-get MCP response before returning it to the client. These session-level records are useful for PostHog's UI ("View recordings" links) but not for programmatic/MCP consumers.
Alternatively, add an optional parameter like include_sessions: false (defaulting to false).
The fields MCP consumers actually need are:
step_counts(funnel counts per step)number_of_samples(exposure count per variant)probability(chance to win)credible_intervals(confidence bounds)significant(boolean)expected_loss(if available)
Note: the PostHog/mcp repo is archived, so filing here instead.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the backend handler for the experiment-results-get MCP tool, using the tool name and mcp.posthog.com reference. Confirm where step_sessions enters the response and check the relevant experiment or MCP tests, if available; done means session records no longer make the response unusably large while the listed statistical fields remain available.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100