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.

fix(mcp): feature_entitlement for access control tools (#97607)

Alex Lidercf219db51ae3
diff --git a/products/access_control/mcp/tools.yaml b/products/access_control/mcp/tools.yaml
index c3fd9872d3a4..244f311ea8fe 100644
--- a/products/access_control/mcp/tools.yaml
+++ b/products/access_control/mcp/tools.yaml
@@ -29,6 +29,7 @@ tools:
Project id. If omitted, uses the active project.
optional: true
fallback: projectId
+ feature_entitlement: access_control
access-control-default-properties-list:
operation: organizations_projects_access_control_default_properties_retrieve
enabled: true
@@ -50,6 +51,7 @@ tools:
Project id. If omitted, uses the active project.
optional: true
fallback: projectId
+ feature_entitlement: access_control
access-control-defaults-get:
operation: organizations_projects_access_control_defaults_retrieve
enabled: true
@@ -76,6 +78,7 @@ tools:
Project id. If omitted, uses the active project.
optional: true
fallback: projectId
+ feature_entitlement: access_control
response:
exclude:
- can_edit
@@ -107,6 +110,7 @@ tools:
member_id:
description: |
The organization membership id, as `organization_membership_id` in access-control-members-list.
+ feature_entitlement: access_control
access-control-member-properties-list:
operation: organizations_projects_access_control_member_properties_retrieve
enabled: true
@@ -135,6 +139,7 @@ tools:
member_id:
description: |
The organization membership id, as `organization_membership_id` in access-control-members-list.
+ feature_entitlement: access_control
access-control-members-list:
operation: organizations_projects_access_control_members_retrieve
enabled: true
@@ -168,6 +173,7 @@ tools:
member_id:
description: |
Optional. Narrow the result to one member, by organization membership id.
+ feature_entitlement: access_control
response:
exclude:
- project.minimum
@@ -198,6 +204,7 @@ tools:
description: |
The role id, as `role_id` in access-control-roles-list or an entry of `role_ids` in
access-control-members-list.
+ feature_entitlement: role_based_access
access-control-role-properties-list:
operation: organizations_projects_access_control_role_properties_retrieve
enabled: true
@@ -222,6 +229,7 @@ tools:
description: |
The role id, as `role_id` in access-control-roles-list or an entry of `role_ids` in
access-control-members-list.
+ feature_entitlement: role_based_access
access-control-roles-list:
operation: organizations_projects_access_control_roles_retrieve
enabled: true
@@ -252,6 +260,7 @@ tools:
role_id:
description: |
Optional. Narrow the result to one role, by role id.
+ feature_entitlement: role_based_access
response:
exclude:
- project.minimum
diff --git a/products/access_control/skills/checking-member-access/SKILL.md b/products/access_control/skills/checking-member-access/SKILL.md
index 7baaede51d7e..9b08d6d837e6 100644
--- a/products/access_control/skills/checking-member-access/SKILL.md
+++ b/products/access_control/skills/checking-member-access/SKILL.md
@@ -26,14 +26,17 @@ Not for changing rules. The read tools cannot write, and the settings page is wh
## Plan availability
-- Free and pay-as-you-go plans have no access control. Every level resolves to the PostHog default with
- `source` `system_default`, and any rule the tools return has no effect. Say so, and stop.
+- Free and pay-as-you-go plans have no access control, and the access control tools are not offered to
+ them. If the tools are missing from the catalog, say that the plan does not include access control and
+ suggest upgrading to the Boost plan. Link the plan comparison: https://posthog.com/platform-packages.
- Boost and Scale include the default levels and rules for single members on the project, on tools, on
objects and on properties.
-- Roles exist on every plan, but role rules count for access only on Enterprise. On other plans a role
- rule the tools return has no effect, and a member's roles never change the enforced level.
+- Roles exist on every plan, but role rules are an Enterprise feature: they can be set and are enforced
+ only there, and the three role access tools are offered only there. If the tools are missing, say that
+ role-based access control needs the Enterprise plan, with the same link. On other plans a member's
+ roles never change the enforced level.
- The tools do not say which plan the organization is on. A `source_subject` of `role` anywhere in a
- `members-list` result proves that role rules count. Without that, ask the user whether the organization
+ `members-list` result proves that role rules are enforced. Without that, ask the user whether the organization
is on Enterprise before walking roles in step 4 of the workflow.
## How access resolves
diff --git a/services/mcp/schema/generated-tool-definitions.json b/services/mcp/schema/generated-tool-definitions.json
index 44093879e45e..5fdf5fae7008 100644
--- a/services/mcp/schema/generated-tool-definitions.json
+++ b/services/mcp/schema/generated-tool-definitions.json
@@ -11,7 +11,8 @@
"idempotentHint": true,
"openWorldHint": true,
"readOnlyHint": true
- }
+ },
+ "feature_entitlement": "access_control"
},
"access-control-default-properties-list": {
"description": "Property rules that apply to everyone in the project without a rule of their own on that property: which person and event properties are hidden (`none`), read-only (`read`), or open (`read_write`). Every property is `read_write` unless a rule says otherwise.",
@@ -25,7 +26,8 @@
"idempotentHint": true,
"openWorldHint": true,
"readOnlyHint": true
- }
+ },
+ "feature_entitlement": "access_control"
},
"access-control-defaults-get": {
"description": "The access everyone in the project gets unless a rule of their own, or a role's rule, says otherwise: the default project level (member or admin) and the default level per tool (none, viewer, editor, manager), with the lowest and highest level each tool allows. Also lists which tools accept rules on single objects, such as one dashboard or one notebook. Start here to understand a project's baseline before checking a member or a role.",
@@ -39,7 +41,8 @@
"idempotentHint": true,
"openWorldHint": true,
"readOnlyHint": true
- }
+ },
+ "feature_entitlement": "access_control"
},
"access-control-member-objects-list": {
"description": "The rules configured for a member on single objects, for example a dashboard, a notebook or a warehouse table they are given access to, or blocked from, regardless of their tool-level access. Only the member's own rules are returned. An empty list means the member has no object rules of their own. Their tool-level access still applies.",
@@ -53,7 +56,8 @@
"idempotentHint": true,
"openWorldHint": true,
"readOnlyHint": true
- }
+ },
+ "feature_entitlement": "access_control"
},
"access-control-member-properties-list": {
"description": "The property rules configured for a member: which person and event properties they cannot see (`none`), can only read (`read`), or can read and write (`read_write`). Every property is `read_write` unless a rule says otherwise. Only the member's own rules are returned.",
@@ -67,7 +71,8 @@
"idempotentHint": true,
"openWorldHint": true,
"readOnlyHint": true
- }
+ },
+ "feature_entitlement": "access_control"
},
"access-control-members-list": {
"description": "For every organization member, the access enforced in the project: to the project itself and to each tool (dashboards, insights, feature flags, and so on). Per entry, `access_level` is the member's own stored rule (null when none), `effective_access_level` is what is enforced, and `inherited_access` says where that level comes from when it is not the member's own rule: `source_subject` is `role` or `default`, and `source` is `org_admin` when the member is an organization admin with full access to everything. Pass `member_id` (an `organization_membership_id`, from this tool or org-members-list) for one member. The checking-member-access skill explains how the levels combine.",
@@ -81,7 +86,8 @@
"idempotentHint": true,
"openWorldHint": true,
"readOnlyHint": true
- }
+ },
+ "feature_entitlement": "access_control"
},
"access-control-role-objects-list": {
"description": "The rules configured for a role on single objects, for example a dashboard, a notebook or a warehouse table the role's members are given access to, or blocked from, regardless of their tool-level access.",
@@ -95,7 +101,8 @@
"idempotentHint": true,
"openWorldHint": true,
"readOnlyHint": true
- }
+ },
+ "feature_entitlement": "role_based_access"
},
"access-control-role-properties-list": {
"description": "The property rules configured for a role: which person and event properties the role's members cannot see (`none`), can only read (`read`), or can read and write (`read_write`).",
@@ -109,7 +116,8 @@
"idempotentHint": true,
"openWorldHint": true,
"readOnlyHint": true
- }
+ },
+ "feature_entitlement": "role_based_access"
},
"access-control-roles-list": {
"description": "For every role in the organization, the access it grants in the project: to the project itself and to each tool. Per entry, `access_level` is the role's own stored rule, `effective_access_level` is what the role's members get from it, and `inherited_access` says where that level comes from when the role has no rule of its own. Pass `role_id` for one role.",
@@ -123,7 +131,8 @@
"idempotentHint": true,
"openWorldHint": true,
"readOnlyHint": true
- }
+ },
+ "feature_entitlement": "role_based_access"
},
"account-relationship-definitions-create": {
"description": "Create a Customer Analytics account relationship definition — a team-defined relationship type between a PostHog user and an account, such as CSM or Onboarding manager. Provide `name` (required, unique within the team), optional `description` explaining what the relationship means, and `is_single_holder` (default true) controlling whether only one user can hold the relationship per account at a time. Definitions are team-scoped and shared across all accounts; assign a user to a specific account with `accounts-relationships-create`.",
diff --git a/services/mcp/schema/tool-definitions-all.json b/services/mcp/schema/tool-definitions-all.json
index 2871028fec8f..4510f56400af 100644
--- a/services/mcp/schema/tool-definitions-all.json
+++ b/services/mcp/schema/tool-definitions-all.json
@@ -11,7 +11,8 @@
"idempotentHint": true,
"openWorldHint": true,
"readOnlyHint": true
- }
+ },
+ "feature_entitlement": "access_control"
},
"access-control-default-properties-list": {
"description": "Property rules that apply to everyone in the project without a rule of their own on that property: which person and event properties are hidden (`none`), read-only (`read`), or open (`read_write`). Every property is `read_write` unless a rule says otherwise.",
@@ -25,7 +26,8 @@
"idempotentHint": true,
"openWorldHint": true,
"readOnlyHint": true
- }
+ },
+ "feature_entitlement": "access_control"
},
"access-control-defaults-get": {
"description": "The access everyone in the project gets unless a rule of their own, or a role's rule, says otherwise: the default project level (member or admin) and the default level per tool (none, viewer, editor, manager), with the lowest and highest level each tool allows. Also lists which tools accept rules on single objects, such as one dashboard or one notebook. Start here to understand a project's baseline before checking a member or a role.",
@@ -39,7 +41,8 @@
"idempotentHint": true,
"openWorldHint": true,
"readOnlyHint": true
- }
+ },
+ "feature_entitlement": "access_control"
},
"access-control-member-objects-list": {
"description": "The rules configured for a member on single objects, for example a dashboard, a notebook or a warehouse table they are given access to, or blocked from, regardless of their tool-level access. Only the member's own rules are returned. An empty list means the member has no object rules of their own. Their tool-level access still applies.",
@@ -53,7 +56,8 @@
"idempotentHint": true,
"openWorldHint": true,
"readOnlyHint": true
- }
+ },
+ "feature_entitlement": "access_control"
},
"access-control-member-properties-list": {
"description": "The property rules configured for a member: which person and event properties they cannot see (`none`), can only read (`read`), or can read and write (`read_write`). Every property is `read_write` unless a rule says otherwise. Only the member's own rules are returned.",
@@ -67,7 +71,8 @@
"idempotentHint": true,
"openWorldHint": true,
"readOnlyHint": true
- }
+ },
+ "feature_entitlement": "access_control"
},
"access-control-members-list": {
"description": "For every organization member, the access enforced in the project: to the project itself and to each tool (dashboards, insights, feature flags, and so on). Per entry, `access_level` is the member's own stored rule (null when none), `effective_access_level` is what is enforced, and `inherited_access` says where that level comes from when it is not the member's own rule: `source_subject` is `role` or `default`, and `source` is `org_admin` when the member is an organization admin with full access to everything. Pass `member_id` (an `organization_membership_id`, from this tool or org-members-list) for one member. The checking-member-access skill explains how the levels combine.",
@@ -81,7 +86,8 @@
"idempotentHint": true,
"openWorldHint": true,
"readOnlyHint": true
- }
+ },
+ "feature_entitlement": "access_control"
},
"access-control-role-objects-list": {
"description": "The rules configured for a role on single objects, for example a dashboard, a notebook or a warehouse table the role's members are given access to, or blocked from, regardless of their tool-level access.",
@@ -95,7 +101,8 @@
"idempotentHint": true,
"openWorldHint": true,
"readOnlyHint": true
- }
+ },
+ "feature_entitlement": "role_based_access"
},
"access-control-role-properties-list": {
"description": "The property rules configured for a role: which person and event properties the role's members cannot see (`none`), can only read (`read`), or can read and write (`read_write`).",
@@ -109,7 +116,8 @@
"idempotentHint": true,
"openWorldHint": true,
"readOnlyHint": true
- }
+ },
+ "feature_entitlement": "role_based_access"
},
"access-control-roles-list": {
"description": "For every role in the organization, the access it grants in the project: to the project itself and to each tool. Per entry, `access_level` is the role's own stored rule, `effective_access_level` is what the role's members get from it, and `inherited_access` says where that level comes from when the role has no rule of its own. Pass `role_id` for one role.",
@@ -123,7 +131,8 @@
"idempotentHint": true,
"openWorldHint": true,
"readOnlyHint": true
- }
+ },
+ "feature_entitlement": "role_based_access"
},
"account-relationship-definitions-create": {
"description": "Create a Customer Analytics account relationship definition — a team-defined relationship type between a PostHog user and an account, such as CSM or Onboarding manager. Provide `name` (required, unique within the team), optional `description` explaining what the relationship means, and `is_single_holder` (default true) controlling whether only one user can hold the relationship per account at a time. Definitions are team-scoped and shared across all accounts; assign a user to a specific account with `accounts-relationships-create`.",
diff --git a/services/mcp/tests/unit/tool-filtering.test.ts b/services/mcp/tests/unit/tool-filtering.test.ts
index cead19f81168..11897d81537b 100644
--- a/services/mcp/tests/unit/tool-filtering.test.ts
+++ b/services/mcp/tests/unit/tool-filtering.test.ts
@@ -1213,3 +1213,36 @@ describe('Tool Filtering - Entitlements (activity log family)', () => {
expect(unknown).toContain('advanced-activity-logs-list')
})
})
+
+describe('Tool Filtering - Entitlements (access control family)', () => {
+ const memberAndDefaultTools = [
+ 'access-control-defaults-get',
+ 'access-control-members-list',
+ 'access-control-member-objects-list',
+ 'access-control-member-properties-list',
+ 'access-control-default-objects-list',
+ 'access-control-default-properties-list',
+ ]
+ const roleTools = [
+ 'access-control-roles-list',
+ 'access-control-role-objects-list',
+ 'access-control-role-properties-list',
+ ]
+
+ it.each(memberAndDefaultTools)('%s needs access_control', (tool) => {
+ expect(getToolsForFeatures({ availableFeatures: [], isCloud: true })).not.toContain(tool)
+ expect(getToolsForFeatures({ availableFeatures: ['access_control'], isCloud: true })).toContain(tool)
+ })
+
+ it.each(roleTools)('%s needs role_based_access, not just access_control', (tool) => {
+ expect(getToolsForFeatures({ availableFeatures: ['access_control'], isCloud: true })).not.toContain(tool)
+ expect(getToolsForFeatures({ availableFeatures: ['role_based_access'], isCloud: true })).toContain(tool)
+ })
+
+ it('fails open when entitlements are unknown', () => {
+ const unknown = getToolsForFeatures({ isCloud: true })
+ for (const tool of [...memberAndDefaultTools, ...roleTools]) {
+ expect(unknown).toContain(tool)
+ }
+ })
+})