Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

feat(data-warehouse): render the full connection form on the source connect page (#63252)

Tom Owerse3a416bf3088
diff --git a/products/data_warehouse/backend/api/external_data_source.py b/products/data_warehouse/backend/api/external_data_source.py
index c16b482b074a..2545cc89dfb1 100644
--- a/products/data_warehouse/backend/api/external_data_source.py
+++ b/products/data_warehouse/backend/api/external_data_source.py
@@ -1001,10 +1001,10 @@ class SourceSetupSerializer(serializers.Serializer):
required=False,
help_text=(
"Connection details as flat keys for the source_type (discover required fields with the wizard "
- "tool). Prefer references over raw secrets: for OAuth sources pass the source's integration id key "
- "(e.g. {'hubspot_integration_id': 123}); for credential sources pass {'credential_id': <id>} "
- "referencing credentials the user stored via the connect-link page (discover ids with the "
- "stored_credentials endpoint) — they are merged in server-side and deleted once consumed. "
+ "tool). Prefer references over raw secrets: pass {'credential_id': <id>} referencing the connection "
+ "details the user stored via the connect-link page (discover ids with the stored_credentials "
+ "endpoint) — they are merged in server-side and deleted once consumed. An already-connected OAuth "
+ "integration can be passed via its id key instead (e.g. {'hubspot_integration_id': 123}). "
"A 'schemas' array is NOT required — all discovered tables are enabled automatically with sensible "
"sync defaults."
),
@@ -1060,24 +1060,17 @@ class SourceConnectLinkSerializer(serializers.Serializer):
auth_method = serializers.ChoiceField(
choices=["oauth", "credentials"],
help_text=(
- "'oauth' = the user authorizes in their browser; 'credentials' = the user enters credentials in the "
- "PostHog UI. Either way secrets never pass through the agent."
+ "What the user will do on the connect page: 'oauth' = authorize an account in their browser; "
+ "'credentials' = enter connection details (or pick OAuth where the source offers both). Either "
+ "way secrets never pass through the agent, and the result is always a stored credential id."
),
)
connect_url = serializers.CharField(
help_text=(
- "Full URL to share with the user. They open it in a browser to authorize or enter credentials directly "
- "in PostHog — credentials never pass through the agent or the chat."
+ "Full URL to share with the user. It opens the source's connection form in PostHog — "
+ "credentials never pass through the agent or the chat."
)
)
- integration_field = serializers.CharField(
- allow_null=True,
- help_text=(
- "The payload key to pass to data-warehouse-source-setup: for OAuth sources, the source's integration "
- "id key (e.g. 'hubspot_integration_id'); for credential sources, 'credential_id' referencing the "
- "credentials the user stored via the connect page."
- ),
- )
instructions = serializers.CharField(help_text="Next steps for the agent to relay to the user.")
@@ -1105,20 +1098,17 @@ class SourceCredentialSerializer(serializers.Serializer):
)
-def _find_oauth_field(config: object) -> dict | None:
- """Recursively find an OAuth field ({type: 'oauth', kind, name, ...}) in a source config dump."""
- if isinstance(config, dict):
- if config.get("type") == "oauth" and config.get("kind"):
- return config
- for value in config.values():
- found = _find_oauth_field(value)
- if found is not None:
- return found
- elif isinstance(config, list):
- for item in config:
- found = _find_oauth_field(item)
- if found is not None:
- return found
+def _find_top_level_oauth_field(config: dict) -> dict | None:
+ """Find a top-level OAuth field ({type: 'oauth', kind, name, ...}) in a source config dump.
+
+ Only a top-level OAuth field makes a source OAuth-only (e.g. Hubspot). An OAuth option
+ nested inside a select (e.g. Stripe's auth_method) coexists with credential options, so
+ those sources route to the credentials connect page — its form still offers the OAuth
+ choice alongside API keys.
+ """
+ for field in config.get("fields") or []:
+ if isinstance(field, dict) and field.get("type") == "oauth" and field.get("kind"):
+ return field
return None
@@ -2919,11 +2909,10 @@ class ExternalDataSourceViewSet(TeamAndOrgViewSetMixin, AccessControlViewSetMixi
def connect_link(self, request: Request, *args: Any, **kwargs: Any) -> Response:
"""Return a secure browser link for connecting a data warehouse source.
- For OAuth sources the link starts the OAuth authorize flow; for credential sources it opens a minimal
- connect page where the user enters only their credentials — no table selection, no source creation.
- Either way the user authenticates in their browser, credentials never pass through the agent, and the
- agent finishes setup afterwards by passing the resulting reference (integration id or credential id)
- to data-warehouse-source-setup.
+ The link opens a minimal connect page rendering the source's full connection form — OAuth options
+ included — with no table selection and no source creation. The user authenticates in their browser,
+ secrets never pass through the agent, and the agent finishes setup afterwards by passing the stored
+ credential id to data-warehouse-source-setup.
"""
source_type = request.query_params.get("source_type")
if not source_type:
@@ -2940,43 +2929,26 @@ class ExternalDataSourceViewSet(TeamAndOrgViewSetMixin, AccessControlViewSetMixi
)
source = SourceRegistry.get_source(source_type_model)
- oauth_field = _find_oauth_field(source.get_source_config.model_dump())
-
- # Minimal connect page: credentials only — no table selection, no source creation in the UI.
- ui_path = f"/project/{self.team_id}/data-warehouse/connect?kind={quote(str(source_type))}"
-
- if oauth_field is not None:
- connect_url = (
- f"{settings.SITE_URL}/api/integrations/authorize"
- f"?kind={quote(oauth_field['kind'])}&next={quote(ui_path, safe='')}"
- )
- data = {
- "source_type": source_type,
- "auth_method": "oauth",
- "connect_url": connect_url,
- "integration_field": oauth_field["name"],
- "instructions": (
- f"Share this link with the user to authorize {source_type} in their browser. Once they confirm "
- f"they're done, find the new integration id via integrations-list (kind='{oauth_field['kind']}') "
- f'and call data-warehouse-source-setup with {{"{oauth_field["name"]}": <integration id>}}. '
- "Never ask the user to paste OAuth tokens into the chat."
- ),
- }
- else:
- data = {
- "source_type": source_type,
- "auth_method": "credentials",
- "connect_url": f"{settings.SITE_URL}{ui_path}",
- "integration_field": "credential_id",
- "instructions": (
- f"Share this link with the user. They enter their {source_type} credentials directly in PostHog "
- "(over TLS) — never ask them to paste credentials into the chat. The page only stores the "
- "credentials; it does not create the source. Once the user confirms they're done, find the "
- f"stored credential id via data-warehouse-stored-credentials-list (source_type='{source_type}', "
- 'newest first) and call data-warehouse-source-setup with {"credential_id": <id>} in the payload. '
- "Stored credentials are single-use and expire after 24 hours."
- ),
- }
+ oauth_field = _find_top_level_oauth_field(source.get_source_config.model_dump())
+ action_phrase = (
+ f"connect their {source_type} account" if oauth_field else f"enter their {source_type} connection details"
+ )
+
+ data = {
+ "source_type": source_type,
+ "auth_method": "oauth" if oauth_field else "credentials",
+ "connect_url": (
+ f"{settings.SITE_URL}/project/{self.team_id}/data-warehouse/connect?kind={quote(str(source_type))}"
+ ),
+ "instructions": (
+ f"Share this link with the user. They {action_phrase} directly in PostHog — never ask them to "
+ "paste credentials or tokens into the chat. The page only stores the connection details; it does "
+ "not create the source. Once the user confirms they're done, find the stored credential id via "
+ f"data-warehouse-stored-credentials-list (source_type='{source_type}', newest first) and call "
+ 'data-warehouse-source-setup with {"credential_id": <id>} in the payload. Stored credentials are '
+ "single-use and expire after 24 hours."
+ ),
+ }
return Response(status=status.HTTP_200_OK, data=SourceConnectLinkSerializer(data).data)
@extend_schema(responses=ExternalDataSourceConnectionOptionSerializer(many=True))
diff --git a/products/data_warehouse/backend/api/test/test_external_data_source.py b/products/data_warehouse/backend/api/test/test_external_data_source.py
index 25194a5d0039..8e2817b1cb5a 100644
--- a/products/data_warehouse/backend/api/test/test_external_data_source.py
+++ b/products/data_warehouse/backend/api/test/test_external_data_source.py
@@ -8425,23 +8425,25 @@ class TestExternalDataSourceConnectLink(APIBaseTest):
f"/api/environments/{self.team.pk}/external_data_sources/connect_link?source_type={source_type}"
)
- def test_connect_link_oauth_source(self):
- response = self._connect_link("Hubspot")
- assert response.status_code == status.HTTP_200_OK
- data = response.json()
- assert data["auth_method"] == "oauth"
- assert data["integration_field"] == "hubspot_integration_id"
- assert "/api/integrations/authorize?kind=hubspot" in data["connect_url"]
- # The post-auth return path lands on the minimal connect page, not the full wizard.
- assert "data-warehouse%2Fconnect" in data["connect_url"]
-
- def test_connect_link_credentials_source(self):
- response = self._connect_link("Postgres")
+ @parameterized.expand(
+ [
+ # OAuth-only sources connect via the same page — the form renders the integration picker.
+ ("oauth_only", "Hubspot", "oauth"),
+ ("credentials_only", "Postgres", "credentials"),
+ # Stripe's OAuth option is nested inside the auth_method select alongside API key —
+ # the page form offers both, so the user chooses how to authenticate.
+ ("mixed_auth", "Stripe", "credentials"),
+ ]
+ )
+ def test_connect_link_always_points_at_the_connect_page(self, _name, source_type, expected_auth_method):
+ response = self._connect_link(source_type)
assert response.status_code == status.HTTP_200_OK
data = response.json()
- assert data["auth_method"] == "credentials"
- assert data["integration_field"] == "credential_id"
- assert f"/project/{self.team.pk}/data-warehouse/connect?kind=Postgres" in data["connect_url"]
+ assert data["auth_method"] == expected_auth_method
+ assert f"/project/{self.team.pk}/data-warehouse/connect?kind={source_type}" in data["connect_url"]
+ # One discovery path for every source: the page stores a credential, the agent passes its id.
+ assert "data-warehouse-stored-credentials-list" in data["instructions"]
+ assert "credential_id" in data["instructions"]
def test_connect_link_missing_source_type(self):
response = self.client.get(f"/api/environments/{self.team.pk}/external_data_sources/connect_link")
diff --git a/products/data_warehouse/frontend/generated/api.schemas.ts b/products/data_warehouse/frontend/generated/api.schemas.ts
index c1889c639e7e..9064474189ad 100644
--- a/products/data_warehouse/frontend/generated/api.schemas.ts
+++ b/products/data_warehouse/frontend/generated/api.schemas.ts
@@ -1357,18 +1357,13 @@ export const AuthMethodEnumApi = {
export interface SourceConnectLinkApi {
/** The source type the link is for. */
source_type: string
- /** 'oauth' = the user authorizes in their browser; 'credentials' = the user enters credentials in the PostHog UI. Either way secrets never pass through the agent.
+ /** What the user will do on the connect page: 'oauth' = authorize an account in their browser; 'credentials' = enter connection details (or pick OAuth where the source offers both). Either way secrets never pass through the agent, and the result is always a stored credential id.
*
* * `oauth` - oauth
* * `credentials` - credentials */
auth_method: AuthMethodEnumApi
- /** Full URL to share with the user. They open it in a browser to authorize or enter credentials directly in PostHog — credentials never pass through the agent or the chat. */
+ /** Full URL to share with the user. It opens the source's connection form in PostHog — credentials never pass through the agent or the chat. */
connect_url: string
- /**
- * The payload key to pass to data-warehouse-source-setup: for OAuth sources, the source's integration id key (e.g. 'hubspot_integration_id'); for credential sources, 'credential_id' referencing the credentials the user stored via the connect page.
- * @nullable
- */
- integration_field: string | null
/** Next steps for the agent to relay to the user. */
instructions: string
}
@@ -1634,7 +1629,7 @@ export interface DatabaseSchemaRequestApi {
}
/**
- * Connection details as flat keys for the source_type (discover required fields with the wizard tool). Prefer references over raw secrets: for OAuth sources pass the source's integration id key (e.g. {'hubspot_integration_id': 123}); for credential sources pass {'credential_id': <id>} referencing credentials the user stored via the connect-link page (discover ids with the stored_credentials endpoint) — they are merged in server-side and deleted once consumed. A 'schemas' array is NOT required — all discovered tables are enabled automatically with sensible sync defaults.
+ * Connection details as flat keys for the source_type (discover required fields with the wizard tool). Prefer references over raw secrets: pass {'credential_id': <id>} referencing the connection details the user stored via the connect-link page (discover ids with the stored_credentials endpoint) — they are merged in server-side and deleted once consumed. An already-connected OAuth integration can be passed via its id key instead (e.g. {'hubspot_integration_id': 123}). A 'schemas' array is NOT required — all discovered tables are enabled automatically with sensible sync defaults.
*/
export type SourceSetupApiPayload = { [key: string]: unknown }
@@ -1869,7 +1864,7 @@ export interface SourceSetupApi {
* * `OracleFusion` - OracleFusion
* * `Custom` - Custom */
source_type: ExternalDataSourceTypeEnumApi
- /** Connection details as flat keys for the source_type (discover required fields with the wizard tool). Prefer references over raw secrets: for OAuth sources pass the source's integration id key (e.g. {'hubspot_integration_id': 123}); for credential sources pass {'credential_id': <id>} referencing credentials the user stored via the connect-link page (discover ids with the stored_credentials endpoint) — they are merged in server-side and deleted once consumed. A 'schemas' array is NOT required — all discovered tables are enabled automatically with sensible sync defaults. */
+ /** Connection details as flat keys for the source_type (discover required fields with the wizard tool). Prefer references over raw secrets: pass {'credential_id': <id>} referencing the connection details the user stored via the connect-link page (discover ids with the stored_credentials endpoint) — they are merged in server-side and deleted once consumed. An already-connected OAuth integration can be passed via its id key instead (e.g. {'hubspot_integration_id': 123}). A 'schemas' array is NOT required — all discovered tables are enabled automatically with sensible sync defaults. */
payload?: SourceSetupApiPayload
/**
* Table name prefix in HogQL, e.g. 'stripe' produces stripe_charges. Defaults to the source type.
diff --git a/products/data_warehouse/frontend/generated/api.ts b/products/data_warehouse/frontend/generated/api.ts
index 00c823cbf298..74e974178e1b 100644
--- a/products/data_warehouse/frontend/generated/api.ts
+++ b/products/data_warehouse/frontend/generated/api.ts
@@ -1102,11 +1102,10 @@ export const getExternalDataSourcesConnectLinkRetrieveUrl = (
/**
* Return a secure browser link for connecting a data warehouse source.
*
- * For OAuth sources the link starts the OAuth authorize flow; for credential sources it opens a minimal
- * connect page where the user enters only their credentials — no table selection, no source creation.
- * Either way the user authenticates in their browser, credentials never pass through the agent, and the
- * agent finishes setup afterwards by passing the resulting reference (integration id or credential id)
- * to data-warehouse-source-setup.
+ * The link opens a minimal connect page rendering the source's full connection form — OAuth options
+ * included — with no table selection and no source creation. The user authenticates in their browser,
+ * secrets never pass through the agent, and the agent finishes setup afterwards by passing the stored
+ * credential id to data-warehouse-source-setup.
*/
export const externalDataSourcesConnectLinkRetrieve = async (
projectId: string,
diff --git a/products/data_warehouse/frontend/generated/api.zod.ts b/products/data_warehouse/frontend/generated/api.zod.ts
index e7a19067ab6b..e4fc8816aadb 100644
--- a/products/data_warehouse/frontend/generated/api.zod.ts
+++ b/products/data_warehouse/frontend/generated/api.zod.ts
@@ -1713,7 +1713,7 @@ export const ExternalDataSourcesSetupCreateBody = /* @__PURE__ */ zod.object({
.record(zod.string(), zod.unknown())
.optional()
.describe(
- "Connection details as flat keys for the source_type (discover required fields with the wizard tool). Prefer references over raw secrets: for OAuth sources pass the source's integration id key (e.g. {'hubspot_integration_id': 123}); for credential sources pass {'credential_id': <id>} referencing credentials the user stored via the connect-link page (discover ids with the stored_credentials endpoint) — they are merged in server-side and deleted once consumed. A 'schemas' array is NOT required — all discovered tables are enabled automatically with sensible sync defaults."
+ "Connection details as flat keys for the source_type (discover required fields with the wizard tool). Prefer references over raw secrets: pass {'credential_id': <id>} referencing the connection details the user stored via the connect-link page (discover ids with the stored_credentials endpoint) — they are merged in server-side and deleted once consumed. An already-connected OAuth integration can be passed via its id key instead (e.g. {'hubspot_integration_id': 123}). A 'schemas' array is NOT required — all discovered tables are enabled automatically with sensible sync defaults."
),
prefix: zod
.string()
diff --git a/products/data_warehouse/frontend/scenes/SourceConnectScene/SourceConnectScene.tsx b/products/data_warehouse/frontend/scenes/SourceConnectScene/SourceConnectScene.tsx
index 1bea4e746772..4a67f7e6dbf0 100644
--- a/products/data_warehouse/frontend/scenes/SourceConnectScene/SourceConnectScene.tsx
+++ b/products/data_warehouse/frontend/scenes/SourceConnectScene/SourceConnectScene.tsx
@@ -7,6 +7,7 @@ import { LemonButton, LemonSkeleton, LemonTag, Link, Tooltip } from '@posthog/le
import { LemonBanner } from 'lib/lemon-ui/LemonBanner'
import { LemonMarkdown } from 'lib/lemon-ui/LemonMarkdown'
import { SceneExport } from 'scenes/sceneTypes'
+import { urls } from 'scenes/urls'
import { SceneContent } from '~/layout/scenes/components/SceneContent'
import { SceneTitleSection } from '~/layout/scenes/components/SceneTitleSection'
@@ -21,14 +22,8 @@ export const scene: SceneExport = {
}
export function SourceConnectScene(): JSX.Element {
- const {
- kind,
- sourceConfig,
- isOauthSource,
- storedCredential,
- availableSourcesLoading,
- isCredentialsFormSubmitting,
- } = useValues(sourceConnectSceneLogic)
+ const { kind, sourceConfig, storedCredential, availableSourcesLoading, isCredentialsFormSubmitting } =
+ useValues(sourceConnectSceneLogic)
const { setCredentialsFormValue } = useActions(sourceConnectSceneLogic)
if (availableSourcesLoading) {
@@ -54,9 +49,9 @@ export function SourceConnectScene(): JSX.Element {
name={`Connect ${sourceLabel}`}
resourceType={{ type: 'data_pipeline' }}
description={
- isOauthSource || storedCredential
+ storedCredential
? undefined
- : `Enter your ${sourceLabel} credentials. They are stored encrypted, kept only until the source is created (at most 24 hours), and never shared with anyone — including the assistant that sent you here.`
+ : `Connect your ${sourceLabel} account or enter its credentials. Everything you submit is stored encrypted, kept only until the source is created (at most 24 hours), and never shared with anyone — including the assistant that sent you here.`
}
/>
<div className="max-w-200">
@@ -68,14 +63,6 @@ export function SourceConnectScene(): JSX.Element {
source. Credential id: <code>{storedCredential.credential_id}</code>.
</p>
</LemonBanner>
- ) : isOauthSource ? (
- <LemonBanner type="info">
- <p className="font-semibold mb-1">{sourceLabel} connects through your browser.</p>
- <p className="m-0 text-sm">
- If you've just finished authorizing {sourceLabel} in this window, you're all set — return to
- your chat and let the assistant know, and it will finish setting up the source.
- </p>
- </LemonBanner>
) : (
<Form
logic={sourceConnectSceneLogic}
@@ -118,6 +105,7 @@ export function SourceConnectScene(): JSX.Element {
showAccessMethodSelector={false}
showCdcConfig={false}
setSourceConnectionDetailsValue={setCredentialsFormValue}
+ oauthRedirectUrl={urls.dataWarehouseSourceConnect(sourceConfig.name)}
/>
<LemonButton
type="primary"
diff --git a/products/data_warehouse/frontend/scenes/SourceConnectScene/sourceConnectSceneLogic.test.ts b/products/data_warehouse/frontend/scenes/SourceConnectScene/sourceConnectSceneLogic.test.ts
index 971a7bd35532..0dff06d4403a 100644
--- a/products/data_warehouse/frontend/scenes/SourceConnectScene/sourceConnectSceneLogic.test.ts
+++ b/products/data_warehouse/frontend/scenes/SourceConnectScene/sourceConnectSceneLogic.test.ts
@@ -112,17 +112,6 @@ describe('sourceConnectSceneLogic', () => {
expect(sourceConnectSceneLogic.values.sourceConfig).toBeNull()
})
- it.each([
- ['Postgres', false],
- ['Hubspot', true],
- // Stripe's oauth field is nested inside a select option — must still count as oauth,
- // matching the backend's recursive _find_oauth_field
- ['Stripe', true],
- ])('classifies %s as oauth=%s', (kind, expected) => {
- router.actions.push(`/data-warehouse/connect?kind=${kind}`)
- expect(sourceConnectSceneLogic.values.isOauthSource).toEqual(expected)
- })
-
it('starts with no stored credential and records one after setStoredCredential', () => {
expect(sourceConnectSceneLogic.values.storedCredential).toBeNull()
sourceConnectSceneLogic.actions.setStoredCredential({
diff --git a/products/data_warehouse/frontend/scenes/SourceConnectScene/sourceConnectSceneLogic.tsx b/products/data_warehouse/frontend/scenes/SourceConnectScene/sourceConnectSceneLogic.tsx
index 47d5d322d0d7..074c1d767a70 100644
--- a/products/data_warehouse/frontend/scenes/SourceConnectScene/sourceConnectSceneLogic.tsx
+++ b/products/data_warehouse/frontend/scenes/SourceConnectScene/sourceConnectSceneLogic.tsx
@@ -16,20 +16,6 @@ import { availableSourcesLogic } from '../NewSourceScene/availableSourcesLogic'
import { getErrorsForFields } from '../NewSourceScene/sourceWizardLogic'
import type { sourceConnectSceneLogicType } from './sourceConnectSceneLogicType'
-const containsOauthField = (fields: SourceFieldConfig[]): boolean =>
- fields.some((field) => {
- if (field.type === 'oauth') {
- return true
- }
- if (field.type === 'switch-group') {
- return containsOauthField(field.fields)
- }
- if (field.type === 'select') {
- return field.options.some((option) => containsOauthField(option.fields ?? []))
- }
- return false
- })
-
const buildCredentialsPayload = async (
fields: SourceFieldConfig[],
formPayload: Record<string, any>
@@ -92,10 +78,6 @@ export const sourceConnectSceneLogic = kea<sourceConnectSceneLogicType>([
)
},
],
- isOauthSource: [
- (s) => [s.sourceConfig],
- (sourceConfig): boolean => (sourceConfig ? containsOauthField(sourceConfig.fields) : false),
- ],
breadcrumbs: [
(s) => [s.sourceConfig],
(sourceConfig): Breadcrumb[] => [
diff --git a/products/data_warehouse/frontend/shared/components/forms/SourceForm.tsx b/products/data_warehouse/frontend/shared/components/forms/SourceForm.tsx
index ff6f03435694..17ad2bd3df03 100644
--- a/products/data_warehouse/frontend/shared/components/forms/SourceForm.tsx
+++ b/products/data_warehouse/frontend/shared/components/forms/SourceForm.tsx
@@ -14,6 +14,7 @@ import {
LemonTextArea,
} from '@posthog/lemon-ui'
+import { IntegrationChoice } from 'lib/components/CyclotronJob/integrations/IntegrationChoice'
import { FEATURE_FLAGS } from 'lib/constants'
import { LemonBanner } from 'lib/lemon-ui/LemonBanner'
import { LemonField } from 'lib/lemon-ui/LemonField'
@@ -47,6 +48,8 @@ export interface SourceFormProps {
sourceWizardLogicProps?: SourceWizardLogicProps
/** Override the form value setter — for hosts other than the wizard (e.g. the connect page). */
setSourceConnectionDetailsValue?: (key: FieldName, value: any) => void
+ /** Where the OAuth authorize flow returns to — for hosts other than the wizard (e.g. the connect page). */
+ oauthRedirectUrl?: string
}
export function SourceAccessMethodSelector({
@@ -102,7 +105,8 @@ export const sourceFieldToElement = (
sourceConfig: SourceConfig,
lastValue?: any,
isUpdateMode?: boolean,
- setSourceConnectionDetailsValue?: (key: FieldName, value: any) => void
+ setSourceConnectionDetailsValue?: (key: FieldName, value: any) => void,
+ oauthRedirectUrl?: string
): JSX.Element => {
// It doesn't make sense for this to show on an update to an existing connection since we likely just want to change
// a field or two. There is also some divergence in creates vs. updates that make this a bit more complex to handle.
@@ -166,7 +170,8 @@ export const sourceFieldToElement = (
sourceConfig,
lastValue?.[field.name],
isUpdateMode,
- setSourceConnectionDetailsValue
+ setSourceConnectionDetailsValue,
+ oauthRedirectUrl
)
)}
</Group>
@@ -190,7 +195,8 @@ export const sourceFieldToElement = (
sourceConfig,
lastValue?.[optionField.name],
isUpdateMode,
- setSourceConnectionDetailsValue
+ setSourceConnectionDetailsValue,
+ oauthRedirectUrl
)
)
@@ -237,16 +243,29 @@ export const sourceFieldToElement = (
if (field.type === 'oauth') {
return (
<LemonField key={field.name} name={field.name} label={field.label}>
- {({ value, onChange }) => (
- <SourceIntegrationChoice
- key={field.name}
- sourceConfig={sourceConfig}
- value={value}
- onChange={onChange}
- integration={field.kind}
- schema={field.requiredScopes ? { requiredScopes: field.requiredScopes } : undefined}
- />
- )}
+ {({ value, onChange }) =>
+ // SourceIntegrationChoice is wizard-bound (mounts sourceWizardLogic and redirects the
+ // OAuth flow back to the wizard) — hosts like the connect page override the redirect.
+ oauthRedirectUrl ? (
+ <IntegrationChoice
+ key={field.name}
+ value={value}
+ onChange={onChange}
+ integration={field.kind}
+ redirectUrl={oauthRedirectUrl}
+ schema={field.requiredScopes ? { requiredScopes: field.requiredScopes } : undefined}
+ />
+ ) : (
+ <SourceIntegrationChoice
+ key={field.name}
+ sourceConfig={sourceConfig}
+ value={value}
+ onChange={onChange}
+ integration={field.kind}
+ schema={field.requiredScopes ? { requiredScopes: field.requiredScopes } : undefined}
+ />
+ )
+ }
</LemonField>
)
}
@@ -274,7 +293,8 @@ export const sourceFieldToElement = (
sourceConfig,
lastValue,
isUpdateMode,
- setSourceConnectionDetailsValue
+ setSourceConnectionDetailsValue,
+ oauthRedirectUrl
)
}
@@ -650,6 +670,7 @@ export function SourceFormComponent({
setSourceConfigValue,
sourceWizardLogicProps,
setSourceConnectionDetailsValue: setSourceConnectionDetailsValueOverride,
+ oauthRedirectUrl,
}: SourceFormProps): JSX.Element {
const { availableSources, availableSourcesLoading } = useValues(availableSourcesLogic)
const { featureFlags } = useValues(featureFlagLogic)
@@ -777,7 +798,8 @@ export function SourceFormComponent({
sourceConfig,
jobInputs?.[field.name],
isUpdateMode,
- setSourceConnectionDetailsValue
+ setSourceConnectionDetailsValue,
+ oauthRedirectUrl
)
)
)}
diff --git a/products/data_warehouse/mcp/tools.yaml b/products/data_warehouse/mcp/tools.yaml
index 8466b487fcdb..591507e0efc4 100644
--- a/products/data_warehouse/mcp/tools.yaml
+++ b/products/data_warehouse/mcp/tools.yaml
@@ -77,15 +77,14 @@ tools:
title: Get a secure connect link for a source
description: >
Return a secure browser link to connect a data warehouse source WITHOUT the user pasting secrets into the
- chat. For OAuth sources (Hubspot, Salesforce, Google Ads, …) it returns an authorization URL; for credential
- sources (Postgres, MySQL, Stripe API key, …) it links to a minimal page where the user enters only their
- credentials — the page stores them encrypted and temporarily, and does NOT create the source. This is the
- preferred, secure way to collect credentials: share the returned connect_url with the user, wait for them to
- confirm they're done, then find the stored reference (OAuth: 'integrations-list' filtered by the source's
- kind; credentials: 'data-warehouse-stored-credentials-list' filtered by source_type) and call
- 'data-warehouse-source-setup' with the returned integration_field key (e.g. {'hubspot_integration_id': 123}
- or {'credential_id': '<uuid>'}). Stored credentials are single-use and expire after 24 hours. Never ask the
- user to paste raw database passwords or API keys into the chat.
+ chat. The link opens a minimal page rendering the source's full connection form — the user authorizes via
+ OAuth or enters credentials there, whichever the source offers — and the page stores the connection details
+ encrypted and temporarily; it does NOT create the source. This is the preferred, secure way to collect
+ credentials: share the returned connect_url with the user, wait for them to confirm they're done, then find
+ the stored credential via 'data-warehouse-stored-credentials-list' (filter by source_type, newest first) and
+ call 'data-warehouse-source-setup' with {'credential_id': '<uuid>'} in the payload. Stored credentials are
+ single-use and expire after 24 hours. Never ask the user to paste raw database passwords, API keys, or OAuth
+ tokens into the chat.
param_overrides:
source_type:
input_schema: ExternalDataSourceTypeSchema
@@ -110,11 +109,12 @@ tools:
and submit them via 'external-data-sources-update-webhook-inputs-create'. Use this for revenue (Stripe), CRM
(Hubspot, Salesforce), support tickets (Zendesk), e-commerce (Shopify), and your own databases (Postgres,
MySQL, BigQuery, Snowflake). Discover required credential fields per source_type with
- 'external-data-sources-wizard'. Prefer references over raw secrets in the payload: for OAuth sources pass
- the integration id key (e.g. {'hubspot_integration_id': 123}); for credential sources pass {'credential_id':
- '<uuid>'} referencing credentials the user stored via the 'data-warehouse-source-connect-link' page
- (discover ids with 'data-warehouse-stored-credentials-list'). Stored credentials are deleted once the source
- is created. For fine-grained per-table control, use 'external-data-sources-create' instead.
+ 'external-data-sources-wizard'. Prefer references over raw secrets in the payload: pass {'credential_id':
+ '<uuid>'} referencing the connection details the user stored via the 'data-warehouse-source-connect-link'
+ page (discover ids with 'data-warehouse-stored-credentials-list'); stored credentials are deleted once the
+ source is created. For an already-connected OAuth integration you can instead pass its integration id key
+ (e.g. {'hubspot_integration_id': 123}). For fine-grained per-table control, use
+ 'external-data-sources-create' instead.
exclude_params:
- client_secret
- account_id
diff --git a/products/data_warehouse/skills/setting-up-a-data-warehouse-source/SKILL.md b/products/data_warehouse/skills/setting-up-a-data-warehouse-source/SKILL.md
index 26f536854368..8b12767950c7 100644
--- a/products/data_warehouse/skills/setting-up-a-data-warehouse-source/SKILL.md
+++ b/products/data_warehouse/skills/setting-up-a-data-warehouse-source/SKILL.md
@@ -49,19 +49,15 @@ missing required fields).
1. **Discover the source type and its fields** (optional): `external-data-sources-wizard` lists every source type and
the credential fields each needs. Use it to know what to ask the user for; skip it if the source type is obvious.
2. **Collect credentials securely**: call `data-warehouse-source-connect-link({source_type})`. It returns a
- `connect_url` to share with the user. Either way the page is a terminal hand-off: it collects the authorization or
- credentials and nothing else — the user returns to the chat and you finish setup:
- - **OAuth sources** (Hubspot, Salesforce, Google Ads, …) → an authorize URL. After the user confirms they've
- authorized, find the new integration id via `integrations-list` (filter by the source's kind) and pass the
- returned `integration_field` key to setup (e.g. `{"hubspot_integration_id": 123}`).
- - **Credential sources** (Postgres, MySQL, Stripe API key, …) → a minimal connect page where they enter only their
- credentials over TLS. The page validates them against a live connection and stashes them encrypted in a temporary
- store — it does NOT create the source. After the user confirms they're done, find the stored credential id via
- `data-warehouse-stored-credentials-list` (filter by `source_type`, newest first; the page also shows the id to
- the user) and pass `{"credential_id": <id>}` to setup. Stored credentials are single-use — deleted as soon as
- setup consumes them — and expire after 24 hours.
-
- Never ask the user to paste raw database passwords or API keys into the chat.
+ `connect_url` to a minimal connect page rendering the source's full connection form — the user authorizes via
+ OAuth or enters credentials there, whichever the source offers (the response's `auth_method` tells you which to
+ expect). The page validates the details against a live connection and stashes them encrypted in a temporary
+ store — it does NOT create the source. After the user confirms they're done, find the stored credential id via
+ `data-warehouse-stored-credentials-list` (filter by `source_type`, newest first; the page also shows the id to
+ the user) and pass `{"credential_id": <id>}` to setup. Stored credentials are single-use — deleted as soon as
+ setup consumes them — and expire after 24 hours.
+
+ Never ask the user to paste raw database passwords, API keys, or OAuth tokens into the chat.
3. **Create in one call**: `data-warehouse-source-setup({source_type, payload, prefix})`. The server validates
credentials, discovers all tables, enables them with sync defaults (incremental where a tracking column exists,
@@ -311,10 +307,11 @@ If the user wants near-real-time replication from Postgres:
- **Prefix is load-bearing.** It's part of every HogQL query the user will ever write against these tables. Pick
something short, descriptive, and not already taken.
- **Prefer the secure connect-link for any credentials.** Use `data-warehouse-source-connect-link` so the user
- authenticates in their browser — OAuth sources (Hubspot, Salesforce, Google Ads) authorize via PostHog, and
- credential sources (Postgres, Stripe key, …) enter secrets on the minimal connect page, which stores them without
- creating the source. Don't collect OAuth tokens or database passwords in chat; pass the integration id or
- `credential_id` reference to setup — source creation always happens through setup, not the UI.
+ authenticates in their browser — the connect page renders the source's full connection form (OAuth and credential
+ options alike) and stores the result without creating the source. Don't collect OAuth tokens or database passwords
+ in chat; pass the `credential_id` reference to setup — source creation always happens through setup, not the UI.
+ (An already-connected OAuth integration can also be passed directly via its id key, e.g.
+ `{"hubspot_integration_id": 123}`.)
- **Webhooks are a separate step after create.** Setting `sync_type: "webhook"` on a schema doesn't register the
webhook — the `create-webhook` call does. Always follow create → create-webhook → webhook-info for webhook-type
schemas, and never leave a webhook schema dangling without registration (it just won't receive events).
diff --git a/products/data_warehouse/skills/suggesting-data-imports/SKILL.md b/products/data_warehouse/skills/suggesting-data-imports/SKILL.md
index 7b6eb837803c..6d5d2dfcfde5 100644
--- a/products/data_warehouse/skills/suggesting-data-imports/SKILL.md
+++ b/products/data_warehouse/skills/suggesting-data-imports/SKILL.md
@@ -89,7 +89,7 @@ Common join patterns:
- **Don't guess table names.** Always check `posthog:read-data-warehouse-schema` and `posthog:external-data-schemas-list` before saying data doesn't exist.
- **Check prefixes.** Imported tables are often prefixed (e.g. `stripe_charges` not `charges`). The user might not know the prefix.
-- **Collect credentials securely.** Use `data-warehouse-source-connect-link` to hand the user a browser link — OAuth sources (Google Ads, Meta Ads, Hubspot) authorize via PostHog, and credential sources enter secrets on a minimal connect page that stashes them temporarily without creating the source. Afterwards pass the integration id or `{"credential_id": <id>}` (discovered via `data-warehouse-stored-credentials-list`) to `data-warehouse-source-setup` — stored credentials are single-use and expire after 24 hours. Don't collect passwords or OAuth tokens in chat.
+- **Collect credentials securely.** Use `data-warehouse-source-connect-link` to hand the user a browser link — it opens a minimal connect page rendering the source's full connection form (OAuth or credentials, whichever the source offers) that stashes the details temporarily without creating the source. Afterwards pass `{"credential_id": <id>}` (discovered via `data-warehouse-stored-credentials-list`) to `data-warehouse-source-setup` — stored credentials are single-use and expire after 24 hours. Don't collect passwords or OAuth tokens in chat.
- **Not all systems are supported.** If the user's system isn't in the wizard list, suggest using Postgres/MySQL as a bridge if they can export to a database, or mention that custom sources can be requested.
## Related tools
diff --git a/services/mcp/schema/generated-tool-definitions.json b/services/mcp/schema/generated-tool-definitions.json
index 966e9b9581ec..101a5bc3f12f 100644
--- a/services/mcp/schema/generated-tool-definitions.json
+++ b/services/mcp/schema/generated-tool-definitions.json
@@ -1326,7 +1326,7 @@
}
},
"data-warehouse-source-connect-link": {
- "description": "Return a secure browser link to connect a data warehouse source WITHOUT the user pasting secrets into the chat. For OAuth sources (Hubspot, Salesforce, Google Ads, …) it returns an authorization URL; for credential sources (Postgres, MySQL, Stripe API key, …) it links to a minimal page where the user enters only their credentials — the page stores them encrypted and temporarily, and does NOT create the source. This is the preferred, secure way to collect credentials: share the returned connect_url with the user, wait for them to confirm they're done, then find the stored reference (OAuth: 'integrations-list' filtered by the source's kind; credentials: 'data-warehouse-stored-credentials-list' filtered by source_type) and call 'data-warehouse-source-setup' with the returned integration_field key (e.g. {'hubspot_integration_id': 123} or {'credential_id': '<uuid>'}). Stored credentials are single-use and expire after 24 hours. Never ask the user to paste raw database passwords or API keys into the chat.",
+ "description": "Return a secure browser link to connect a data warehouse source WITHOUT the user pasting secrets into the chat. The link opens a minimal page rendering the source's full connection form — the user authorizes via OAuth or enters credentials there, whichever the source offers — and the page stores the connection details encrypted and temporarily; it does NOT create the source. This is the preferred, secure way to collect credentials: share the returned connect_url with the user, wait for them to confirm they're done, then find the stored credential via 'data-warehouse-stored-credentials-list' (filter by source_type, newest first) and call 'data-warehouse-source-setup' with {'credential_id': '<uuid>'} in the payload. Stored credentials are single-use and expire after 24 hours. Never ask the user to paste raw database passwords, API keys, or OAuth tokens into the chat.",
"category": "Data warehouse",
"feature": "data_warehouse",
"summary": "Get a secure connect link for a source",
@@ -1340,7 +1340,7 @@
}
},
"data-warehouse-source-setup": {
- "description": "Connect an external data source and start importing it into queryable warehouse tables in a single call. Validates credentials, discovers all available tables, enables them with sensible sync defaults (incremental where supported to keep ongoing cost low), and creates the source — no 'schemas' array required. For webhook-capable sources (e.g. Stripe) a webhook is auto-registered after creation: check the 'webhook' key in the response — on success webhook-capable tables sync in real time (including webhook-only tables like Stripe Discount); on failure (e.g. the API key can't create webhooks) tables keep the polling defaults and webhook-only tables stay disabled. If 'webhook.pending_inputs' is non-empty, ask the user for those values and submit them via 'external-data-sources-update-webhook-inputs-create'. Use this for revenue (Stripe), CRM (Hubspot, Salesforce), support tickets (Zendesk), e-commerce (Shopify), and your own databases (Postgres, MySQL, BigQuery, Snowflake). Discover required credential fields per source_type with 'external-data-sources-wizard'. Prefer references over raw secrets in the payload: for OAuth sources pass the integration id key (e.g. {'hubspot_integration_id': 123}); for credential sources pass {'credential_id': '<uuid>'} referencing credentials the user stored via the 'data-warehouse-source-connect-link' page (discover ids with 'data-warehouse-stored-credentials-list'). Stored credentials are deleted once the source is created. For fine-grained per-table control, use 'external-data-sources-create' instead.",
+ "description": "Connect an external data source and start importing it into queryable warehouse tables in a single call. Validates credentials, discovers all available tables, enables them with sensible sync defaults (incremental where supported to keep ongoing cost low), and creates the source — no 'schemas' array required. For webhook-capable sources (e.g. Stripe) a webhook is auto-registered after creation: check the 'webhook' key in the response — on success webhook-capable tables sync in real time (including webhook-only tables like Stripe Discount); on failure (e.g. the API key can't create webhooks) tables keep the polling defaults and webhook-only tables stay disabled. If 'webhook.pending_inputs' is non-empty, ask the user for those values and submit them via 'external-data-sources-update-webhook-inputs-create'. Use this for revenue (Stripe), CRM (Hubspot, Salesforce), support tickets (Zendesk), e-commerce (Shopify), and your own databases (Postgres, MySQL, BigQuery, Snowflake). Discover required credential fields per source_type with 'external-data-sources-wizard'. Prefer references over raw secrets in the payload: pass {'credential_id': '<uuid>'} referencing the connection details the user stored via the 'data-warehouse-source-connect-link' page (discover ids with 'data-warehouse-stored-credentials-list'); stored credentials are deleted once the source is created. For an already-connected OAuth integration you can instead pass its integration id key (e.g. {'hubspot_integration_id': 123}). For fine-grained per-table control, use 'external-data-sources-create' instead.",
"category": "Data warehouse",
"feature": "data_warehouse",
"summary": "Set up a data warehouse source (one step)",
diff --git a/services/mcp/schema/tool-definitions-all.json b/services/mcp/schema/tool-definitions-all.json
index 7ec4b6c62a8b..73f1d59d02e9 100644
--- a/services/mcp/schema/tool-definitions-all.json
+++ b/services/mcp/schema/tool-definitions-all.json
@@ -1342,7 +1342,7 @@
}
},
"data-warehouse-source-connect-link": {
- "description": "Return a secure browser link to connect a data warehouse source WITHOUT the user pasting secrets into the chat. For OAuth sources (Hubspot, Salesforce, Google Ads, …) it returns an authorization URL; for credential sources (Postgres, MySQL, Stripe API key, …) it links to a minimal page where the user enters only their credentials — the page stores them encrypted and temporarily, and does NOT create the source. This is the preferred, secure way to collect credentials: share the returned connect_url with the user, wait for them to confirm they're done, then find the stored reference (OAuth: 'integrations-list' filtered by the source's kind; credentials: 'data-warehouse-stored-credentials-list' filtered by source_type) and call 'data-warehouse-source-setup' with the returned integration_field key (e.g. {'hubspot_integration_id': 123} or {'credential_id': '<uuid>'}). Stored credentials are single-use and expire after 24 hours. Never ask the user to paste raw database passwords or API keys into the chat.",
+ "description": "Return a secure browser link to connect a data warehouse source WITHOUT the user pasting secrets into the chat. The link opens a minimal page rendering the source's full connection form — the user authorizes via OAuth or enters credentials there, whichever the source offers — and the page stores the connection details encrypted and temporarily; it does NOT create the source. This is the preferred, secure way to collect credentials: share the returned connect_url with the user, wait for them to confirm they're done, then find the stored credential via 'data-warehouse-stored-credentials-list' (filter by source_type, newest first) and call 'data-warehouse-source-setup' with {'credential_id': '<uuid>'} in the payload. Stored credentials are single-use and expire after 24 hours. Never ask the user to paste raw database passwords, API keys, or OAuth tokens into the chat.",
"category": "Data warehouse",
"feature": "data_warehouse",
"summary": "Get a secure connect link for a source",
@@ -1356,7 +1356,7 @@
}
},
"data-warehouse-source-setup": {
- "description": "Connect an external data source and start importing it into queryable warehouse tables in a single call. Validates credentials, discovers all available tables, enables them with sensible sync defaults (incremental where supported to keep ongoing cost low), and creates the source — no 'schemas' array required. For webhook-capable sources (e.g. Stripe) a webhook is auto-registered after creation: check the 'webhook' key in the response — on success webhook-capable tables sync in real time (including webhook-only tables like Stripe Discount); on failure (e.g. the API key can't create webhooks) tables keep the polling defaults and webhook-only tables stay disabled. If 'webhook.pending_inputs' is non-empty, ask the user for those values and submit them via 'external-data-sources-update-webhook-inputs-create'. Use this for revenue (Stripe), CRM (Hubspot, Salesforce), support tickets (Zendesk), e-commerce (Shopify), and your own databases (Postgres, MySQL, BigQuery, Snowflake). Discover required credential fields per source_type with 'external-data-sources-wizard'. Prefer references over raw secrets in the payload: for OAuth sources pass the integration id key (e.g. {'hubspot_integration_id': 123}); for credential sources pass {'credential_id': '<uuid>'} referencing credentials the user stored via the 'data-warehouse-source-connect-link' page (discover ids with 'data-warehouse-stored-credentials-list'). Stored credentials are deleted once the source is created. For fine-grained per-table control, use 'external-data-sources-create' instead.",
+ "description": "Connect an external data source and start importing it into queryable warehouse tables in a single call. Validates credentials, discovers all available tables, enables them with sensible sync defaults (incremental where supported to keep ongoing cost low), and creates the source — no 'schemas' array required. For webhook-capable sources (e.g. Stripe) a webhook is auto-registered after creation: check the 'webhook' key in the response — on success webhook-capable tables sync in real time (including webhook-only tables like Stripe Discount); on failure (e.g. the API key can't create webhooks) tables keep the polling defaults and webhook-only tables stay disabled. If 'webhook.pending_inputs' is non-empty, ask the user for those values and submit them via 'external-data-sources-update-webhook-inputs-create'. Use this for revenue (Stripe), CRM (Hubspot, Salesforce), support tickets (Zendesk), e-commerce (Shopify), and your own databases (Postgres, MySQL, BigQuery, Snowflake). Discover required credential fields per source_type with 'external-data-sources-wizard'. Prefer references over raw secrets in the payload: pass {'credential_id': '<uuid>'} referencing the connection details the user stored via the 'data-warehouse-source-connect-link' page (discover ids with 'data-warehouse-stored-credentials-list'); stored credentials are deleted once the source is created. For an already-connected OAuth integration you can instead pass its integration id key (e.g. {'hubspot_integration_id': 123}). For fine-grained per-table control, use 'external-data-sources-create' instead.",
"category": "Data warehouse",
"feature": "data_warehouse",
"summary": "Set up a data warehouse source (one step)",
diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.ts
index 7686ff69a21f..92c7d7cdee58 100644
--- a/services/mcp/src/api/generated.ts
+++ b/services/mcp/src/api/generated.ts
@@ -40622,18 +40622,13 @@ export namespace Schemas {
export interface SourceConnectLink {
/** The source type the link is for. */
source_type: string;
- /** 'oauth' = the user authorizes in their browser; 'credentials' = the user enters credentials in the PostHog UI. Either way secrets never pass through the agent.
+ /** What the user will do on the connect page: 'oauth' = authorize an account in their browser; 'credentials' = enter connection details (or pick OAuth where the source offers both). Either way secrets never pass through the agent, and the result is always a stored credential id.
*
* * `oauth` - oauth
* * `credentials` - credentials */
auth_method: AuthMethodEnum;
- /** Full URL to share with the user. They open it in a browser to authorize or enter credentials directly in PostHog — credentials never pass through the agent or the chat. */
+ /** Full URL to share with the user. It opens the source's connection form in PostHog — credentials never pass through the agent or the chat. */
connect_url: string;
- /**
- * The payload key to pass to data-warehouse-source-setup: for OAuth sources, the source's integration id key (e.g. 'hubspot_integration_id'); for credential sources, 'credential_id' referencing the credentials the user stored via the connect page.
- * @nullable
- */
- integration_field: string | null;
/** Next steps for the agent to relay to the user. */
instructions: string;
}
@@ -40915,7 +40910,7 @@ export namespace Schemas {
} as const;
/**
- * Connection details as flat keys for the source_type (discover required fields with the wizard tool). Prefer references over raw secrets: for OAuth sources pass the source's integration id key (e.g. {'hubspot_integration_id': 123}); for credential sources pass {'credential_id': <id>} referencing credentials the user stored via the connect-link page (discover ids with the stored_credentials endpoint) — they are merged in server-side and deleted once consumed. A 'schemas' array is NOT required — all discovered tables are enabled automatically with sensible sync defaults.
+ * Connection details as flat keys for the source_type (discover required fields with the wizard tool). Prefer references over raw secrets: pass {'credential_id': <id>} referencing the connection details the user stored via the connect-link page (discover ids with the stored_credentials endpoint) — they are merged in server-side and deleted once consumed. An already-connected OAuth integration can be passed via its id key instead (e.g. {'hubspot_integration_id': 123}). A 'schemas' array is NOT required — all discovered tables are enabled automatically with sensible sync defaults.
*/
export type SourceSetupPayload = { [key: string]: unknown };
@@ -41150,7 +41145,7 @@ export namespace Schemas {
* * `OracleFusion` - OracleFusion
* * `Custom` - Custom */
source_type: ExternalDataSourceTypeEnum;
- /** Connection details as flat keys for the source_type (discover required fields with the wizard tool). Prefer references over raw secrets: for OAuth sources pass the source's integration id key (e.g. {'hubspot_integration_id': 123}); for credential sources pass {'credential_id': <id>} referencing credentials the user stored via the connect-link page (discover ids with the stored_credentials endpoint) — they are merged in server-side and deleted once consumed. A 'schemas' array is NOT required — all discovered tables are enabled automatically with sensible sync defaults. */
+ /** Connection details as flat keys for the source_type (discover required fields with the wizard tool). Prefer references over raw secrets: pass {'credential_id': <id>} referencing the connection details the user stored via the connect-link page (discover ids with the stored_credentials endpoint) — they are merged in server-side and deleted once consumed. An already-connected OAuth integration can be passed via its id key instead (e.g. {'hubspot_integration_id': 123}). A 'schemas' array is NOT required — all discovered tables are enabled automatically with sensible sync defaults. */
payload?: SourceSetupPayload;
/**
* Table name prefix in HogQL, e.g. 'stripe' produces stripe_charges. Defaults to the source type.
diff --git a/services/mcp/src/generated/data_warehouse/api.ts b/services/mcp/src/generated/data_warehouse/api.ts
index 8b70205ec0dd..7b79076a7495 100644
--- a/services/mcp/src/generated/data_warehouse/api.ts
+++ b/services/mcp/src/generated/data_warehouse/api.ts
@@ -1006,11 +1006,10 @@ export const ExternalDataSourcesCheckCdcPrerequisitesCreateParams = /* @__PURE__
/**
* Return a secure browser link for connecting a data warehouse source.
*
- * For OAuth sources the link starts the OAuth authorize flow; for credential sources it opens a minimal
- * connect page where the user enters only their credentials — no table selection, no source creation.
- * Either way the user authenticates in their browser, credentials never pass through the agent, and the
- * agent finishes setup afterwards by passing the resulting reference (integration id or credential id)
- * to data-warehouse-source-setup.
+ * The link opens a minimal connect page rendering the source's full connection form — OAuth options
+ * included — with no table selection and no source creation. The user authenticates in their browser,
+ * secrets never pass through the agent, and the agent finishes setup afterwards by passing the stored
+ * credential id to data-warehouse-source-setup.
*/
export const ExternalDataSourcesConnectLinkRetrieveParams = /* @__PURE__ */ zod.object({
project_id: zod
@@ -1307,7 +1306,7 @@ export const ExternalDataSourcesSetupCreateBody = /* @__PURE__ */ zod.object({
.record(zod.string(), zod.unknown())
.optional()
.describe(
- "Connection details as flat keys for the source_type (discover required fields with the wizard tool). Prefer references over raw secrets: for OAuth sources pass the source's integration id key (e.g. {'hubspot_integration_id': 123}); for credential sources pass {'credential_id': <id>} referencing credentials the user stored via the connect-link page (discover ids with the stored_credentials endpoint) — they are merged in server-side and deleted once consumed. A 'schemas' array is NOT required — all discovered tables are enabled automatically with sensible sync defaults."
+ "Connection details as flat keys for the source_type (discover required fields with the wizard tool). Prefer references over raw secrets: pass {'credential_id': <id>} referencing the connection details the user stored via the connect-link page (discover ids with the stored_credentials endpoint) — they are merged in server-side and deleted once consumed. An already-connected OAuth integration can be passed via its id key instead (e.g. {'hubspot_integration_id': 123}). A 'schemas' array is NOT required — all discovered tables are enabled automatically with sensible sync defaults."
),
prefix: zod
.string()
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/data-warehouse-source-setup.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/data-warehouse-source-setup.json
index 352bf54d67af..ae6eb5b8baca 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/data-warehouse-source-setup.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/data-warehouse-source-setup.json
@@ -15,7 +15,7 @@
},
"payload": {
"additionalProperties": {},
- "description": "Connection details as flat keys for the source_type (discover required fields with the wizard tool). Prefer references over raw secrets: for OAuth sources pass the source's integration id key (e.g. {'hubspot_integration_id': 123}); for credential sources pass {'credential_id': <id>} referencing credentials the user stored via the connect-link page (discover ids with the stored_credentials endpoint) — they are merged in server-side and deleted once consumed. A 'schemas' array is NOT required — all discovered tables are enabled automatically with sensible sync defaults.",
+ "description": "Connection details as flat keys for the source_type (discover required fields with the wizard tool). Prefer references over raw secrets: pass {'credential_id': <id>} referencing the connection details the user stored via the connect-link page (discover ids with the stored_credentials endpoint) — they are merged in server-side and deleted once consumed. An already-connected OAuth integration can be passed via its id key instead (e.g. {'hubspot_integration_id': 123}). A 'schemas' array is NOT required — all discovered tables are enabled automatically with sensible sync defaults.",
"propertyNames": {
"type": "string"
},