: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
feat(mcp-registry): make discovery reachable by agents and people (#95309)
Daniel Visca3b67969de0be
diff --git a/frontend/package.json b/frontend/package.jsonindex 6d13290b388f..d1bfd00f1386 100644--- a/frontend/package.json+++ b/frontend/package.json@@ -119,6 +119,7 @@"@posthog/products-managed-migrations": "workspace:*","@posthog/products-marketing-analytics": "workspace:*","@posthog/products-mcp-analytics": "workspace:*",+ "@posthog/products-mcp-registry": "workspace:*","@posthog/products-mcp-store": "workspace:*","@posthog/products-messaging": "workspace:*","@posthog/products-metrics": "workspace:*",diff --git a/frontend/src/lib/agentScopes.generated.ts b/frontend/src/lib/agentScopes.generated.tsindex 3edce00fead2..5b9d0e2a69eb 100644--- a/frontend/src/lib/agentScopes.generated.ts+++ b/frontend/src/lib/agentScopes.generated.ts@@ -93,6 +93,7 @@ export const AGENT_USE_CASE_SCOPES = ['marketing_analytics:write','mcp_analytics:read','mcp_analytics:write',+ 'mcp_registry:read','metrics:read','notebook:read','notebook:write',diff --git a/frontend/src/productScenes.tsx b/frontend/src/productScenes.tsxindex 1c303cd1eed5..f0bb5d7e28e1 100644--- a/frontend/src/productScenes.tsx+++ b/frontend/src/productScenes.tsx@@ -116,6 +116,7 @@ export const productScenes: Record<string, () => Promise<any>> = {ManagedMigrationNew: () => import('../../products/managed_migrations/frontend/ManagedMigration'),MCPAnalytics: () => import('../../products/mcp_analytics/frontend/MCPAnalyticsScene'),MCPAnalyticsToolDetail: () => import('../../products/mcp_analytics/frontend/MCPAnalyticsToolDetail'),+ MCPRegistry: () => import('../../products/mcp_registry/frontend/MCPRegistryScene'),McpGateway: () => import('../../products/mcp_store/frontend/gateway/McpGatewayScene'),McpGatewayServer: () => import('../../products/mcp_store/frontend/gateway/GatewayServerScene'),McpGatewayAgent: () => import('../../products/mcp_store/frontend/gateway/GatewayAgentScene'),diff --git a/frontend/src/products.tsx b/frontend/src/products.tsxindex bd4eb08ac92f..9e8f95f9b0de 100644--- a/frontend/src/products.tsx+++ b/frontend/src/products.tsx@@ -197,6 +197,7 @@ export const productRoutes: Record<string, [string, string]> = {'/mcp-analytics/intent-clustering': ['MCPAnalytics', 'mcpAnalyticsIntentClustering'],'/mcp-analytics/missing-capabilities': ['MCPAnalytics', 'mcpAnalyticsMissingCapabilities'],'/mcp-analytics/notifications': ['MCPAnalytics', 'mcpAnalyticsNotifications'],+ '/mcp-registry': ['MCPRegistry', 'mcpRegistry'],'/mcp-servers/server/:id': ['McpGatewayServer', 'mcpGatewayServer'],'/mcp-servers/agent/:id': ['McpGatewayAgent', 'mcpGatewayAgent'],'/mcp-servers/member/:id': ['McpGatewayMember', 'mcpGatewayMember'],@@ -827,6 +828,11 @@ export const productConfiguration: Record<string, any> = {layout: 'app-container',iconType: 'mcp_analytics',},+ MCPRegistry: {+ name: 'MCP registry',+ projectBased: true,+ description: 'Find an MCP server for a task, ranked by whether it answers and how well it works.',+ },McpGateway: {projectBased: true,name: 'MCP servers',@@ -1364,6 +1370,7 @@ export const productUrls = {mcpAnalyticsIntentClustering: (): string => '/mcp-analytics/intent-clustering',mcpAnalyticsMissingCapabilities: (): string => '/mcp-analytics/missing-capabilities',mcpAnalyticsNotifications: (): string => '/mcp-analytics/notifications',+ mcpRegistry: (): string => '/mcp-registry',mcpGateway: (): string => '/mcp-servers',mcpGatewayTab: (tab: string): string => `/mcp-servers/${tab}`,mcpGatewayServer: (id: string, scope?: string): string =>diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex 702a67617bbe..a458a44c2812 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -749,6 +749,9 @@ importers:'@posthog/products-mcp-analytics':specifier: workspace:*version: link:../products/mcp_analytics+ '@posthog/products-mcp-registry':+ specifier: workspace:*+ version: link:../products/mcp_registry'@posthog/products-mcp-store':specifier: workspace:*version: link:../products/mcp_store@@ -3891,7 +3894,26 @@ importers:specifier: 'catalog:'version: 0.2.4([email protected](patch_hash=139b8d1f1304f9d9da452a9a1244c94ea679dbcb85687d8999563146879fb6f5)([email protected]))- products/mcp_registry: {}+ products/mcp_registry:+ dependencies:+ '@posthog/lemon-ui':+ specifier: '*'+ version: 0.0.0([email protected]([email protected])([email protected])([email protected])([email protected]([email protected]))([email protected]))([email protected]([email protected](patch_hash=139b8d1f1304f9d9da452a9a1244c94ea679dbcb85687d8999563146879fb6f5)([email protected])))([email protected](patch_hash=139b8d1f1304f9d9da452a9a1244c94ea679dbcb85687d8999563146879fb6f5)([email protected]))([email protected]([email protected]))([email protected])+ '@types/react':+ specifier: 18.3.27+ version: 18.3.27+ kea:+ specifier: 'catalog:'+ version: 4.0.0-pre.6(patch_hash=139b8d1f1304f9d9da452a9a1244c94ea679dbcb85687d8999563146879fb6f5)([email protected])+ kea-loaders:+ specifier: 'catalog:'+ version: 3.1.1([email protected](patch_hash=139b8d1f1304f9d9da452a9a1244c94ea679dbcb85687d8999563146879fb6f5)([email protected]))+ kea-router:+ specifier: 'catalog:'+ version: 3.4.1([email protected](patch_hash=139b8d1f1304f9d9da452a9a1244c94ea679dbcb85687d8999563146879fb6f5)([email protected]))+ react:+ specifier: 18.3.1+ version: 18.3.1products/mcp_store:dependencies:diff --git a/posthog/scopes.py b/posthog/scopes.pyindex e40a20e288c5..893ec2f3d5ea 100644--- a/posthog/scopes.py+++ b/posthog/scopes.py@@ -87,6 +87,7 @@ APIScopeObject = Literal["marketing_analytics","mcp_builtin_agent","mcp_analytics",+ "mcp_registry","metrics","notebook","organization",diff --git a/products/mcp_registry/backend/connect.py b/products/mcp_registry/backend/connect.pyindex 4c2effeff6d8..817819dae686 100644--- a/products/mcp_registry/backend/connect.py+++ b/products/mcp_registry/backend/connect.py@@ -25,6 +25,8 @@ Method taxonomy, most to least automated:- ``remote_api_key``: the human must mint a key on the vendor's site; the agenttells them exactly where and takes over from paste onward.- ``local_package``: no hosted remote; the agent runs the published package locally.+ Always human-gated: the package is publisher-controlled code, so a person approves+ the exact package (and version) before the agent installs and runs it.Values that a registry publisher controls (a remote URL, a package identifier) areshell-quoted before they reach a ``command`` string. An agent is told to run these@@ -263,36 +265,42 @@ def _derived_methods(server: MCPRegistryServer) -> list[dict[str, Any]]:if package:version = str(package.get("version") or "")spec = f"{package['identifier']}@{version}" if version else str(package["identifier"])+ # A local package is always human-gated, pinned or not. The package identifier and+ # version are both publisher-controlled: pinning stops the publisher swapping the+ # code after listing it, but says nothing about whether the pinned version itself is+ # trustworthy. So a person confirms the package identity before the agent runs it,+ # and an unpinned spec (which resolves whatever is latest at run time) gets an+ # explicit extra warning on top.steps: list[dict[str, Any]] = [+ {+ "actor": "human",+ "description": (+ "Approve running this package: it is publisher-controlled code from the npm registry. "+ + (+ f"Confirm you want `{spec}` before the agent installs it."+ if version+ else f"The registry published no version, so this resolves whatever the publisher "+ f"has made latest. Confirm the package `{spec}` and pin a version before the agent installs it."+ )+ ),+ "command": None,+ },{"actor": "agent","description": "Add the server as a local process.","command": f"claude mcp add {slug} -- npx -y {shlex.quote(spec)}",- }+ },]- if not version:- # An unpinned spec resolves whatever is latest when the agent runs it, so a- # publisher can list something benign and replace it later. Nobody should run- # that unattended.- steps.insert(- 0,- {- "actor": "human",- "description": "Approve the package first: the registry published no version, so this "- "resolves whatever the publisher has made latest.",- "command": None,- },- )methods.append({"method": "local_package",- "automation": "full" if version else "human_required",+ "automation": "human_required","summary": (- "Run the published package locally, pinned to the listed version (auth requirements may "- "still apply at runtime)."+ "Run the published package locally, pinned to the listed version, after a person approves it "+ "(auth requirements may still apply at runtime)."if version- else "Run the published package locally. The registry listed no version, so a human "- "approves before it runs."+ else "Run the published package locally. The registry listed no version, so a person approves "+ "and pins a version before it runs."),"steps": steps,}diff --git a/products/mcp_registry/backend/constants.py b/products/mcp_registry/backend/constants.pyindex 0c2e2110e06b..73408f05a531 100644--- a/products/mcp_registry/backend/constants.py+++ b/products/mcp_registry/backend/constants.py@@ -23,6 +23,14 @@ MEASURED_TEAM_LIMIT = 500# Shallow-probe batch size per scheduled run: stalest servers first, so the whole index# converges over successive days without one giant sweep.PROBE_BATCH_SIZE = 500+# Probes wait on third-party servers, so they run in parallel. Kept modest because the+# index spreads over many hosts and the sweep is background work, not a load test.+PROBE_CONCURRENCY = 20PROBE_TIMEOUT_SECONDS = 10+# Hard cap on a single probe response body. A registry publisher can point an entry at an+# endpoint that streams an unbounded body; up to PROBE_CONCURRENCY of those buffered at once+# would OOM the scheduled worker. Probes only need the JSON-RPC envelope, so anything past+# this is treated as a failed probe rather than read.+PROBE_RESPONSE_MAX_BYTES = 1_000_000PROBE_TOOL_LIMIT = 100PROBE_TOOL_DESCRIPTION_MAX_CHARS = 500diff --git a/products/mcp_registry/backend/management/commands/backfill_mcp_registry_probes.py b/products/mcp_registry/backend/management/commands/backfill_mcp_registry_probes.pynew file mode 100644index 000000000000..4e3fec32c7f3--- /dev/null+++ b/products/mcp_registry/backend/management/commands/backfill_mcp_registry_probes.py@@ -0,0 +1,46 @@+from typing import Any++from django.core.management.base import BaseCommand++from products.mcp_registry.backend.constants import PROBE_BATCH_SIZE, PROBE_CONCURRENCY+from products.mcp_registry.backend.probe import probe_stalest_servers, probeable_server_count+++class Command(BaseCommand):+ help = (+ "Probe every reachable registry server once, stalest first. The scheduled job only "+ "probes a batch a day, so a fresh index would spend weeks with most servers unprobed, "+ "and liveness carries more ranking weight than anything else. Run this after the first "+ "crawl so the ranking reflects which servers actually answer. Bypasses the feature-flag "+ "gate because this command is an explicit human action."+ )++ def add_arguments(self, parser: Any) -> None:+ parser.add_argument("--limit", type=int, default=None, help="Stop after this many servers.")+ parser.add_argument("--batch-size", type=int, default=PROBE_BATCH_SIZE, help="Servers per batch.")+ parser.add_argument("--concurrency", type=int, default=PROBE_CONCURRENCY, help="Probes in flight.")++ def handle(self, *args: Any, **options: Any) -> None:+ limit = options["limit"]+ if limit is not None and limit < 0:+ limit = 0+ # `limit or count` would treat 0 as "no limit", so spell the default out.+ target = min(limit if limit is not None else probeable_server_count(), probeable_server_count())+ if target == 0:+ self.stdout.write("no probeable servers: crawl the registry first")+ return++ self.stdout.write(f"probing {target} server(s), {options['concurrency']} at a time")+ probed = 0+ while probed < target:+ batch = probe_stalest_servers(+ batch_size=min(options["batch_size"], target - probed),+ concurrency=options["concurrency"],+ )+ if batch == 0:+ # Every remaining server failed to apply; looping again would not change that.+ break+ probed += batch+ self.stdout.write(f" {probed}/{target}")++ self.stdout.write(self.style.SUCCESS(f"probed {probed} server(s)"))diff --git a/products/mcp_registry/backend/presentation/views.py b/products/mcp_registry/backend/presentation/views.pyindex e22c3d1e6cc1..77bc35b17c7c 100644--- a/products/mcp_registry/backend/presentation/views.py+++ b/products/mcp_registry/backend/presentation/views.py@@ -10,6 +10,7 @@ from rest_framework.request import Requestfrom rest_framework.response import Responsefrom posthog.api.routing import TeamAndOrgViewSetMixin+from posthog.auth import OAuthAccessTokenAuthenticationfrom posthog.permissions import PostHogFeatureFlagPermissionfrom products.mcp_registry.backend.facade import api as registry_api@@ -46,13 +47,24 @@ class MCPRegistryServerViewSet(TeamAndOrgViewSetMixin, viewsets.GenericViewSet):"""serializer_class = MCPRegistryServerListSerializer- scope_object = "INTERNAL"+ # A real scope rather than INTERNAL: agents reach this over the MCP server, which+ # authenticates with a personal API key or an OAuth token, and INTERNAL refuses both.+ # The feature flag stays the boundary that keeps the index internal.+ scope_object = "mcp_registry"+ scope_object_read_actions = ["list", "retrieve", "discover", "versions", "compare", "measured_projects"]+ scope_object_write_actions: list[str] = []posthog_feature_flag = MCP_REGISTRY_FEATURE_FLAGpermission_classes = [PostHogFeatureFlagPermission]pagination_class = MCPRegistryPaginationdef _caller_is_staff(self) -> bool:- return bool(getattr(self.request.user, "is_staff", False))+ # The staff tier reports across every project, so it must not ride a grantable+ # credential: a self-registered OAuth client that consents a staff user would+ # otherwise inherit fleet-wide visibility. Session auth and personal API keys+ # keep it, because the user mints those themselves.+ if not getattr(self.request.user, "is_staff", False):+ return False+ return not isinstance(self.request.successful_authenticator, OAuthAccessTokenAuthentication)def _caller_context(self) -> dict[str, Any]:return {"team_id": self.team.id, "caller_is_staff": self._caller_is_staff()}diff --git a/products/mcp_registry/backend/probe.py b/products/mcp_registry/backend/probe.pyindex 648fcf912367..95f1477fb3fb 100644--- a/products/mcp_registry/backend/probe.py+++ b/products/mcp_registry/backend/probe.py@@ -9,19 +9,23 @@ and keep liveness a living signal."""import json+from concurrent.futures import ThreadPoolExecutor, as_completedfrom dataclasses import fieldfrom typing import Any+from django.db.models import Ffrom django.utils import timezoneimport requestsimport structlogfrom posthog.dataclasses import frozen-from posthog.security.pinned_requests import SSRFBlockedError, pinned_request+from posthog.security.pinned_requests import SSRFBlockedError, pinned_sessionfrom products.mcp_registry.backend.constants import (PROBE_BATCH_SIZE,+ PROBE_CONCURRENCY,+ PROBE_RESPONSE_MAX_BYTES,PROBE_TIMEOUT_SECONDS,PROBE_TOOL_DESCRIPTION_MAX_CHARS,PROBE_TOOL_LIMIT,@@ -72,27 +76,76 @@ def _parse_jsonrpc_body(text: str) -> dict[str, Any] | None:return None-def _classify_auth(response: requests.Response) -> str:- www_authenticate = response.headers.get("WWW-Authenticate", "")+def _classify_auth(headers: Any, text: str) -> str:+ www_authenticate = headers.get("WWW-Authenticate", "")if "bearer" in www_authenticate.lower():return "oauth"- hint = (www_authenticate + response.text[:400]).lower()+ hint = (www_authenticate + text[:400]).lower()if "api key" in hint or "api-key" in hint or "api_key" in hint:return "api_key"return "unknown"-def _rpc(url: str, payload: dict[str, Any], session_id: str | None = None) -> requests.Response:+@frozen+class _RpcResponse:+ """A probe response with the body already read and bounded.++ The body is never more than PROBE_RESPONSE_MAX_BYTES, so callers can parse it without+ a publisher-controlled endpoint deciding how much memory the worker holds.+ """++ status_code: int+ headers: Any+ text: str+ truncated: bool = False+++def _read_bounded(response: requests.Response, limit: int = PROBE_RESPONSE_MAX_BYTES) -> tuple[str, bool]:+ """Read a streamed response body, stopping at ``limit`` bytes.++ ``requests`` would otherwise buffer the entire body in memory; with PROBE_CONCURRENCY+ probes in flight, a few oversized publisher endpoints could OOM the worker. Iterating+ the stream caps what we hold regardless of how much the server sends. Returns the+ decoded text (best-effort) and whether it was cut short.+ """+ chunks: list[bytes] = []+ received = 0+ truncated = False+ for chunk in response.iter_content(chunk_size=65536):+ received += len(chunk)+ if received > limit:+ chunks.append(chunk[: max(0, len(chunk) - (received - limit))])+ truncated = True+ break+ chunks.append(chunk)+ body = b"".join(chunks)+ encoding = response.encoding or "utf-8"+ return body.decode(encoding, errors="replace"), truncated+++def _rpc(url: str, payload: dict[str, Any], session_id: str | None = None) -> _RpcResponse:headers = dict(_HEADERS)if session_id:headers["mcp-session-id"] = session_id- return pinned_request("POST", url, json=payload, headers=headers, timeout=PROBE_TIMEOUT_SECONDS)+ # Stream so the body is read under PROBE_RESPONSE_MAX_BYTES rather than buffered whole.+ # The session must stay open while we read, so this uses pinned_session directly.+ with pinned_session(url) as session:+ response = session.post(+ url, json=payload, headers=headers, timeout=PROBE_TIMEOUT_SECONDS, stream=True, allow_redirects=False+ )+ try:+ text, truncated = _read_bounded(response)+ return _RpcResponse(+ status_code=response.status_code, headers=response.headers, text=text, truncated=truncated+ )+ finally:+ response.close()def _fetch_tools(url: str, session_id: str | None) -> list[dict[str, Any]]:_rpc(url, {"jsonrpc": "2.0", "method": "notifications/initialized"}, session_id)response = _rpc(url, {"jsonrpc": "2.0", "id": 2, "method": "tools/list", "params": {}}, session_id)- body = _parse_jsonrpc_body(response.text) or {}+ body = {} if response.truncated else (_parse_jsonrpc_body(response.text) or {})tools = (body.get("result") or {}).get("tools")if not isinstance(tools, list):return []@@ -120,6 +173,10 @@ def shallow_probe(url: str) -> ProbeOutcome:# A redirect target never went through SSRF validation, so refuse to follow.return ProbeOutcome(liveness="not_mcp", detail=f"redirect http {response.status_code}")+ if response.truncated:+ # The body blew past the read cap, so it isn't a usable JSON-RPC envelope.+ return ProbeOutcome(liveness="not_mcp", detail=f"response exceeded {PROBE_RESPONSE_MAX_BYTES} bytes")+body = _parse_jsonrpc_body(response.text)result = (body or {}).get("result") or {}if result.get("serverInfo") or result.get("capabilities"):@@ -132,7 +189,7 @@ def shallow_probe(url: str) -> ProbeOutcome:return ProbeOutcome(liveness="alive_open", auth_method="none", detail=detail, tools=tools)if response.status_code in (401, 403):- return ProbeOutcome(liveness="alive_auth", auth_method=_classify_auth(response))+ return ProbeOutcome(liveness="alive_auth", auth_method=_classify_auth(response.headers, response.text))if response.status_code == 200 and (body or {}).get("error"):return ProbeOutcome(liveness="alive_protocol", detail=f"rpc error {(body or {})['error'].get('code')}")if 200 <= response.status_code < 300:@@ -162,21 +219,46 @@ def apply_probe_outcome(server: MCPRegistryServer, outcome: ProbeOutcome) -> Non)-def probe_stalest_servers(batch_size: int = PROBE_BATCH_SIZE) -> int:+def probeable_server_count() -> int:+ """How many servers the probe can reach at all. Package-only entries have no URL."""+ return MCPRegistryServer.objects.exclude(canonical_url="").count()+++def probe_stalest_servers(batch_size: int = PROBE_BATCH_SIZE, concurrency: int = PROBE_CONCURRENCY) -> int:"""Probe the servers with the oldest (or missing) probe results. Returns count probed.Measured servers first, because their liveness backs real rankings, then the long tail,so the whole index converges over successive scheduled runs.++ Each probe waits on a remote server for up to PROBE_TIMEOUT_SECONDS, so the batch runs+ concurrently: serially, a sweep of the whole index would take days and liveness would+ stay stale enough to distort ranking. Only the HTTP call is threaded. Django opens a+ connection per thread, so the row writes stay on this thread instead of leaving a+ connection per worker behind."""- queryset = (+ servers = list(MCPRegistryServer.objects.exclude(canonical_url="")- .order_by("-is_measured", "last_probed_at")- .values_list("id", flat=True)[:batch_size]+ # nulls_first, or the sweep never converges: Postgres sorts NULL last on an+ # ascending column, so never-probed servers would queue behind every server that+ # already has a timestamp, and each run would re-probe the same batch forever.+ .order_by("-is_measured", F("last_probed_at").asc(nulls_first=True))+ .only("id", "canonical_url", "auth_method")[:batch_size])+ if not servers:+ return 0+probed = 0- for server_id in list(queryset):- server = MCPRegistryServer.objects.get(pk=server_id)- apply_probe_outcome(server, shallow_probe(server.canonical_url))- probed += 1- logger.info("mcp_registry.probe.batch_done", probed=probed)+ with ThreadPoolExecutor(max_workers=min(concurrency, len(servers))) as pool:+ pending = {pool.submit(shallow_probe, server.canonical_url): server for server in servers}+ for future in as_completed(pending):+ server = pending[future]+ try:+ outcome = future.result()+ except Exception:+ # One pathological server must not abandon the rest of the sweep.+ logger.exception("mcp_registry.probe.server_failed", server_id=str(server.id))+ continue+ apply_probe_outcome(server, outcome)+ probed += 1+ logger.info("mcp_registry.probe.batch_done", probed=probed, selected=len(servers))return probeddiff --git a/products/mcp_registry/backend/tests/test_api.py b/products/mcp_registry/backend/tests/test_api.pyindex 4abdf71705f9..b46985aeee94 100644--- a/products/mcp_registry/backend/tests/test_api.py+++ b/products/mcp_registry/backend/tests/test_api.py@@ -1,3 +1,4 @@+from datetime import timedeltafrom typing import Anyfrom posthog.test.base import APIBaseTest@@ -5,6 +6,10 @@ from unittest.mock import patchfrom django.utils import timezone+from posthog.models import PersonalAPIKey+from posthog.models.oauth import OAuthAccessToken, OAuthApplication+from posthog.models.utils import generate_random_token_personal, hash_key_value+from products.mcp_registry.backend.models import MCPMeasuredStats, MCPRegistryServer, MCPRegistryToolfrom products.mcp_registry.backend.ranking import compute_ranking_run@@ -259,6 +264,56 @@ class TestMCPRegistryAPI(APIBaseTest):assert [row["team_id"] for row in rows] == [self.team.id + 1, self.team.id]assert [row["calls"] for row in rows] == [999_999, 50_000]+ def _staff_bearer_headers(self, kind: str) -> dict[str, str]:+ self.user.is_staff = True+ self.user.save()+ if kind == "personal_api_key":+ key = generate_random_token_personal()+ PersonalAPIKey.objects.create(+ label="staff key", user=self.user, secure_value=hash_key_value(key), scopes=["mcp_registry:read"]+ )+ return {"authorization": f"Bearer {key}"}+ application = OAuthApplication.objects.create(+ name="agent",+ client_id="agent_client_id",+ client_type=OAuthApplication.CLIENT_PUBLIC,+ authorization_grant_type=OAuthApplication.GRANT_AUTHORIZATION_CODE,+ redirect_uris="https://example.com/callback",+ algorithm="RS256",+ )+ OAuthAccessToken.objects.create(+ user=self.user,+ application=application,+ token="pha_staff_token",+ scope="mcp_registry:read",+ expires=timezone.now() + timedelta(hours=1),+ )+ return {"authorization": "Bearer pha_staff_token"}++ def test_fleet_tier_refuses_oauth_tokens_even_for_staff(self) -> None:+ # A self-registered OAuth client that consents a staff user must not inherit the+ # cross-project view: the fleet tier stays with session and personal API keys.+ servers = self._seed_index()+ self._seed_another_projects_stats(servers["measured"])++ headers = self._staff_bearer_headers("oauth")++ assert self.client.get(self._url("measured_projects/"), headers=headers).status_code == 403+ detail = self.client.get(self._url(f"{servers['measured'].id}/"), headers=headers).json()+ assert [row["calls"] for row in detail["measured_stats"]] == [50_000]++ def test_fleet_tier_accepts_staff_personal_api_keys(self) -> None:+ # Personal API keys are minted by the user themselves, so staff keep the fleet view.+ servers = self._seed_index()+ self._seed_another_projects_stats(servers["measured"])++ headers = self._staff_bearer_headers("personal_api_key")++ rows = self.client.get(self._url("measured_projects/"), headers=headers).json()+ assert [row["team_id"] for row in rows] == [self.team.id + 1, self.team.id]+ detail = self.client.get(self._url(f"{servers['measured'].id}/"), headers=headers).json()+ assert sorted(row["calls"] for row in detail["measured_stats"]) == [50_000, 999_999]+def _reassign_measurements_to_another_project(self, server: MCPRegistryServer) -> None:MCPMeasuredStats.objects.unscoped().filter(server=server).update(team_id=self.team.id + 1)compute_ranking_run("v2_measured_trust")diff --git a/products/mcp_registry/backend/tests/test_backfill_command.py b/products/mcp_registry/backend/tests/test_backfill_command.pynew file mode 100644index 000000000000..8cb41953fd27--- /dev/null+++ b/products/mcp_registry/backend/tests/test_backfill_command.py@@ -0,0 +1,41 @@+from posthog.test.base import BaseTest+from unittest.mock import patch++from django.core.management import call_command++from products.mcp_registry.backend.models import MCPRegistryServer+++class TestBackfillMCPRegistryProbesCommand(BaseTest):+ def _server(self, name: str) -> MCPRegistryServer:+ return MCPRegistryServer.objects.create(display_name=name, canonical_url=f"https://{name}.example.com/mcp")++ @patch("products.mcp_registry.backend.management.commands.backfill_mcp_registry_probes.probe_stalest_servers")+ def test_limit_zero_probes_nothing(self, mock_probe) -> None:+ self._server("a")++ call_command("backfill_mcp_registry_probes", "--limit", "0")++ mock_probe.assert_not_called()++ @patch("products.mcp_registry.backend.management.commands.backfill_mcp_registry_probes.probe_stalest_servers")+ def test_limit_caps_the_probe_count(self, mock_probe) -> None:+ self._server("a")+ self._server("b")+ self._server("c")+ mock_probe.side_effect = [1, 0]++ call_command("backfill_mcp_registry_probes", "--limit", "1")++ assert mock_probe.call_count == 1+ assert mock_probe.call_args.kwargs["batch_size"] == 1++ @patch("products.mcp_registry.backend.management.commands.backfill_mcp_registry_probes.probe_stalest_servers")+ def test_no_limit_probes_everything_probeable(self, mock_probe) -> None:+ self._server("a")+ self._server("b")+ mock_probe.side_effect = [2, 0]++ call_command("backfill_mcp_registry_probes")++ assert mock_probe.call_args.kwargs["batch_size"] == 2diff --git a/products/mcp_registry/backend/tests/test_connect.py b/products/mcp_registry/backend/tests/test_connect.pyindex 35bbeb7b347b..1e6114e321d3 100644--- a/products/mcp_registry/backend/tests/test_connect.py+++ b/products/mcp_registry/backend/tests/test_connect.py@@ -31,7 +31,7 @@ class TestConnectInstructions(SimpleTestCase):"packages": [{"registry_type": "npm", "identifier": "@example/demo-mcp", "version": "1.0.0"}],},"local_package",- "agent",+ "human",),])@@ -125,15 +125,16 @@ class TestConnectInstructions(SimpleTestCase):@parameterized.expand([- ("pinned", "1.2.3", "full", "@example/[email protected]", "agent"),- ("unpinned", "", "human_required", "@example/demo-mcp", "human"),+ ("pinned", "1.2.3", "@example/[email protected]"),+ ("unpinned", "", "@example/demo-mcp"),])- def test_npm_package_is_pinned_or_needs_approval(- self, _name: str, version: str, automation: str, spec: str, first_actor: str- ) -> None:- # npx resolves latest when the agent runs it, so an unpinned spec lets a publisher- # list something benign and replace it with other code afterwards.+ def test_npm_package_requires_human_approval(self, _name: str, version: str, spec: str) -> None:+ # A local package is publisher-controlled code, so a person always approves the+ # exact package/version before the agent installs it — pinned or not. Pinning stops+ # the publisher swapping code after listing but says nothing about the pinned+ # version itself. An unpinned spec additionally resolves whatever is latest at run+ # time, which is worse.server = _server(canonical_url="",packages=[{"registry_type": "npm", "identifier": "@example/demo-mcp", "version": version}],@@ -142,8 +143,8 @@ class TestConnectInstructions(SimpleTestCase):method = build_connect_instructions(server)["methods"][0]assert method["method"] == "local_package"- assert method["automation"] == automation- assert method["steps"][0]["actor"] == first_actor+ assert method["automation"] == "human_required"+ assert method["steps"][0]["actor"] == "human"assert spec in method["steps"][-1]["command"]def test_row_overrides_replace_derived_methods(self) -> None:diff --git a/products/mcp_registry/backend/tests/test_probe.py b/products/mcp_registry/backend/tests/test_probe.pyindex e5b7f0ed347a..2588157b4872 100644--- a/products/mcp_registry/backend/tests/test_probe.py+++ b/products/mcp_registry/backend/tests/test_probe.py@@ -4,20 +4,30 @@ from posthog.test.base import BaseTestfrom unittest.mock import Mock, patchfrom django.test import SimpleTestCase+from django.utils import timezoneimport requestsfrom parameterized import parameterizedfrom products.mcp_registry.backend.models import MCPRegistryServer, MCPRegistryTool-from products.mcp_registry.backend.probe import ProbeOutcome, apply_probe_outcome, shallow_probe---def _response(status_code: int, body: dict | None = None, text: str = "", headers: dict | None = None) -> Mock:- response = Mock(spec=requests.Response)- response.status_code = status_code- response.text = json.dumps(body) if body is not None else text- response.headers = headers or {}- return response+from products.mcp_registry.backend.probe import (+ ProbeOutcome,+ _RpcResponse,+ apply_probe_outcome,+ probe_stalest_servers,+ shallow_probe,+)+++def _response(+ status_code: int, body: dict | None = None, text: str = "", headers: dict | None = None, truncated: bool = False+) -> _RpcResponse:+ return _RpcResponse(+ status_code=status_code,+ headers=headers or {},+ text=json.dumps(body) if body is not None else text,+ truncated=truncated,+ )_INIT_RESULT = {"jsonrpc": "2.0", "id": 1, "result": {"serverInfo": {"name": "demo"}, "capabilities": {}}}@@ -45,9 +55,9 @@ class TestShallowProbe(SimpleTestCase):),])- @patch("products.mcp_registry.backend.probe.pinned_request")+ @patch("products.mcp_registry.backend.probe._rpc")def test_classification(- self, _name: str, response: Mock, expected_liveness: str, expected_auth: str, mock_request: Mock+ self, _name: str, response: _RpcResponse, expected_liveness: str, expected_auth: str, mock_request: Mock) -> None:mock_request.return_value = response@@ -56,7 +66,7 @@ class TestShallowProbe(SimpleTestCase):assert outcome.liveness == expected_livenessassert outcome.auth_method == expected_auth- @patch("products.mcp_registry.backend.probe.pinned_request")+ @patch("products.mcp_registry.backend.probe._rpc")def test_connection_failure_is_dead_not_raised(self, mock_request: Mock) -> None:mock_request.side_effect = requests.ConnectionError("refused")@@ -65,7 +75,18 @@ class TestShallowProbe(SimpleTestCase):assert outcome.liveness == "dead"assert "refused" in outcome.detail- @patch("products.mcp_registry.backend.probe.pinned_request")+ @patch("products.mcp_registry.backend.probe._rpc")+ def test_oversized_body_is_not_mcp_not_buffered(self, mock_request: Mock) -> None:+ # A publisher endpoint can stream an unbounded body; the probe caps the read and+ # treats the truncated result as unusable rather than parsing a partial envelope.+ mock_request.return_value = _response(200, text="{", truncated=True)++ outcome = shallow_probe("https://demo.example.com/mcp")++ assert outcome.liveness == "not_mcp"+ assert "exceeded" in outcome.detail++ @patch("products.mcp_registry.backend.probe._rpc")def test_open_server_captures_tools_over_sse(self, mock_request: Mock) -> None:tools_body = {"jsonrpc": "2.0",@@ -90,7 +111,61 @@ class TestShallowProbe(SimpleTestCase):assert outcome.auth_method == "none"assert [tool["name"] for tool in outcome.tools] == ["create_issue"]# The session handle from initialize must be echoed on the follow-up calls.- assert mock_request.call_args.kwargs["headers"]["mcp-session-id"] == "session-1"+ assert mock_request.call_args.args[2] == "session-1"+++class TestProbeStalestServers(BaseTest):+ def _server(self, name: str, **kwargs: object) -> MCPRegistryServer:+ return MCPRegistryServer.objects.create(+ display_name=name, canonical_url=f"https://{name}.example.com/mcp", **kwargs+ )++ @patch("products.mcp_registry.backend.probe.shallow_probe")+ def test_never_probed_servers_go_before_already_probed_ones(self, mock_probe: Mock) -> None:+ # Postgres sorts NULL last on an ascending column, so without nulls_first every run+ # re-probes the servers that already have a timestamp and the index never converges.+ mock_probe.return_value = ProbeOutcome(liveness="alive_open", auth_method="none")+ already_probed = self._server("probed", last_probed_at=timezone.now())+ never_probed = self._server("fresh")++ probe_stalest_servers(batch_size=1, concurrency=1)++ never_probed.refresh_from_db()+ already_probed.refresh_from_db()+ assert never_probed.last_probed_at is not None+ assert already_probed.liveness == "unprobed"++ @patch("products.mcp_registry.backend.probe.shallow_probe")+ def test_each_server_receives_its_own_outcome(self, mock_probe: Mock) -> None:+ # Probes resolve out of order across threads, so an outcome could land on the wrong row.+ mock_probe.side_effect = lambda url: ProbeOutcome(+ liveness="alive_open" if "alive" in url else "dead", detail=url+ )+ alive = self._server("alive")+ dead = self._server("dead")++ assert probe_stalest_servers(batch_size=10, concurrency=4) == 2++ alive.refresh_from_db()+ dead.refresh_from_db()+ assert (alive.liveness, dead.liveness) == ("alive_open", "dead")+ assert alive.probe_detail.startswith("https://alive.")++ @patch("products.mcp_registry.backend.probe.shallow_probe")+ def test_one_raising_probe_does_not_abandon_the_batch(self, mock_probe: Mock) -> None:+ def probe(url: str) -> ProbeOutcome:+ if "boom" in url:+ raise RuntimeError("unexpected")+ return ProbeOutcome(liveness="alive_open", auth_method="none")++ mock_probe.side_effect = probe+ self._server("boom")+ survivor = self._server("fine")++ assert probe_stalest_servers(batch_size=10, concurrency=4) == 1++ survivor.refresh_from_db()+ assert survivor.liveness == "alive_open"class TestApplyProbeOutcome(BaseTest):diff --git a/products/mcp_registry/frontend/MCPRegistryScene.tsx b/products/mcp_registry/frontend/MCPRegistryScene.tsxnew file mode 100644index 000000000000..fb6bbd2fdf9a--- /dev/null+++ b/products/mcp_registry/frontend/MCPRegistryScene.tsx@@ -0,0 +1,145 @@+import { useActions, useValues } from 'kea'++import { LemonBanner, LemonButton, LemonInput, LemonTag, Spinner } from '@posthog/lemon-ui'++import { SceneExport } from 'scenes/sceneTypes'++import { SceneContent } from '~/layout/scenes/components/SceneContent'++import { MCPDiscoverCandidateApi, MCPDiscoverCandidateApiMeasured } from './generated/api.schemas'+import { mcpRegistryLogic } from './mcpRegistryLogic'++export const scene: SceneExport = {+ component: MCPRegistryScene,+ logic: mcpRegistryLogic,+}++type LivenessLabel = { label: string; type: 'success' | 'warning' | 'danger' | 'muted' | 'default' }++/** Probe states are internal keys. People need to know whether the server answers. */+const LIVENESS: Record<string, LivenessLabel> = {+ alive_open: { label: 'Live, no sign-in', type: 'success' },+ alive_auth: { label: 'Live, needs sign-in', type: 'success' },+ alive_protocol: { label: 'Responds', type: 'default' },+ package_only: { label: 'Runs locally', type: 'muted' },+ unprobed: { label: 'Not checked yet', type: 'muted' },+ not_mcp: { label: 'Not an MCP server', type: 'warning' },+ dead: { label: 'Not responding', type: 'danger' },+}++function numberFrom(measured: MCPDiscoverCandidateApiMeasured, key: string): number | null {+ const value = measured?.[key]+ return typeof value === 'number' ? value : null+}++function MeasuredTag({ measured }: { measured: MCPDiscoverCandidateApiMeasured }): JSX.Element | null {+ const calls = numberFrom(measured, 'calls')+ if (calls === null) {+ return null+ }+ const errorRate = numberFrom(measured, 'error_rate_pct')+ const success = errorRate === null ? null : `${(100 - errorRate).toFixed(1)}% success`+ return (+ <LemonTag type="highlight">+ {calls.toLocaleString()} real calls{success ? `, ${success}` : ''}+ </LemonTag>+ )+}++function Candidate({ candidate }: { candidate: MCPDiscoverCandidateApi }): JSX.Element {+ const liveness = LIVENESS[candidate.liveness] ?? { label: candidate.liveness, type: 'muted' as const }+ return (+ <li className="border rounded p-3 flex flex-col gap-1">+ <div className="flex items-center gap-2 flex-wrap">+ <span className="text-muted tabular-nums">{candidate.rank}</span>+ <span className="font-semibold">{candidate.title}</span>+ <LemonTag type={liveness.type}>{liveness.label}</LemonTag>+ <MeasuredTag measured={candidate.measured} />+ </div>+ {candidate.registry_name ? (+ <code className="text-xs text-muted break-all">{candidate.registry_name}</code>+ ) : null}+ {candidate.description ? <p className="m-0 text-sm">{candidate.description}</p> : null}+ {candidate.matched_tools.length > 0 ? (+ <div className="flex gap-1 flex-wrap">+ {candidate.matched_tools.map((tool) => (+ <LemonTag key={tool.name} type="option">+ {tool.name}+ </LemonTag>+ ))}+ </div>+ ) : null}+ </li>+ )+}++export function MCPRegistryScene(): JSX.Element {+ const { intent, candidates, responseLoading, searchError, searchedIntent } = useValues(mcpRegistryLogic)+ const { setIntent, search } = useActions(mcpRegistryLogic)++ return (+ <SceneContent>+ <div className="flex flex-col gap-4 max-w-3xl w-full mx-auto">+ <div className="flex flex-col gap-2">+ <h1 className="m-0">Find an MCP server</h1>+ <p className="m-0 text-muted">+ Describe what you want to do. Servers are ranked by whether they answer right now and by how+ well they work for the agents already calling them.+ </p>+ </div>++ <form+ className="flex gap-2"+ onSubmit={(event) => {+ event.preventDefault()+ if (!responseLoading) {+ search()+ }+ }}+ >+ <LemonInput+ className="flex-1"+ value={intent}+ onChange={setIntent}+ placeholder="Deploy my site to Vercel"+ autoFocus+ data-attr="mcp-registry-search"+ />+ <LemonButton+ type="primary"+ htmlType="submit"+ loading={responseLoading}+ disabledReason={!intent.trim() ? 'Describe what you want to do' : undefined}+ >+ Search+ </LemonButton>+ </form>++ {searchError && !responseLoading ? (+ <LemonBanner type="error">+ Search failed: {searchError}. Check the connection and try again.+ </LemonBanner>+ ) : null}++ {responseLoading ? (+ <Spinner className="self-center text-2xl" />+ ) : candidates.length > 0 ? (+ <>+ {/* The box can be edited without resubmitting, so name the query these results answer. */}+ <p className="m-0 text-muted text-sm">Results for “{searchedIntent}”</p>+ <ul className="list-none p-0 m-0 flex flex-col gap-2">+ {candidates.map((candidate) => (+ <Candidate key={candidate.id} candidate={candidate} />+ ))}+ </ul>+ </>+ ) : searchedIntent ? (+ <p className="text-muted">+ Nothing matched “{searchedIntent}”. Search looks for the words a server uses about itself, so+ try the vendor or product name.+ </p>+ ) : null}+ </div>+ </SceneContent>+ )+}diff --git a/products/mcp_registry/frontend/mcpRegistryLogic.ts b/products/mcp_registry/frontend/mcpRegistryLogic.tsnew file mode 100644index 000000000000..7921f35ce75e--- /dev/null+++ b/products/mcp_registry/frontend/mcpRegistryLogic.ts@@ -0,0 +1,128 @@+import { MakeLogicType, actions, kea, path, reducers, selectors } from 'kea'+import { loaders } from 'kea-loaders'+import { actionToUrl, urlToAction } from 'kea-router'++import { projectLogic } from 'scenes/projectLogic'+import { urls } from 'scenes/urls'++import { mcpRegistryServersDiscoverRetrieve } from './generated/api'+import { MCPDiscoverCandidateApi, MCPDiscoverResponseApi } from './generated/api.schemas'++/** Enough candidates to compare, few enough to read without scrolling past the fold. */+const RESULT_LIMIT = 10++// Generated by kea-typegen. Update if you're an agent, ignore if you're human.+export interface mcpRegistryLogicValues {+ candidates: MCPDiscoverCandidateApi[]+ intent: string+ response: MCPDiscoverResponseApi | null+ responseLoading: boolean+ searchError: string | null+ searchedIntent: string+}++// Generated by kea-typegen. Update if you're an agent, ignore if you're human.+export interface mcpRegistryLogicActions {+ search: (_: void) => void+ searchFailure: (+ error: string,+ errorObject?: any+ ) => {+ error: string+ errorObject?: any+ }+ searchSuccess: (+ response: MCPDiscoverResponseApi | null,+ payload?: void+ ) => {+ response: MCPDiscoverResponseApi | null+ payload?: void+ }+ setIntent: (intent: string) => {+ intent: string+ }+}++// Generated by kea-typegen. Update if you're an agent, ignore if you're human.+export interface mcpRegistryLogicMeta {+ __keaTypeGenInternalSelectorTypes: {+ candidates: (response: MCPDiscoverResponseApi | null) => MCPDiscoverCandidateApi[]+ searchedIntent: (response: MCPDiscoverResponseApi | null) => string+ }+}++export type mcpRegistryLogicType = MakeLogicType<+ mcpRegistryLogicValues,+ mcpRegistryLogicActions,+ Record<string, any>,+ mcpRegistryLogicMeta+>++export const mcpRegistryLogic = kea<mcpRegistryLogicType>([+ path(['products', 'mcp_registry', 'frontend', 'mcpRegistryLogic']),+ actions({+ setIntent: (intent: string) => ({ intent }),+ }),+ reducers({+ intent: ['' as string, { setIntent: (_, { intent }) => intent }],+ // kea-loaders only keeps response/responseLoading. The scene needs the failure itself.+ searchError: [+ null as string | null,+ {+ search: () => null,+ searchSuccess: () => null,+ searchFailure: (_, { error }) => String(error),+ },+ ],+ }),+ loaders(({ values }) => ({+ response: [+ null as MCPDiscoverResponseApi | null,+ {+ search: async (_: void, breakpoint) => {+ const intent = values.intent.trim()+ if (!intent) {+ return null+ }+ // The whole page reads one endpoint. Keeping it that way is what lets this+ // move to a public origin later without dragging project plumbing along.+ const projectId = String(projectLogic.findMounted()?.values.currentProjectId)+ const response = await mcpRegistryServersDiscoverRetrieve(projectId, {+ intent,+ limit: RESULT_LIMIT,+ })+ breakpoint()+ return response+ },+ },+ ],+ })),+ selectors({+ candidates: [+ (s) => [s.response],+ (response: MCPDiscoverResponseApi | null): MCPDiscoverCandidateApi[] => response?.candidates ?? [],+ ],+ searchedIntent: [+ (s) => [s.response],+ (response: MCPDiscoverResponseApi | null): string => response?.intent ?? '',+ ],+ }),+ actionToUrl(({ values }) => ({+ // A search someone can paste to a colleague, rather than one that lives in local state.+ search: () => [urls.mcpRegistry(), values.intent ? { q: values.intent } : {}],+ })),+ urlToAction(({ actions, values }) => ({+ [urls.mcpRegistry()]: (_, searchParams) => {+ const query = String(searchParams.q ?? '')+ // Searching pushes the query into the URL, which lands back here. Bail on that echo,+ // or the second pass fires the same request again before the first has resolved.+ if (query === values.intent) {+ return+ }+ actions.setIntent(query)+ if (query) {+ actions.search()+ }+ },+ })),+])diff --git a/products/mcp_registry/manifest.tsx b/products/mcp_registry/manifest.tsxindex 360db4fdb81b..1b7058b57f1c 100644--- a/products/mcp_registry/manifest.tsx+++ b/products/mcp_registry/manifest.tsx@@ -2,6 +2,24 @@ import { ProductManifest } from '~/types'export const manifest: ProductManifest = {name: 'MCP registry',+ scenes: {+ MCPRegistry: {+ name: 'MCP registry',+ import: () => import('./frontend/MCPRegistryScene'),+ projectBased: true,+ description: 'Find an MCP server for a task, ranked by whether it answers and how well it works.',+ },+ },+ routes: {+ '/mcp-registry': ['MCPRegistry', 'mcpRegistry'],+ },+ redirects: {},+ urls: {+ mcpRegistry: (): string => '/mcp-registry',+ },+ fileSystemTypes: {},treeItemsNew: [],+ // No product tree entry yet: the index is behind the mcp-registry flag while it fills up,+ // so it is reached by URL rather than advertised in the nav.treeItemsProducts: [],}diff --git a/products/mcp_registry/mcp/tools.yaml b/products/mcp_registry/mcp/tools.yamlnew file mode 100644index 000000000000..9b98240c9d14--- /dev/null+++ b/products/mcp_registry/mcp/tools.yaml@@ -0,0 +1,68 @@+# MCP tool definition — tool entries are scaffolded from the OpenAPI schema.+# The tool list and operation IDs are kept in sync automatically:+# pnpm --filter=@posthog/mcp run scaffold-yaml -- --sync-all+#+# To enable a tool, set enabled: true and add required scopes + annotations.+# All other fields (title, description, enrich_url, etc.) are yours to configure.+category: MCP registry+feature: mcp_registry+url_prefix: /mcp-registry+ui_apps: {}+tools:+ mcp-registry-discover:+ operation: mcp_registry_servers_discover_retrieve+ enabled: true+ scopes:+ - mcp_registry:read+ annotations:+ readOnly: true+ destructive: false+ idempotent: true+ title: Discover MCP servers for a task+ description: >+ Find the MCP servers most likely to perform a task, ranked, with the instructions to connect to each one.+ Describe the task in `intent` the way a person would ("deploy my site to vercel"), not as keywords.+++ Each candidate carries why it ranked where it did: `liveness` from a real handshake against the server,+ `why` with the score breakdown, and `measured` with observed call volume and success rate when PostHog+ Analytics has seen the server in use. `connect` gives the connection methods, most automated first, with+ each step marked for the agent to run or for a person to do.+++ The index is a global crawl of the official MCP registry rather than a table in this project, so it is not+ queryable in SQL. Relevance is keyword-based today, so a paraphrase can miss: prefer the words a server+ would use about itself. Use `mcp-registry-server-get` for the full tool list of one candidate.+ include_params:+ - intent+ - version+ - limit+ mcp-registry-server-get:+ operation: mcp_registry_servers_retrieve+ enabled: true+ scopes:+ - mcp_registry:read+ annotations:+ readOnly: true+ destructive: false+ idempotent: true+ title: Get an MCP server+ description: >+ Read one registry server by id, as returned by `mcp-registry-discover`. Adds the full advertised tool list,+ per-version ranking scores, and connection instructions to what discover returns.+++ Measured usage is limited to what the calling project may see, so a server another project measured shows+ its ranking but not that project's figures.+ mcp-registry-servers-compare-retrieve:+ operation: mcp_registry_servers_compare_retrieve+ enabled: false+ mcp-registry-servers-list:+ operation: mcp_registry_servers_list+ enabled: false+ mcp-registry-servers-measured-projects-list:+ operation: mcp_registry_servers_measured_projects_list+ enabled: false+ mcp-registry-servers-versions-list:+ operation: mcp_registry_servers_versions_list+ enabled: falsediff --git a/products/mcp_registry/package.json b/products/mcp_registry/package.jsonindex a09e1971ec25..e2d488707b53 100644--- a/products/mcp_registry/package.json+++ b/products/mcp_registry/package.json@@ -4,5 +4,15 @@"backend:test": "pytest -c ../../pytest.ini --rootdir ../.. backend/tests -v --tb=short","backend:lint": "ruff check --config ../../pyproject.toml backend && ruff format --config ../../pyproject.toml --check backend","backend:contract-check": "echo 'Contract files unchanged'"+ },+ "dependencies": {+ "kea": "catalog:",+ "kea-loaders": "catalog:",+ "kea-router": "catalog:"+ },+ "peerDependencies": {+ "@posthog/lemon-ui": "*",+ "@types/react": "*",+ "react": "*"}}diff --git a/services/mcp/schema/generated-tool-definitions.json b/services/mcp/schema/generated-tool-definitions.jsonindex 66f575164105..394b7286dbb8 100644--- a/services/mcp/schema/generated-tool-definitions.json+++ b/services/mcp/schema/generated-tool-definitions.json@@ -8162,6 +8162,34 @@},"feature_flag": "mcp-analytics"},+ "mcp-registry-discover": {+ "description": "Find the MCP servers most likely to perform a task, ranked, with the instructions to connect to each one. Describe the task in `intent` the way a person would (\"deploy my site to vercel\"), not as keywords.\n\nEach candidate carries why it ranked where it did: `liveness` from a real handshake against the server, `why` with the score breakdown, and `measured` with observed call volume and success rate when PostHog Analytics has seen the server in use. `connect` gives the connection methods, most automated first, with each step marked for the agent to run or for a person to do.\n\nThe index is a global crawl of the official MCP registry rather than a table in this project, so it is not queryable in SQL. Relevance is keyword-based today, so a paraphrase can miss: prefer the words a server would use about itself. Use `mcp-registry-server-get` for the full tool list of one candidate.",+ "category": "MCP registry",+ "feature": "mcp_registry",+ "summary": "Discover MCP servers for a task",+ "title": "Discover MCP servers for a task",+ "required_scopes": ["mcp_registry:read"],+ "annotations": {+ "destructiveHint": false,+ "idempotentHint": true,+ "openWorldHint": true,+ "readOnlyHint": true+ }+ },+ "mcp-registry-server-get": {+ "description": "Read one registry server by id, as returned by `mcp-registry-discover`. Adds the full advertised tool list, per-version ranking scores, and connection instructions to what discover returns.\n\nMeasured usage is limited to what the calling project may see, so a server another project measured shows its ranking but not that project's figures.",+ "category": "MCP registry",+ "feature": "mcp_registry",+ "summary": "Get an MCP server",+ "title": "Get an MCP server",+ "required_scopes": ["mcp_registry:read"],+ "annotations": {+ "destructiveHint": false,+ "idempotentHint": true,+ "openWorldHint": true,+ "readOnlyHint": true+ }+ },"media-image-upload-complete": {"description": "Step 2 of the presigned upload flow. Verifies the file uploaded via media-image-upload-start, sniffs its real content type, and activates it — after this it appears in media-images-list and is publicly servable. Returns the permanent url; for emails, put it in the image block's values.src.url.","category": "Core",diff --git a/services/mcp/schema/tool-definitions-all.json b/services/mcp/schema/tool-definitions-all.jsonindex 449f2bea6f12..6eb922a5ac85 100644--- a/services/mcp/schema/tool-definitions-all.json+++ b/services/mcp/schema/tool-definitions-all.json@@ -8556,6 +8556,34 @@},"feature_flag": "mcp-analytics"},+ "mcp-registry-discover": {+ "description": "Find the MCP servers most likely to perform a task, ranked, with the instructions to connect to each one. Describe the task in `intent` the way a person would (\"deploy my site to vercel\"), not as keywords.\n\nEach candidate carries why it ranked where it did: `liveness` from a real handshake against the server, `why` with the score breakdown, and `measured` with observed call volume and success rate when PostHog Analytics has seen the server in use. `connect` gives the connection methods, most automated first, with each step marked for the agent to run or for a person to do.\n\nThe index is a global crawl of the official MCP registry rather than a table in this project, so it is not queryable in SQL. Relevance is keyword-based today, so a paraphrase can miss: prefer the words a server would use about itself. Use `mcp-registry-server-get` for the full tool list of one candidate.",+ "category": "MCP registry",+ "feature": "mcp_registry",+ "summary": "Discover MCP servers for a task",+ "title": "Discover MCP servers for a task",+ "required_scopes": ["mcp_registry:read"],+ "annotations": {+ "destructiveHint": false,+ "idempotentHint": true,+ "openWorldHint": true,+ "readOnlyHint": true+ }+ },+ "mcp-registry-server-get": {+ "description": "Read one registry server by id, as returned by `mcp-registry-discover`. Adds the full advertised tool list, per-version ranking scores, and connection instructions to what discover returns.\n\nMeasured usage is limited to what the calling project may see, so a server another project measured shows its ranking but not that project's figures.",+ "category": "MCP registry",+ "feature": "mcp_registry",+ "summary": "Get an MCP server",+ "title": "Get an MCP server",+ "required_scopes": ["mcp_registry:read"],+ "annotations": {+ "destructiveHint": false,+ "idempotentHint": true,+ "openWorldHint": true,+ "readOnlyHint": true+ }+ },"media-image-upload-complete": {"description": "Step 2 of the presigned upload flow. Verifies the file uploaded via media-image-upload-start, sniffs its real content type, and activates it — after this it appears in media-images-list and is publicly servable. Returns the permanent url; for emails, put it in the image block's values.src.url.","category": "Core",diff --git a/services/mcp/src/generated/mcp_registry/api.ts b/services/mcp/src/generated/mcp_registry/api.tsnew file mode 100644index 000000000000..5a61442945c0--- /dev/null+++ b/services/mcp/src/generated/mcp_registry/api.ts@@ -0,0 +1,38 @@+/**+ * Auto-generated from the Django backend OpenAPI schema.+ * MCP service uses these Zod schemas for generated tool handlers.+ * To regenerate: hogli build:openapi+ *+ * PostHog API - MCP 2 enabled ops+ * OpenAPI spec version: 1.0.0+ */+import * as zod from 'zod'++/**+ * Full server record: tools, measured stats, per-version scores, connection instructions.+ */+export const McpRegistryServersRetrieveParams = () => zod.object({+ id: zod.string(),+ project_id: zod+ .string()+ .describe(+ "Project ID of the project you're trying to access. To find the ID of the project, make a call to \/api\/projects\/."+ ),+})++/**+ * Given a task, return the MCP servers most likely to do it, each with its rank rationale, real usage signal where we measure it, and ready-to-run connection instructions. One call is everything an agent needs to go from a task to a connected server.+ */+export const McpRegistryServersDiscoverRetrieveParams = () => zod.object({+ project_id: zod+ .string()+ .describe(+ "Project ID of the project you're trying to access. To find the ID of the project, make a call to \/api\/projects\/."+ ),+})++export const McpRegistryServersDiscoverRetrieveQueryParams = () => zod.object({+ intent: zod.string().describe('What the agent is trying to do, in natural language.'),+ limit: zod.number().optional().describe('Candidates to return (default 5, max 20).'),+ version: zod.string().optional().describe('Ranking version to rank candidates by.'),+})diff --git a/services/mcp/src/lib/oauth-scopes.generated.ts b/services/mcp/src/lib/oauth-scopes.generated.tsindex 12229b37001d..faa99c99d8e5 100644--- a/services/mcp/src/lib/oauth-scopes.generated.ts+++ b/services/mcp/src/lib/oauth-scopes.generated.ts@@ -140,6 +140,8 @@ export const OAUTH_SCOPES_SUPPORTED = ['marketing_analytics:write','mcp_analytics:read','mcp_analytics:write',+ 'mcp_registry:read',+ 'mcp_registry:write','metrics:read','metrics:write','notebook:read',diff --git a/services/mcp/src/tools/generated/index.ts b/services/mcp/src/tools/generated/index.tsindex 053dfc862381..e4745696d33d 100644--- a/services/mcp/src/tools/generated/index.ts+++ b/services/mcp/src/tools/generated/index.ts@@ -38,6 +38,7 @@ import { GENERATED_TOOLS as logs } from './logs'import { GENERATED_TOOLS as managed_migrations } from './managed_migrations'import { GENERATED_TOOLS as marketing_analytics } from './marketing_analytics'import { GENERATED_TOOLS as mcp_analytics } from './mcp_analytics'+import { GENERATED_TOOLS as mcp_registry } from './mcp_registry'import { GENERATED_TOOLS as mcp_store } from './mcp_store'import { GENERATED_TOOLS as messaging } from './messaging'import { GENERATED_TOOLS as metrics } from './metrics'@@ -104,6 +105,7 @@ export const GENERATED_TOOL_MAP: Record<string, () => ToolBase<ZodObjectAny>> =...managed_migrations,...marketing_analytics,...mcp_analytics,+ ...mcp_registry,...mcp_store,...messaging,...metrics,diff --git a/services/mcp/src/tools/generated/mcp_registry.ts b/services/mcp/src/tools/generated/mcp_registry.tsnew file mode 100644index 000000000000..557bdc53c2bf--- /dev/null+++ b/services/mcp/src/tools/generated/mcp_registry.ts@@ -0,0 +1,58 @@+// AUTO-GENERATED from products/mcp_registry/mcp/tools.yaml + OpenAPI — do not edit+import { z } from 'zod'++import type { Schemas } from '@/api/generated'+import * as orvalSchemas from '@/generated/mcp_registry/api'+import type { Context, ToolBase, ZodObjectAny } from '@/tools/types'++const McpRegistryDiscoverSchema = () => {+ const McpRegistryServersDiscoverRetrieveQueryParams = orvalSchemas.McpRegistryServersDiscoverRetrieveQueryParams()+ return McpRegistryServersDiscoverRetrieveQueryParams+}++const mcpRegistryDiscover = (): ToolBase<+ ReturnType<typeof McpRegistryDiscoverSchema>,+ Schemas.MCPDiscoverResponse+> => ({+ name: 'mcp-registry-discover',+ schema: McpRegistryDiscoverSchema(),+ handler: async (context: Context, params: z.infer<ReturnType<typeof McpRegistryDiscoverSchema>>) => {+ const projectId = await context.stateManager.getProjectId()+ const result = await context.api.request<Schemas.MCPDiscoverResponse>({+ method: 'GET',+ path: `/api/projects/${encodeURIComponent(String(projectId))}/mcp_registry/servers/discover/`,+ query: {+ intent: params.intent,+ limit: params.limit,+ version: params.version,+ },+ })+ return result+ },+})++const McpRegistryServerGetSchema = () => {+ const McpRegistryServersRetrieveParams = orvalSchemas.McpRegistryServersRetrieveParams()+ return McpRegistryServersRetrieveParams.omit({ project_id: true })+}++const mcpRegistryServerGet = (): ToolBase<+ ReturnType<typeof McpRegistryServerGetSchema>,+ Schemas.MCPRegistryServerDetail+> => ({+ name: 'mcp-registry-server-get',+ schema: McpRegistryServerGetSchema(),+ handler: async (context: Context, params: z.infer<ReturnType<typeof McpRegistryServerGetSchema>>) => {+ const projectId = await context.stateManager.getProjectId()+ const result = await context.api.request<Schemas.MCPRegistryServerDetail>({+ method: 'GET',+ path: `/api/projects/${encodeURIComponent(String(projectId))}/mcp_registry/servers/${encodeURIComponent(String(params.id))}/`,+ })+ return result+ },+})++export const GENERATED_TOOLS: Record<string, () => ToolBase<ZodObjectAny>> = {+ 'mcp-registry-discover': mcpRegistryDiscover,+ 'mcp-registry-server-get': mcpRegistryServerGet,+}diff --git a/services/mcp/src/tools/links/app-url-manifest.json b/services/mcp/src/tools/links/app-url-manifest.jsonindex 14ab2463ead4..a2488bea29ef 100644--- a/services/mcp/src/tools/links/app-url-manifest.json+++ b/services/mcp/src/tools/links/app-url-manifest.json@@ -1119,6 +1119,11 @@"params": ["tab"],"scope": "project"},+ "mcpRegistry": {+ "template": "/mcp-registry",+ "params": [],+ "scope": "project"+ },"metrics": {"template": "/metrics","params": [],diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/generate-app-url.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/generate-app-url.jsonindex 3fa8f96934b6..56207cb80062 100644--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/generate-app-url.json+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/generate-app-url.json@@ -13,7 +13,7 @@"type": "object"},"url": {- "description": "A path template copied verbatim from the catalog below (e.g. `/persons/{uuid}`). Its `{placeholders}` are filled from `params`. These slugs come from PostHog's canonical route table, so they are always correct — never pass a path that is not in this list.\n\n/account-connected/{kind}\n/account/credential-review\n/account/social-connected\n/activity-logs\n/activity/{tab}\n/agentic/account-mismatch\n/agentic/authorize\n/ai\n/ai-enrichment\n/ai-evals/datasets\n/ai-evals/datasets/{id}\n/ai-evals/evaluations\n/ai-evals/evaluations/offline/experiments\n/ai-evals/evaluations/offline/experiments/{experimentId}\n/ai-evals/evaluations/templates\n/ai-evals/evaluations/{id}\n/ai-evals/taggers\n/ai-evals/taggers/{id}\n/ai-gateway\n/ai-observability/clusters\n/ai-observability/clusters/{runId}/{clusterId}\n/ai-observability/dashboard\n/ai-observability/errors\n/ai-observability/generations\n/ai-observability/playground\n/ai-observability/reviews\n/ai-observability/self-driving\n/ai-observability/sentiment\n/ai-observability/sessions\n/ai-observability/sessions/{id}\n/ai-observability/tools\n/ai-observability/traces\n/ai-observability/traces/{id}\n/ai-observability/users\n/ai/history\n/alerts\n/approvals/{id}\n/billing/authorization_status\n/business-knowledge\n/canvas\n/cli/authorize\n/cli/live\n/code-review\n/code/canvas/{channelId}/{dashboardId}\n/code/channel/{channelId}\n/code/task/{taskId}\n/cohorts\n/cohorts/{id}\n/cohorts/{id}/calculation-history\n/connect/vercel/link\n/coupons/{campaign}\n/create-organization\n/customer_analytics\n/customer_analytics/accounts\n/customer_analytics/accounts/{accountId}\n/customer_analytics/announcements\n/customer_analytics/configuration\n/customer_analytics/dashboard\n/customer_analytics/feature-requests\n/customer_analytics/feed\n/customer_analytics/journeys\n/customer_analytics/journeys/new\n/customer_analytics/journeys/templates\n/customer_analytics/journeys/{id}/edit\n/customer_analytics/notes\n/customer_analytics/tasks\n/dashboard\n/dashboard/templates/{templateId}/copy-to-project\n/dashboard/{id}\n/dashboard/{id}/sharing\n/dashboard/{id}/subscriptions\n/dashboard/{id}/subscriptions/{subscriptionId}\n/dashboard/{id}/tiles/{tileId}\n/data-catalog\n/data-catalog/metrics/{name}\n/data-management/actions\n/data-management/actions/new\n/data-management/actions/new/\n/data-management/actions/{id}\n/data-management/annotations\n/data-management/annotations/{id}\n/data-management/core-events\n/data-management/database\n/data-management/destinations\n/data-management/event-filtering\n/data-management/events\n/data-management/events/{id}\n/data-management/events/{id}/edit\n/data-management/history\n/data-management/ingestion-warnings\n/data-management/ingestion-warnings-v2\n/data-management/managed-viewsets\n/data-management/materialized-columns\n/data-management/properties\n/data-management/properties/{id}\n/data-management/properties/{id}/edit\n/data-management/revenue\n/data-management/schema\n/data-management/sources\n/data-management/sources/{id}/schemas\n/data-management/sources/{sourceId}/schemas/{schemaId}\n/data-management/transformations\n/data-management/variables\n/data-management/variables/{id}\n/data-management/variables/{id}/edit\n/data-management/warehouse-properties\n/data-ops\n/data-warehouse/connect\n/data-warehouse/new-source\n/debug\n/debug/hog\n/early_access_features\n/early_access_features/{id}\n/embedded/{token}\n/endpoints\n/endpoints/{name}\n/engineering-analytics/authors/{handle}\n/engineering-analytics/health\n/engineering-analytics/overview\n/engineering-analytics/pull-requests\n/engineering-analytics/repos/{repoOwner}/{repoName}/actions/runs/{runId}\n/engineering-analytics/repos/{repoOwner}/{repoName}/actions/workflows/{workflowName}\n/engineering-analytics/repos/{repoOwner}/{repoName}/pull-requests/{number}\n/engineering-analytics/teams\n/engineering-analytics/teams/{ownerTeam}\n/engineering-analytics/test-health\n/engineering-analytics/workflows\n/error_tracking\n/error_tracking/alerts/new/{templateId}\n/error_tracking/alerts/{id}\n/error_tracking/fingerprint/{fingerprint}\n/error_tracking/{id}\n/error_tracking/{id}/fingerprints\n/events/{id}/{timestamp}\n/experiments\n/experiments/shared-metrics\n/experiments/shared-metrics/{id}\n/experiments/staff\n/experiments/{id}\n/exports\n/feature_flags\n/feature_flags/new\n/feature_flags/staff\n/feature_flags/staff/cohorts\n/feature_flags/templates\n/feature_flags/{id}\n/functions/new/{templateId}\n/functions/{id}\n/games/368hedgehogs\n/games/flappyhog\n/groups/{groupTypeIndex}\n/groups/{groupTypeIndex}/new\n/groups/{groupTypeIndex}/{groupKey}\n/health\n/health/alerts\n/health/pipeline-status\n/health/sdk-health\n/health/{category}\n/heatmaps\n/heatmaps/new\n/heatmaps/recording\n/heatmaps/{id}\n/home\n/identity-matching\n/inbox\n/inbox/reports/triage\n/inbox/scouts/findings\n/inbox/scouts/runs\n/inbox/scouts/scratchpad\n/inbox/scouts/{skillName}\n/inbox/{tab}/{reportId}\n/insights\n/insights/new\n/insights/quick-start\n/insights/{id}\n/insights/{id}/edit\n/insights/{id}/sharing\n/insights/{id}/subscriptions\n/insights/{id}/subscriptions/{subscriptionId}\n/insights/{insightShortId}/alerts\n/instance/async_migrations\n/instance/async_migrations/future\n/instance/async_migrations/settings\n/instance/dead_letter_queue\n/instance/kafka_inspector\n/instance/metrics\n/instance/settings\n/instance/staff_users\n/instance/status\n/integrations/stripe/confirm-install\n/integrations/vercel/link-error\n/integrations/{kind}/callback\n/integrations/{slug}\n/legal\n/legal/new/{type}\n/link/{id}\n/links\n/live-debugger\n/login\n/login/2fa\n/login/2fa_setup\n/logs\n/logs/alerts/{alertId}/notifications/{hogFunctionId}\n/logs/alerts/{id}\n/logs/drop-rules/new\n/logs/drop-rules/{id}\n/logs/retention-rules/new\n/logs/retention-rules/{id}\n/managed_migrations\n/managed_migrations/new\n/marketing\n/mcp-analytics\n/mcp-analytics/activity\n/mcp-analytics/dashboard\n/mcp-analytics/intent-clustering\n/mcp-analytics/missing-capabilities\n/mcp-analytics/notifications\n/mcp-analytics/sessions\n/mcp-analytics/tool-quality\n/mcp-analytics/tool-quality/{toolName}\n/mcp-servers\n/mcp-servers/agent/{id}\n/mcp-servers/member/{id}\n/mcp-servers/server/{id}\n/mcp-servers/{tab}\n/metrics\n/models\n/models/{id}\n/move-to-cloud\n/my-tickets\n/notebooks\n/notebooks/{shortId}\n/oauth/authorize\n/onboarding\n/organization-deactivated\n/organization-pending-deletion\n/organization/billing\n/organization/billing/overview\n/organization/billing/real-time-usage\n/organization/confirm-creation\n/organization/create-project\n/person/{id}\n/persons\n/persons/{uuid}\n/pipeline/batch-exports/new/{service}\n/pipeline/batch-exports/{id}\n/pipeline/new/\n/pipeline/plugins/{id}\n/preflight\n/product_tours\n/product_tours/{id}\n/project-pending-deletion\n/prompt-management/prompts\n/prompt-management/prompts/{name}\n/pulse\n/replay-vision\n/replay-vision/new/template\n/replay-vision/observations/{observationId}\n/replay-vision/{id}/budget\n/replay-vision/{id}/configure\n/replay-vision/{id}/details\n/replay-vision/{id}/overview\n/replay-vision/{id}/self-driving\n/replay-vision/{id}/template\n/replay-vision/{id}/triggers\n/replay/file-playback\n/replay/home\n/replay/kiosk\n/replay/playlists/{id}\n/replay/settings\n/replay/{id}\n/reset\n/reset/{userUuid}/{token}\n/reset_2fa/{userUuid}/{token}\n/resource-transfer/{resourceKind}/{resourceId}\n/sessions/{id}\n/settings/environment-approvals\n/settings/organization-authentication/{feature}/{configId}\n/settings/project\n/settings/user-feature-previews\n/shared/{token}\n/shared_dashboard/{shareToken}\n/signup\n/signup/{id}\n/site/{url}\n/skills\n/skills/community\n/skills/{categoryTab}\n/skills/{name}\n/slack-task-context\n/sql\n/stamphog\n/stamphog/digests\n/stamphog/install/callback\n/stamphog/runs\n/startups\n/streamlit-apps\n/streamlit-apps/new\n/streamlit-apps/{id}\n/streamlit-apps/{id}/edit\n/subscriptions\n/subscriptions/new\n/subscriptions/{id}\n/subscriptions/{id}/edit\n/support\n/support/settings\n/support/tickets\n/support/tickets/{ticketId}\n/surveys\n/surveys/form/new\n/surveys/guided/new\n/surveys/{id}\n/tasks\n/tasks/new\n/tasks/{taskId}\n/themes/custom-css\n/toolbar\n/tracing\n/unsubscribe\n/user_research\n/user_research/{id}\n/user_research/{topicId}/response/{responseId}\n/verify_email\n/visual_review\n/visual_review/repos/{repoId}/flakiness\n/visual_review/repos/{repoId}/runs\n/visual_review/repos/{repoId}/snapshots\n/visual_review/repos/{repoId}/{runType}/snapshots/{identifier}\n/visual_review/runs/{runId}\n/visual_review/settings\n/web\n/web-scripts\n/web-scripts/new\n/web/agents\n/web/bots\n/web/content-autopilot\n/web/health\n/web/live\n/web/marketing\n/web/page-performance\n/web/page-reports\n/web/recap\n/web/session-attribution-explorer\n/web/web-vitals\n/wizard/runs\n/workflows\n/workflows/library/messages/{id}\n/workflows/library/templates/new\n/workflows/library/templates/{id}\n/workflows/new/workflow\n/workflows/{id}/{tab}",+ "description": "A path template copied verbatim from the catalog below (e.g. `/persons/{uuid}`). Its `{placeholders}` are filled from `params`. These slugs come from PostHog's canonical route table, so they are always correct — never pass a path that is not in this list.\n\n/account-connected/{kind}\n/account/credential-review\n/account/social-connected\n/activity-logs\n/activity/{tab}\n/agentic/account-mismatch\n/agentic/authorize\n/ai\n/ai-enrichment\n/ai-evals/datasets\n/ai-evals/datasets/{id}\n/ai-evals/evaluations\n/ai-evals/evaluations/offline/experiments\n/ai-evals/evaluations/offline/experiments/{experimentId}\n/ai-evals/evaluations/templates\n/ai-evals/evaluations/{id}\n/ai-evals/taggers\n/ai-evals/taggers/{id}\n/ai-gateway\n/ai-observability/clusters\n/ai-observability/clusters/{runId}/{clusterId}\n/ai-observability/dashboard\n/ai-observability/errors\n/ai-observability/generations\n/ai-observability/playground\n/ai-observability/reviews\n/ai-observability/self-driving\n/ai-observability/sentiment\n/ai-observability/sessions\n/ai-observability/sessions/{id}\n/ai-observability/tools\n/ai-observability/traces\n/ai-observability/traces/{id}\n/ai-observability/users\n/ai/history\n/alerts\n/approvals/{id}\n/billing/authorization_status\n/business-knowledge\n/canvas\n/cli/authorize\n/cli/live\n/code-review\n/code/canvas/{channelId}/{dashboardId}\n/code/channel/{channelId}\n/code/task/{taskId}\n/cohorts\n/cohorts/{id}\n/cohorts/{id}/calculation-history\n/connect/vercel/link\n/coupons/{campaign}\n/create-organization\n/customer_analytics\n/customer_analytics/accounts\n/customer_analytics/accounts/{accountId}\n/customer_analytics/announcements\n/customer_analytics/configuration\n/customer_analytics/dashboard\n/customer_analytics/feature-requests\n/customer_analytics/feed\n/customer_analytics/journeys\n/customer_analytics/journeys/new\n/customer_analytics/journeys/templates\n/customer_analytics/journeys/{id}/edit\n/customer_analytics/notes\n/customer_analytics/tasks\n/dashboard\n/dashboard/templates/{templateId}/copy-to-project\n/dashboard/{id}\n/dashboard/{id}/sharing\n/dashboard/{id}/subscriptions\n/dashboard/{id}/subscriptions/{subscriptionId}\n/dashboard/{id}/tiles/{tileId}\n/data-catalog\n/data-catalog/metrics/{name}\n/data-management/actions\n/data-management/actions/new\n/data-management/actions/new/\n/data-management/actions/{id}\n/data-management/annotations\n/data-management/annotations/{id}\n/data-management/core-events\n/data-management/database\n/data-management/destinations\n/data-management/event-filtering\n/data-management/events\n/data-management/events/{id}\n/data-management/events/{id}/edit\n/data-management/history\n/data-management/ingestion-warnings\n/data-management/ingestion-warnings-v2\n/data-management/managed-viewsets\n/data-management/materialized-columns\n/data-management/properties\n/data-management/properties/{id}\n/data-management/properties/{id}/edit\n/data-management/revenue\n/data-management/schema\n/data-management/sources\n/data-management/sources/{id}/schemas\n/data-management/sources/{sourceId}/schemas/{schemaId}\n/data-management/transformations\n/data-management/variables\n/data-management/variables/{id}\n/data-management/variables/{id}/edit\n/data-management/warehouse-properties\n/data-ops\n/data-warehouse/connect\n/data-warehouse/new-source\n/debug\n/debug/hog\n/early_access_features\n/early_access_features/{id}\n/embedded/{token}\n/endpoints\n/endpoints/{name}\n/engineering-analytics/authors/{handle}\n/engineering-analytics/health\n/engineering-analytics/overview\n/engineering-analytics/pull-requests\n/engineering-analytics/repos/{repoOwner}/{repoName}/actions/runs/{runId}\n/engineering-analytics/repos/{repoOwner}/{repoName}/actions/workflows/{workflowName}\n/engineering-analytics/repos/{repoOwner}/{repoName}/pull-requests/{number}\n/engineering-analytics/teams\n/engineering-analytics/teams/{ownerTeam}\n/engineering-analytics/test-health\n/engineering-analytics/workflows\n/error_tracking\n/error_tracking/alerts/new/{templateId}\n/error_tracking/alerts/{id}\n/error_tracking/fingerprint/{fingerprint}\n/error_tracking/{id}\n/error_tracking/{id}/fingerprints\n/events/{id}/{timestamp}\n/experiments\n/experiments/shared-metrics\n/experiments/shared-metrics/{id}\n/experiments/staff\n/experiments/{id}\n/exports\n/feature_flags\n/feature_flags/new\n/feature_flags/staff\n/feature_flags/staff/cohorts\n/feature_flags/templates\n/feature_flags/{id}\n/functions/new/{templateId}\n/functions/{id}\n/games/368hedgehogs\n/games/flappyhog\n/groups/{groupTypeIndex}\n/groups/{groupTypeIndex}/new\n/groups/{groupTypeIndex}/{groupKey}\n/health\n/health/alerts\n/health/pipeline-status\n/health/sdk-health\n/health/{category}\n/heatmaps\n/heatmaps/new\n/heatmaps/recording\n/heatmaps/{id}\n/home\n/identity-matching\n/inbox\n/inbox/reports/triage\n/inbox/scouts/findings\n/inbox/scouts/runs\n/inbox/scouts/scratchpad\n/inbox/scouts/{skillName}\n/inbox/{tab}/{reportId}\n/insights\n/insights/new\n/insights/quick-start\n/insights/{id}\n/insights/{id}/edit\n/insights/{id}/sharing\n/insights/{id}/subscriptions\n/insights/{id}/subscriptions/{subscriptionId}\n/insights/{insightShortId}/alerts\n/instance/async_migrations\n/instance/async_migrations/future\n/instance/async_migrations/settings\n/instance/dead_letter_queue\n/instance/kafka_inspector\n/instance/metrics\n/instance/settings\n/instance/staff_users\n/instance/status\n/integrations/stripe/confirm-install\n/integrations/vercel/link-error\n/integrations/{kind}/callback\n/integrations/{slug}\n/legal\n/legal/new/{type}\n/link/{id}\n/links\n/live-debugger\n/login\n/login/2fa\n/login/2fa_setup\n/logs\n/logs/alerts/{alertId}/notifications/{hogFunctionId}\n/logs/alerts/{id}\n/logs/drop-rules/new\n/logs/drop-rules/{id}\n/logs/retention-rules/new\n/logs/retention-rules/{id}\n/managed_migrations\n/managed_migrations/new\n/marketing\n/mcp-analytics\n/mcp-analytics/activity\n/mcp-analytics/dashboard\n/mcp-analytics/intent-clustering\n/mcp-analytics/missing-capabilities\n/mcp-analytics/notifications\n/mcp-analytics/sessions\n/mcp-analytics/tool-quality\n/mcp-analytics/tool-quality/{toolName}\n/mcp-registry\n/mcp-servers\n/mcp-servers/agent/{id}\n/mcp-servers/member/{id}\n/mcp-servers/server/{id}\n/mcp-servers/{tab}\n/metrics\n/models\n/models/{id}\n/move-to-cloud\n/my-tickets\n/notebooks\n/notebooks/{shortId}\n/oauth/authorize\n/onboarding\n/organization-deactivated\n/organization-pending-deletion\n/organization/billing\n/organization/billing/overview\n/organization/billing/real-time-usage\n/organization/confirm-creation\n/organization/create-project\n/person/{id}\n/persons\n/persons/{uuid}\n/pipeline/batch-exports/new/{service}\n/pipeline/batch-exports/{id}\n/pipeline/new/\n/pipeline/plugins/{id}\n/preflight\n/product_tours\n/product_tours/{id}\n/project-pending-deletion\n/prompt-management/prompts\n/prompt-management/prompts/{name}\n/pulse\n/replay-vision\n/replay-vision/new/template\n/replay-vision/observations/{observationId}\n/replay-vision/{id}/budget\n/replay-vision/{id}/configure\n/replay-vision/{id}/details\n/replay-vision/{id}/overview\n/replay-vision/{id}/self-driving\n/replay-vision/{id}/template\n/replay-vision/{id}/triggers\n/replay/file-playback\n/replay/home\n/replay/kiosk\n/replay/playlists/{id}\n/replay/settings\n/replay/{id}\n/reset\n/reset/{userUuid}/{token}\n/reset_2fa/{userUuid}/{token}\n/resource-transfer/{resourceKind}/{resourceId}\n/sessions/{id}\n/settings/environment-approvals\n/settings/organization-authentication/{feature}/{configId}\n/settings/project\n/settings/user-feature-previews\n/shared/{token}\n/shared_dashboard/{shareToken}\n/signup\n/signup/{id}\n/site/{url}\n/skills\n/skills/community\n/skills/{categoryTab}\n/skills/{name}\n/slack-task-context\n/sql\n/stamphog\n/stamphog/digests\n/stamphog/install/callback\n/stamphog/runs\n/startups\n/streamlit-apps\n/streamlit-apps/new\n/streamlit-apps/{id}\n/streamlit-apps/{id}/edit\n/subscriptions\n/subscriptions/new\n/subscriptions/{id}\n/subscriptions/{id}/edit\n/support\n/support/settings\n/support/tickets\n/support/tickets/{ticketId}\n/surveys\n/surveys/form/new\n/surveys/guided/new\n/surveys/{id}\n/tasks\n/tasks/new\n/tasks/{taskId}\n/themes/custom-css\n/toolbar\n/tracing\n/unsubscribe\n/user_research\n/user_research/{id}\n/user_research/{topicId}/response/{responseId}\n/verify_email\n/visual_review\n/visual_review/repos/{repoId}/flakiness\n/visual_review/repos/{repoId}/runs\n/visual_review/repos/{repoId}/snapshots\n/visual_review/repos/{repoId}/{runType}/snapshots/{identifier}\n/visual_review/runs/{runId}\n/visual_review/settings\n/web\n/web-scripts\n/web-scripts/new\n/web/agents\n/web/bots\n/web/content-autopilot\n/web/health\n/web/live\n/web/marketing\n/web/page-performance\n/web/page-reports\n/web/recap\n/web/session-attribution-explorer\n/web/web-vitals\n/wizard/runs\n/workflows\n/workflows/library/messages/{id}\n/workflows/library/templates/new\n/workflows/library/templates/{id}\n/workflows/new/workflow\n/workflows/{id}/{tab}","type": "string"}},diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/mcp-registry-discover.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/mcp-registry-discover.jsonnew file mode 100644index 000000000000..44b68407cf6c--- /dev/null+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/mcp-registry-discover.json@@ -0,0 +1,19 @@+{+ "$schema": "https://json-schema.org/draft/2020-12/schema",+ "properties": {+ "intent": {+ "description": "What the agent is trying to do, in natural language.",+ "type": "string"+ },+ "limit": {+ "description": "Candidates to return (default 5, max 20).",+ "type": "number"+ },+ "version": {+ "description": "Ranking version to rank candidates by.",+ "type": "string"+ }+ },+ "required": ["intent"],+ "type": "object"+}diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/mcp-registry-server-get.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/mcp-registry-server-get.jsonnew file mode 100644index 000000000000..f9bfd8020ef3--- /dev/null+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/mcp-registry-server-get.json@@ -0,0 +1,10 @@+{+ "$schema": "https://json-schema.org/draft/2020-12/schema",+ "properties": {+ "id": {+ "type": "string"+ }+ },+ "required": ["id"],+ "type": "object"+}