Skip to content

: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.

feat(review_hog): expose review trigger/status/detail as MCP tools (#72917)

Dawid Karasiewicz30fbff22c695
diff --git a/frontend/src/layout/navigation-3000/sidepanel/panels/access_control/ResourceAccessControlsV2/accessControlsLogic.ts b/frontend/src/layout/navigation-3000/sidepanel/panels/access_control/ResourceAccessControlsV2/accessControlsLogic.ts
index 719fcd60833f..9201e6958d8c 100644
--- a/frontend/src/layout/navigation-3000/sidepanel/panels/access_control/ResourceAccessControlsV2/accessControlsLogic.ts
+++ b/frontend/src/layout/navigation-3000/sidepanel/panels/access_control/ResourceAccessControlsV2/accessControlsLogic.ts
@@ -384,6 +384,7 @@ export interface accessControlsLogicActions {
| 'query_performance'
| 'replay_scanner'
| 'revenue_analytics'
+ | 'review_hog'
| 'session_recording'
| 'session_recording_playlist'
| 'sharing_configuration'
@@ -520,6 +521,7 @@ export interface accessControlsLogicMeta {
| 'query_performance'
| 'replay_scanner'
| 'revenue_analytics'
+ | 'review_hog'
| 'session_recording'
| 'session_recording_playlist'
| 'sharing_configuration'
@@ -660,6 +662,7 @@ export interface accessControlsLogicMeta {
| 'query_performance'
| 'replay_scanner'
| 'revenue_analytics'
+ | 'review_hog'
| 'session_recording'
| 'session_recording_playlist'
| 'sharing_configuration'
@@ -773,6 +776,7 @@ export interface accessControlsLogicMeta {
| 'query_performance'
| 'replay_scanner'
| 'revenue_analytics'
+ | 'review_hog'
| 'session_recording'
| 'session_recording_playlist'
| 'sharing_configuration'
diff --git a/frontend/src/layout/navigation-3000/sidepanel/panels/access_control/ResourceAccessControlsV2/groupedAccessControlRuleModalLogic.ts b/frontend/src/layout/navigation-3000/sidepanel/panels/access_control/ResourceAccessControlsV2/groupedAccessControlRuleModalLogic.ts
index 9a4e5e15fac0..19e5b5f9e6f0 100644
--- a/frontend/src/layout/navigation-3000/sidepanel/panels/access_control/ResourceAccessControlsV2/groupedAccessControlRuleModalLogic.ts
+++ b/frontend/src/layout/navigation-3000/sidepanel/panels/access_control/ResourceAccessControlsV2/groupedAccessControlRuleModalLogic.ts
@@ -105,6 +105,7 @@ export interface groupedAccessControlRuleModalLogicValues {
| 'query_performance'
| 'replay_scanner'
| 'revenue_analytics'
+ | 'review_hog'
| 'session_recording'
| 'session_recording_playlist'
| 'sharing_configuration'
@@ -222,6 +223,7 @@ export interface groupedAccessControlRuleModalLogicValues {
| 'query_performance'
| 'replay_scanner'
| 'revenue_analytics'
+ | 'review_hog'
| 'session_recording'
| 'session_recording_playlist'
| 'sharing_configuration'
@@ -331,6 +333,7 @@ export interface groupedAccessControlRuleModalLogicValues {
| 'query_performance'
| 'replay_scanner'
| 'revenue_analytics'
+ | 'review_hog'
| 'session_recording'
| 'session_recording_playlist'
| 'sharing_configuration'
@@ -453,6 +456,7 @@ export interface groupedAccessControlRuleModalLogicValues {
| 'query_performance'
| 'replay_scanner'
| 'revenue_analytics'
+ | 'review_hog'
| 'session_recording'
| 'session_recording_playlist'
| 'sharing_configuration'
@@ -575,6 +579,7 @@ export interface groupedAccessControlRuleModalLogicActions {
| 'query_performance'
| 'replay_scanner'
| 'revenue_analytics'
+ | 'review_hog'
| 'session_recording'
| 'session_recording_playlist'
| 'sharing_configuration'
@@ -704,6 +709,7 @@ export interface groupedAccessControlRuleModalLogicActions {
| 'query_performance'
| 'replay_scanner'
| 'revenue_analytics'
+ | 'review_hog'
| 'session_recording'
| 'session_recording_playlist'
| 'sharing_configuration'
@@ -813,6 +819,7 @@ export interface groupedAccessControlRuleModalLogicActions {
| 'query_performance'
| 'replay_scanner'
| 'revenue_analytics'
+ | 'review_hog'
| 'session_recording'
| 'session_recording_playlist'
| 'sharing_configuration'
@@ -961,6 +968,7 @@ export interface groupedAccessControlRuleModalLogicMeta {
| 'query_performance'
| 'replay_scanner'
| 'revenue_analytics'
+ | 'review_hog'
| 'session_recording'
| 'session_recording_playlist'
| 'sharing_configuration'
@@ -1072,6 +1080,7 @@ export interface groupedAccessControlRuleModalLogicMeta {
| 'query_performance'
| 'replay_scanner'
| 'revenue_analytics'
+ | 'review_hog'
| 'session_recording'
| 'session_recording_playlist'
| 'sharing_configuration'
@@ -1182,6 +1191,7 @@ export interface groupedAccessControlRuleModalLogicMeta {
| 'query_performance'
| 'replay_scanner'
| 'revenue_analytics'
+ | 'review_hog'
| 'session_recording'
| 'session_recording_playlist'
| 'sharing_configuration'
@@ -1292,6 +1302,7 @@ export interface groupedAccessControlRuleModalLogicMeta {
| 'query_performance'
| 'replay_scanner'
| 'revenue_analytics'
+ | 'review_hog'
| 'session_recording'
| 'session_recording_playlist'
| 'sharing_configuration'
@@ -1403,6 +1414,7 @@ export interface groupedAccessControlRuleModalLogicMeta {
| 'query_performance'
| 'replay_scanner'
| 'revenue_analytics'
+ | 'review_hog'
| 'session_recording'
| 'session_recording_playlist'
| 'sharing_configuration'
@@ -1513,6 +1525,7 @@ export interface groupedAccessControlRuleModalLogicMeta {
| 'query_performance'
| 'replay_scanner'
| 'revenue_analytics'
+ | 'review_hog'
| 'session_recording'
| 'session_recording_playlist'
| 'sharing_configuration'
@@ -1634,6 +1647,7 @@ export interface groupedAccessControlRuleModalLogicMeta {
| 'query_performance'
| 'replay_scanner'
| 'revenue_analytics'
+ | 'review_hog'
| 'session_recording'
| 'session_recording_playlist'
| 'sharing_configuration'
@@ -1744,6 +1758,7 @@ export interface groupedAccessControlRuleModalLogicMeta {
| 'query_performance'
| 'replay_scanner'
| 'revenue_analytics'
+ | 'review_hog'
| 'session_recording'
| 'session_recording_playlist'
| 'sharing_configuration'
diff --git a/frontend/src/layout/navigation-3000/sidepanel/panels/access_control/accessControlLogic.ts b/frontend/src/layout/navigation-3000/sidepanel/panels/access_control/accessControlLogic.ts
index 6163d613a331..188dd5ebd568 100644
--- a/frontend/src/layout/navigation-3000/sidepanel/panels/access_control/accessControlLogic.ts
+++ b/frontend/src/layout/navigation-3000/sidepanel/panels/access_control/accessControlLogic.ts
@@ -136,6 +136,7 @@ export interface accessControlLogicValues {
| 'query_performance'
| 'replay_scanner'
| 'revenue_analytics'
+ | 'review_hog'
| 'session_recording'
| 'session_recording_playlist'
| 'sharing_configuration'
@@ -379,6 +380,7 @@ export interface accessControlLogicMeta {
| 'query_performance'
| 'replay_scanner'
| 'revenue_analytics'
+ | 'review_hog'
| 'session_recording'
| 'session_recording_playlist'
| 'sharing_configuration'
@@ -483,6 +485,7 @@ export interface accessControlLogicMeta {
| 'query_performance'
| 'replay_scanner'
| 'revenue_analytics'
+ | 'review_hog'
| 'session_recording'
| 'session_recording_playlist'
| 'sharing_configuration'
@@ -590,6 +593,7 @@ export interface accessControlLogicMeta {
| 'query_performance'
| 'replay_scanner'
| 'revenue_analytics'
+ | 'review_hog'
| 'session_recording'
| 'session_recording_playlist'
| 'sharing_configuration'
@@ -700,6 +704,7 @@ export interface accessControlLogicMeta {
| 'query_performance'
| 'replay_scanner'
| 'revenue_analytics'
+ | 'review_hog'
| 'session_recording'
| 'session_recording_playlist'
| 'sharing_configuration'
@@ -981,6 +986,7 @@ export const accessControlLogic = kea<accessControlLogicType>([
| 'query_performance'
| 'replay_scanner'
| 'revenue_analytics'
+ | 'review_hog'
| 'session_recording'
| 'session_recording_playlist'
| 'sharing_configuration'
@@ -1090,6 +1096,7 @@ export const accessControlLogic = kea<accessControlLogicType>([
| 'query_performance'
| 'replay_scanner'
| 'revenue_analytics'
+ | 'review_hog'
| 'session_recording'
| 'session_recording_playlist'
| 'sharing_configuration'
@@ -1213,6 +1220,7 @@ export const accessControlLogic = kea<accessControlLogicType>([
| 'query_performance'
| 'replay_scanner'
| 'revenue_analytics'
+ | 'review_hog'
| 'session_recording'
| 'session_recording_playlist'
| 'sharing_configuration'
diff --git a/frontend/src/lib/agentScopes.generated.ts b/frontend/src/lib/agentScopes.generated.ts
index 3b111e57a052..4124bbd17ebc 100644
--- a/frontend/src/lib/agentScopes.generated.ts
+++ b/frontend/src/lib/agentScopes.generated.ts
@@ -98,6 +98,8 @@ export const AGENT_USE_CASE_SCOPES = [
'query:read',
'replay_scanner:read',
'replay_scanner:write',
+ 'review_hog:read',
+ 'review_hog:write',
'session_recording:read',
'session_recording:write',
'session_recording_playlist:read',
diff --git a/frontend/src/lib/scopes.tsx b/frontend/src/lib/scopes.tsx
index 006bf8d5270f..575892edd9b3 100644
--- a/frontend/src/lib/scopes.tsx
+++ b/frontend/src/lib/scopes.tsx
@@ -205,6 +205,7 @@ export const API_SCOPES: APIScope[] = [
},
},
{ key: 'signal_scout', objectName: 'Signals agent', objectPlural: 'signals agents' },
+ { key: 'review_hog', objectName: 'ReviewHog', objectPlural: 'ReviewHog reviews' },
{ key: 'stamphog', objectName: 'Stamphog', objectPlural: 'stamphog' },
{ key: 'streamlit_app', objectName: 'Streamlit app', objectPlural: 'Streamlit apps' },
{ key: 'task', objectName: 'Task', objectPlural: 'tasks' },
diff --git a/frontend/src/types.ts b/frontend/src/types.ts
index 9abdf5bd8609..3db6893f49c7 100644
--- a/frontend/src/types.ts
+++ b/frontend/src/types.ts
@@ -5781,6 +5781,7 @@ export const API_SCOPE_OBJECTS = [
'query',
'query_performance',
'replay_scanner',
+ 'review_hog',
'revenue_analytics',
'session_recording',
'session_recording_playlist',
diff --git a/posthog/scopes.py b/posthog/scopes.py
index 6bbf705ef7ea..be69e0be65a2 100644
--- a/posthog/scopes.py
+++ b/posthog/scopes.py
@@ -92,6 +92,7 @@ APIScopeObject = Literal[
"query", # Covers query and events endpoints
"query_performance",
"replay_scanner",
+ "review_hog",
"revenue_analytics",
"session_recording",
"session_recording_playlist",
diff --git a/products/review_hog/ARCHITECTURE.md b/products/review_hog/ARCHITECTURE.md
index 2ab83dae45de..375c60a750af 100644
--- a/products/review_hog/ARCHITECTURE.md
+++ b/products/review_hog/ARCHITECTURE.md
@@ -467,11 +467,16 @@ See [DECISIONS.md](./DECISIONS.md) for the "reuse the leaf, own the model" bound
- **Prod label trigger** (settings, `posthog/settings/access.py`) — `REVIEWHOG_TRIGGER_TOKEN` (shared secret),
`REVIEWHOG_TEAM_ID` (the run team), `REVIEWHOG_RUN_USER_ID` (optional; falls back to the integration creator).
-**Triggers.** Four entry points drive the same `ReviewPRWorkflow`: the `run_review` CLI (manual / eval), the
+**Triggers.** Five entry points drive the same `ReviewPRWorkflow`: the `run_review` CLI (manual / eval), the
`reviewhog` **label** on a `PostHog/posthog` PR (a thin GitHub Action → `POST /api/review_hog/trigger`), a **UI**
-"Review this PR" field in the Code review scene (session-authed, any installation-accessible PR), and an **inbox**
-trigger (a `TaskRun` receiver auto-reviews self-driving Signals implementations). See [DECISIONS.md](./DECISIONS.md)
-for each trigger's auth / scope / identity rules.
+"Review this PR" field in the Code review scene (any installation-accessible PR), an **inbox** trigger (a
+`TaskRun` receiver auto-reviews self-driving Signals implementations), and **MCP tools**
+(`review-hog-reviews-{trigger,list,get}`, defined in `products/review_hog/mcp/tools.yaml` and gated on the
+`review-hog` feature flag) that drive the same reviews viewset with a personal API key or OAuth token. The UI and
+MCP paths are one surface: the viewset carries the grantable `review_hog` scope (`review_hog:read` for list /
+retrieve / perspective_stats, `review_hog:write` for trigger) rather than INTERNAL, and the trigger action keeps
+the `REVIEWHOG_TEAM_ID` dogfood gate and its synchronous URL / App-access / fork / open-state checks regardless of
+caller. See [DECISIONS.md](./DECISIONS.md) for each trigger's auth / scope / identity rules.
**Review surfaces (Code review scene).** The reviews API's `scope=mine` ("For you") matches reports where the
viewer is the **acting user OR the PR's author** — `author_login` compared case-insensitively against the
diff --git a/products/review_hog/DECISIONS.md b/products/review_hog/DECISIONS.md
index 7d6724a9d87b..1827c4049085 100644
--- a/products/review_hog/DECISIONS.md
+++ b/products/review_hog/DECISIONS.md
@@ -198,6 +198,29 @@ read `FINAL_REPORT.md` there first (config glossary + coverage matrix + ranking)
rate drops materially (toward ≤50%) on frozen-PR evals with the valid-finding set intact (item 5's
coverage matrix as the guard); kill if valid findings drop with the noise.
+### ✅ BUILT 2026-07-27 — reviews surface exposed as MCP tools (grantable `review_hog` scope)
+
+Agents needed to drive ReviewHog over MCP — kick off a review, poll progress, pull the finished findings
+([PR #72917](https://github.com/PostHog/posthog/pull/72917)). The capabilities already existed as the reviews
+viewset behind the Code review UI; the blocker was auth: the viewset was `scope_object = "INTERNAL"`
+(session-only), unreachable with the personal API key / OAuth token MCP authenticates with. Decisions:
+
+- **A grantable `review_hog` scope, not a widened INTERNAL.** The viewset moves to `scope_object = "review_hog"`
+ with `trigger` behind `review_hog:write` and `perspective_stats` behind `review_hog:read` (`list` / `retrieve`
+ map to `review_hog:read` by default). Session UI access is unchanged — this only adds token access. The scope
+ is mirrored across the standard lists (`posthog/scopes.py`, the frontend `API_SCOPE_OBJECTS` array + the PAK
+ modal in `scopes.tsx`, the generated agent / OAuth scope lists, the MCP guard lists).
+- **Three thin tools over the existing surface** (`products/review_hog/mcp/tools.yaml`):
+ `review-hog-reviews-trigger` (write), `review-hog-reviews-list` (status polling — running turns first with the
+ `progress` stage / counters), `review-hog-reviews-get` (validated + dismissed findings, published body). All
+ three are gated on the `review-hog` feature flag — the same flag that gates the Code review menu entry —
+ evaluated fail-closed at MCP init. The other scaffolded operations (settings, perspectives, validators, blind
+ spots, perspective stats) stay `enabled: false` until an agent job needs them.
+- **Identity + gates inherited, not widened:** an MCP-triggered review runs under the token's user — the same
+ "requester is both run user and acting user" rule as the UI trigger — and the trigger action keeps the
+ `REVIEWHOG_TEAM_ID` dogfood gate and its synchronous URL / App-access / fork / open-state checks regardless of
+ caller.
+
### ✅ BUILT 2026-07-21 — held-back reviews reach PR authors (deep links, authored-PRs scope, truthful drawer + comment)
Dogfooding surfaced a dead-end: a review triggered from the Code review scene runs under the **requester's**
diff --git a/products/review_hog/backend/api/reviews.py b/products/review_hog/backend/api/reviews.py
index 69b56a4d988f..2e819850752d 100644
--- a/products/review_hog/backend/api/reviews.py
+++ b/products/review_hog/backend/api/reviews.py
@@ -468,7 +468,10 @@ class ReviewRecentReviewsViewSet(TeamAndOrgViewSetMixin, viewsets.GenericViewSet
be opened.
"""
- scope_object = "INTERNAL"
+ # `review_hog` rather than INTERNAL so the reads and trigger the Code review UI drives are also
+ # reachable with a personal API key or OAuth token, which is how MCP tools authenticate. Session
+ # UI access is unchanged; this only adds token access, gated by review_hog:read / review_hog:write.
+ scope_object = "review_hog"
# Unscoped only to satisfy the router/introspection; every real query goes through `for_team`.
queryset = ReviewReport.objects.unscoped()
serializer_class = ReviewRecentReviewSerializer
@@ -587,7 +590,7 @@ class ReviewRecentReviewsViewSet(TeamAndOrgViewSetMixin, viewsets.GenericViewSet
"recent completed reviews in scope — the requesting user's by default, every review on this project "
"with `scope=everyone` — and how many of those the validator kept vs dismissed.",
)
- @action(methods=["GET"], detail=False)
+ @action(methods=["GET"], detail=False, required_scopes=["review_hog:read"])
def perspective_stats(self, request: Request, **kwargs) -> Response:
params = PerspectiveStatsParamsSerializer(data=request.query_params)
params.is_valid(raise_exception=True)
@@ -639,7 +642,7 @@ class ReviewRecentReviewsViewSet(TeamAndOrgViewSetMixin, viewsets.GenericViewSet
"Otherwise non-blocking: returns the Temporal workflow id immediately while the review runs in "
"the worker.",
)
- @action(methods=["POST"], detail=False)
+ @action(methods=["POST"], detail=False, required_scopes=["review_hog:write"])
def trigger(self, request: Request, **kwargs) -> Response:
team_id = resolve_effective_team_id(self.team_id)
# Dogfood gate: the UI trigger only runs on the designated ReviewHog team for now — reviews are
diff --git a/products/review_hog/backend/tests/test_reviews_api.py b/products/review_hog/backend/tests/test_reviews_api.py
index 374efc309117..5c9174435ca2 100644
--- a/products/review_hog/backend/tests/test_reviews_api.py
+++ b/products/review_hog/backend/tests/test_reviews_api.py
@@ -5,6 +5,7 @@ from posthog.test.base import APIBaseTest
from django.utils import timezone
+from parameterized import parameterized
from social_django.models import UserSocialAuth
from posthog.models import Team, User
@@ -185,6 +186,25 @@ class TestRecentReviewsAPI(APIBaseTest):
assert {r["pr_number"] for r in res.json()["results"]} == {1, 2}
assert self.client.get(self.url, {"scope": "nonsense"}).status_code == 400
+ @parameterized.expand(
+ [
+ ("review_hog_read_allowed", ["review_hog:read"], 200),
+ ("unrelated_scope_denied", ["insight:read"], 403),
+ ]
+ )
+ def test_list_api_key_scope_is_review_hog(self, _name: str, scopes: list[str], expected_status: int) -> None:
+ # The list/get/trigger endpoints carry the `review_hog` scope so the MCP tools reach them with a
+ # personal API key or OAuth token — a revert to INTERNAL would reject the read-scoped key here and
+ # take the MCP review tools down with it.
+ self._report(pr_number=1, acting_user=self.user)
+ api_key = self.create_personal_api_key_with_scopes(scopes)
+ self.client.logout()
+ self.client.credentials(HTTP_AUTHORIZATION=f"Bearer {api_key}")
+
+ res = self.client.get(self.url)
+
+ assert res.status_code == expected_status
+
def test_list_limit_grows_the_page_and_has_more_flags_the_rest(self) -> None:
# "Show more" grows `limit` instead of offset-paging. has_more must flip false exactly when
# the page covers everything (off-by-one here strands or dead-ends the button), and
diff --git a/products/review_hog/mcp/tools.yaml b/products/review_hog/mcp/tools.yaml
new file mode 100644
index 000000000000..75cc28376789
--- /dev/null
+++ b/products/review_hog/mcp/tools.yaml
@@ -0,0 +1,91 @@
+# MCP tool definition — tool entries are scaffolded from the OpenAPI schema.
+# The tool list and operation IDs are kept in sync automatically:
+# pnpm --filter=@posthog/mcp run scaffold-yaml -- --sync-all
+#
+# To enable a tool, set enabled: true and add required scopes + annotations.
+# All other fields (title, description, enrich_url, etc.) are yours to configure.
+category: ReviewHog
+feature: review_hog
+url_prefix: /code_review
+ui_apps: {}
+tools:
+ review-hog-blind-spots-list:
+ operation: review_hog_blind_spots_list
+ enabled: false
+ review-hog-blind-spots-partial-update:
+ operation: review_hog_blind_spots_partial_update
+ enabled: false
+ review-hog-perspectives-list:
+ operation: review_hog_perspectives_list
+ enabled: false
+ review-hog-perspectives-partial-update:
+ operation: review_hog_perspectives_partial_update
+ enabled: false
+ review-hog-reviews-get:
+ operation: review_hog_reviews_retrieve
+ enabled: true
+ scopes:
+ - review_hog:read
+ annotations:
+ readOnly: true
+ destructive: false
+ idempotent: true
+ title: Get a ReviewHog review
+ description: >
+ Fetch one completed ReviewHog review by `id` (from `review-hog-reviews-list`), including the latest turn's
+ validated `findings` (each with file, line ranges, priority, and the suggested fix), the
+ `dismissed_findings` the validator dropped and why, and the `report_markdown` published to the PR. A first
+ review still in flight has no detail yet — poll `review-hog-reviews-list` until it completes.
+ feature_flag: review-hog
+ review-hog-reviews-list:
+ operation: review_hog_reviews_list
+ enabled: true
+ scopes:
+ - review_hog:read
+ annotations:
+ readOnly: true
+ destructive: false
+ idempotent: true
+ list: true
+ title: List ReviewHog reviews
+ description: >
+ List recent ReviewHog reviews on this project — use it to poll a review's status. Running reviews come
+ first, each with `in_progress: true` and a `progress` object (the in-flight turn's `review_stage` plus
+ `done`/`total` counters); completed reviews follow, newest first, with their finding counts by priority
+ (`must_fix_count`, `should_fix_count`, `consider_count`) and whether they were `published`. Each row's `id`
+ opens the full review via `review-hog-reviews-get`. Defaults to the requesting user's reviews; pass
+ `scope=everyone` for every review on the project, and `limit` to widen the page.
+ feature_flag: review-hog
+ review-hog-reviews-perspective-stats-retrieve:
+ operation: review_hog_reviews_perspective_stats_retrieve
+ enabled: false
+ review-hog-reviews-trigger:
+ operation: review_hog_reviews_trigger_create
+ enabled: true
+ scopes:
+ - review_hog:write
+ annotations:
+ readOnly: false
+ destructive: false
+ idempotent: false
+ title: Trigger a ReviewHog review
+ description: >
+ Start a ReviewHog review of a pull request and publish it back to the PR. Pass the PR as `pr_url` (e.g.
+ `https://github.com/PostHog/posthog/pull/123`); the repository must be accessible to the project's GitHub
+ App installation. Non-blocking: returns a `workflow_id` and `status` of `started` while the review runs. If
+ the PR's current commit already has a published review it returns `already_reviewed` without starting a run,
+ and triggering a PR whose review is already running joins the in-flight run. Poll progress with
+ `review-hog-reviews-list` and read the finished findings with `review-hog-reviews-get`.
+ feature_flag: review-hog
+ review-hog-settings-partial-update:
+ operation: review_hog_settings_partial_update
+ enabled: false
+ review-hog-settings-retrieve:
+ operation: review_hog_settings_retrieve
+ enabled: false
+ review-hog-validators-list:
+ operation: review_hog_validators_list
+ enabled: false
+ review-hog-validators-partial-update:
+ operation: review_hog_validators_partial_update
+ enabled: false
diff --git a/services/mcp/schema/generated-tool-definitions.json b/services/mcp/schema/generated-tool-definitions.json
index 381cf4e94894..0bd56105be8b 100644
--- a/services/mcp/schema/generated-tool-definitions.json
+++ b/services/mcp/schema/generated-tool-definitions.json
@@ -7238,6 +7238,51 @@
"readOnlyHint": true
}
},
+ "review-hog-reviews-get": {
+ "description": "Fetch one completed ReviewHog review by `id` (from `review-hog-reviews-list`), including the latest turn's validated `findings` (each with file, line ranges, priority, and the suggested fix), the `dismissed_findings` the validator dropped and why, and the `report_markdown` published to the PR. A first review still in flight has no detail yet — poll `review-hog-reviews-list` until it completes.",
+ "category": "ReviewHog",
+ "feature": "review_hog",
+ "summary": "Get a ReviewHog review",
+ "title": "Get a ReviewHog review",
+ "required_scopes": ["review_hog:read"],
+ "annotations": {
+ "destructiveHint": false,
+ "idempotentHint": true,
+ "openWorldHint": true,
+ "readOnlyHint": true
+ },
+ "feature_flag": "review-hog"
+ },
+ "review-hog-reviews-list": {
+ "description": "List recent ReviewHog reviews on this project — use it to poll a review's status. Running reviews come first, each with `in_progress: true` and a `progress` object (the in-flight turn's `review_stage` plus `done`/`total` counters); completed reviews follow, newest first, with their finding counts by priority (`must_fix_count`, `should_fix_count`, `consider_count`) and whether they were `published`. Each row's `id` opens the full review via `review-hog-reviews-get`. Defaults to the requesting user's reviews; pass `scope=everyone` for every review on the project, and `limit` to widen the page.",
+ "category": "ReviewHog",
+ "feature": "review_hog",
+ "summary": "List ReviewHog reviews",
+ "title": "List ReviewHog reviews",
+ "required_scopes": ["review_hog:read"],
+ "annotations": {
+ "destructiveHint": false,
+ "idempotentHint": true,
+ "openWorldHint": true,
+ "readOnlyHint": true
+ },
+ "feature_flag": "review-hog"
+ },
+ "review-hog-reviews-trigger": {
+ "description": "Start a ReviewHog review of a pull request and publish it back to the PR. Pass the PR as `pr_url` (e.g. `https://github.com/PostHog/posthog/pull/123`); the repository must be accessible to the project's GitHub App installation. Non-blocking: returns a `workflow_id` and `status` of `started` while the review runs. If the PR's current commit already has a published review it returns `already_reviewed` without starting a run, and triggering a PR whose review is already running joins the in-flight run. Poll progress with `review-hog-reviews-list` and read the finished findings with `review-hog-reviews-get`.",
+ "category": "ReviewHog",
+ "feature": "review_hog",
+ "summary": "Trigger a ReviewHog review",
+ "title": "Trigger a ReviewHog review",
+ "required_scopes": ["review_hog:write"],
+ "annotations": {
+ "destructiveHint": false,
+ "idempotentHint": false,
+ "openWorldHint": true,
+ "readOnlyHint": false
+ },
+ "feature_flag": "review-hog"
+ },
"role-get": {
"description": "Get details of a specific role including its name, creation date, and creator.",
"category": "Platform Features",
diff --git a/services/mcp/schema/tool-definitions-all.json b/services/mcp/schema/tool-definitions-all.json
index 34affcc4df67..71c3544fc230 100644
--- a/services/mcp/schema/tool-definitions-all.json
+++ b/services/mcp/schema/tool-definitions-all.json
@@ -7773,6 +7773,51 @@
"readOnlyHint": true
}
},
+ "review-hog-reviews-get": {
+ "description": "Fetch one completed ReviewHog review by `id` (from `review-hog-reviews-list`), including the latest turn's validated `findings` (each with file, line ranges, priority, and the suggested fix), the `dismissed_findings` the validator dropped and why, and the `report_markdown` published to the PR. A first review still in flight has no detail yet — poll `review-hog-reviews-list` until it completes.",
+ "category": "ReviewHog",
+ "feature": "review_hog",
+ "summary": "Get a ReviewHog review",
+ "title": "Get a ReviewHog review",
+ "required_scopes": ["review_hog:read"],
+ "annotations": {
+ "destructiveHint": false,
+ "idempotentHint": true,
+ "openWorldHint": true,
+ "readOnlyHint": true
+ },
+ "feature_flag": "review-hog"
+ },
+ "review-hog-reviews-list": {
+ "description": "List recent ReviewHog reviews on this project — use it to poll a review's status. Running reviews come first, each with `in_progress: true` and a `progress` object (the in-flight turn's `review_stage` plus `done`/`total` counters); completed reviews follow, newest first, with their finding counts by priority (`must_fix_count`, `should_fix_count`, `consider_count`) and whether they were `published`. Each row's `id` opens the full review via `review-hog-reviews-get`. Defaults to the requesting user's reviews; pass `scope=everyone` for every review on the project, and `limit` to widen the page.",
+ "category": "ReviewHog",
+ "feature": "review_hog",
+ "summary": "List ReviewHog reviews",
+ "title": "List ReviewHog reviews",
+ "required_scopes": ["review_hog:read"],
+ "annotations": {
+ "destructiveHint": false,
+ "idempotentHint": true,
+ "openWorldHint": true,
+ "readOnlyHint": true
+ },
+ "feature_flag": "review-hog"
+ },
+ "review-hog-reviews-trigger": {
+ "description": "Start a ReviewHog review of a pull request and publish it back to the PR. Pass the PR as `pr_url` (e.g. `https://github.com/PostHog/posthog/pull/123`); the repository must be accessible to the project's GitHub App installation. Non-blocking: returns a `workflow_id` and `status` of `started` while the review runs. If the PR's current commit already has a published review it returns `already_reviewed` without starting a run, and triggering a PR whose review is already running joins the in-flight run. Poll progress with `review-hog-reviews-list` and read the finished findings with `review-hog-reviews-get`.",
+ "category": "ReviewHog",
+ "feature": "review_hog",
+ "summary": "Trigger a ReviewHog review",
+ "title": "Trigger a ReviewHog review",
+ "required_scopes": ["review_hog:write"],
+ "annotations": {
+ "destructiveHint": false,
+ "idempotentHint": false,
+ "openWorldHint": true,
+ "readOnlyHint": false
+ },
+ "feature_flag": "review-hog"
+ },
"role-get": {
"description": "Get details of a specific role including its name, creation date, and creator.",
"category": "Platform Features",
diff --git a/services/mcp/src/generated/review_hog/api.ts b/services/mcp/src/generated/review_hog/api.ts
new file mode 100644
index 000000000000..64fe3b6e750c
--- /dev/null
+++ b/services/mcp/src/generated/review_hog/api.ts
@@ -0,0 +1,76 @@
+/**
+ * Auto-generated from the Django backend OpenAPI schema.
+ * MCP service uses these Zod schemas for generated tool handlers.
+ * To regenerate: hogli build:openapi
+ *
+ * PostHog API - MCP 3 enabled ops
+ * OpenAPI spec version: 1.0.0
+ */
+import * as zod from 'zod'
+
+/**
+ * Recent ReviewHog reviews on this project: actively running reviews first (with the in-flight turn's stage), then the most recent completed ones — at most `limit` rows (default 5), plus `has_more` for whether a larger `limit` would reveal more. By default only the requesting user's reviews; `scope=everyone` lists every review on the project.
+ * @summary List recent reviews
+ */
+export const ReviewHogReviewsListParams = /* @__PURE__ */ zod.object({
+ project_id: zod
+ .string()
+ .describe(
+ "Project ID of the project you're trying to access. To find the ID of the project, make a call to \/api\/projects\/."
+ ),
+})
+
+export const reviewHogReviewsListQueryLimitDefault = 5
+export const reviewHogReviewsListQueryLimitMax = 100
+
+export const reviewHogReviewsListQueryScopeDefault = `mine`
+
+export const ReviewHogReviewsListQueryParams = /* @__PURE__ */ zod.object({
+ limit: zod
+ .number()
+ .min(1)
+ .max(reviewHogReviewsListQueryLimitMax)
+ .default(reviewHogReviewsListQueryLimitDefault)
+ .describe(
+ 'Maximum rows to return. The list grows this instead of paging by offset — in-progress rows reorder the list between refreshes, so offset pages would shift under the reader.'
+ ),
+ scope: zod
+ .enum(['mine', 'everyone'])
+ .default(reviewHogReviewsListQueryScopeDefault)
+ .describe(
+ 'Whose reviews to list: `mine` (the default) for reviews the requesting user ran plus reviews of pull requests they authored (matched via their linked GitHub login), `everyone` for every review on this project.\n\n\* `mine` - mine\n\* `everyone` - everyone'
+ ),
+})
+
+/**
+ * One completed ReviewHog review on this project, with the latest turn's validated findings, the findings the validator dismissed (and why), and the review body published to GitHub. Project-wide, so reviews listed under `scope=everyone` can be opened too.
+ * @summary Retrieve one review's detail
+ */
+export const ReviewHogReviewsRetrieveParams = /* @__PURE__ */ zod.object({
+ id: zod.string().describe('A UUID string identifying this review report.'),
+ project_id: zod
+ .string()
+ .describe(
+ "Project ID of the project you're trying to access. To find the ID of the project, make a call to \/api\/projects\/."
+ ),
+})
+
+/**
+ * Start a ReviewHog review of any pull request the project's GitHub App installation can access, and publish it back to the PR. The requesting user is the review's acting user: their enabled perspectives, blind-spot check, validator, and urgency threshold drive the run, and it appears under their recent reviews. Nonexistent, closed, and fork PRs are rejected synchronously; a PR whose current commit already has a published review returns 'already_reviewed' without starting a run, and triggering a PR whose review is currently running joins the in-flight run. Otherwise non-blocking: returns the Temporal workflow id immediately while the review runs in the worker.
+ * @summary Start a review of a pull request
+ */
+export const ReviewHogReviewsTriggerCreateParams = /* @__PURE__ */ zod.object({
+ project_id: zod
+ .string()
+ .describe(
+ "Project ID of the project you're trying to access. To find the ID of the project, make a call to \/api\/projects\/."
+ ),
+})
+
+export const ReviewHogReviewsTriggerCreateBody = /* @__PURE__ */ zod.object({
+ pr_url: zod
+ .string()
+ .describe(
+ "GitHub pull request URL to review, e.g. 'https:\/\/github.com\/PostHog\/posthog.com\/pull\/123'. The repository must be accessible to the project's GitHub App installation."
+ ),
+})
diff --git a/services/mcp/src/lib/oauth-scopes.generated.ts b/services/mcp/src/lib/oauth-scopes.generated.ts
index 3da94e2bbe94..9a937c1fbde6 100644
--- a/services/mcp/src/lib/oauth-scopes.generated.ts
+++ b/services/mcp/src/lib/oauth-scopes.generated.ts
@@ -155,6 +155,8 @@ export const OAUTH_SCOPES_SUPPORTED = [
'query:write',
'replay_scanner:read',
'replay_scanner:write',
+ 'review_hog:read',
+ 'review_hog:write',
'revenue_analytics:read',
'revenue_analytics:write',
'session_recording:read',
diff --git a/services/mcp/src/tools/generated/index.ts b/services/mcp/src/tools/generated/index.ts
index d7dd0bd9329c..b24b50aed3e7 100644
--- a/services/mcp/src/tools/generated/index.ts
+++ b/services/mcp/src/tools/generated/index.ts
@@ -44,6 +44,7 @@ import { GENERATED_TOOLS as queryWrappers } from './query-wrappers'
import { GENERATED_TOOLS as reminders } from './reminders'
import { GENERATED_TOOLS as replay } from './replay'
import { GENERATED_TOOLS as replay_vision } from './replay_vision'
+import { GENERATED_TOOLS as review_hog } from './review_hog'
import { GENERATED_TOOLS as signals } from './signals'
import { GENERATED_TOOLS as skills } from './skills'
import { GENERATED_TOOLS as stamphog } from './stamphog'
@@ -101,6 +102,7 @@ export const GENERATED_TOOL_MAP: Record<string, () => ToolBase<ZodObjectAny>> =
...reminders,
...replay,
...replay_vision,
+ ...review_hog,
...signals,
...skills,
...stamphog,
diff --git a/services/mcp/src/tools/generated/review_hog.ts b/services/mcp/src/tools/generated/review_hog.ts
new file mode 100644
index 000000000000..e41c86735304
--- /dev/null
+++ b/services/mcp/src/tools/generated/review_hog.ts
@@ -0,0 +1,74 @@
+// AUTO-GENERATED from products/review_hog/mcp/tools.yaml + OpenAPI — do not edit
+import { z } from 'zod'
+
+import type { Schemas } from '@/api/generated'
+import {
+ ReviewHogReviewsListQueryParams,
+ ReviewHogReviewsRetrieveParams,
+ ReviewHogReviewsTriggerCreateBody,
+} from '@/generated/review_hog/api'
+import { withPostHogUrl, type WithPostHogUrl } from '@/tools/tool-utils'
+import type { Context, ToolBase, ZodObjectAny } from '@/tools/types'
+
+const ReviewHogReviewsGetSchema = ReviewHogReviewsRetrieveParams.omit({ project_id: true })
+
+const reviewHogReviewsGet = (): ToolBase<typeof ReviewHogReviewsGetSchema, Schemas.ReviewDetail> => ({
+ name: 'review-hog-reviews-get',
+ schema: ReviewHogReviewsGetSchema,
+ handler: async (context: Context, params: z.infer<typeof ReviewHogReviewsGetSchema>) => {
+ const projectId = await context.stateManager.getProjectId()
+ const result = await context.api.request<Schemas.ReviewDetail>({
+ method: 'GET',
+ path: `/api/projects/${encodeURIComponent(String(projectId))}/review_hog/reviews/${encodeURIComponent(String(params.id))}/`,
+ })
+ return result
+ },
+})
+
+const ReviewHogReviewsListSchema = ReviewHogReviewsListQueryParams
+
+const reviewHogReviewsList = (): ToolBase<
+ typeof ReviewHogReviewsListSchema,
+ WithPostHogUrl<Schemas.ReviewRecentReviewsPage>
+> => ({
+ name: 'review-hog-reviews-list',
+ schema: ReviewHogReviewsListSchema,
+ handler: async (context: Context, params: z.infer<typeof ReviewHogReviewsListSchema>) => {
+ const projectId = await context.stateManager.getProjectId()
+ const result = await context.api.request<Schemas.ReviewRecentReviewsPage>({
+ method: 'GET',
+ path: `/api/projects/${encodeURIComponent(String(projectId))}/review_hog/reviews/`,
+ query: {
+ limit: params.limit,
+ scope: params.scope,
+ },
+ })
+ return await withPostHogUrl(context, result, '/code_review')
+ },
+})
+
+const ReviewHogReviewsTriggerSchema = ReviewHogReviewsTriggerCreateBody
+
+const reviewHogReviewsTrigger = (): ToolBase<typeof ReviewHogReviewsTriggerSchema, Schemas.ReviewTriggerResponse> => ({
+ name: 'review-hog-reviews-trigger',
+ schema: ReviewHogReviewsTriggerSchema,
+ handler: async (context: Context, params: z.infer<typeof ReviewHogReviewsTriggerSchema>) => {
+ const projectId = await context.stateManager.getProjectId()
+ const body: Record<string, unknown> = {}
+ if (params.pr_url !== undefined) {
+ body['pr_url'] = params.pr_url
+ }
+ const result = await context.api.request<Schemas.ReviewTriggerResponse>({
+ method: 'POST',
+ path: `/api/projects/${encodeURIComponent(String(projectId))}/review_hog/reviews/trigger/`,
+ body,
+ })
+ return result
+ },
+})
+
+export const GENERATED_TOOLS: Record<string, () => ToolBase<ZodObjectAny>> = {
+ 'review-hog-reviews-get': reviewHogReviewsGet,
+ 'review-hog-reviews-list': reviewHogReviewsList,
+ 'review-hog-reviews-trigger': reviewHogReviewsTrigger,
+}
diff --git a/services/mcp/tests/unit/tool-filtering.test.ts b/services/mcp/tests/unit/tool-filtering.test.ts
index 6f7a8c05148e..96da3312012c 100644
--- a/services/mcp/tests/unit/tool-filtering.test.ts
+++ b/services/mcp/tests/unit/tool-filtering.test.ts
@@ -818,10 +818,11 @@ describe('Tool Filtering - Feature Flags', () => {
'stamphog',
'product-data-catalog',
'loops',
+ 'review-hog',
'warehouse-person-properties',
])
)
- expect(flags).toHaveLength(23)
+ expect(flags).toHaveLength(24)
})
it('every loops tool is gated on the loops flag', () => {