: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(billing): explain organization scope for billing mcp 403s (#115094)
posthog[bot]5157c1d3cbd4
diff --git a/products/billing/mcp/tools.yaml b/products/billing/mcp/tools.yamlindex 33d6f6f3bda0..6c59fd79e722 100644--- a/products/billing/mcp/tools.yaml+++ b/products/billing/mcp/tools.yaml@@ -20,8 +20,9 @@ tools:description: >The product features the organization's plans include, with any overrides applied. The cheapest read in thebilling API, readable by any member. Use it to check whether a feature such as group analytics or- white-labelling is available before suggesting it. Beta: behind the organization-billing-api flag, and the- output shape may change while it is.+ white-labelling is available before suggesting it. Needs an API key or OAuth token with organization access,+ because a key limited to specific projects gets a 403. Beta: behind the organization-billing-api flag, and+ the output shape may change while it is.feature_flag: organization-billing-apibilling-forecast-get:operation: billing_forecast_retrieve@@ -36,7 +37,8 @@ tools:description: >Projected usage and amounts for the rest of the billing period, with and without the spend limit, perproduct, add-on and tier, with the four projected totals. Needs full billing access. Use it for "what will- this month cost"; for what has accrued so far call billing-spend-summary-get. Beta: behind the+ this month cost"; for what has accrued so far call billing-spend-summary-get. Needs an API key or OAuth+ token with organization access, because a key limited to specific projects gets a 403. Beta: behind theorganization-billing-api flag, and the output shape may change while it is.feature_flag: organization-billing-apiurl_prefix: /organization/billing/overview@@ -53,8 +55,9 @@ tools:description: >Per product, the spend limit for the current period, a limit deferred to the next period because it was setbelow current spend, spend so far, and whether the limit is reached. Needs full billing access. Use it for- "am I over my spend limit"; the quota limiting state PostHog applies is on billing-usage-summary-get. Beta:- behind the organization-billing-api flag, and the output shape may change while it is.+ "am I over my spend limit"; the quota limiting state PostHog applies is on billing-usage-summary-get. Needs+ an API key or OAuth token with organization access, because a key limited to specific projects gets a 403.+ Beta: behind the organization-billing-api flag, and the output shape may change while it is.feature_flag: organization-billing-apibilling-overview-get:operation: billing_list@@ -119,8 +122,9 @@ tools:description: >One product by key, for example product_analytics or session_replay, with its add-ons, features, priceschedule and subscribed state. Call billing-products-summary-get first to find the key. Pass- include_plans=true for the plan list. Readable by any member. Beta: behind the organization-billing-api- flag, and the output shape may change while it is.+ include_plans=true for the plan list. Readable by any member. Needs an API key or OAuth token with+ organization access, because a key limited to specific projects gets a 403. Beta: behind the+ organization-billing-api flag, and the output shape may change while it is.feature_flag: organization-billing-apibilling-products-summary-get:operation: billing_products_summary_retrieve@@ -137,7 +141,9 @@ tools:product, add-on or feature a question is about. A product or add-on says whether the organization subscribesto it. A feature says whether it is available to the organization, trials and overrides included, and liststhe add-ons that carry it. For prices and plans, pass the product key to billing-product-get. Readable by- any member. Beta: behind the organization-billing-api flag, and the output shape may change while it is.+ any member. Needs an API key or OAuth token with organization access, because a key limited to specific+ projects gets a 403. Beta: behind the organization-billing-api flag, and the output shape may change while+ it is.feature_flag: organization-billing-apiurl_prefix: /organization/billing/overviewbilling-projects-list:@@ -153,7 +159,8 @@ tools:description: >Every project the organization has reported usage for, with its name where it still exists and a deletedmarker where it does not. Use it to learn which project ids a project breakdown or a team_ids filter on- billing-usage-timeseries-get and billing-spend-timeseries-get can name. Beta: behind the+ billing-usage-timeseries-get and billing-spend-timeseries-get can name. Needs an API key or OAuth token with+ organization access, because a key limited to specific projects gets a 403. Beta: behind theorganization-billing-api flag, and the output shape may change while it is.feature_flag: organization-billing-apiurl_prefix: /organization/billing/overview@@ -218,8 +225,9 @@ tools:Amounts accrued so far this billing period, before and after discount, per product, add-on and tier, withthe two totals. An organization total, so it needs full billing access: owners always, and admins whenowner-only billing is off. Use it for "what have we spent so far this month". For the projection to the end- of the period call billing-forecast-get, and for spend over time call billing-spend-timeseries-get. Beta:- behind the organization-billing-api flag, and the output shape may change while it is.+ of the period call billing-forecast-get, and for spend over time call billing-spend-timeseries-get. Needs an+ API key or OAuth token with organization access, because a key limited to specific projects gets a 403.+ Beta: behind the organization-billing-api flag, and the output shape may change while it is.feature_flag: organization-billing-apiurl_prefix: /organization/billing/spendbilling-spend-timeseries-get:@@ -239,8 +247,9 @@ tools:usage and spend reads. That member grant covers the series only, not the totals onbilling-spend-summary-get. Use it to investigate a cost spike, compare periods, or attribute spend toproducts or projects. For spend so far this period call billing-spend-summary-get, and for quantities call- billing-usage-timeseries-get. Beta: behind the organization-billing-api flag, and the output shape may- change while it is.+ billing-usage-timeseries-get. Needs an API key or OAuth token with organization access, because a key+ limited to specific projects gets a 403. Beta: behind the organization-billing-api flag, and the output+ shape may change while it is.param_overrides:team_ids:description: >@@ -292,7 +301,8 @@ tools:startup program labels and billing provider. One small read, readable by any member. Use it to answer "whatplan is this organization on", "when does the billing period end" or "is there an active trial". For usageagainst limits call billing-usage-summary-get; to find a product, add-on or feature call- billing-products-summary-get; for feature access call billing-features-get. Beta: behind the+ billing-products-summary-get; for feature access call billing-features-get. Needs an API key or OAuth token+ with organization access, because a key limited to specific projects gets a 403. Beta: behind theorganization-billing-api flag, and the output shape may change while it is.feature_flag: organization-billing-apiurl_prefix: /organization/billing/overview@@ -362,8 +372,9 @@ tools:description: >Per product and add-on: the limit in effect, whether usage is over or approaching it, and whether theresource is being limited right now. No counts, so any member can read it. Use it for "am I near my events- limit" or "is ingestion being limited"; for the counts call billing-usage-summary-get. Beta: behind the- organization-billing-api flag, and the output shape may change while it is.+ limit" or "is ingestion being limited"; for the counts call billing-usage-summary-get. Needs an API key or+ OAuth token with organization access, because a key limited to specific projects gets a 403. Beta: behind+ the organization-billing-api flag, and the output shape may change while it is.feature_flag: organization-billing-apiurl_prefix: /organization/billing/usagebilling-usage-summary-get:@@ -383,8 +394,9 @@ tools:last date the usage reports cover. It is an organization total, so it needs full billing access.billing-usage-timeseries-get reads the same numbers per project with usage read access, andbilling-usage-status-get is the read for members. Use it for "how many events have we used". For amounts- call billing-spend-summary-get, and for usage over time call billing-usage-timeseries-get. Beta: behind the- organization-billing-api flag, and the output shape may change while it is.+ call billing-spend-summary-get, and for usage over time call billing-usage-timeseries-get. Needs an API key+ or OAuth token with organization access, because a key limited to specific projects gets a 403. Beta: behind+ the organization-billing-api flag, and the output shape may change while it is.feature_flag: organization-billing-apiurl_prefix: /organization/billing/usagebilling-usage-timeseries-get:@@ -404,8 +416,9 @@ tools:usage and spend reads. That member grant covers the series only, not the totals onbilling-usage-summary-get. Use it to investigate a usage spike, compare periods, or attribute usage toprojects. For usage so far this period call billing-usage-summary-get, and for dollar amounts call- billing-spend-timeseries-get. Beta: behind the organization-billing-api flag, and the output shape may- change while it is.+ billing-spend-timeseries-get. Needs an API key or OAuth token with organization access, because a key+ limited to specific projects gets a 403. Beta: behind the organization-billing-api flag, and the output+ shape may change while it is.param_overrides:team_ids:description: >diff --git a/services/mcp/schema/generated-tool-definitions.json b/services/mcp/schema/generated-tool-definitions.jsonindex d97b51c5021d..beaab1c4f7ea 100644--- a/services/mcp/schema/generated-tool-definitions.json+++ b/services/mcp/schema/generated-tool-definitions.json@@ -1520,7 +1520,7 @@}},"billing-features-get": {- "description": "The product features the organization's plans include, with any overrides applied. The cheapest read in the billing API, readable by any member. Use it to check whether a feature such as group analytics or white-labelling is available before suggesting it. Beta: behind the organization-billing-api flag, and the output shape may change while it is.",+ "description": "The product features the organization's plans include, with any overrides applied. The cheapest read in the billing API, readable by any member. Use it to check whether a feature such as group analytics or white-labelling is available before suggesting it. Needs an API key or OAuth token with organization access, because a key limited to specific projects gets a 403. Beta: behind the organization-billing-api flag, and the output shape may change while it is.","category": "Billing","feature": "billing","summary": "Get available features",@@ -1535,7 +1535,7 @@"feature_flag": "organization-billing-api"},"billing-forecast-get": {- "description": "Projected usage and amounts for the rest of the billing period, with and without the spend limit, per product, add-on and tier, with the four projected totals. Needs full billing access. Use it for \"what will this month cost\"; for what has accrued so far call billing-spend-summary-get. Beta: behind the organization-billing-api flag, and the output shape may change while it is.",+ "description": "Projected usage and amounts for the rest of the billing period, with and without the spend limit, per product, add-on and tier, with the four projected totals. Needs full billing access. Use it for \"what will this month cost\"; for what has accrued so far call billing-spend-summary-get. Needs an API key or OAuth token with organization access, because a key limited to specific projects gets a 403. Beta: behind the organization-billing-api flag, and the output shape may change while it is.","category": "Billing","feature": "billing","summary": "Get the forecast for this billing period",@@ -1550,7 +1550,7 @@"feature_flag": "organization-billing-api"},"billing-limits-get": {- "description": "Per product, the spend limit for the current period, a limit deferred to the next period because it was set below current spend, spend so far, and whether the limit is reached. Needs full billing access. Use it for \"am I over my spend limit\"; the quota limiting state PostHog applies is on billing-usage-summary-get. Beta: behind the organization-billing-api flag, and the output shape may change while it is.",+ "description": "Per product, the spend limit for the current period, a limit deferred to the next period because it was set below current spend, spend so far, and whether the limit is reached. Needs full billing access. Use it for \"am I over my spend limit\"; the quota limiting state PostHog applies is on billing-usage-summary-get. Needs an API key or OAuth token with organization access, because a key limited to specific projects gets a 403. Beta: behind the organization-billing-api flag, and the output shape may change while it is.","category": "Billing","feature": "billing","summary": "Get spend limits",@@ -1579,7 +1579,7 @@}},"billing-product-get": {- "description": "One product by key, for example product_analytics or session_replay, with its add-ons, features, price schedule and subscribed state. Call billing-products-summary-get first to find the key. Pass include_plans=true for the plan list. Readable by any member. Beta: behind the organization-billing-api flag, and the output shape may change while it is.",+ "description": "One product by key, for example product_analytics or session_replay, with its add-ons, features, price schedule and subscribed state. Call billing-products-summary-get first to find the key. Pass include_plans=true for the plan list. Readable by any member. Needs an API key or OAuth token with organization access, because a key limited to specific projects gets a 403. Beta: behind the organization-billing-api flag, and the output shape may change while it is.","category": "Billing","feature": "billing","summary": "Get one product",@@ -1594,7 +1594,7 @@"feature_flag": "organization-billing-api"},"billing-products-summary-get": {- "description": "Every product with its add-ons and the names of its features, without prices or plans. Use it to find the product, add-on or feature a question is about. A product or add-on says whether the organization subscribes to it. A feature says whether it is available to the organization, trials and overrides included, and lists the add-ons that carry it. For prices and plans, pass the product key to billing-product-get. Readable by any member. Beta: behind the organization-billing-api flag, and the output shape may change while it is.",+ "description": "Every product with its add-ons and the names of its features, without prices or plans. Use it to find the product, add-on or feature a question is about. A product or add-on says whether the organization subscribes to it. A feature says whether it is available to the organization, trials and overrides included, and lists the add-ons that carry it. For prices and plans, pass the product key to billing-product-get. Readable by any member. Needs an API key or OAuth token with organization access, because a key limited to specific projects gets a 403. Beta: behind the organization-billing-api flag, and the output shape may change while it is.","category": "Billing","feature": "billing","summary": "Get every product in summary",@@ -1609,7 +1609,7 @@"feature_flag": "organization-billing-api"},"billing-projects-list": {- "description": "Every project the organization has reported usage for, with its name where it still exists and a deleted marker where it does not. Use it to learn which project ids a project breakdown or a team_ids filter on billing-usage-timeseries-get and billing-spend-timeseries-get can name. Beta: behind the organization-billing-api flag, and the output shape may change while it is.",+ "description": "Every project the organization has reported usage for, with its name where it still exists and a deleted marker where it does not. Use it to learn which project ids a project breakdown or a team_ids filter on billing-usage-timeseries-get and billing-spend-timeseries-get can name. Needs an API key or OAuth token with organization access, because a key limited to specific projects gets a 403. Beta: behind the organization-billing-api flag, and the output shape may change while it is.","category": "Billing","feature": "billing","summary": "List projects with usage",@@ -1638,7 +1638,7 @@}},"billing-spend-summary-get": {- "description": "Amounts accrued so far this billing period, before and after discount, per product, add-on and tier, with the two totals. An organization total, so it needs full billing access: owners always, and admins when owner-only billing is off. Use it for \"what have we spent so far this month\". For the projection to the end of the period call billing-forecast-get, and for spend over time call billing-spend-timeseries-get. Beta: behind the organization-billing-api flag, and the output shape may change while it is.",+ "description": "Amounts accrued so far this billing period, before and after discount, per product, add-on and tier, with the two totals. An organization total, so it needs full billing access: owners always, and admins when owner-only billing is off. Use it for \"what have we spent so far this month\". For the projection to the end of the period call billing-forecast-get, and for spend over time call billing-spend-timeseries-get. Needs an API key or OAuth token with organization access, because a key limited to specific projects gets a 403. Beta: behind the organization-billing-api flag, and the output shape may change while it is.","category": "Billing","feature": "billing","summary": "Get spend this billing period",@@ -1653,7 +1653,7 @@"feature_flag": "organization-billing-api"},"billing-spend-timeseries-get": {- "description": "Spend over time as dollar amounts, per product and per project. Pages by limit and cursor, and returns only the projects the caller can see. Needs usage read access. Owners always have it, and admins have it when owner-only billing is off. Members have it when owner-only billing is off and the organization allows member usage and spend reads. That member grant covers the series only, not the totals on billing-spend-summary-get. Use it to investigate a cost spike, compare periods, or attribute spend to products or projects. For spend so far this period call billing-spend-summary-get, and for quantities call billing-usage-timeseries-get. Beta: behind the organization-billing-api flag, and the output shape may change while it is.",+ "description": "Spend over time as dollar amounts, per product and per project. Pages by limit and cursor, and returns only the projects the caller can see. Needs usage read access. Owners always have it, and admins have it when owner-only billing is off. Members have it when owner-only billing is off and the organization allows member usage and spend reads. That member grant covers the series only, not the totals on billing-spend-summary-get. Use it to investigate a cost spike, compare periods, or attribute spend to products or projects. For spend so far this period call billing-spend-summary-get, and for quantities call billing-usage-timeseries-get. Needs an API key or OAuth token with organization access, because a key limited to specific projects gets a 403. Beta: behind the organization-billing-api flag, and the output shape may change while it is.","category": "Billing","feature": "billing","summary": "Get spend over time by project",@@ -1668,7 +1668,7 @@"feature_flag": "organization-billing-api"},"billing-subscription-get": {- "description": "The organization's subscription: plan, subscription flag and level, billing period, trial, discounts, startup program labels and billing provider. One small read, readable by any member. Use it to answer \"what plan is this organization on\", \"when does the billing period end\" or \"is there an active trial\". For usage against limits call billing-usage-summary-get; to find a product, add-on or feature call billing-products-summary-get; for feature access call billing-features-get. Beta: behind the organization-billing-api flag, and the output shape may change while it is.",+ "description": "The organization's subscription: plan, subscription flag and level, billing period, trial, discounts, startup program labels and billing provider. One small read, readable by any member. Use it to answer \"what plan is this organization on\", \"when does the billing period end\" or \"is there an active trial\". For usage against limits call billing-usage-summary-get; to find a product, add-on or feature call billing-products-summary-get; for feature access call billing-features-get. Needs an API key or OAuth token with organization access, because a key limited to specific projects gets a 403. Beta: behind the organization-billing-api flag, and the output shape may change while it is.","category": "Billing","feature": "billing","summary": "Get subscription",@@ -1697,7 +1697,7 @@}},"billing-usage-status-get": {- "description": "Per product and add-on: the limit in effect, whether usage is over or approaching it, and whether the resource is being limited right now. No counts, so any member can read it. Use it for \"am I near my events limit\" or \"is ingestion being limited\"; for the counts call billing-usage-summary-get. Beta: behind the organization-billing-api flag, and the output shape may change while it is.",+ "description": "Per product and add-on: the limit in effect, whether usage is over or approaching it, and whether the resource is being limited right now. No counts, so any member can read it. Use it for \"am I near my events limit\" or \"is ingestion being limited\"; for the counts call billing-usage-summary-get. Needs an API key or OAuth token with organization access, because a key limited to specific projects gets a 403. Beta: behind the organization-billing-api flag, and the output shape may change while it is.","category": "Billing","feature": "billing","summary": "Get usage limit status",@@ -1712,7 +1712,7 @@"feature_flag": "organization-billing-api"},"billing-usage-summary-get": {- "description": "Usage so far this billing period. Per usage key it returns the usage, the limit in effect and today's usage where PostHog tracks it. It also says whether PostHog is limiting the resource right now. Per product and add-on it returns the current usage, limit, ratio and over-limit flag. It returns quantities only, with the last date the usage reports cover. It is an organization total, so it needs full billing access. billing-usage-timeseries-get reads the same numbers per project with usage read access, and billing-usage-status-get is the read for members. Use it for \"how many events have we used\". For amounts call billing-spend-summary-get, and for usage over time call billing-usage-timeseries-get. Beta: behind the organization-billing-api flag, and the output shape may change while it is.",+ "description": "Usage so far this billing period. Per usage key it returns the usage, the limit in effect and today's usage where PostHog tracks it. It also says whether PostHog is limiting the resource right now. Per product and add-on it returns the current usage, limit, ratio and over-limit flag. It returns quantities only, with the last date the usage reports cover. It is an organization total, so it needs full billing access. billing-usage-timeseries-get reads the same numbers per project with usage read access, and billing-usage-status-get is the read for members. Use it for \"how many events have we used\". For amounts call billing-spend-summary-get, and for usage over time call billing-usage-timeseries-get. Needs an API key or OAuth token with organization access, because a key limited to specific projects gets a 403. Beta: behind the organization-billing-api flag, and the output shape may change while it is.","category": "Billing","feature": "billing","summary": "Get usage this billing period",@@ -1727,7 +1727,7 @@"feature_flag": "organization-billing-api"},"billing-usage-timeseries-get": {- "description": "Usage over time as quantities, per usage type and per project. Pages by limit and cursor, and returns only the projects the caller can see. Needs usage read access. Owners always have it, and admins have it when owner-only billing is off. Members have it when owner-only billing is off and the organization allows member usage and spend reads. That member grant covers the series only, not the totals on billing-usage-summary-get. Use it to investigate a usage spike, compare periods, or attribute usage to projects. For usage so far this period call billing-usage-summary-get, and for dollar amounts call billing-spend-timeseries-get. Beta: behind the organization-billing-api flag, and the output shape may change while it is.",+ "description": "Usage over time as quantities, per usage type and per project. Pages by limit and cursor, and returns only the projects the caller can see. Needs usage read access. Owners always have it, and admins have it when owner-only billing is off. Members have it when owner-only billing is off and the organization allows member usage and spend reads. That member grant covers the series only, not the totals on billing-usage-summary-get. Use it to investigate a usage spike, compare periods, or attribute usage to projects. For usage so far this period call billing-usage-summary-get, and for dollar amounts call billing-spend-timeseries-get. Needs an API key or OAuth token with organization access, because a key limited to specific projects gets a 403. Beta: behind the organization-billing-api flag, and the output shape may change while it is.","category": "Billing","feature": "billing","summary": "Get usage over time by project",diff --git a/services/mcp/schema/tool-definitions-all.json b/services/mcp/schema/tool-definitions-all.jsonindex 0bfbb40ae2fc..9fda99fd762f 100644--- a/services/mcp/schema/tool-definitions-all.json+++ b/services/mcp/schema/tool-definitions-all.json@@ -1535,7 +1535,7 @@}},"billing-features-get": {- "description": "The product features the organization's plans include, with any overrides applied. The cheapest read in the billing API, readable by any member. Use it to check whether a feature such as group analytics or white-labelling is available before suggesting it. Beta: behind the organization-billing-api flag, and the output shape may change while it is.",+ "description": "The product features the organization's plans include, with any overrides applied. The cheapest read in the billing API, readable by any member. Use it to check whether a feature such as group analytics or white-labelling is available before suggesting it. Needs an API key or OAuth token with organization access, because a key limited to specific projects gets a 403. Beta: behind the organization-billing-api flag, and the output shape may change while it is.","category": "Billing","feature": "billing","summary": "Get available features",@@ -1550,7 +1550,7 @@"feature_flag": "organization-billing-api"},"billing-forecast-get": {- "description": "Projected usage and amounts for the rest of the billing period, with and without the spend limit, per product, add-on and tier, with the four projected totals. Needs full billing access. Use it for \"what will this month cost\"; for what has accrued so far call billing-spend-summary-get. Beta: behind the organization-billing-api flag, and the output shape may change while it is.",+ "description": "Projected usage and amounts for the rest of the billing period, with and without the spend limit, per product, add-on and tier, with the four projected totals. Needs full billing access. Use it for \"what will this month cost\"; for what has accrued so far call billing-spend-summary-get. Needs an API key or OAuth token with organization access, because a key limited to specific projects gets a 403. Beta: behind the organization-billing-api flag, and the output shape may change while it is.","category": "Billing","feature": "billing","summary": "Get the forecast for this billing period",@@ -1565,7 +1565,7 @@"feature_flag": "organization-billing-api"},"billing-limits-get": {- "description": "Per product, the spend limit for the current period, a limit deferred to the next period because it was set below current spend, spend so far, and whether the limit is reached. Needs full billing access. Use it for \"am I over my spend limit\"; the quota limiting state PostHog applies is on billing-usage-summary-get. Beta: behind the organization-billing-api flag, and the output shape may change while it is.",+ "description": "Per product, the spend limit for the current period, a limit deferred to the next period because it was set below current spend, spend so far, and whether the limit is reached. Needs full billing access. Use it for \"am I over my spend limit\"; the quota limiting state PostHog applies is on billing-usage-summary-get. Needs an API key or OAuth token with organization access, because a key limited to specific projects gets a 403. Beta: behind the organization-billing-api flag, and the output shape may change while it is.","category": "Billing","feature": "billing","summary": "Get spend limits",@@ -1594,7 +1594,7 @@}},"billing-product-get": {- "description": "One product by key, for example product_analytics or session_replay, with its add-ons, features, price schedule and subscribed state. Call billing-products-summary-get first to find the key. Pass include_plans=true for the plan list. Readable by any member. Beta: behind the organization-billing-api flag, and the output shape may change while it is.",+ "description": "One product by key, for example product_analytics or session_replay, with its add-ons, features, price schedule and subscribed state. Call billing-products-summary-get first to find the key. Pass include_plans=true for the plan list. Readable by any member. Needs an API key or OAuth token with organization access, because a key limited to specific projects gets a 403. Beta: behind the organization-billing-api flag, and the output shape may change while it is.","category": "Billing","feature": "billing","summary": "Get one product",@@ -1609,7 +1609,7 @@"feature_flag": "organization-billing-api"},"billing-products-summary-get": {- "description": "Every product with its add-ons and the names of its features, without prices or plans. Use it to find the product, add-on or feature a question is about. A product or add-on says whether the organization subscribes to it. A feature says whether it is available to the organization, trials and overrides included, and lists the add-ons that carry it. For prices and plans, pass the product key to billing-product-get. Readable by any member. Beta: behind the organization-billing-api flag, and the output shape may change while it is.",+ "description": "Every product with its add-ons and the names of its features, without prices or plans. Use it to find the product, add-on or feature a question is about. A product or add-on says whether the organization subscribes to it. A feature says whether it is available to the organization, trials and overrides included, and lists the add-ons that carry it. For prices and plans, pass the product key to billing-product-get. Readable by any member. Needs an API key or OAuth token with organization access, because a key limited to specific projects gets a 403. Beta: behind the organization-billing-api flag, and the output shape may change while it is.","category": "Billing","feature": "billing","summary": "Get every product in summary",@@ -1624,7 +1624,7 @@"feature_flag": "organization-billing-api"},"billing-projects-list": {- "description": "Every project the organization has reported usage for, with its name where it still exists and a deleted marker where it does not. Use it to learn which project ids a project breakdown or a team_ids filter on billing-usage-timeseries-get and billing-spend-timeseries-get can name. Beta: behind the organization-billing-api flag, and the output shape may change while it is.",+ "description": "Every project the organization has reported usage for, with its name where it still exists and a deleted marker where it does not. Use it to learn which project ids a project breakdown or a team_ids filter on billing-usage-timeseries-get and billing-spend-timeseries-get can name. Needs an API key or OAuth token with organization access, because a key limited to specific projects gets a 403. Beta: behind the organization-billing-api flag, and the output shape may change while it is.","category": "Billing","feature": "billing","summary": "List projects with usage",@@ -1653,7 +1653,7 @@}},"billing-spend-summary-get": {- "description": "Amounts accrued so far this billing period, before and after discount, per product, add-on and tier, with the two totals. An organization total, so it needs full billing access: owners always, and admins when owner-only billing is off. Use it for \"what have we spent so far this month\". For the projection to the end of the period call billing-forecast-get, and for spend over time call billing-spend-timeseries-get. Beta: behind the organization-billing-api flag, and the output shape may change while it is.",+ "description": "Amounts accrued so far this billing period, before and after discount, per product, add-on and tier, with the two totals. An organization total, so it needs full billing access: owners always, and admins when owner-only billing is off. Use it for \"what have we spent so far this month\". For the projection to the end of the period call billing-forecast-get, and for spend over time call billing-spend-timeseries-get. Needs an API key or OAuth token with organization access, because a key limited to specific projects gets a 403. Beta: behind the organization-billing-api flag, and the output shape may change while it is.","category": "Billing","feature": "billing","summary": "Get spend this billing period",@@ -1668,7 +1668,7 @@"feature_flag": "organization-billing-api"},"billing-spend-timeseries-get": {- "description": "Spend over time as dollar amounts, per product and per project. Pages by limit and cursor, and returns only the projects the caller can see. Needs usage read access. Owners always have it, and admins have it when owner-only billing is off. Members have it when owner-only billing is off and the organization allows member usage and spend reads. That member grant covers the series only, not the totals on billing-spend-summary-get. Use it to investigate a cost spike, compare periods, or attribute spend to products or projects. For spend so far this period call billing-spend-summary-get, and for quantities call billing-usage-timeseries-get. Beta: behind the organization-billing-api flag, and the output shape may change while it is.",+ "description": "Spend over time as dollar amounts, per product and per project. Pages by limit and cursor, and returns only the projects the caller can see. Needs usage read access. Owners always have it, and admins have it when owner-only billing is off. Members have it when owner-only billing is off and the organization allows member usage and spend reads. That member grant covers the series only, not the totals on billing-spend-summary-get. Use it to investigate a cost spike, compare periods, or attribute spend to products or projects. For spend so far this period call billing-spend-summary-get, and for quantities call billing-usage-timeseries-get. Needs an API key or OAuth token with organization access, because a key limited to specific projects gets a 403. Beta: behind the organization-billing-api flag, and the output shape may change while it is.","category": "Billing","feature": "billing","summary": "Get spend over time by project",@@ -1683,7 +1683,7 @@"feature_flag": "organization-billing-api"},"billing-subscription-get": {- "description": "The organization's subscription: plan, subscription flag and level, billing period, trial, discounts, startup program labels and billing provider. One small read, readable by any member. Use it to answer \"what plan is this organization on\", \"when does the billing period end\" or \"is there an active trial\". For usage against limits call billing-usage-summary-get; to find a product, add-on or feature call billing-products-summary-get; for feature access call billing-features-get. Beta: behind the organization-billing-api flag, and the output shape may change while it is.",+ "description": "The organization's subscription: plan, subscription flag and level, billing period, trial, discounts, startup program labels and billing provider. One small read, readable by any member. Use it to answer \"what plan is this organization on\", \"when does the billing period end\" or \"is there an active trial\". For usage against limits call billing-usage-summary-get; to find a product, add-on or feature call billing-products-summary-get; for feature access call billing-features-get. Needs an API key or OAuth token with organization access, because a key limited to specific projects gets a 403. Beta: behind the organization-billing-api flag, and the output shape may change while it is.","category": "Billing","feature": "billing","summary": "Get subscription",@@ -1712,7 +1712,7 @@}},"billing-usage-status-get": {- "description": "Per product and add-on: the limit in effect, whether usage is over or approaching it, and whether the resource is being limited right now. No counts, so any member can read it. Use it for \"am I near my events limit\" or \"is ingestion being limited\"; for the counts call billing-usage-summary-get. Beta: behind the organization-billing-api flag, and the output shape may change while it is.",+ "description": "Per product and add-on: the limit in effect, whether usage is over or approaching it, and whether the resource is being limited right now. No counts, so any member can read it. Use it for \"am I near my events limit\" or \"is ingestion being limited\"; for the counts call billing-usage-summary-get. Needs an API key or OAuth token with organization access, because a key limited to specific projects gets a 403. Beta: behind the organization-billing-api flag, and the output shape may change while it is.","category": "Billing","feature": "billing","summary": "Get usage limit status",@@ -1727,7 +1727,7 @@"feature_flag": "organization-billing-api"},"billing-usage-summary-get": {- "description": "Usage so far this billing period. Per usage key it returns the usage, the limit in effect and today's usage where PostHog tracks it. It also says whether PostHog is limiting the resource right now. Per product and add-on it returns the current usage, limit, ratio and over-limit flag. It returns quantities only, with the last date the usage reports cover. It is an organization total, so it needs full billing access. billing-usage-timeseries-get reads the same numbers per project with usage read access, and billing-usage-status-get is the read for members. Use it for \"how many events have we used\". For amounts call billing-spend-summary-get, and for usage over time call billing-usage-timeseries-get. Beta: behind the organization-billing-api flag, and the output shape may change while it is.",+ "description": "Usage so far this billing period. Per usage key it returns the usage, the limit in effect and today's usage where PostHog tracks it. It also says whether PostHog is limiting the resource right now. Per product and add-on it returns the current usage, limit, ratio and over-limit flag. It returns quantities only, with the last date the usage reports cover. It is an organization total, so it needs full billing access. billing-usage-timeseries-get reads the same numbers per project with usage read access, and billing-usage-status-get is the read for members. Use it for \"how many events have we used\". For amounts call billing-spend-summary-get, and for usage over time call billing-usage-timeseries-get. Needs an API key or OAuth token with organization access, because a key limited to specific projects gets a 403. Beta: behind the organization-billing-api flag, and the output shape may change while it is.","category": "Billing","feature": "billing","summary": "Get usage this billing period",@@ -1742,7 +1742,7 @@"feature_flag": "organization-billing-api"},"billing-usage-timeseries-get": {- "description": "Usage over time as quantities, per usage type and per project. Pages by limit and cursor, and returns only the projects the caller can see. Needs usage read access. Owners always have it, and admins have it when owner-only billing is off. Members have it when owner-only billing is off and the organization allows member usage and spend reads. That member grant covers the series only, not the totals on billing-usage-summary-get. Use it to investigate a usage spike, compare periods, or attribute usage to projects. For usage so far this period call billing-usage-summary-get, and for dollar amounts call billing-spend-timeseries-get. Beta: behind the organization-billing-api flag, and the output shape may change while it is.",+ "description": "Usage over time as quantities, per usage type and per project. Pages by limit and cursor, and returns only the projects the caller can see. Needs usage read access. Owners always have it, and admins have it when owner-only billing is off. Members have it when owner-only billing is off and the organization allows member usage and spend reads. That member grant covers the series only, not the totals on billing-usage-summary-get. Use it to investigate a usage spike, compare periods, or attribute usage to projects. For usage so far this period call billing-usage-summary-get, and for dollar amounts call billing-spend-timeseries-get. Needs an API key or OAuth token with organization access, because a key limited to specific projects gets a 403. Beta: behind the organization-billing-api flag, and the output shape may change while it is.","category": "Billing","feature": "billing","summary": "Get usage over time by project",diff --git a/services/mcp/src/lib/errors.ts b/services/mcp/src/lib/errors.tsindex d3cd094975e3..0792d3876264 100644--- a/services/mcp/src/lib/errors.ts+++ b/services/mcp/src/lib/errors.ts@@ -438,6 +438,19 @@ export function formatPermissionErrorMessage(error: PostHogPermissionError): str].join('\n')}+ // The backend sends this detail when a token restricted to some projects calls an organization endpoint.+ if (error.detail.includes('API keys with scoped projects are only supported on project-based endpoints')) {+ return [+ `PostHog API permission denied: ${error.detail}`,+ '',+ `The request to ${callTarget} was rejected with HTTP 403. This is an organization endpoint, and your API key or OAuth token is limited to specific projects. More project access does not fix this.`,+ '',+ 'To fix: use a Personal API key or OAuth token with organization access. In PostHog, open User settings → Personal API keys and set the key access to "All access" or "Organizations" (with this organization), not "Projects".',+ '',+ `See: ${PERSONAL_API_KEY_DOCS_URL}`,+ ].join('\n')+ }+return [`PostHog API permission denied: ${error.detail}`,'',diff --git a/services/mcp/tests/unit/permission-errors.test.ts b/services/mcp/tests/unit/permission-errors.test.tsindex d14b493102da..9d12d31d845b 100644--- a/services/mcp/tests/unit/permission-errors.test.ts+++ b/services/mcp/tests/unit/permission-errors.test.ts@@ -84,6 +84,20 @@ describe('formatPermissionErrorMessage', () => {expect(text).toContain('PostHog API permission denied')expect(text).toContain('HTTP 403')})++ it('tells a project-scoped token to use organization access on an organization endpoint', () => {+ const error = new PostHogPermissionError({+ detail: 'API keys with scoped projects are only supported on project-based endpoints.',+ url: 'https://us.posthog.com/api/organizations/abc/billing/subscription/',+ method: 'GET',+ })++ const text = formatPermissionErrorMessage(error)++ expect(text).toContain('organization endpoint')+ expect(text).toContain('"All access"')+ expect(text).not.toContain('have access to this project')+ })})describe('buildInsufficientScopeChallenge', () => {