: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(mcp_store): accept google oauth metadata in mcp discovery (#109200)
posthog[bot]5d0cefccd218
diff --git a/frontend/snapshots.yml b/frontend/snapshots.ymlindex 038427be67d7..476f423ee4b1 100644--- a/frontend/snapshots.yml+++ b/frontend/snapshots.yml@@ -12378,6 +12378,10 @@ snapshots:hash: v1.k794b7964.4faa82bf59db418403a0b28d8124704b9c85fcc2a2bec5972a908634df209e84.Eu4aIjVfV37IpoHd8CVf9q8l5gi81p8rAy5bPHScb1sscenes-app-mcp-servers-connect-server-modal--custom-server-without-recorded-auth-type--light:hash: v1.k794b7964.db5fa21534ba04f6a8f5b352da7f7c2fe04d8f8fc3027093dc3157d30c25ce51.pFkNBfksp7dVX80g7MyMlD9ypiUajQ_mQ4ASWjTPrrc+ scenes-app-mcp-store-oauth-redirect-uri--default--dark:+ hash: v1.k794b7964.b1c7a8cf8ef24632928b544b079d8e3eda9d6b8c409d554b4f6b1e0bb58ee8f0.VObDufgfXmJ64Kp9ToBU_dBviNFf8svaKfFshzrs4vE+ scenes-app-mcp-store-oauth-redirect-uri--default--light:+ hash: v1.k794b7964.0206cf4743ec99cc070033c6a012f68ecee3dafbe337c06f2881d7164abec0ff.QAHgb7jTVNFNiYOwodfC7HGEtV2eOwVoxkRSrVttFlAscenes-app-mlinference--playground--dark:hash: v1.k794b7964.a9df705956d7728515a76cee6267e5451c06f9802deab795f8f74826dec0b4c7.MbZhIPP4m6wo2SM8LW7qqdXza75-wlLiyu62Q6cUyuQscenes-app-mlinference--playground--light:diff --git a/products/mcp_store/backend/oauth.py b/products/mcp_store/backend/oauth.pyindex e1a8a311d287..8f35c1ec0212 100644--- a/products/mcp_store/backend/oauth.py+++ b/products/mcp_store/backend/oauth.py@@ -47,6 +47,10 @@ class OAuthAuthorizeURLError(Exception):pass+class OAuthMetadataValidationError(ValueError):+ """Discovered OAuth metadata fails a safety check. The message is safe to show to the user."""++class DCRRegistrationRejectedError(Exception):"""The authorization server rejected the Dynamic Client Registration request.@@ -248,6 +252,28 @@ def _registrable_domain(hostname: str) -> str | None:return f"{extracted.domain}.{extracted.suffix}".lower()+# Providers whose own metadata puts OAuth endpoints on a second registrable domain.+# Discovery fetches issuer metadata from the issuer origin, so an attacker cannot claim these issuers.+_TRUSTED_ISSUER_ENDPOINT_DOMAINS: dict[str, frozenset[str]] = {+ # Google: issuer on accounts.google.com, token_endpoint on oauth2.googleapis.com.+ "google.com": frozenset({"googleapis.com"}),+}+++_GOOGLE_ISSUER = "https://accounts.google.com"+# Google returns a refresh token only for an offline grant, and only when the user sees the consent screen.+_GOOGLE_AUTHORIZE_PARAMS = {"access_type": "offline", "prompt": "consent"}+++def provider_authorize_params(metadata: dict) -> dict[str, str]:+ """Return extra authorize parameters for a verified provider, or an empty dict for any other issuer."""+ issuer = (metadata.get("issuer") or "").rstrip("/")+ endpoint = urlparse(metadata.get("authorization_endpoint") or "")+ if issuer == _GOOGLE_ISSUER and endpoint.scheme == "https" and endpoint.hostname == "accounts.google.com":+ return dict(_GOOGLE_AUTHORIZE_PARAMS)+ return {}++def _validate_endpoints_bound_to_issuer(metadata: dict) -> None:"""Reject metadata where OAuth endpoints live on an unrelated registrable domain from the issuer.@@ -263,16 +289,17 @@ def _validate_endpoints_bound_to_issuer(metadata: dict) -> None:"""issuer = (metadata.get("issuer") or "").rstrip("/")if not issuer:- raise ValueError("OAuth metadata is missing issuer")+ raise OAuthMetadataValidationError("OAuth metadata is missing issuer")parsed_issuer = urlparse(issuer)if not parsed_issuer.scheme or not parsed_issuer.netloc:- raise ValueError("OAuth metadata issuer is not an absolute URL")+ raise OAuthMetadataValidationError("OAuth metadata issuer is not an absolute URL")issuer_domain = _registrable_domain(parsed_issuer.hostname or "")if issuer_domain is None:- raise ValueError("OAuth metadata issuer has no registrable domain")+ raise OAuthMetadataValidationError("OAuth metadata issuer has no registrable domain")+ allowed_domains = {issuer_domain} | _TRUSTED_ISSUER_ENDPOINT_DOMAINS.get(issuer_domain, frozenset())for field in ("authorization_endpoint", "token_endpoint", "registration_endpoint"):url = metadata.get(field)if not url:@@ -285,9 +312,9 @@ def _validate_endpoints_bound_to_issuer(metadata: dict) -> None:field=field,endpoint=url,)- raise ValueError(f"OAuth endpoint '{field}' scheme does not match issuer")+ raise OAuthMetadataValidationError(f"OAuth endpoint '{field}' scheme does not match issuer")endpoint_domain = _registrable_domain(parsed.hostname or "")- if endpoint_domain != issuer_domain:+ if endpoint_domain not in allowed_domains:logger.warning("OAuth endpoint registrable domain does not match issuer",issuer=issuer,@@ -296,7 +323,7 @@ def _validate_endpoints_bound_to_issuer(metadata: dict) -> None:issuer_domain=issuer_domain,endpoint_domain=endpoint_domain,)- raise ValueError(f"OAuth endpoint '{field}' is on an unrelated domain from issuer")+ raise OAuthMetadataValidationError(f"OAuth endpoint '{field}' is on an unrelated domain from issuer")def discover_oauth_metadata(server_url: str) -> dict:diff --git a/products/mcp_store/backend/presentation/views.py b/products/mcp_store/backend/presentation/views.pyindex 6c7e7fbcec1f..b76700213f08 100644--- a/products/mcp_store/backend/presentation/views.py+++ b/products/mcp_store/backend/presentation/views.py@@ -68,11 +68,13 @@ from ..oauth import (DcrClientRegistration,DCRRegistrationRejectedError,OAuthAuthorizeURLError,+ OAuthMetadataValidationError,OAuthTokenExchangeError,discover_oauth_metadata,exchange_oauth_token,generate_pkce,oauth_resource,+ provider_authorize_params,register_dcr_client,requested_oauth_scopes,resolve_template_oauth_credentials,@@ -126,6 +128,13 @@ def _dcr_failed_detail(error: "DCRRegistrationFailedError") -> str:return "OAuth registration failed."+def _oauth_discovery_failed_detail(error: Exception) -> str:+ # Other discovery errors can carry upstream URLs or response bodies, so only validation messages reach the user.+ if isinstance(error, OAuthMetadataValidationError):+ return f"OAuth discovery failed. {error}"+ return "OAuth discovery failed."++def _hash_oauth_state_token(token: str) -> str:return hashlib.sha256(token.encode("utf-8")).hexdigest()@@ -1048,6 +1057,7 @@ class MCPServerInstallationViewSet(TeamAndOrgViewSetMixin, viewsets.ModelViewSet"state": state_token,"code_challenge": code_challenge,"code_challenge_method": "S256",+ **provider_authorize_params(metadata),}try:scopes = requested_oauth_scopes(metadata, scope_allowlist)@@ -1474,7 +1484,7 @@ class MCPServerInstallationViewSet(TeamAndOrgViewSetMixin, viewsets.ModelViewSet)if created:installation.delete()- return Response({"detail": "OAuth discovery failed."}, status=status.HTTP_400_BAD_REQUEST)+ return Response({"detail": _oauth_discovery_failed_detail(e)}, status=status.HTTP_400_BAD_REQUEST)try:registration = self._register_dcr_client_or_raise(@@ -1735,7 +1745,7 @@ class MCPServerInstallationViewSet(TeamAndOrgViewSetMixin, viewsets.ModelViewSetlogger.exception("OAuth discovery failed", server_url=mcp_url, error=str(e))if created:installation.delete()- return Response({"detail": "OAuth discovery failed."}, status=status.HTTP_400_BAD_REQUEST)+ return Response({"detail": _oauth_discovery_failed_detail(e)}, status=status.HTTP_400_BAD_REQUEST)issuer_url = metadata.get("issuer", "")if not issuer_url:@@ -1945,7 +1955,7 @@ class MCPServerInstallationViewSet(TeamAndOrgViewSetMixin, viewsets.ModelViewSetserver_url=template.url,error=str(e),)- return Response({"detail": "OAuth discovery failed."}, status=status.HTTP_400_BAD_REQUEST)+ return Response({"detail": _oauth_discovery_failed_detail(e)}, status=status.HTTP_400_BAD_REQUEST)installation.oauth_metadata = metadatainstallation.save(update_fields=["oauth_metadata", "updated_at"])else:diff --git a/products/mcp_store/backend/test/test_api.py b/products/mcp_store/backend/test/test_api.pyindex c4c6eb18c40f..bb3dd4fe79ae 100644--- a/products/mcp_store/backend/test/test_api.py+++ b/products/mcp_store/backend/test/test_api.py@@ -1,9 +1,10 @@import hashlib-from datetime import timedelta+from datetime import UTC, datetime, timedeltafrom urllib.parse import parse_qs, urlparse, urlsplit+import time_machinefrom posthog.test.base import APIBaseTest, ClickhouseTestMixin, QueryMatchingTest-from unittest.mock import patch+from unittest.mock import MagicMock, patchfrom django.conf import settingsfrom django.core.cache import cache@@ -50,6 +51,7 @@ from products.mcp_store.backend.presentation.views import (MCPServerInstallationViewSet,_is_valid_posthog_code_callback_url,)+from products.mcp_store.backend.proxy import validate_installation_authALLOWED_VERDICT = PinnedUrlVerdict(allowed=True, reason=None, pinned_ips=set())ALLOW_URL = patch("products.mcp_store.backend.url_policy.validate_url_and_pin_ips", return_value=ALLOWED_VERDICT)@@ -3540,7 +3542,7 @@ class TestOAuthIssuerSpoofingProtection(ClickhouseTestMixin, APIBaseTest, QueryM@ALLOW_URL@patch("products.mcp_store.backend.presentation.views.discover_oauth_metadata")def test_spoofed_issuer_fails_and_no_state_persisted(self, mock_discover, _allow):- mock_discover.side_effect = ValueError("Issuer mismatch in authorization server metadata")+ mock_discover.side_effect = ValueError("Issuer mismatch at https://internal.example.com")response = self.client.post(f"/api/environments/{self.team.id}/mcp_server_installations/install_custom/",@@ -3549,8 +3551,123 @@ class TestOAuthIssuerSpoofingProtection(ClickhouseTestMixin, APIBaseTest, QueryM)assert response.status_code == status.HTTP_400_BAD_REQUEST+ assert response.json()["detail"] == "OAuth discovery failed."assert not MCPServerInstallation.objects.filter(url="https://evil.com/mcp").exists()+ @ALLOW_URL+ @patch("products.mcp_store.backend.oauth.is_url_allowed", return_value=(True, None))+ @patch("products.mcp_store.backend.oauth.requests.get")+ def test_discovery_reports_the_failed_metadata_check(self, mock_get, _allow_oauth, _allow):+ metadata = {+ "issuer": "https://evil.com",+ "authorization_endpoint": "https://evil.com/authorize",+ "token_endpoint": "https://attacker.example.net/token",+ }++ def respond(url: str, **_kwargs) -> MagicMock:+ response = MagicMock()+ response.status_code = 200 if url == "https://evil.com/.well-known/oauth-authorization-server" else 404+ response.ok = response.status_code == 200+ response.json.return_value = metadata+ return response++ mock_get.side_effect = respond++ response = self.client.post(+ f"/api/environments/{self.team.id}/mcp_server_installations/install_custom/",+ data={"name": "Evil", "url": "https://evil.com/mcp", "auth_type": "oauth"},+ format="json",+ )++ assert response.status_code == status.HTTP_400_BAD_REQUEST+ assert response.json()["detail"] == (+ "OAuth discovery failed. OAuth endpoint 'token_endpoint' is on an unrelated domain from issuer"+ )+ assert not MCPServerInstallation.objects.filter(url="https://evil.com/mcp").exists()++ @ALLOW_URL+ @patch("products.mcp_store.backend.oauth.is_url_allowed", return_value=(True, None))+ @patch("products.mcp_store.backend.oauth.requests.post")+ @patch("products.mcp_store.backend.presentation.views.discover_oauth_metadata")+ def test_google_install_gets_a_refresh_token_that_survives_the_refresh_threshold(+ self, mock_discover, mock_post, _allow_oauth, _allow+ ):+ mock_discover.return_value = {+ "issuer": "https://accounts.google.com",+ "authorization_endpoint": "https://accounts.google.com/o/oauth2/v2/auth",+ "token_endpoint": "https://oauth2.googleapis.com/token",+ "code_challenge_methods_supported": ["S256"],+ "resource": "https://gmail.example.com/mcp",+ "resource_scopes_supported": ["https://www.googleapis.com/auth/gmail.readonly"],+ }++ def token_response(data: dict) -> MagicMock:+ response = MagicMock()+ response.status_code = 200+ response.json.return_value = data+ return response++ mock_post.side_effect = [+ token_response({"access_token": "first-access", "refresh_token": "google-refresh", "expires_in": 3599}),+ token_response({"access_token": "second-access", "expires_in": 3599}),+ ]+ start = datetime.now(UTC)++ with time_machine.travel(start, tick=False):+ install_response = self.client.post(+ f"/api/environments/{self.team.id}/mcp_server_installations/install_custom/",+ data={+ "name": "Gmail",+ "url": "https://gmail.example.com/mcp",+ "auth_type": "oauth",+ "client_id": "google-client-id",+ "client_secret": "google-client-secret",+ },+ format="json",+ )+ assert install_response.status_code == status.HTTP_200_OK, install_response.content+ install_url = urlparse(install_response.json()["redirect_url"])+ install_params = parse_qs(install_url.query)+ assert install_url.netloc == "accounts.google.com"+ assert install_params["access_type"] == ["offline"]+ assert install_params["prompt"] == ["consent"]+ assert install_params["code_challenge_method"] == ["S256"]+ assert install_params["redirect_uri"] == [f"{settings.SITE_URL}/api/mcp_store/oauth_redirect/"]++ callback = self.client.get(+ "/api/mcp_store/oauth_redirect/",+ {"state": install_params["state"][0], "code": "google-auth-code"},+ )+ assert callback.status_code == status.HTTP_302_FOUND++ installation = MCPServerInstallation.objects.get(url="https://gmail.example.com/mcp", user=self.user)+ assert installation.sensitive_configuration["refresh_token"] == "google-refresh"++ with time_machine.travel(start + timedelta(seconds=1800), tick=False):+ ok, error_response = validate_installation_auth(installation)++ assert ok, error_response+ refresh_call = mock_post.call_args_list[1]+ assert refresh_call.args[0] == "https://oauth2.googleapis.com/token"+ assert refresh_call.kwargs["data"]["grant_type"] == "refresh_token"+ assert refresh_call.kwargs["data"]["refresh_token"] == "google-refresh"+ installation.refresh_from_db()+ sensitive = installation.sensitive_configuration+ assert sensitive["access_token"] == "second-access"+ assert sensitive["refresh_token"] == "google-refresh"+ assert "needs_reauth" not in sensitive++ reconnect = self.client.get(+ f"/api/environments/{self.team.id}/mcp_server_installations/authorize/",+ {"installation_id": str(installation.id)},+ )+ assert reconnect.status_code == status.HTTP_302_FOUND+ reconnect_params = parse_qs(urlparse(reconnect["Location"]).query)+ assert reconnect_params["access_type"] == ["offline"]+ assert reconnect_params["prompt"] == ["consent"]+ assert reconnect_params["client_id"] == ["google-client-id"]+ mock_discover.assert_called_once()+@ALLOW_URL@patch("products.mcp_store.backend.presentation.views.register_dcr_client")@patch("products.mcp_store.backend.presentation.views.discover_oauth_metadata")@@ -3821,6 +3938,8 @@ class TestOAuthIssuerSpoofingProtection(ClickhouseTestMixin, APIBaseTest, QueryMassert params["client_id"][0] == "existing-client-id"assert params["resource"][0] == "https://mcp.example.com/"assert params["scope"][0] == "read"+ assert "access_type" not in params+ assert "prompt" not in params@ALLOW_URLdef test_authorize_uses_opaque_state_token(self, _allow):@@ -3922,6 +4041,46 @@ class TestBuildAuthorizeUrlFromMetadata(SimpleTestCase):# PostHog's PRM resource must win over the AS-baked issuer resourceassert params["resource"] == ["https://mcp.railway.com"]+ @parameterized.expand(+ [+ (+ "verified_google_issuer",+ "https://accounts.google.com",+ "https://accounts.google.com/o/oauth2/v2/auth",+ {"access_type": ["offline"], "prompt": ["consent"]},+ ),+ ("other_issuer", "https://auth.example.com", "https://auth.example.com/authorize", {}),+ (+ "google_issuer_claim_with_foreign_authorize_endpoint",+ "https://accounts.google.com",+ "https://attacker.example.net/authorize",+ {},+ ),+ (+ "google_authorize_endpoint_under_other_issuer",+ "https://auth.example.com",+ "https://accounts.google.com/o/oauth2/v2/auth",+ {},+ ),+ ]+ )+ def test_adds_offline_consent_params_only_for_google(+ self, _name: str, issuer: str, authorization_endpoint: str, expected: dict[str, list[str]]+ ) -> None:+ view = MCPServerInstallationViewSet()+ authorize_url = view._build_authorize_url_from_metadata(+ metadata={"issuer": issuer, "authorization_endpoint": authorization_endpoint},+ client_id="test-client",+ redirect_uri="https://us.posthog.com/api/mcp_store/oauth_redirect/",+ state_token="test-state",+ code_challenge="test-challenge",+ )++ params = parse_qs(urlsplit(authorize_url).query)+ assert {key: params[key] for key in ("access_type", "prompt") if key in params} == expected+ assert params["code_challenge"] == ["test-challenge"]+ assert params["code_challenge_method"] == ["S256"]+def test_keeps_repeated_endpoint_query_params(self) -> None:view = MCPServerInstallationViewSet()authorize_url = view._build_authorize_url_from_metadata(diff --git a/products/mcp_store/backend/test/test_oauth_unit.py b/products/mcp_store/backend/test/test_oauth_unit.pyindex 6c97dd3792f1..2a2c189cfa3b 100644--- a/products/mcp_store/backend/test/test_oauth_unit.py+++ b/products/mcp_store/backend/test/test_oauth_unit.py@@ -6,6 +6,7 @@ import requestsfrom parameterized import parameterizedfrom products.mcp_store.backend.oauth import (+ OAuthMetadataValidationError,SSRFBlockedError,_resolve_issuer,_validate_endpoints_bound_to_issuer,@@ -348,6 +349,14 @@ class TestValidateEndpointsBoundToIssuer(SimpleTestCase):"registration_endpoint": "https://mcp.buildbetter.app/register",},),+ (+ "google_token_endpoint_on_googleapis",+ {+ "issuer": "https://accounts.google.com",+ "authorization_endpoint": "https://accounts.google.com/o/oauth2/v2/auth",+ "token_endpoint": "https://oauth2.googleapis.com/token",+ },+ ),("non_standard_port_in_issuer_does_not_break_registrable_domain_extraction",{@@ -400,6 +409,24 @@ class TestValidateEndpointsBoundToIssuer(SimpleTestCase):},"token_endpoint",),+ (+ "googleapis_endpoint_under_non_google_issuer",+ {+ "issuer": "https://auth.example.com",+ "authorization_endpoint": "https://auth.example.com/authorize",+ "token_endpoint": "https://oauth2.googleapis.com/token",+ },+ "token_endpoint",+ ),+ (+ "unrelated_domain_under_google_issuer",+ {+ "issuer": "https://accounts.google.com",+ "authorization_endpoint": "https://accounts.google.com/o/oauth2/v2/auth",+ "token_endpoint": "https://attacker.com/token",+ },+ "token_endpoint",+ ),("unrelated_registrable_domain_co_uk_lookalike",{@@ -412,7 +439,7 @@ class TestValidateEndpointsBoundToIssuer(SimpleTestCase):])def test_rejects_mismatched_endpoints(self, _name, metadata, offending_field):- with self.assertRaises(ValueError) as ctx:+ with self.assertRaises(OAuthMetadataValidationError) as ctx:_validate_endpoints_bound_to_issuer(metadata)self.assertIn(offending_field, str(ctx.exception))diff --git a/products/mcp_store/frontend/OAuthRedirectUri.stories.tsx b/products/mcp_store/frontend/OAuthRedirectUri.stories.tsxnew file mode 100644index 000000000000..591f29beda51--- /dev/null+++ b/products/mcp_store/frontend/OAuthRedirectUri.stories.tsx@@ -0,0 +1,12 @@+import type { Meta, StoryObj } from '@storybook/react'++import { OAuthRedirectUri } from './OAuthRedirectUri'++const meta: Meta<typeof OAuthRedirectUri> = {+ title: 'Scenes-App/MCP Store/OAuth redirect URI',+ component: OAuthRedirectUri,+ parameters: { layout: 'padded' },+}+export default meta++export const Default: StoryObj<typeof OAuthRedirectUri> = {}diff --git a/products/mcp_store/frontend/OAuthRedirectUri.test.tsx b/products/mcp_store/frontend/OAuthRedirectUri.test.tsxnew file mode 100644index 000000000000..38876059d8c4--- /dev/null+++ b/products/mcp_store/frontend/OAuthRedirectUri.test.tsx@@ -0,0 +1,34 @@+import '@testing-library/jest-dom'++import { act, cleanup, render, screen } from '@testing-library/react'++import { preflightLogic } from 'lib/logic/preflightLogic'++import { initKeaTests } from '~/test/init'+import { PreflightStatus } from '~/types'++import { OAuthRedirectUri } from './OAuthRedirectUri'++describe('OAuthRedirectUri', () => {+ beforeEach(() => {+ initKeaTests(false)+ preflightLogic.mount()+ })++ afterEach(() => {+ cleanup()+ })++ it('shows only the configured site URL and nothing before preflight resolves', () => {+ const { container } = render(<OAuthRedirectUri />)++ expect(container).toBeEmptyDOMElement()++ act(() => {+ preflightLogic.actions.loadPreflightSuccess({ site_url: 'https://posthog.example.com' } as PreflightStatus)+ })++ expect(screen.getByText('https://posthog.example.com/api/mcp_store/oauth_redirect/')).toBeInTheDocument()+ expect(screen.queryByText(new RegExp(window.location.origin))).not.toBeInTheDocument()+ })+})diff --git a/products/mcp_store/frontend/OAuthRedirectUri.tsx b/products/mcp_store/frontend/OAuthRedirectUri.tsxnew file mode 100644index 000000000000..9d38d1527420--- /dev/null+++ b/products/mcp_store/frontend/OAuthRedirectUri.tsx@@ -0,0 +1,23 @@+import { useValues } from 'kea'++import { CopyToClipboardInline } from 'lib/components/CopyToClipboard'+import { preflightLogic } from 'lib/logic/preflightLogic'++export function OAuthRedirectUri(): JSX.Element | null {+ const { preflight } = useValues(preflightLogic)++ // The backend builds the redirect URI from SITE_URL, which can differ from the browser origin.+ if (!preflight?.site_url) {+ return null+ }++ return (+ <div>+ <div className="font-semibold">Redirect URI</div>+ <p className="text-secondary mb-1">Add this URI to your OAuth client at the provider.</p>+ <CopyToClipboardInline description="redirect URI" className="font-mono break-all">+ {`${preflight.site_url}/api/mcp_store/oauth_redirect/`}+ </CopyToClipboardInline>+ </div>+ )+}diff --git a/products/mcp_store/frontend/gateway/GatewayAddServerModal.tsx b/products/mcp_store/frontend/gateway/GatewayAddServerModal.tsxindex 63f84a0b5ac7..ede46de9ae4e 100644--- a/products/mcp_store/frontend/gateway/GatewayAddServerModal.tsx+++ b/products/mcp_store/frontend/gateway/GatewayAddServerModal.tsx@@ -13,6 +13,7 @@ import {import { LemonField } from 'lib/lemon-ui/LemonField'import { InstallCustomAuthTypeEnumApi } from '../generated/api.schemas'+import { OAuthRedirectUri } from '../OAuthRedirectUri'import { isValidMcpUrl } from './gatewayAddServer'import { AGENT_GRANT_SCOPE_OPTIONS } from './gatewayUtils'import { mcpGatewayLogic } from './mcpGatewayLogic'@@ -158,6 +159,7 @@ export function GatewayAddServerModal(): JSX.Element | null {header: 'Advanced OAuth settings',content: (<div className="flex flex-col gap-3">+ <OAuthRedirectUri /><LemonField.Purelabel="OAuth client ID (optional)"help="Leave blank to let PostHog register a client."diff --git a/products/mcp_store/frontend/scene/AddCustomServerForm.tsx b/products/mcp_store/frontend/scene/AddCustomServerForm.tsxindex 89126f33519b..6c8e12adc825 100644--- a/products/mcp_store/frontend/scene/AddCustomServerForm.tsx+++ b/products/mcp_store/frontend/scene/AddCustomServerForm.tsx@@ -9,6 +9,7 @@ import { LemonField } from 'lib/lemon-ui/LemonField'import type { McpInstallationScope } from '../mcpStoreLogic'import { mcpStoreLogic } from '../mcpStoreLogic'+import { OAuthRedirectUri } from '../OAuthRedirectUri'const AUTH_TYPE_OPTIONS = [{ value: 'api_key', label: 'API key' },@@ -122,6 +123,7 @@ export function AddCustomServerForm(): JSX.Element {header: 'Advanced — bring your own OAuth client',content: (<div className="deprecated-space-y-3">+ <OAuthRedirectUri /><LemonFieldname="client_id"label="OAuth client ID"