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.

chore(warehouse_sources): document Custom REST source payload shape for MCP (#65422)

Marcus Hof31dfee07f284
diff --git a/products/data_warehouse/backend/api/external_data_source.py b/products/data_warehouse/backend/api/external_data_source.py
index d3e32d51e6c4..4be429f1211b 100644
--- a/products/data_warehouse/backend/api/external_data_source.py
+++ b/products/data_warehouse/backend/api/external_data_source.py
@@ -1137,6 +1137,10 @@ class SourceSetupSerializer(serializers.Serializer):
"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}). "
+ "For source_type 'Custom' (a user-defined REST API) the keys are 'manifest_json' (a stringified "
+ "RESTAPIConfig describing client.base_url, auth, and resources) plus the credential for the auth "
+ "type the manifest declares — 'auth_token' (bearer), 'auth_api_key' (api_key), or 'auth_password' "
+ "(http_basic); keep secrets in these auth_* keys, never inline in the manifest. "
"A 'schemas' array is NOT required — all discovered tables are enabled automatically with sensible "
"sync defaults."
),
@@ -1258,6 +1262,13 @@ class DatabaseSchemaRequestSerializer(serializers.Serializer):
The request body contains source_type plus flat source-specific credential fields
(e.g. host, port, database, user, password, schema for Postgres). The credential
fields vary per source_type and are validated dynamically by the source registry.
+
+ For source_type "Custom" (a user-defined REST API) the body carries `manifest_json`
+ (a stringified RESTAPIConfig describing client.base_url, auth, and resources) plus the
+ credential for the manifest's declared auth type — `auth_token` (bearer), `auth_api_key`
+ (api_key), or `auth_password` (http_basic); keep secrets in these auth_* keys, never
+ inline in manifest_json. The returned tables mirror the manifest's resources, with
+ detected primary keys and incremental cursors.
"""
source_type = serializers.ChoiceField(
diff --git a/products/warehouse_sources/frontend/generated/api.schemas.ts b/products/warehouse_sources/frontend/generated/api.schemas.ts
index b8f786196d3f..701813528385 100644
--- a/products/warehouse_sources/frontend/generated/api.schemas.ts
+++ b/products/warehouse_sources/frontend/generated/api.schemas.ts
@@ -2606,6 +2606,13 @@ export interface PaginatedExternalDataSourceConnectionOptionListApi {
* The request body contains source_type plus flat source-specific credential fields
* (e.g. host, port, database, user, password, schema for Postgres). The credential
* fields vary per source_type and are validated dynamically by the source registry.
+ *
+ * For source_type "Custom" (a user-defined REST API) the body carries `manifest_json`
+ * (a stringified RESTAPIConfig describing client.base_url, auth, and resources) plus the
+ * credential for the manifest's declared auth type — `auth_token` (bearer), `auth_api_key`
+ * (api_key), or `auth_password` (http_basic); keep secrets in these auth_* keys, never
+ * inline in manifest_json. The returned tables mirror the manifest's resources, with
+ * detected primary keys and incremental cursors.
*/
export interface DatabaseSchemaRequestApi {
/** The source type to validate against.
@@ -3254,7 +3261,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: 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.
+ * 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}). For source_type 'Custom' (a user-defined REST API) the keys are 'manifest_json' (a stringified RESTAPIConfig describing client.base_url, auth, and resources) plus the credential for the auth type the manifest declares — 'auth_token' (bearer), 'auth_api_key' (api_key), or 'auth_password' (http_basic); keep secrets in these auth_* keys, never inline in the manifest. A 'schemas' array is NOT required — all discovered tables are enabled automatically with sensible sync defaults.
*/
export type SourceSetupApiPayload = { [key: string]: unknown }
@@ -3902,7 +3909,7 @@ export interface SourceSetupApi {
* * `RB2B` - RB2B
* * `Superwall` - Superwall */
source_type: ExternalDataSourceTypeEnumApi
- /** 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. */
+ /** 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}). For source_type 'Custom' (a user-defined REST API) the keys are 'manifest_json' (a stringified RESTAPIConfig describing client.base_url, auth, and resources) plus the credential for the auth type the manifest declares — 'auth_token' (bearer), 'auth_api_key' (api_key), or 'auth_password' (http_basic); keep secrets in these auth_* keys, never inline in the manifest. 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/warehouse_sources/frontend/generated/api.zod.ts b/products/warehouse_sources/frontend/generated/api.zod.ts
index 3a343d783982..fd113e5df2f6 100644
--- a/products/warehouse_sources/frontend/generated/api.zod.ts
+++ b/products/warehouse_sources/frontend/generated/api.zod.ts
@@ -2555,7 +2555,7 @@ export const ExternalDataSourcesDatabaseSchemaCreateBody = /* @__PURE__ */ zod
),
})
.describe(
- 'Validate credentials and preview available tables from a remote database.\n\nThe request body contains source_type plus flat source-specific credential fields\n(e.g. host, port, database, user, password, schema for Postgres). The credential\nfields vary per source_type and are validated dynamically by the source registry.'
+ 'Validate credentials and preview available tables from a remote database.\n\nThe request body contains source_type plus flat source-specific credential fields\n(e.g. host, port, database, user, password, schema for Postgres). The credential\nfields vary per source_type and are validated dynamically by the source registry.\n\nFor source_type \"Custom\" (a user-defined REST API) the body carries `manifest_json`\n(a stringified RESTAPIConfig describing client.base_url, auth, and resources) plus the\ncredential for the manifest\'s declared auth type — `auth_token` (bearer), `auth_api_key`\n(api_key), or `auth_password` (http_basic); keep secrets in these auth_\* keys, never\ninline in manifest_json. The returned tables mirror the manifest\'s resources, with\ndetected primary keys and incremental cursors.'
)
/**
@@ -3229,7 +3229,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: 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."
+ "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}). For source_type 'Custom' (a user-defined REST API) the keys are 'manifest_json' (a stringified RESTAPIConfig describing client.base_url, auth, and resources) plus the credential for the auth type the manifest declares — 'auth_token' (bearer), 'auth_api_key' (api_key), or 'auth_password' (http_basic); keep secrets in these auth_\* keys, never inline in the manifest. A 'schemas' array is NOT required — all discovered tables are enabled automatically with sensible sync defaults."
),
prefix: zod
.string()
diff --git a/services/mcp/schema/tool-inputs.json b/services/mcp/schema/tool-inputs.json
index 79c78a88ce10..1dce297a2283 100644
--- a/services/mcp/schema/tool-inputs.json
+++ b/services/mcp/schema/tool-inputs.json
@@ -390,7 +390,7 @@
"type": "string"
},
"additionalProperties": {},
- "description": "Connection credentials for the source. Keys depend on source_type. For database sources: host, port, database, user, password, schema. For SaaS sources: api_key or OAuth fields. Use external-data-sources-wizard to see required fields per source type."
+ "description": "Connection credentials for the source. Keys depend on source_type. For database sources: host, port, database, user, password, schema. For SaaS sources: api_key or OAuth fields. For source_type \"Custom\" (a user-defined REST API): `manifest_json` (a stringified RESTAPIConfig describing client.base_url, auth, and resources) plus the credential for the auth type declared in the manifest — `auth_token` (bearer), `auth_api_key` (api_key), or `auth_password` (http_basic); keep secrets in these auth_* keys, never inline in manifest_json. Use external-data-sources-wizard to see required fields per source type."
},
"ExternalDataSourceTypeSchema": {
"type": "string",
diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.ts
index aa5edc5fc741..91829a2a5445 100644
--- a/services/mcp/src/api/generated.ts
+++ b/services/mcp/src/api/generated.ts
@@ -16608,6 +16608,13 @@ export namespace Schemas {
* The request body contains source_type plus flat source-specific credential fields
* (e.g. host, port, database, user, password, schema for Postgres). The credential
* fields vary per source_type and are validated dynamically by the source registry.
+ *
+ * For source_type "Custom" (a user-defined REST API) the body carries `manifest_json`
+ * (a stringified RESTAPIConfig describing client.base_url, auth, and resources) plus the
+ * credential for the manifest's declared auth type — `auth_token` (bearer), `auth_api_key`
+ * (api_key), or `auth_password` (http_basic); keep secrets in these auth_* keys, never
+ * inline in manifest_json. The returned tables mirror the manifest's resources, with
+ * detected primary keys and incremental cursors.
*/
export interface DatabaseSchemaRequest {
/** The source type to validate against.
@@ -48088,7 +48095,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: 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.
+ * 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}). For source_type 'Custom' (a user-defined REST API) the keys are 'manifest_json' (a stringified RESTAPIConfig describing client.base_url, auth, and resources) plus the credential for the auth type the manifest declares — 'auth_token' (bearer), 'auth_api_key' (api_key), or 'auth_password' (http_basic); keep secrets in these auth_* keys, never inline in the manifest. A 'schemas' array is NOT required — all discovered tables are enabled automatically with sensible sync defaults.
*/
export type SourceSetupPayload = { [key: string]: unknown };
@@ -48736,7 +48743,7 @@ export namespace Schemas {
* * `RB2B` - RB2B
* * `Superwall` - Superwall */
source_type: ExternalDataSourceTypeEnum;
- /** 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. */
+ /** 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}). For source_type 'Custom' (a user-defined REST API) the keys are 'manifest_json' (a stringified RESTAPIConfig describing client.base_url, auth, and resources) plus the credential for the auth type the manifest declares — 'auth_token' (bearer), 'auth_api_key' (api_key), or 'auth_password' (http_basic); keep secrets in these auth_* keys, never inline in the manifest. 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/warehouse_sources/api.ts b/services/mcp/src/generated/warehouse_sources/api.ts
index a825e3e8d377..57984b05f6a6 100644
--- a/services/mcp/src/generated/warehouse_sources/api.ts
+++ b/services/mcp/src/generated/warehouse_sources/api.ts
@@ -2300,7 +2300,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: 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."
+ "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}). For source_type 'Custom' (a user-defined REST API) the keys are 'manifest_json' (a stringified RESTAPIConfig describing client.base_url, auth, and resources) plus the credential for the auth type the manifest declares — 'auth_token' (bearer), 'auth_api_key' (api_key), or 'auth_password' (http_basic); keep secrets in these auth_* keys, never inline in the manifest. A 'schemas' array is NOT required — all discovered tables are enabled automatically with sensible sync defaults."
),
prefix: zod
.string()
diff --git a/services/mcp/src/schema/tool-inputs.ts b/services/mcp/src/schema/tool-inputs.ts
index 1be482d0163b..7f88da56d112 100644
--- a/services/mcp/src/schema/tool-inputs.ts
+++ b/services/mcp/src/schema/tool-inputs.ts
@@ -48,7 +48,7 @@ export const ExternalDataJobsSchemasSchema = z
export const ExternalDataSourcePayloadSchema = z
.record(z.string(), z.unknown())
.describe(
- 'Connection credentials for the source. Keys depend on source_type. For database sources: host, port, database, user, password, schema. For SaaS sources: api_key or OAuth fields. Use external-data-sources-wizard to see required fields per source type.'
+ 'Connection credentials for the source. Keys depend on source_type. For database sources: host, port, database, user, password, schema. For SaaS sources: api_key or OAuth fields. For source_type "Custom" (a user-defined REST API): `manifest_json` (a stringified RESTAPIConfig describing client.base_url, auth, and resources) plus the credential for the auth type declared in the manifest — `auth_token` (bearer), `auth_api_key` (api_key), or `auth_password` (http_basic); keep secrets in these auth_* keys, never inline in manifest_json. Use external-data-sources-wizard to see required fields per source type.'
)
export const ExternalDataSourceTypeSchema = z
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 d6e6196e2383..be5d441bc7b1 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
@@ -20,7 +20,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: 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.",
+ "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}). For source_type 'Custom' (a user-defined REST API) the keys are 'manifest_json' (a stringified RESTAPIConfig describing client.base_url, auth, and resources) plus the credential for the auth type the manifest declares — 'auth_token' (bearer), 'auth_api_key' (api_key), or 'auth_password' (http_basic); keep secrets in these auth_* keys, never inline in the manifest. A 'schemas' array is NOT required — all discovered tables are enabled automatically with sensible sync defaults.",
"propertyNames": {
"type": "string"
},
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/external-data-sources-create.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/external-data-sources-create.json
index dbf7a6172f9a..beddee0d6158 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/external-data-sources-create.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/external-data-sources-create.json
@@ -26,7 +26,7 @@
},
"payload": {
"additionalProperties": {},
- "description": "Connection credentials for the source. Keys depend on source_type. For database sources: host, port, database, user, password, schema. For SaaS sources: api_key or OAuth fields. Use external-data-sources-wizard to see required fields per source type.",
+ "description": "Connection credentials for the source. Keys depend on source_type. For database sources: host, port, database, user, password, schema. For SaaS sources: api_key or OAuth fields. For source_type \"Custom\" (a user-defined REST API): `manifest_json` (a stringified RESTAPIConfig describing client.base_url, auth, and resources) plus the credential for the auth type declared in the manifest — `auth_token` (bearer), `auth_api_key` (api_key), or `auth_password` (http_basic); keep secrets in these auth_* keys, never inline in manifest_json. Use external-data-sources-wizard to see required fields per source type.",
"propertyNames": {
"type": "string"
},
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/external-data-sources-db-schema.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/external-data-sources-db-schema.json
index e6f3dce2c45d..e19908df4044 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/external-data-sources-db-schema.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/external-data-sources-db-schema.json
@@ -3,7 +3,7 @@
"properties": {
"payload": {
"additionalProperties": {},
- "description": "Connection credentials for the source. Keys depend on source_type. For database sources: host, port, database, user, password, schema. For SaaS sources: api_key or OAuth fields. Use external-data-sources-wizard to see required fields per source type.",
+ "description": "Connection credentials for the source. Keys depend on source_type. For database sources: host, port, database, user, password, schema. For SaaS sources: api_key or OAuth fields. For source_type \"Custom\" (a user-defined REST API): `manifest_json` (a stringified RESTAPIConfig describing client.base_url, auth, and resources) plus the credential for the auth type declared in the manifest — `auth_token` (bearer), `auth_api_key` (api_key), or `auth_password` (http_basic); keep secrets in these auth_* keys, never inline in manifest_json. Use external-data-sources-wizard to see required fields per source type.",
"propertyNames": {
"type": "string"
},