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: let orgs limit MCP access to read-only (#86299)

Alex Lider0ad474fa91cf
diff --git a/posthog/api/posthog_connection.py b/posthog/api/posthog_connection.py
index 8fb6ba3724b6..445e5a76b9f4 100644
--- a/posthog/api/posthog_connection.py
+++ b/posthog/api/posthog_connection.py
@@ -31,7 +31,13 @@ from rest_framework.response import Response
from rest_framework.throttling import BaseThrottle
from posthog.api.routing import TeamAndOrgViewSetMixin
-from posthog.auth import OAuthAccessTokenAuthentication, PersonalAPIKeyAuthentication, SessionAuthentication
+from posthog.auth import (
+ MCP_USER_AGENT_MARKER,
+ OAuthAccessTokenAuthentication,
+ PersonalAPIKeyAuthentication,
+ SessionAuthentication,
+ is_mcp_request,
+)
from posthog.models.integration import POSTHOG_CONNECT_KIND, Integration, OauthIntegration, posthog_connect_base_url
from posthog.permissions import get_authenticator_scopes
from posthog.rate_limit import PostHogConnectionForwardThrottle
@@ -152,10 +158,19 @@ def _forward_through_connection(
*,
query: dict[str, Any] | None = None,
data: Any = None,
+ mcp_origin: bool = False,
) -> ForwardResult:
- """Replay one request against the connected project, injecting the connection's token."""
+ """Replay one request against the connected project, injecting the connection's token.
+
+ Pass mcp_origin=True to stamp the outbound request with the MCP user agent, so the
+ target organization applies its MCP read-only policy to a write that an MCP client
+ started through this connection. A forward that did not start from an MCP request must
+ not be marked: the target organization restricts MCP, not connections."""
token = _connection_access_token(integration)
base = posthog_connect_base_url(integration.config.get("region"))
+ headers = {"Authorization": f"Bearer {token}", CONNECTION_MARKER_HEADER: "1"}
+ if mcp_origin:
+ headers["User-Agent"] = f"posthog-connection; {MCP_USER_AGENT_MARKER}"
raw = bytearray()
timed_out = False
@@ -168,7 +183,7 @@ def _forward_through_connection(
f"{base}/{path}",
params=query or None,
json=data if method in _METHODS_WITH_BODY else None,
- headers={"Authorization": f"Bearer {token}", CONNECTION_MARKER_HEADER: "1"},
+ headers=headers,
timeout=CONNECTION_FORWARD_TIMEOUT_SECONDS,
# A compromised/misconfigured target must not be able to 30x us into resending the
# bearer token to another origin.
@@ -317,6 +332,7 @@ class PostHogConnectionViewSet(TeamAndOrgViewSetMixin, viewsets.GenericViewSet):
_validate_target_path(payload["path"]),
query=payload.get("query"),
data=payload.get("data"),
+ mcp_origin=is_mcp_request(request),
)
body = {"status": result.status, "data": result.data}
# A failure on this side is mirrored as the outer status too, so a caller that only reads the
diff --git a/posthog/api/routing.py b/posthog/api/routing.py
index 7dc7524ec9cb..13cebe1da88a 100644
--- a/posthog/api/routing.py
+++ b/posthog/api/routing.py
@@ -34,6 +34,7 @@ from posthog.models.user import User
from posthog.permissions import (
AccessControlPermission,
APIScopePermission,
+ MCPAccessPermission,
OrganizationMemberPermissions,
SharingTokenPermission,
TeamMemberAccessPermission,
@@ -255,9 +256,9 @@ class TeamAndOrgViewSetMixin(_GenericViewSet):
except NotImplementedError:
pass
else:
- # Domain enforcement is a tenant boundary, not an authorization level: views that
- # shape their own permission chain cannot opt out of it.
- return [*dangerously_defined, VerifiedDomainEnforcementPermission()]
+ # Domain enforcement and the MCP cap are tenant boundaries, not authorization
+ # levels. Views that shape their own permission chain cannot remove them.
+ return [*dangerously_defined, VerifiedDomainEnforcementPermission(), MCPAccessPermission()]
if isinstance(self.request.successful_authenticator, InternalAPIAuthentication):
return [IsAuthenticated()]
@@ -270,7 +271,11 @@ class TeamAndOrgViewSetMixin(_GenericViewSet):
# NOTE: We define these here to make it hard _not_ to use them. If you want to override them, you have to
# override the entire method.
- permission_classes: list = [IsAuthenticated, APIScopePermission, AccessControlPermission]
+ permission_classes: list = [
+ IsAuthenticated,
+ APIScopePermission,
+ AccessControlPermission,
+ ]
if self._is_team_view or self._is_project_view:
permission_classes.append(TeamMemberAccessPermission)
@@ -278,8 +283,10 @@ class TeamAndOrgViewSetMixin(_GenericViewSet):
permission_classes.append(OrganizationMemberPermissions)
# After the membership permission, so non-members get the generic denial and the
- # organization row it resolved is reused.
+ # organization row it resolved is reused. The MCP cap follows for the same reason:
+ # its message must not disclose another organization's security settings.
permission_classes.append(VerifiedDomainEnforcementPermission)
+ permission_classes.append(MCPAccessPermission)
permission_classes.extend(self.permission_classes)
return [permission() for permission in permission_classes]
diff --git a/posthog/api/test/__snapshots__/test_element.ambr b/posthog/api/test/__snapshots__/test_element.ambr
index 6dd8443d3c72..4fa815d7e71b 100644
--- a/posthog/api/test/__snapshots__/test_element.ambr
+++ b/posthog/api/test/__snapshots__/test_element.ambr
@@ -68,6 +68,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -366,6 +367,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -418,6 +420,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -497,6 +500,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
diff --git a/posthog/api/test/__snapshots__/test_preflight.ambr b/posthog/api/test/__snapshots__/test_preflight.ambr
index 245ac729815f..57fd6d7c4eb7 100644
--- a/posthog/api/test/__snapshots__/test_preflight.ambr
+++ b/posthog/api/test/__snapshots__/test_preflight.ambr
@@ -68,6 +68,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
diff --git a/posthog/api/test/dashboards/__snapshots__/test_dashboard.ambr b/posthog/api/test/dashboards/__snapshots__/test_dashboard.ambr
index 65c00a119c22..a5d770de4603 100644
--- a/posthog/api/test/dashboards/__snapshots__/test_dashboard.ambr
+++ b/posthog/api/test/dashboards/__snapshots__/test_dashboard.ambr
@@ -68,6 +68,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -515,6 +516,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -615,6 +617,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -755,6 +758,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -808,6 +812,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -887,6 +892,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -1064,6 +1070,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -2435,6 +2442,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -2581,6 +2589,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -2769,6 +2778,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -3129,6 +3139,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -3229,6 +3240,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -3369,6 +3381,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -3422,6 +3435,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -3501,6 +3515,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -3695,6 +3710,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -3801,6 +3817,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -3971,6 +3988,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -4217,6 +4235,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -4548,6 +4567,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -4688,6 +4708,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -4741,6 +4762,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -4820,6 +4842,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -5128,6 +5151,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -5454,6 +5478,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -5594,6 +5619,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -5647,6 +5673,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -5742,6 +5769,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -7728,6 +7756,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -7828,6 +7857,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -7968,6 +7998,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -8021,6 +8052,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -8100,6 +8132,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -8190,6 +8223,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -8926,6 +8960,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -9066,6 +9101,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -9119,6 +9155,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -9198,6 +9235,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -9272,6 +9310,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -9552,6 +9591,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -9884,6 +9924,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -10024,6 +10065,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -10077,6 +10119,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -10165,6 +10208,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -10470,6 +10514,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -10891,6 +10936,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -11031,6 +11077,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -11084,6 +11131,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -11163,6 +11211,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -12294,6 +12343,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -12434,6 +12484,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -12487,6 +12538,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -12566,6 +12618,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -12782,6 +12835,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -13430,6 +13484,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -13530,6 +13585,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -13670,6 +13726,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -13723,6 +13780,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -13802,6 +13860,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -13892,6 +13951,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -14628,6 +14688,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -14768,6 +14829,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -14821,6 +14883,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -14900,6 +14963,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -14974,6 +15038,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
diff --git a/posthog/api/test/notebooks/__snapshots__/test_notebook.ambr b/posthog/api/test/notebooks/__snapshots__/test_notebook.ambr
index fca32a9abf8a..8b10f6102cff 100644
--- a/posthog/api/test/notebooks/__snapshots__/test_notebook.ambr
+++ b/posthog/api/test/notebooks/__snapshots__/test_notebook.ambr
@@ -68,6 +68,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -159,6 +160,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -299,6 +301,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -366,6 +369,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -445,6 +449,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -846,6 +851,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -994,6 +1000,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -1263,6 +1270,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -1403,6 +1411,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -1470,6 +1479,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -1549,6 +1559,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -1672,6 +1683,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -1751,6 +1763,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
diff --git a/posthog/api/test/test_posthog_connection.py b/posthog/api/test/test_posthog_connection.py
index ecc585f5de5b..c0b3cd4ca41d 100644
--- a/posthog/api/test/test_posthog_connection.py
+++ b/posthog/api/test/test_posthog_connection.py
@@ -75,6 +75,34 @@ class TestPostHogConnectionForward:
assert mock_request.call_args[1]["params"] == {"limit": "5"}
assert mock_request.call_args[1]["allow_redirects"] is False
+ def test_forward_marks_the_target_as_mcp_only_for_mcp_origin(self, client: HttpClient):
+ from posthog.auth import MCP_USER_AGENT_MARKER
+ from posthog.models.personal_api_key import PersonalAPIKey
+ from posthog.models.utils import generate_random_token_personal, hash_key_value
+
+ key_value = generate_random_token_personal()
+ PersonalAPIKey.objects.create(label="mcp", user=self.user, secure_value=hash_key_value(key_value), scopes=["*"])
+ with patch(FORWARD_PATH) as mock_request:
+ mock_request.return_value = _mock_response(201, {"id": "abc"})
+ client.post(
+ self._forward_url(),
+ {"method": "POST", "path": "api/projects/2/tasks/", "data": {"description": "hi"}},
+ content_type="application/json",
+ HTTP_AUTHORIZATION=f"Bearer {key_value}",
+ headers={"User-Agent": f"cursor/1.0 {MCP_USER_AGENT_MARKER}; version: 1.0.0"},
+ )
+ assert MCP_USER_AGENT_MARKER in mock_request.call_args[1]["headers"]["User-Agent"]
+
+ with patch(FORWARD_PATH) as mock_request:
+ mock_request.return_value = _mock_response(201, {"id": "abc"})
+ client.force_login(self.user)
+ client.post(
+ self._forward_url(),
+ {"method": "POST", "path": "api/projects/2/tasks/", "data": {"description": "hi"}},
+ content_type="application/json",
+ )
+ assert "User-Agent" not in mock_request.call_args[1]["headers"]
+
def test_forward_sends_body_only_for_write_methods(self, client: HttpClient):
client.force_login(self.user)
with patch(FORWARD_PATH) as mock_request:
diff --git a/posthog/auth.py b/posthog/auth.py
index ed710b05ce8f..98fb8e9f2df1 100644
--- a/posthog/auth.py
+++ b/posthog/auth.py
@@ -1475,3 +1475,27 @@ class WebhookSignatureAuthentication(authentication.BaseAuthentication):
def authenticate_header(self, request: Request) -> str:
return "WebhookSignature"
+
+
+# services/mcp sends this user agent on its API calls (USER_AGENT in its
+# oauth-constants.ts). The two runtimes cannot share one constant, so this value
+# mirrors that one. If they diverge, this check stops matching MCP traffic and the
+# read-only policy stops applying. A client controls its own user agent. The match applies MCP
+# policy to the normal MCP pathway only. It does not stop a hostile key holder.
+# The same credential keeps its full scopes under a different user agent. A future
+# change can reduce the credential's scopes when the token is created.
+MCP_USER_AGENT_MARKER = "posthog/mcp-server"
+
+
+def is_mcp_request(request: Union[HttpRequest, Request]) -> bool:
+ """Returns True when a token-authenticated request comes through the MCP server."""
+ authenticator = getattr(request, "successful_authenticator", None)
+ # Every user-delegated scoped-token type the MCP server can authenticate with. ID-JAG
+ # (XAA) tokens are served from the same OAuth token endpoint and carry scopes, so a
+ # write on that pathway must be classified as MCP like a personal key or OAuth token.
+ if isinstance(
+ authenticator,
+ PersonalAPIKeyAuthentication | OAuthAccessTokenAuthentication | IDJagAccessTokenAuthentication,
+ ):
+ return MCP_USER_AGENT_MARKER in (request.headers.get("User-Agent") or "")
+ return False
diff --git a/posthog/management/migration_analysis/hot_table_acknowledged_migrations.txt b/posthog/management/migration_analysis/hot_table_acknowledged_migrations.txt
index 91f021b57389..73544273761a 100644
--- a/posthog/management/migration_analysis/hot_table_acknowledged_migrations.txt
+++ b/posthog/management/migration_analysis/hot_table_acknowledged_migrations.txt
@@ -21,3 +21,4 @@ posthog.1262_organization_members_can_see_org_members
posthog.1272_user_ui_configuration
posthog.1284_organization_enforce_verified_domains
posthog.1304_organization_has_active_subscription
+posthog.1322_organization_read_only_mcp_access
diff --git a/posthog/migrations/1322_organization_read_only_mcp_access.py b/posthog/migrations/1322_organization_read_only_mcp_access.py
new file mode 100644
index 000000000000..e7c29749b4c3
--- /dev/null
+++ b/posthog/migrations/1322_organization_read_only_mcp_access.py
@@ -0,0 +1,20 @@
+# Generated by Django 5.2.17 on 2026-08-25 10:52
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+ dependencies = [("posthog", "1321_add_user_facet_settings")]
+
+ operations = [
+ migrations.AddField(
+ model_name="organization",
+ name="read_only_mcp_access",
+ field=models.BooleanField(
+ blank=True,
+ default=False,
+ help_text="When True, requests through the PostHog MCP server can read but not change this organization's data.",
+ null=True,
+ ),
+ ),
+ ]
diff --git a/posthog/migrations/max_migration.txt b/posthog/migrations/max_migration.txt
index fe3447b0c2be..3e4dceee97f6 100644
--- a/posthog/migrations/max_migration.txt
+++ b/posthog/migrations/max_migration.txt
@@ -1 +1 @@
-1321_add_user_facet_settings
+1322_organization_read_only_mcp_access
diff --git a/posthog/models/organization.py b/posthog/models/organization.py
index cb8a31024665..e5aae4f94e23 100644
--- a/posthog/models/organization.py
+++ b/posthog/models/organization.py
@@ -279,6 +279,12 @@ class Organization(ModelActivityMixin, UUIDTModel):
help_text="When False, members (below admin) only see themselves in the members list and only project members in access control.",
)
allow_publicly_shared_resources = models.BooleanField(default=True)
+ read_only_mcp_access = models.BooleanField(
+ default=False,
+ null=True,
+ blank=True,
+ help_text="When True, requests through the PostHog MCP server can read but not change this organization's data.",
+ )
default_role = models.ForeignKey(
"ee.Role",
on_delete=models.SET_NULL,
diff --git a/posthog/permissions.py b/posthog/permissions.py
index 23a2aeefc7fe..49fafee02217 100644
--- a/posthog/permissions.py
+++ b/posthog/permissions.py
@@ -25,6 +25,7 @@ from posthog.auth import (
SharingAccessTokenAuthentication,
SharingPasswordProtectedAuthentication,
TeamSecretTokenAuthentication,
+ is_mcp_request,
)
from posthog.cloud_utils import is_cloud
from posthog.constants import AvailableFeature
@@ -42,6 +43,7 @@ from posthog.scopes import (
from posthog.session.reauth import sensitive_action_reference, step_up_required
from posthog.utils import get_can_create_org
+from products.access_control.backend.facade.mcp_access import mcp_access_denial
from products.access_control.backend.facade.user_access_control import (
AccessControlLevel,
UserAccessControl,
@@ -862,6 +864,75 @@ class APIScopePermission(ScopeBasePermission):
return
+class MCPAccessPermission(ScopeBasePermission):
+ """Denies write actions through the MCP server when the organization restricts it.
+
+ This class is an independent vote in the permission stack. DRF combines permission
+ classes with AND semantics, so a `*`-scoped token that passes `APIScopePermission`
+ is still capped here. The stack runs this class after the membership permissions,
+ so non-members get the generic denial. This class subclasses ScopeBasePermission
+ only for `_get_required_scopes`. It derives an action's read or write nature the
+ same way `APIScopePermission` does."""
+
+ def has_permission(self, request, view) -> bool:
+ # Cheap exit first. Almost every request is not MCP. The check is two isinstance
+ # checks and one header read, with no query.
+ if not is_mcp_request(request):
+ return True
+
+ # Root viewsets (organizations, projects, environments) carry no parent URL kwargs,
+ # and `get_organization_from_view` falls back to the user's current organization
+ # there, which is a UI preference, not the request's target. When an object exists,
+ # delegate to has_object_permission, which resolves the target organization from the
+ # fetched object and caps the write there — the same split OrganizationMemberPermissions
+ # uses. A create has no object and lands in the resolved organization (what the
+ # serializer's create uses), so the current-organization resolution is correct for it;
+ # a list is a read and passes _admits either way. Views deriving their target from the
+ # current team are also fine by construction.
+ target_in_url = bool(view.parent_query_kwargs) or bool(view.param_derived_from_user_current_team)
+ if not target_in_url and getattr(view, "action", None) not in ["list", "create"]:
+ return True
+
+ return self._admits(request, view, self._target_organization(view))
+
+ def has_object_permission(self, request, view, object) -> bool:
+ if not is_mcp_request(request):
+ return True
+ if isinstance(object, Organization):
+ return self._admits(request, view, object)
+ organization = getattr(object, "organization", None)
+ if isinstance(organization, Organization):
+ return self._admits(request, view, organization)
+ return True
+
+ @staticmethod
+ def _target_organization(view) -> Optional[Organization]:
+ if getattr(view, "scope_object", None) is None:
+ return None
+ try:
+ return get_organization_from_view(view)
+ except (ValueError, NotFound):
+ return None
+
+ def _admits(self, request, view, organization: Optional[Organization]) -> bool:
+ if organization is None:
+ return True
+ required_scopes = self._get_required_scopes(request, view)
+ if required_scopes is None:
+ # This action is unclassified: no required_scopes, or an INTERNAL scope object.
+ # On the default stack, APIScopePermission already rejects token auth for these.
+ # A dangerously_get_permissions chain can omit APIScopePermission. Fall back to
+ # the HTTP method there and treat every non-safe method as a write.
+ writes = request.method not in SAFE_METHODS
+ else:
+ writes = any(scope.endswith(":write") for scope in required_scopes)
+ denial = mcp_access_denial(organization, is_mcp=True, writes=writes)
+ if denial is not None:
+ self.message = denial
+ return False
+ return True
+
+
class AccessControlPermission(ScopeBasePermission):
"""
Unified permissions access - controls access to any object based on the user's access controls
diff --git a/posthog/session_recordings/test/__snapshots__/test_session_recording_playlist.ambr b/posthog/session_recordings/test/__snapshots__/test_session_recording_playlist.ambr
index 782f1e8de3be..bc3573674767 100644
--- a/posthog/session_recordings/test/__snapshots__/test_session_recording_playlist.ambr
+++ b/posthog/session_recordings/test/__snapshots__/test_session_recording_playlist.ambr
@@ -366,6 +366,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -506,6 +507,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -559,6 +561,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -638,6 +641,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -1492,6 +1496,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -1632,6 +1637,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -1685,6 +1691,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -1757,6 +1764,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -1809,6 +1817,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -2261,6 +2270,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -2314,6 +2324,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -2393,6 +2404,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
diff --git a/posthog/session_recordings/test/__snapshots__/test_session_recordings.ambr b/posthog/session_recordings/test/__snapshots__/test_session_recordings.ambr
index 6f0e310de8d3..0091fbc77ea0 100644
--- a/posthog/session_recordings/test/__snapshots__/test_session_recordings.ambr
+++ b/posthog/session_recordings/test/__snapshots__/test_session_recordings.ambr
@@ -76,6 +76,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -422,6 +423,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -475,6 +477,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -554,6 +557,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -606,6 +610,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -913,6 +918,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -1256,6 +1262,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -1309,6 +1316,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -1388,6 +1396,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -1440,6 +1449,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -1747,6 +1757,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -2087,6 +2098,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -2140,6 +2152,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -2219,6 +2232,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -2271,6 +2285,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -2578,6 +2593,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -2918,6 +2934,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -2971,6 +2988,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -3050,6 +3068,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -3102,6 +3121,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -3409,6 +3429,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -3752,6 +3773,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -3805,6 +3827,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -3884,6 +3907,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -3936,6 +3960,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -4243,6 +4268,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -4586,6 +4612,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -4639,6 +4666,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -4718,6 +4746,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -4770,6 +4799,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -5077,6 +5107,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -5420,6 +5451,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -5473,6 +5505,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -5552,6 +5585,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -5604,6 +5638,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -5911,6 +5946,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -6512,6 +6548,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -6652,6 +6689,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -6705,6 +6743,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -6784,6 +6823,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -6836,6 +6876,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -7367,6 +7408,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -7507,6 +7549,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -7560,6 +7603,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -7685,6 +7729,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -7737,6 +7782,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -8188,6 +8234,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -8297,6 +8344,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -8437,6 +8485,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -8490,6 +8539,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -8569,6 +8619,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -8621,6 +8672,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -8964,6 +9016,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -9280,6 +9333,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -9420,6 +9474,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -9473,6 +9528,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -9527,6 +9583,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -9606,6 +9663,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -9658,6 +9716,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -10165,6 +10224,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -10217,6 +10277,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -10359,6 +10420,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -10859,6 +10921,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -10906,6 +10969,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -11046,6 +11110,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -11099,6 +11164,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -11178,6 +11244,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -11230,6 +11297,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -11752,6 +11820,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -11892,6 +11961,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -11945,6 +12015,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -12024,6 +12095,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -12076,6 +12148,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -12128,6 +12201,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -12576,6 +12650,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -12682,6 +12757,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -12822,6 +12898,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -12875,6 +12952,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -12954,6 +13032,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -13006,6 +13085,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -13613,6 +13693,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -13753,6 +13834,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -13903,6 +13985,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -13982,6 +14065,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -14034,6 +14118,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -14578,6 +14663,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -14718,6 +14804,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -14771,6 +14858,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -14850,6 +14938,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -14902,6 +14991,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
diff --git a/posthog/tasks/test/__snapshots__/test_process_scheduled_changes.ambr b/posthog/tasks/test/__snapshots__/test_process_scheduled_changes.ambr
index 28ebe8612c06..7c22347d3764 100644
--- a/posthog/tasks/test/__snapshots__/test_process_scheduled_changes.ambr
+++ b/posthog/tasks/test/__snapshots__/test_process_scheduled_changes.ambr
@@ -472,6 +472,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -758,6 +759,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -1407,6 +1409,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -1789,6 +1792,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
diff --git a/products/access_control/backend/facade/mcp_access.py b/products/access_control/backend/facade/mcp_access.py
new file mode 100644
index 000000000000..a2da54b77a4c
--- /dev/null
+++ b/products/access_control/backend/facade/mcp_access.py
@@ -0,0 +1,30 @@
+"""The org-wide MCP read-only policy.
+
+`Organization.read_only_mcp_access` caps what any member can do through the PostHog MCP
+server. Reads work. Writes are denied. The cap applies to every member, including admins.
+Access through the app and direct API use are not affected.
+
+This module is the decision point. It takes domain facts and returns a verdict. It does
+not read requests. `posthog.auth.is_mcp_request` classifies the pathway. Enforcement
+points such as `MCPAccessPermission` in posthog/permissions.py gather the facts and
+apply the verdict. The access-control facade's `decide()` can call this later, to apply the
+same cap to object-level decisions.
+"""
+
+from posthog.constants import AvailableFeature
+from posthog.models.organization import Organization
+
+
+def mcp_access_denial(organization: Organization, *, is_mcp: bool, writes: bool) -> str | None:
+ """Makes the MCP read-only decision. Returns a denial message for the user when the
+ organization restricts MCP access and the action writes. Returns None to allow."""
+ if not writes or not is_mcp:
+ return None
+ if not organization.read_only_mcp_access:
+ return None
+ if not organization.is_feature_available(AvailableFeature.ORGANIZATION_SECURITY_SETTINGS):
+ return None
+ return (
+ "Your organization restricts MCP access to read-only. "
+ "An organization admin can change this in your organization settings."
+ )
diff --git a/products/access_control/backend/tests/test_mcp_access.py b/products/access_control/backend/tests/test_mcp_access.py
new file mode 100644
index 000000000000..7a0da2958906
--- /dev/null
+++ b/products/access_control/backend/tests/test_mcp_access.py
@@ -0,0 +1,169 @@
+from posthog.test.base import APIBaseTest
+
+from django.http import HttpRequest
+from django.test import SimpleTestCase
+
+from parameterized import parameterized
+
+from posthog.auth import (
+ MCP_USER_AGENT_MARKER,
+ IDJagAccessTokenAuthentication,
+ OAuthAccessTokenAuthentication,
+ PersonalAPIKeyAuthentication,
+ SessionAuthentication,
+ is_mcp_request,
+)
+from posthog.constants import AvailableFeature
+from posthog.models.organization import OrganizationMembership
+from posthog.models.personal_api_key import PersonalAPIKey
+from posthog.models.utils import generate_random_token_personal, hash_key_value
+
+
+class TestMCPReadOnlyEnforcement(APIBaseTest):
+ def setUp(self) -> None:
+ super().setUp()
+ self.organization.available_product_features = [
+ {
+ "key": AvailableFeature.ORGANIZATION_SECURITY_SETTINGS,
+ "name": AvailableFeature.ORGANIZATION_SECURITY_SETTINGS,
+ },
+ # So the multi-project plan gate passes and MCPAccessPermission is the denier
+ # on the root-create path, not PremiumMultiProjectPermission.
+ {"key": AvailableFeature.ORGANIZATIONS_PROJECTS, "name": AvailableFeature.ORGANIZATIONS_PROJECTS},
+ ]
+ self.organization.save()
+ # Owner, not the default member: the cap binds every level, so the membership
+ # permissions must pass for MCPAccessPermission to be the one that denies.
+ self.organization_membership.level = OrganizationMembership.Level.OWNER
+ self.organization_membership.save()
+ self.key_value = generate_random_token_personal()
+ PersonalAPIKey.objects.create(
+ label="mcp test",
+ user=self.user,
+ secure_value=hash_key_value(self.key_value),
+ scopes=["*"],
+ )
+ self.client.logout()
+
+ def _set_read_only(self, value: bool) -> None:
+ self.organization.read_only_mcp_access = value
+ self.organization.save()
+
+ def _request(self, method: str, body: dict | None = None, mcp: bool = True):
+ return getattr(self.client, method)(
+ f"/api/projects/{self.team.id}/feature_flags/",
+ body or {},
+ HTTP_AUTHORIZATION=f"Bearer {self.key_value}",
+ headers={"User-Agent": f"cursor/1.0 {MCP_USER_AGENT_MARKER}; version: 1.0.0"} if mcp else None,
+ )
+
+ def test_read_only_org_denies_mcp_writes_and_allows_reads(self) -> None:
+ self._set_read_only(True)
+
+ denied = self._request("post", {"key": "mcp-e2e-should-fail", "name": "e2e"})
+ assert denied.status_code == 403
+ assert "read-only" in denied.json()["detail"]
+
+ assert self._request("get").status_code == 200
+
+ @parameterized.expand([("flag_off", False, True), ("not_mcp_user_agent", True, False)])
+ def test_writes_pass_without_flag_or_marker(self, _name: str, read_only: bool, mcp: bool) -> None:
+ self._set_read_only(read_only)
+
+ response = self._request("post", {"key": f"flag-{_name}", "name": "e2e"}, mcp=mcp)
+ assert response.status_code == 201
+
+ def test_root_create_is_capped_against_the_current_org(self) -> None:
+ # A create has no object to defer to; it lands in the caller's current org, which
+ # here is the read-only one. POST /api/projects/ must be capped.
+ self._set_read_only(True)
+
+ response = self.client.post(
+ "/api/projects/",
+ {"name": "new project via mcp"},
+ content_type="application/json",
+ HTTP_AUTHORIZATION=f"Bearer {self.key_value}",
+ headers={"User-Agent": f"cursor/1.0 {MCP_USER_AGENT_MARKER}; version: 1.0.0"},
+ )
+ assert response.status_code == 403
+ assert "read-only" in response.json()["detail"]
+
+ def test_root_viewset_caps_against_the_target_org_not_current_org(self) -> None:
+ # The read-only org is the target; the caller's *current* org is a different,
+ # uncapped one. A root environment write must be capped against the target.
+ from posthog.models.organization import Organization
+
+ self._set_read_only(True)
+ other_org, _, _ = Organization.objects.bootstrap(self.user, name="uncapped current org")
+ self.user.current_organization = other_org
+ self.user.save()
+
+ response = self.client.patch(
+ f"/api/environments/{self.team.id}/",
+ {"name": "renamed via mcp"},
+ content_type="application/json",
+ HTTP_AUTHORIZATION=f"Bearer {self.key_value}",
+ headers={"User-Agent": f"cursor/1.0 {MCP_USER_AGENT_MARKER}; version: 1.0.0"},
+ )
+ assert response.status_code == 403
+ assert "read-only" in response.json()["detail"]
+
+ def test_dangerously_defined_permission_chains_are_still_capped(self) -> None:
+ self._set_read_only(True)
+
+ response = self.client.patch(
+ "/api/organizations/@current/",
+ {"name": "renamed via mcp"},
+ content_type="application/json",
+ HTTP_AUTHORIZATION=f"Bearer {self.key_value}",
+ headers={"User-Agent": f"cursor/1.0 {MCP_USER_AGENT_MARKER}; version: 1.0.0"},
+ )
+ assert response.status_code == 403
+ assert "read-only" in response.json()["detail"]
+
+ def test_non_member_gets_the_generic_denial_not_the_policy_message(self) -> None:
+ from posthog.models.organization import Organization
+
+ self._set_read_only(True)
+ _, _, other_team = Organization.objects.bootstrap(None, name="other org")
+
+ response = self.client.post(
+ f"/api/projects/{other_team.id}/feature_flags/",
+ {"key": "cross-org-probe", "name": "probe"},
+ HTTP_AUTHORIZATION=f"Bearer {self.key_value}",
+ headers={"User-Agent": f"cursor/1.0 {MCP_USER_AGENT_MARKER}; version: 1.0.0"},
+ )
+ assert response.status_code == 403
+ assert "read-only" not in response.json()["detail"]
+
+ def test_flag_without_entitlement_does_not_enforce(self) -> None:
+ self._set_read_only(True)
+ self.organization.available_product_features = []
+ self.organization.save()
+
+ assert self._request("post", {"key": "flag-unentitled", "name": "e2e"}).status_code == 201
+
+
+class TestIsMCPRequest(SimpleTestCase):
+ @staticmethod
+ def _request(authenticator: object, user_agent: str) -> HttpRequest:
+ request = HttpRequest()
+ request.META["HTTP_USER_AGENT"] = user_agent
+ request.successful_authenticator = authenticator # type: ignore[attr-defined]
+ return request
+
+ @parameterized.expand(
+ [
+ ("personal_api_key", PersonalAPIKeyAuthentication),
+ ("oauth", OAuthAccessTokenAuthentication),
+ ("id_jag", IDJagAccessTokenAuthentication),
+ ]
+ )
+ def test_scoped_token_with_mcp_user_agent_is_mcp(self, _name: str, auth_class: type) -> None:
+ assert is_mcp_request(self._request(auth_class(), f"cursor/1.0 {MCP_USER_AGENT_MARKER}")) is True
+
+ def test_scoped_token_without_mcp_user_agent_is_not_mcp(self) -> None:
+ assert is_mcp_request(self._request(PersonalAPIKeyAuthentication(), "curl/8")) is False
+
+ def test_session_auth_is_never_mcp(self) -> None:
+ assert is_mcp_request(self._request(SessionAuthentication(), MCP_USER_AGENT_MARKER)) is False
diff --git a/products/actions/backend/api/test/__snapshots__/test_action.ambr b/products/actions/backend/api/test/__snapshots__/test_action.ambr
index ff7054bf4152..a2688d9d3e7d 100644
--- a/products/actions/backend/api/test/__snapshots__/test_action.ambr
+++ b/products/actions/backend/api/test/__snapshots__/test_action.ambr
@@ -68,6 +68,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -208,6 +209,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -275,6 +277,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -354,6 +357,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -555,6 +559,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -695,6 +700,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -836,6 +842,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -903,6 +910,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -982,6 +990,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -1158,6 +1167,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -1237,6 +1247,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -1411,6 +1422,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
diff --git a/products/annotations/backend/api/test/__snapshots__/test_annotation.ambr b/products/annotations/backend/api/test/__snapshots__/test_annotation.ambr
index 41480417c3b2..738c43b76fe0 100644
--- a/products/annotations/backend/api/test/__snapshots__/test_annotation.ambr
+++ b/products/annotations/backend/api/test/__snapshots__/test_annotation.ambr
@@ -68,6 +68,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -208,6 +209,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -275,6 +277,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -354,6 +357,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -590,6 +594,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -730,6 +735,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -871,6 +877,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -938,6 +945,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -1017,6 +1025,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -1253,6 +1262,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -1393,6 +1403,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -1474,6 +1485,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -1553,6 +1565,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -1750,6 +1763,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -1829,6 +1843,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -1938,6 +1953,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
diff --git a/products/cdp/backend/api/test/__snapshots__/test_plugin.ambr b/products/cdp/backend/api/test/__snapshots__/test_plugin.ambr
index 277c69ae1185..28cf23ac9ae9 100644
--- a/products/cdp/backend/api/test/__snapshots__/test_plugin.ambr
+++ b/products/cdp/backend/api/test/__snapshots__/test_plugin.ambr
@@ -68,6 +68,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -122,6 +123,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -174,6 +176,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -260,6 +263,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -359,6 +363,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -404,6 +409,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -458,6 +464,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -503,6 +510,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -555,6 +563,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -641,6 +650,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -740,6 +750,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -785,6 +796,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -839,6 +851,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -891,6 +904,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -986,6 +1000,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -1039,6 +1054,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -1091,6 +1107,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -1198,6 +1215,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -1243,6 +1261,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
diff --git a/products/feature_flags/backend/api/test/__snapshots__/test_feature_flag.ambr b/products/feature_flags/backend/api/test/__snapshots__/test_feature_flag.ambr
index 008e2c709915..b501c0bc0fed 100644
--- a/products/feature_flags/backend/api/test/__snapshots__/test_feature_flag.ambr
+++ b/products/feature_flags/backend/api/test/__snapshots__/test_feature_flag.ambr
@@ -516,6 +516,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -973,6 +974,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -1490,6 +1492,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -1569,6 +1572,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
diff --git a/products/feature_flags/backend/api/test/__snapshots__/test_organization_feature_flag.ambr b/products/feature_flags/backend/api/test/__snapshots__/test_organization_feature_flag.ambr
index 729387d32c4a..12fcc23eb4a4 100644
--- a/products/feature_flags/backend/api/test/__snapshots__/test_organization_feature_flag.ambr
+++ b/products/feature_flags/backend/api/test/__snapshots__/test_organization_feature_flag.ambr
@@ -68,6 +68,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -396,6 +397,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -573,6 +575,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -662,6 +665,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -880,6 +884,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -973,6 +978,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -1060,6 +1066,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -1306,6 +1313,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -1431,6 +1439,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -1483,6 +1492,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -1558,6 +1568,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -1758,6 +1769,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -1819,6 +1831,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -1991,6 +2004,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
diff --git a/products/product_analytics/backend/tests/api/__snapshots__/test_insight.ambr b/products/product_analytics/backend/tests/api/__snapshots__/test_insight.ambr
index 40cae6b2ee7b..017f23c3892b 100644
--- a/products/product_analytics/backend/tests/api/__snapshots__/test_insight.ambr
+++ b/products/product_analytics/backend/tests/api/__snapshots__/test_insight.ambr
@@ -478,6 +478,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -894,6 +895,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -986,6 +988,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -1126,6 +1129,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -1179,6 +1183,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -1258,6 +1263,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -1549,6 +1555,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
@@ -1655,6 +1662,7 @@
"posthog_organization"."members_can_use_personal_api_keys",
"posthog_organization"."members_can_see_org_members",
"posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."read_only_mcp_access",
"posthog_organization"."default_role_id",
"posthog_organization"."plugins_access_level",
"posthog_organization"."for_internal_metrics",
diff --git a/services/mcp/src/lib/oauth-constants.ts b/services/mcp/src/lib/oauth-constants.ts
index 68beffa9b4a0..966f9c7c5748 100644
--- a/services/mcp/src/lib/oauth-constants.ts
+++ b/services/mcp/src/lib/oauth-constants.ts
@@ -7,6 +7,9 @@ import type { CloudRegion } from '@/tools/types'
import packageJson from '../../package.json'
+// posthog/auth.py mirrors the "posthog/mcp-server" prefix as MCP_USER_AGENT_MARKER.
+// PostHog matches it to apply the org-level MCP read-only policy. If the prefix
+// changes, the policy stops matching MCP traffic. Change both sides together.
export const USER_AGENT = `posthog/mcp-server; version: ${packageJson.version}`
export interface GetUserAgentOptions {