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): stop URL fallback from poaching ops owned by another product (#63199)

Ben Whitef48c9aeade4e
diff --git a/products/alerts/mcp/tools.yaml b/products/alerts/mcp/tools.yaml
index ee447c06c03d..fc0783b263c1 100644
--- a/products/alerts/mcp/tools.yaml
+++ b/products/alerts/mcp/tools.yaml
@@ -140,36 +140,3 @@ tools:
insights-thresholds-retrieve:
operation: insights_thresholds_retrieve
enabled: false
- logs-alerts-create:
- operation: logs_alerts_create
- enabled: false
- logs-alerts-destinations-create:
- operation: logs_alerts_destinations_create
- enabled: false
- logs-alerts-destinations-delete-create:
- operation: logs_alerts_destinations_delete_create
- enabled: false
- logs-alerts-destroy:
- operation: logs_alerts_destroy
- enabled: false
- logs-alerts-events-list:
- operation: logs_alerts_events_list
- enabled: false
- logs-alerts-list:
- operation: logs_alerts_list
- enabled: false
- logs-alerts-partial-update:
- operation: logs_alerts_partial_update
- enabled: false
- logs-alerts-reset-create:
- operation: logs_alerts_reset_create
- enabled: false
- logs-alerts-retrieve:
- operation: logs_alerts_retrieve
- enabled: false
- logs-alerts-simulate-create:
- operation: logs_alerts_simulate_create
- enabled: false
- logs-alerts-update:
- operation: logs_alerts_update
- enabled: false
diff --git a/products/cohorts/mcp/tools.yaml b/products/cohorts/mcp/tools.yaml
index 8c69bf7f8bca..44861b988241 100644
--- a/products/cohorts/mcp/tools.yaml
+++ b/products/cohorts/mcp/tools.yaml
@@ -233,6 +233,3 @@ tools:
cohorts-used-in-retrieve:
operation: cohorts_used_in_retrieve
enabled: false
- persons-cohorts-retrieve:
- operation: persons_cohorts_retrieve
- enabled: false
diff --git a/products/dashboards/mcp/tools.yaml b/products/dashboards/mcp/tools.yaml
index 3fbd10662445..84c0117637a7 100644
--- a/products/dashboards/mcp/tools.yaml
+++ b/products/dashboards/mcp/tools.yaml
@@ -481,18 +481,6 @@ tools:
param_overrides:
id:
cast: string-int
- dashboards-sharing-list:
- operation: dashboards_sharing_list
- enabled: false
- dashboards-sharing-passwords-create:
- operation: dashboards_sharing_passwords_create
- enabled: false
- dashboards-sharing-passwords-destroy:
- operation: dashboards_sharing_passwords_destroy
- enabled: false
- dashboards-sharing-refresh-create:
- operation: dashboards_sharing_refresh_create
- enabled: false
dashboards-stream-tiles-retrieve:
operation: dashboards_stream_tiles_retrieve
enabled: false
diff --git a/products/integrations/mcp/tools.yaml b/products/integrations/mcp/tools.yaml
index a61c0001a1b8..d6858c6f8aa3 100644
--- a/products/integrations/mcp/tools.yaml
+++ b/products/integrations/mcp/tools.yaml
@@ -174,21 +174,3 @@ tools:
role-external-references-lookup-retrieve:
operation: role_external_references_lookup_retrieve
enabled: false
- users-integrations-github-branches-retrieve:
- operation: users_integrations_github_branches_retrieve
- enabled: false
- users-integrations-github-destroy:
- operation: users_integrations_github_destroy
- enabled: false
- users-integrations-github-repos-refresh-create:
- operation: users_integrations_github_repos_refresh_create
- enabled: false
- users-integrations-github-repos-retrieve:
- operation: users_integrations_github_repos_retrieve
- enabled: false
- users-integrations-github-start-create:
- operation: users_integrations_github_start_create
- enabled: false
- users-integrations-list:
- operation: users_integrations_list
- enabled: false
diff --git a/products/logs/mcp/tools.yaml b/products/logs/mcp/tools.yaml
index 4e8bb56ba5b7..da0f11fb395e 100644
--- a/products/logs/mcp/tools.yaml
+++ b/products/logs/mcp/tools.yaml
@@ -9,30 +9,6 @@ feature: logs
url_prefix: /logs
ui_apps: {}
tools:
- batch-exports-logs-retrieve:
- operation: batch_exports_logs_retrieve
- enabled: false
- batch-exports-runs-logs-retrieve:
- operation: batch_exports_runs_logs_retrieve
- enabled: false
- domains-scim-logs-retrieve:
- operation: domains_scim_logs_retrieve
- enabled: false
- endpoints-logs-retrieve:
- operation: endpoints_logs_retrieve
- enabled: false
- file-download-batch-exports-logs-retrieve:
- operation: file_download_batch_exports_logs_retrieve
- enabled: false
- hog-flow-templates-logs-retrieve:
- operation: hog_flow_templates_logs_retrieve
- enabled: false
- hog-flows-logs-retrieve:
- operation: hog_flows_logs_retrieve
- enabled: false
- hog-functions-logs-retrieve:
- operation: hog_functions_logs_retrieve
- enabled: false
logs-alerts-create:
operation: logs_alerts_create
enabled: true
@@ -443,9 +419,6 @@ tools:
logs-views-update:
operation: logs_views_update
enabled: false
- plugin-configs-logs-list:
- operation: plugin_configs_logs_list
- enabled: false
query-logs:
operation: logs_query_create
enabled: true
diff --git a/products/notebooks/mcp/tools.yaml b/products/notebooks/mcp/tools.yaml
index 73f4e66c2627..c56540172671 100644
--- a/products/notebooks/mcp/tools.yaml
+++ b/products/notebooks/mcp/tools.yaml
@@ -9,18 +9,6 @@ feature: notebooks
url_prefix: /notebooks
ui_apps: {}
tools:
- accounts-notebooks-create:
- operation: accounts_notebooks_create
- enabled: false
- accounts-notebooks-destroy:
- operation: accounts_notebooks_destroy
- enabled: false
- accounts-notebooks-list:
- operation: accounts_notebooks_list
- enabled: false
- accounts-notebooks-retrieve:
- operation: accounts_notebooks_retrieve
- enabled: false
notebooks-activity-retrieve:
operation: notebooks_activity_retrieve
enabled: false
@@ -158,18 +146,6 @@ tools:
description: >
Get a specific notebook by its short_id. Returns the full notebook including title, content, version, and
creation/modification metadata.
- notebooks-sharing-list:
- operation: notebooks_sharing_list
- enabled: false
- notebooks-sharing-passwords-create:
- operation: notebooks_sharing_passwords_create
- enabled: false
- notebooks-sharing-passwords-destroy:
- operation: notebooks_sharing_passwords_destroy
- enabled: false
- notebooks-sharing-refresh-create:
- operation: notebooks_sharing_refresh_create
- enabled: false
notebooks-update:
operation: notebooks_update
enabled: false
diff --git a/products/tasks/mcp/tools.yaml b/products/tasks/mcp/tools.yaml
index 7a709c1e7d6a..a6dbf4103a43 100644
--- a/products/tasks/mcp/tools.yaml
+++ b/products/tasks/mcp/tools.yaml
@@ -180,9 +180,6 @@ tools:
- created_at
- updated_at
- completed_at
- tasks-runs-logs-retrieve:
- operation: tasks_runs_logs_retrieve
- enabled: false
tasks-runs-partial-update:
operation: tasks_runs_partial_update
enabled: false
diff --git a/services/mcp/scripts/scaffold-yaml.ts b/services/mcp/scripts/scaffold-yaml.ts
index d25030435df6..c575da15ccd9 100644
--- a/services/mcp/scripts/scaffold-yaml.ts
+++ b/services/mcp/scripts/scaffold-yaml.ts
@@ -134,7 +134,7 @@ function findOperationsByTag(spec: OpenApiSpec, product: string): DiscoveredOper
* x-product doesn't match, same as generate-openapi-types.mjs
* matchUrlToProduct().
*/
-function findOperationsByUrl(spec: OpenApiSpec, product: string): DiscoveredOperation[] {
+function findOperationsByUrl(spec: OpenApiSpec, product: string, syncedProducts?: Set<string>): DiscoveredOperation[] {
const ops: DiscoveredOperation[] = []
const httpMethods = new Set(['get', 'post', 'put', 'patch', 'delete'])
const productsToMatch = [
@@ -156,6 +156,20 @@ function findOperationsByUrl(spec: OpenApiSpec, product: string): DiscoveredOper
continue
}
+ // Don't let the URL fallback poach an op that another *synced* product
+ // already owns via x-product — e.g. agent .../sessions/{id}/logs/ is
+ // tagged agent_platform but its path matches the logs product. Ops whose
+ // x-product isn't a synced product (e.g. reverse_proxy ops grouped under
+ // the proxy-records definition) still match by path, as do legacy ops
+ // with no x-product.
+ if (syncedProducts) {
+ const normProduct = product.replace(/-/g, '_').toLowerCase()
+ const xProduct = (op['x-product'] ?? []).map((p) => p.replace(/-/g, '_').toLowerCase())
+ if (!xProduct.includes(normProduct) && xProduct.some((p) => syncedProducts.has(p))) {
+ continue
+ }
+ }
+
ops.push({
operationId: op.operationId,
method: method.toUpperCase(),
@@ -175,9 +189,13 @@ function findOperationsByUrl(spec: OpenApiSpec, product: string): DiscoveredOper
* and ViewSets in products/<name>/backend/)
* 2. URL path substring match (fallback for legacy endpoints)
*/
-function findOperationsByProduct(spec: OpenApiSpec, product: string): DiscoveredOperation[] {
+function findOperationsByProduct(
+ spec: OpenApiSpec,
+ product: string,
+ syncedProducts?: Set<string>
+): DiscoveredOperation[] {
const byTag = findOperationsByTag(spec, product)
- const byUrl = findOperationsByUrl(spec, product)
+ const byUrl = findOperationsByUrl(spec, product, syncedProducts)
// Merge, preferring tag-matched ops and deduping by operationId
const seen = new Set(byTag.map((op) => op.operationId))
@@ -440,8 +458,12 @@ function syncAll(spec: OpenApiSpec): void {
const writtenFiles: string[] = []
const noOpsProducts: string[] = []
+ // Every product/definition being synced, normalized. The URL fallback uses this
+ // to avoid poaching an op that another synced product owns via x-product.
+ const syncedProducts = new Set(targets.map((t) => t.product.replace(/-/g, '_').toLowerCase()))
+
for (const { product, filePath, subset } of targets) {
- const rawOps = findOperationsByProduct(spec, product)
+ const rawOps = findOperationsByProduct(spec, product, syncedProducts)
const ops = deduplicateOperations(rawOps)
if (ops.length === 0) {
const label = path.relative(REPO_ROOT, filePath)