Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
feat(mcp): overlay Pipedream catalog apps onto their own DCR MCP servers (#8842)
Eric Hayes602691bb85f6
diff --git a/.sqlx/query-6a0913c72b34930cb3389acf26069f959a4ad577770dd75661765d948ef744c5.json b/.sqlx/query-0b7dc8cc80a488395f529ad634f8e3452bdf649842ef7c9ca7322cf52541d885.jsonsimilarity index 78%rename from .sqlx/query-6a0913c72b34930cb3389acf26069f959a4ad577770dd75661765d948ef744c5.jsonrename to .sqlx/query-0b7dc8cc80a488395f529ad634f8e3452bdf649842ef7c9ca7322cf52541d885.jsonindex 5a5cf8aeb7..84be485ec9 100644--- a/.sqlx/query-6a0913c72b34930cb3389acf26069f959a4ad577770dd75661765d948ef744c5.json+++ b/.sqlx/query-0b7dc8cc80a488395f529ad634f8e3452bdf649842ef7c9ca7322cf52541d885.json@@ -1,6 +1,6 @@{"db_name": "PostgreSQL",- "query": "\n SELECT user_id, app_slug, server_name, account_id, enabled\n FROM pipedream_mcp_connections\n WHERE app_slug = $1 AND enabled\n ",+ "query": "\n SELECT user_id, app_slug, server_name, account_id, enabled\n FROM pipedream_mcp_connections\n WHERE app_slug = $1 AND enabled\n AND NOT EXISTS (SELECT 1 FROM mcp_overlays o WHERE o.app_slug = $1)\n ","describe": {"columns": [{@@ -42,5 +42,5 @@false]},- "hash": "6a0913c72b34930cb3389acf26069f959a4ad577770dd75661765d948ef744c5"+ "hash": "0b7dc8cc80a488395f529ad634f8e3452bdf649842ef7c9ca7322cf52541d885"}diff --git a/.sqlx/query-4a0d39d153e0be43db48a157d77bcfe5318e36b237b9d4af8f1cbf6ff4fe79b1.json b/.sqlx/query-4a0d39d153e0be43db48a157d77bcfe5318e36b237b9d4af8f1cbf6ff4fe79b1.jsonnew file mode 100644index 0000000000..a3e98f444d--- /dev/null+++ b/.sqlx/query-4a0d39d153e0be43db48a157d77bcfe5318e36b237b9d4af8f1cbf6ff4fe79b1.json@@ -0,0 +1,26 @@+{+ "db_name": "PostgreSQL",+ "query": "SELECT app_slug, server_url FROM mcp_overlays ORDER BY app_slug",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "app_slug",+ "type_info": "Text"+ },+ {+ "ordinal": 1,+ "name": "server_url",+ "type_info": "Text"+ }+ ],+ "parameters": {+ "Left": []+ },+ "nullable": [+ false,+ false+ ]+ },+ "hash": "4a0d39d153e0be43db48a157d77bcfe5318e36b237b9d4af8f1cbf6ff4fe79b1"+}diff --git a/.sqlx/query-8a430d6ee2c4e39dc85b1e9ea5630fd823f65e1b83a450f96cbf4cca0c24818d.json b/.sqlx/query-8a430d6ee2c4e39dc85b1e9ea5630fd823f65e1b83a450f96cbf4cca0c24818d.jsonnew file mode 100644index 0000000000..5ff034f79b--- /dev/null+++ b/.sqlx/query-8a430d6ee2c4e39dc85b1e9ea5630fd823f65e1b83a450f96cbf4cca0c24818d.json@@ -0,0 +1,28 @@+{+ "db_name": "PostgreSQL",+ "query": "SELECT app_slug, server_url FROM mcp_overlays WHERE app_slug = $1",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "app_slug",+ "type_info": "Text"+ },+ {+ "ordinal": 1,+ "name": "server_url",+ "type_info": "Text"+ }+ ],+ "parameters": {+ "Left": [+ "Text"+ ]+ },+ "nullable": [+ false,+ false+ ]+ },+ "hash": "8a430d6ee2c4e39dc85b1e9ea5630fd823f65e1b83a450f96cbf4cca0c24818d"+}diff --git a/.sqlx/query-ccee0941901634aaa91df3d5978662fdcb9ef8fb9553587ff3f53913895eea14.json b/.sqlx/query-96b06d2aa00d3a1a0e0975ba9d27381f2ca50a3aeee0da22069a00c5c14769fe.jsonsimilarity index 84%rename from .sqlx/query-ccee0941901634aaa91df3d5978662fdcb9ef8fb9553587ff3f53913895eea14.jsonrename to .sqlx/query-96b06d2aa00d3a1a0e0975ba9d27381f2ca50a3aeee0da22069a00c5c14769fe.jsonindex 6166e02773..92ddf1c802 100644--- a/.sqlx/query-ccee0941901634aaa91df3d5978662fdcb9ef8fb9553587ff3f53913895eea14.json+++ b/.sqlx/query-96b06d2aa00d3a1a0e0975ba9d27381f2ca50a3aeee0da22069a00c5c14769fe.json@@ -1,6 +1,6 @@{"db_name": "PostgreSQL",- "query": "\n SELECT user_id, app_slug, server_name, account_id, enabled\n FROM pipedream_mcp_connections\n WHERE user_id = $1 AND app_slug = $2\n ",+ "query": "\n SELECT user_id, app_slug, server_name, account_id, enabled\n FROM pipedream_mcp_connections\n WHERE user_id = $1 AND app_slug = $2\n AND NOT EXISTS (SELECT 1 FROM mcp_overlays o WHERE o.app_slug = $2)\n ","describe": {"columns": [{@@ -43,5 +43,5 @@false]},- "hash": "ccee0941901634aaa91df3d5978662fdcb9ef8fb9553587ff3f53913895eea14"+ "hash": "96b06d2aa00d3a1a0e0975ba9d27381f2ca50a3aeee0da22069a00c5c14769fe"}diff --git a/.sqlx/query-a905842e5c1f31766d551eb43ab6dc520f212c9af7ec5b6de4965213916fd9ea.json b/.sqlx/query-c3707d03d63e155f111c0f9120d96f3ccdcfcc68426cef82c54ff04e2d64c161.jsonsimilarity index 76%rename from .sqlx/query-a905842e5c1f31766d551eb43ab6dc520f212c9af7ec5b6de4965213916fd9ea.jsonrename to .sqlx/query-c3707d03d63e155f111c0f9120d96f3ccdcfcc68426cef82c54ff04e2d64c161.jsonindex 5d0d74d997..7e297ca514 100644--- a/.sqlx/query-a905842e5c1f31766d551eb43ab6dc520f212c9af7ec5b6de4965213916fd9ea.json+++ b/.sqlx/query-c3707d03d63e155f111c0f9120d96f3ccdcfcc68426cef82c54ff04e2d64c161.json@@ -1,6 +1,6 @@{"db_name": "PostgreSQL",- "query": "\n SELECT user_id, app_slug, server_name, account_id, enabled\n FROM pipedream_mcp_connections\n WHERE user_id = $1\n ORDER BY server_name\n ",+ "query": "\n SELECT user_id, app_slug, server_name, account_id, enabled\n FROM pipedream_mcp_connections c\n WHERE user_id = $1\n AND NOT EXISTS (SELECT 1 FROM mcp_overlays o WHERE o.app_slug = c.app_slug)\n ORDER BY server_name\n ","describe": {"columns": [{@@ -42,5 +42,5 @@false]},- "hash": "a905842e5c1f31766d551eb43ab6dc520f212c9af7ec5b6de4965213916fd9ea"+ "hash": "c3707d03d63e155f111c0f9120d96f3ccdcfcc68426cef82c54ff04e2d64c161"}diff --git a/Cargo.lock b/Cargo.lockindex b3af08cd62..9496f2d727 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -15064,6 +15064,7 @@ dependencies = ["futures","http 1.4.0","macro_authorization",+ "macro_db_migrator","macro_user_id","mcp_toolset","model-error-response",diff --git a/apps/web/src/features/connector-import/connector-import-dialog.tsx b/apps/web/src/features/connector-import/connector-import-dialog.tsxindex 32bb121cf0..8cb055a7c8 100644--- a/apps/web/src/features/connector-import/connector-import-dialog.tsx+++ b/apps/web/src/features/connector-import/connector-import-dialog.tsx@@ -1,9 +1,6 @@import { openChatWithInput } from '@app/features/chat/ChatWithAgentButton';import { nativeToolSlug } from '@app/features/onboarding/queries/connected-tools';-import {- assignOauthUrl,- reserveOauthPopup,-} from '@app/features/settings/connections/mcp-oauth';+import { assignOauthUrl, reserveOauthPopup } from '@core/pipedream/oauth-popup';import { Telemetry } from '@macro-inc/observability';import {useMcpServersQuery,diff --git a/apps/web/src/features/onboarding/queries/connected-tools.test.ts b/apps/web/src/features/onboarding/queries/connected-tools.test.tsindex a0e2de0d2b..f2489e7a55 100644--- a/apps/web/src/features/onboarding/queries/connected-tools.test.ts+++ b/apps/web/src/features/onboarding/queries/connected-tools.test.ts@@ -12,7 +12,7 @@ describe('native onboarding connections', () => {'https://mcp.notion.com/mcp','https://mcp.slack.com/mcp','https://mcp.posthog.com/mcp',- 'https://mcp.datadoghq.com/mcp',+ 'https://mcp.datadoghq.com/v1/mcp','https://mcp.grafana.com/mcp',].map((url) => ({url,diff --git a/apps/web/src/features/settings/connections/DiscoverView.test.tsx b/apps/web/src/features/settings/connections/DiscoverView.test.tsxindex e1fb97cbd4..de2feb8b4a 100644--- a/apps/web/src/features/settings/connections/DiscoverView.test.tsx+++ b/apps/web/src/features/settings/connections/DiscoverView.test.tsx@@ -40,6 +40,13 @@ const [state, setState] = createStore({const fetchNextPage = vi.fn();const observations: Array<{ intersect: () => void; node: Element }> = [];+vi.mock('@queries/pipedream-connectors', () => ({+ usePipedreamConnectedSlugs: () => ({+ slugs: () => new Set<string>(),+ ready: () => true,+ }),+}));+vi.mock('@core/pipedream/catalog', () => ({createPipedreamCatalogSearch: () => {const [search, setSearch] = createSignal('');diff --git a/apps/web/src/features/settings/connections/DiscoverView.tsx b/apps/web/src/features/settings/connections/DiscoverView.tsxindex f9919341fb..f8f899b098 100644--- a/apps/web/src/features/settings/connections/DiscoverView.tsx+++ b/apps/web/src/features/settings/connections/DiscoverView.tsx@@ -10,6 +10,7 @@ import CheckIcon from '@icon/system/regular/check.svg';import MagnifyingGlassIcon from '@icon/system/regular/magnifying-glass.svg';import PlusIcon from '@icon/system/regular/plus.svg';import SpinnerIcon from '@icon/system/regular/spinner-gap.svg';+import { usePipedreamConnectedSlugs } from '@queries/pipedream-connectors';import type { PipedreamCatalogEntryResponse } from '@service-cognition/client';import { Button, InputGroup, Tooltip } from '@ui';import { createMemo, createSignal, For, Show } from 'solid-js';@@ -27,8 +28,10 @@ import { useConnectionsView } from './view-state';export function DiscoverView(props: { model: ConnectionsModel }) {const view = useConnectionsView();+ // Includes overlaid apps, which are connected as native MCP servers.+ const connected = usePipedreamConnectedSlugs();const alreadyHave = createMemo(() => {- const slugs = new Set<string>();+ const slugs = new Set<string>(connected.slugs());for (const row of props.model.capabilities) {if (row.status !== 'not-connected') slugs.add(row.provider);}diff --git a/apps/web/src/features/settings/connections/native-actions.ts b/apps/web/src/features/settings/connections/native-actions.tsindex 41c13c54e3..937c4a47ec 100644--- a/apps/web/src/features/settings/connections/native-actions.ts+++ b/apps/web/src/features/settings/connections/native-actions.ts@@ -1,11 +1,11 @@import { toast } from '@core/component/Toast/Toast';+import { assignOauthUrl, reserveOauthPopup } from '@core/pipedream/oauth-popup';import {useDeleteMcpServerMutation,useStartMcpAuthMutation,useUpdateMcpServerMutation,} from '@queries/mcp-servers';import { writeMcpAuthAttempted } from '../mcp-auth-attempt';-import { assignOauthUrl, reserveOauthPopup } from './mcp-oauth';export function useNativeMcpActions() {const authorize = useStartMcpAuthMutation();diff --git a/apps/web/src/lib/core/component/AI/constant/mcpServers.ts b/apps/web/src/lib/core/component/AI/constant/mcpServers.tsindex fb15e11688..9a9db845a2 100644--- a/apps/web/src/lib/core/component/AI/constant/mcpServers.ts+++ b/apps/web/src/lib/core/component/AI/constant/mcpServers.ts@@ -44,7 +44,7 @@ export const QUICK_CONNECT_SERVERS = [{server_name: 'Datadog',app_slug: 'datadog',- url: 'https://mcp.datadoghq.com/mcp',+ url: 'https://mcp.datadoghq.com/v1/mcp',icon: IconDatadog as SvgIcon,},{diff --git a/apps/web/src/features/settings/connections/mcp-oauth.ts b/apps/web/src/lib/core/pipedream/oauth-popup.tssimilarity index 100%rename from apps/web/src/features/settings/connections/mcp-oauth.tsrename to apps/web/src/lib/core/pipedream/oauth-popup.tsdiff --git a/apps/web/src/lib/queries/pipedream-connectors.test.ts b/apps/web/src/lib/queries/pipedream-connectors.test.tsindex f12b0c98f4..662f7ec3b1 100644--- a/apps/web/src/lib/queries/pipedream-connectors.test.ts+++ b/apps/web/src/lib/queries/pipedream-connectors.test.ts@@ -12,6 +12,16 @@ const mocks = vi.hoisted(() => ({native: false,openNative: vi.fn(),userId: 'user-one',+ token: vi.fn(),+ startAuth: vi.fn(),+ fetchServers: vi.fn(),+ reservePopup: vi.fn(),+ assignUrl: vi.fn(),+ overlays: [] as { app_slug: string; server_url: string }[],+ overlaysUnavailable: false,+ cachedOverlays: undefined as+ | { app_slug: string; server_url: string }[]+ | undefined,}));vi.mock('@core/util/platform', () => ({ isTauri: () => mocks.native }));vi.mock('@core/pipedream/connect-native', () => ({@@ -20,18 +30,29 @@ vi.mock('@core/pipedream/connect-native', () => ({vi.mock('@core/pipedream/connect-ui', () => ({openPipedreamConnectUI: mocks.open,}));+vi.mock('@core/pipedream/oauth-popup', () => ({+ reserveOauthPopup: mocks.reservePopup,+ assignOauthUrl: mocks.assignUrl,+}));vi.mock('@queries/client', () => ({queryClient: {setQueryData: mocks.setData,invalidateQueries: mocks.invalidate,- getQueryData: () => ({ id: mocks.userId }),+ getQueryData: (key: readonly unknown[]) =>+ key[1] === 'overlays' ? mocks.cachedOverlays : { id: mocks.userId },+ ensureQueryData: async () => {+ if (mocks.overlaysUnavailable) throw new Error('404');+ return mocks.overlays;+ },+ fetchQuery: mocks.fetchServers,},}));vi.mock('@service-cognition/client', () => ({PIPEDREAM_DISABLED: 'PIPEDREAM_DISABLED',cognitionApiServiceClient: {- createPipedreamToken: async () => ok({ token: 'fixture' }),+ createPipedreamToken: mocks.token,completePipedreamConnection: mocks.complete,+ startMcpAuth: mocks.startAuth,recoverPipedreamConnection: mocks.recover,},}));@@ -42,6 +63,10 @@ beforeEach(() => {vi.clearAllMocks();mocks.native = false;mocks.userId = 'user-one';+ mocks.overlays = [];+ mocks.overlaysUnavailable = false;+ mocks.cachedOverlays = undefined;+ mocks.token.mockImplementation(async () => ok({ token: 'fixture' }));mocks.open.mockImplementation(() => ({ close: mocks.close }));mocks.openNative.mockImplementation(() => ({ close: mocks.close }));mocks.recover.mockResolvedValue(@@ -170,3 +195,79 @@ describe('verified Pipedream connection completion', () => {expect(mocks.setData).not.toHaveBeenCalled();});});++describe('overlaid apps connect through their own MCP server', () => {+ const sentry = {+ app_slug: 'sentry',+ server_url: 'https://mcp.sentry.dev/mcp',+ };+ const authorized = {+ url: 'https://mcp.sentry.dev/mcp',+ server_name: 'Sentry',+ enabled: true,+ authenticated: true,+ };++ beforeEach(() => {+ mocks.cachedOverlays = [sentry];+ mocks.startAuth.mockResolvedValue(+ ok({ authorization_url: 'https://sentry.io/oauth/authorize?x=1' })+ );+ });++ it('authorizes the overlay server in the reserved tab, never Pipedream', async () => {+ const popup = { closed: false, close: vi.fn() };+ mocks.reservePopup.mockReturnValue(popup);+ mocks.fetchServers.mockResolvedValue([authorized]);++ const outcome = await connectPipedreamApp({+ appSlug: 'sentry',+ serverName: 'Sentry',+ });++ expect(outcome).toBe('connected');+ expect(mocks.startAuth).toHaveBeenCalledWith({+ server_url: 'https://mcp.sentry.dev/mcp',+ server_name: 'Sentry',+ });+ expect(mocks.assignUrl).toHaveBeenCalledWith(+ popup,+ 'https://sentry.io/oauth/authorize?x=1'+ );+ expect(mocks.token).not.toHaveBeenCalled();+ expect(mocks.open).not.toHaveBeenCalled();+ });++ it('reports closed when the tab closes before the server is authorized', async () => {+ mocks.reservePopup.mockReturnValue({ closed: true, close: vi.fn() });+ mocks.fetchServers.mockResolvedValue([+ { ...authorized, authenticated: false },+ ]);++ expect(await connectPipedreamApp({ appSlug: 'sentry' })).toBe('closed');+ });++ it('looks the overlay up when it is not cached yet', async () => {+ mocks.cachedOverlays = undefined;+ mocks.overlays = [sentry];+ mocks.fetchServers.mockResolvedValue([authorized]);++ expect(await connectPipedreamApp({ appSlug: 'sentry' })).toBe('connected');+ expect(mocks.reservePopup).not.toHaveBeenCalled();+ expect(mocks.assignUrl).toHaveBeenCalledWith(+ null,+ 'https://sentry.io/oauth/authorize?x=1'+ );+ expect(mocks.token).not.toHaveBeenCalled();+ });+});++describe('a backend without overlays', () => {+ it('connects through Pipedream when the overlay list cannot be read', async () => {+ mocks.overlaysUnavailable = true;+ const { pending, event } = await connect();+ event({ type: 'close' });+ expect(await pending).toBe('closed');+ expect(mocks.token).toHaveBeenCalledOnce();+ });+});diff --git a/apps/web/src/lib/queries/pipedream-connectors.ts b/apps/web/src/lib/queries/pipedream-connectors.tsindex beb432f826..940a7c824b 100644--- a/apps/web/src/lib/queries/pipedream-connectors.ts+++ b/apps/web/src/lib/queries/pipedream-connectors.ts@@ -3,6 +3,7 @@ import {type PipedreamConnectEvent,type PipedreamConnectUI,} from '@core/pipedream/connect-ui';+import { assignOauthUrl, reserveOauthPopup } from '@core/pipedream/oauth-popup';import { pipedreamSlugsMatch } from '@core/pipedream/slugs';import { isTauri } from '@core/util/platform';import { ThrownResultError, throwOnErr } from '@core/util/result';@@ -11,13 +12,19 @@ import { authKeys } from '@queries/auth/keys';import type { UserInfoData } from '@queries/auth/user-info';import { queryClient } from '@queries/client';import { queryReadyGate } from '@queries/gate';+import {+ mcpServersQueryOptions,+ useMcpServersQuery,+} from '@queries/mcp-servers';import {cognitionApiServiceClient,PIPEDREAM_DISABLED,type PipedreamCatalogResponse,type PipedreamConnectionResponse,+ type PipedreamOverlayResponse,type PipedreamUpdateRequest,} from '@service-cognition/client';+import type { ServerResponse } from '@service-cognition/generated/schemas';import {type InfiniteData,infiniteQueryOptions,@@ -25,17 +32,21 @@ import {useMutation,useQuery,} from '@tanstack/solid-query';+import { ResultAsync } from 'neverthrow';import { type Accessor, createMemo } from 'solid-js';const KEYS = {all: ['pipedreamConnectors'] as const,list: ['pipedreamConnectors', 'list'] as const,+ overlays: ['pipedreamConnectors', 'overlays'] as const,catalog: (search: string) =>['pipedreamConnectors', 'catalog', search] as const,};/** Stable placeholder for `neverSuspend` consumers (see below). */const NO_CONNECTIONS: PipedreamConnectionResponse[] = [];+const NO_OVERLAYS: PipedreamOverlayResponse[] = [];+const NO_SERVERS: ServerResponse[] = [];function fetchPipedreamConnections() {return throwOnErr(@@ -66,12 +77,63 @@ export function usePipedreamConnectionsQuery(options?: {}));}+function fetchPipedreamOverlays() {+ return throwOnErr(+ async () => await cognitionApiServiceClient.listPipedreamOverlays()+ );+}++function pipedreamOverlaysQueryOptions() {+ return {+ queryKey: KEYS.overlays,+ queryFn: fetchPipedreamOverlays,+ staleTime: 10 * 60 * 1000,+ };+}++/**+ * The catalog apps that connect through their own MCP server instead of+ * Pipedream. Never suspends: the empty placeholder only means "not loaded+ * yet", so surfaces that decide anything from it also check `ready`.+ */+export function usePipedreamOverlaysQuery() {+ return useQuery(() => ({+ ...pipedreamOverlaysQueryOptions(),+ placeholderData: NO_OVERLAYS,+ }));+}++function sameEndpoint(a: string, b: string) {+ return a.replace(/\/+$/, '') === b.replace(/\/+$/, '');+}++/**+ * The overlaid apps `servers` holds an enabled, authorized native connection+ * for, by app slug.+ */+export function overlaidSlugsConnected(+ overlays: readonly PipedreamOverlayResponse[],+ servers: readonly ServerResponse[]+): string[] {+ return overlays+ .filter((overlay) =>+ servers.some(+ (server) =>+ server.enabled &&+ server.authenticated &&+ sameEndpoint(server.url, overlay.server_url)+ )+ )+ .map((overlay) => overlay.app_slug);+}+/*** The app slugs the current user has connected, as a set, plus whether the- * answer is known yet. `ready` is false while the query is still serving the+ * answer is known yet. `ready` is false while a query is still serving its* `neverSuspend` placeholder, which callers must not read as "connected to* nothing". Shared by every surface that shows a connected/not-connected- * indicator so they cannot disagree.+ * indicator so they cannot disagree. Overlaid apps count as connected+ * through their native MCP server, never through Pipedream.*/export function usePipedreamConnectedSlugs(options?: {refetchInterval?: number;@@ -83,15 +145,31 @@ export function usePipedreamConnectedSlugs(options?: {neverSuspend: true,refetchInterval: options?.refetchInterval,});- const slugs = createMemo<ReadonlySet<string>>(- () =>- new Set(- (queryReadyGate(query) ? query.data : NO_CONNECTIONS)- .filter((connection) => connection.enabled)- .map((connection) => connection.app_slug)- )- );- const ready = () => !query.isPlaceholderData && queryReadyGate(query);+ const overlays = usePipedreamOverlaysQuery();+ const servers = useMcpServersQuery({+ neverSuspend: true,+ refetchInterval: options?.refetchInterval,+ });+ const slugs = createMemo<ReadonlySet<string>>(() => {+ const overlayList = queryReadyGate(overlays) ? overlays.data : NO_OVERLAYS;+ const overlaid = new Set(overlayList.map((overlay) => overlay.app_slug));+ return new Set([+ ...(queryReadyGate(query) ? query.data : NO_CONNECTIONS)+ .filter(+ (connection) =>+ connection.enabled && !overlaid.has(connection.app_slug)+ )+ .map((connection) => connection.app_slug),+ ...overlaidSlugsConnected(+ overlayList,+ queryReadyGate(servers) ? servers.data : NO_SERVERS+ ),+ ]);+ });+ const ready = () =>+ [query, overlays, servers].every(+ (source) => !source.isPlaceholderData && queryReadyGate(source)+ );return { slugs, ready };}@@ -207,6 +285,10 @@ let pipedreamUnsupported = false;* with our backend, which verifies ownership against Pipedream before* storing it.*+ * An overlaid app (see {@link usePipedreamOverlaysQuery}) never goes through+ * Pipedream: it authorizes its own MCP server with the native MCP OAuth flow+ * in a new tab instead, and is connected once that server is authorized.+ ** Resolves `'connected'` on success (connections cache already refreshed),* `'closed'` when the user dismissed the UI without finishing, and* `'unsupported'` when the deployment has no Pipedream configured. Rejects@@ -220,14 +302,27 @@ export async function connectPipedreamApp(args: {/** Where the Connect iframe mounts; see `openPipedreamConnectUI`. */container?: HTMLElement;}): Promise<PipedreamConnectOutcome> {+ // The authorization URL arrives after an await, so an overlaid app's tab+ // is reserved now, inside the click. Surfaces that offer connecting load+ // the overlays first; an uncached list falls back to opening the URL.+ const cachedOverlay = queryClient+ .getQueryData<PipedreamOverlayResponse[]>(KEYS.overlays)+ ?.find((overlay) => overlay.app_slug === args.appSlug);+ const popup = cachedOverlay ? reserveOauthPopup() : null;return Telemetry.span('pipedream.connect', async (span) => {span.setAttr('connector.app_slug', args.appSlug);span.setAttr('connector.native', isTauri());try {- const outcome = await connectPipedreamAccount(args, span);+ const overlay =+ cachedOverlay ?? (await lookUpOverlay(args.appSlug, span));+ span.setAttr('connector.overlaid', overlay !== undefined);+ const outcome = overlay+ ? await connectOverlaidApp(overlay, args, popup, span)+ : await connectPipedreamAccount(args, span);span.setAttr('connector.outcome', outcome);return outcome;} catch (error) {+ popup?.close();// Do not copy third-party errors or Connect URLs into telemetry.span.error('Pipedream connection failed');throw error;@@ -235,14 +330,89 @@ export async function connectPipedreamApp(args: {});}+/**+ * The overlay for `appSlug`, or none when the overlay list cannot be read: a+ * backend without the overlay route still connects through Pipedream, and+ * one with it refuses overlaid apps there itself.+ */+async function lookUpOverlay(+ appSlug: string,+ span: Span+): Promise<PipedreamOverlayResponse | undefined> {+ const overlays = await ResultAsync.fromPromise(+ queryClient.ensureQueryData(pipedreamOverlaysQueryOptions()),+ () => ({ kind: 'overlays-unavailable' as const })+ );+ if (overlays.isErr()) {+ span.setAttr('connector.overlays_unavailable', true);+ return undefined;+ }+ return overlays.value.find((overlay) => overlay.app_slug === appSlug);+}++const OVERLAY_AUTH_POLL_MS = 2000;+// Matches the backend's pending-authorization lifetime.+const OVERLAY_AUTH_TIMEOUT_MS = 10 * 60 * 1000;++function currentUserId() {+ return queryClient.getQueryData<UserInfoData>(authKeys.userInfo.queryKey)?.id;+}++/**+ * Authorize an overlaid app's own MCP server in `popup` (or the system+ * browser), then wait for the server list to show it authorized. The+ * callback page cannot message this tab, so the list is re-read until the+ * grant lands, the tab is closed, or the pending authorization expires.+ */+async function connectOverlaidApp(+ overlay: PipedreamOverlayResponse,+ args: Parameters<typeof connectPipedreamApp>[0],+ popup: Window | null,+ span: Span+): Promise<PipedreamConnectOutcome> {+ const userId = currentUserId();+ const started = await span.span('mcp.auth_start', async () =>+ throwOnErr(+ async () =>+ await cognitionApiServiceClient.startMcpAuth({+ server_url: overlay.server_url,+ server_name: args.serverName ?? overlay.app_slug,+ })+ )+ );+ if (currentUserId() !== userId) {+ popup?.close();+ return 'closed';+ }+ assignOauthUrl(popup, started.authorization_url);++ const consent = span.span('mcp.consent');+ try {+ const deadline = Date.now() + OVERLAY_AUTH_TIMEOUT_MS;+ while (Date.now() < deadline && currentUserId() === userId) {+ const closed = popup?.closed ?? false;+ const servers = await queryClient.fetchQuery({+ ...mcpServersQueryOptions(),+ staleTime: 0,+ });+ if (overlaidSlugsConnected([overlay], servers).length > 0) {+ return 'connected';+ }+ if (closed) return 'closed';+ await new Promise((resolve) => setTimeout(resolve, OVERLAY_AUTH_POLL_MS));+ }+ return 'closed';+ } finally {+ consent.end();+ }+}+async function connectPipedreamAccount(args: Parameters<typeof connectPipedreamApp>[0],span: Span): Promise<PipedreamConnectOutcome> {if (pipedreamUnsupported) return 'unsupported';- const currentUserId = () =>- queryClient.getQueryData<UserInfoData>(authKeys.userInfo.queryKey)?.id;const userId = currentUserId();const token = await span.span('pipedream.token', async () =>cognitionApiServiceClient.createPipedreamToken()diff --git a/apps/web/src/lib/service-clients/service-cognition/client.ts b/apps/web/src/lib/service-clients/service-cognition/client.tsindex 4796bb71bf..30030c0517 100644--- a/apps/web/src/lib/service-clients/service-cognition/client.ts+++ b/apps/web/src/lib/service-clients/service-cognition/client.ts@@ -25,6 +25,7 @@ import type { GetChatsForAttachmentResponse } from './generated/schemas/getChatsimport type { HttpSendChatMessageRequest } from './generated/schemas/httpSendChatMessageRequest';import type { PatchChatRequest } from './generated/schemas/patchChatRequest';import type { PipedreamCatalogResponse } from './generated/schemas/pipedreamCatalogResponse';+import type { PipedreamOverlayResponse } from './generated/schemas/pipedreamOverlayResponse';import type { ProjectionStateResponse } from './generated/schemas/projectionStateResponse';import type { SendChatMessageResponse } from './generated/schemas/sendChatMessageResponse';import type { ServerResponse } from './generated/schemas/serverResponse';@@ -100,6 +101,7 @@ export type PipedreamRecoverRequest = {};export type { PipedreamCatalogEntryResponse } from './generated/schemas/pipedreamCatalogEntryResponse';export type { PipedreamCatalogResponse } from './generated/schemas/pipedreamCatalogResponse';+export type { PipedreamOverlayResponse } from './generated/schemas/pipedreamOverlayResponse';/** Error code for deployments where Pipedream MCP connect is not configured. */export const PIPEDREAM_DISABLED = 'PIPEDREAM_DISABLED' as const;@@ -506,6 +508,18 @@ export const cognitionApiServiceClient = {).map((result) => result);},+ /**+ * Catalog apps that connect through their own MCP server instead of+ * Pipedream; connect them with `startMcpAuth` against `server_url`.+ */+ async listPipedreamOverlays() {+ return (+ await dcsFetch<PipedreamOverlayResponse[]>(`/pipedream/mcp/overlays`, {+ method: 'GET',+ })+ ).map((result) => result);+ },+async structuredCompletion(args: StructuredCompletionRequest) {return (await fetchWithToken<diff --git a/apps/web/src/lib/service-clients/service-cognition/generated/client.ts b/apps/web/src/lib/service-clients/service-cognition/generated/client.tsindex 9c67bc4920..5716311bc0 100644--- a/apps/web/src/lib/service-clients/service-cognition/generated/client.ts+++ b/apps/web/src/lib/service-clients/service-cognition/generated/client.ts@@ -40,6 +40,7 @@ import type {PipedreamCatalogResponse,PipedreamCompleteRequest,PipedreamConnectionResponse,+ PipedreamOverlayResponse,PipedreamRecoverRequest,PipedreamTokenResponse,PipedreamUpdateRequest,@@ -2352,7 +2353,8 @@ export const browsePipedreamMcpCatalog = async (/*** Verifies with Pipedream that the account exists and was connected for-the authenticated user before persisting anything.+the authenticated user before persisting anything. An overlaid app is+refused with 409: it connects through its own MCP server instead.* @summary Register a connected account reported by the Pipedream Connect UI.*/export type completePipedreamMcpConnectionResponse200 = {@@ -2370,6 +2372,11 @@ export type completePipedreamMcpConnectionResponse404 = {status: 404;};+export type completePipedreamMcpConnectionResponse409 = {+ data: ErrorResponse;+ status: 409;+};+export type completePipedreamMcpConnectionResponse500 = {data: ErrorResponse;status: 500;@@ -2387,6 +2394,7 @@ export type completePipedreamMcpConnectionResponseSuccess =export type completePipedreamMcpConnectionResponseError = (| completePipedreamMcpConnectionResponse401| completePipedreamMcpConnectionResponse404+ | completePipedreamMcpConnectionResponse409| completePipedreamMcpConnectionResponse500| completePipedreamMcpConnectionResponse501) & {@@ -2619,9 +2627,69 @@ export const deletePipedreamMcpConnection = async (} as deletePipedreamMcpConnectionResponse;};+/**+ * Clients connect these with the native MCP OAuth flow against+`server_url`; Pipedream refuses to complete a connection for them.+ * @summary List the catalog apps that connect through their own MCP server.+ */+export type listPipedreamMcpOverlaysResponse200 = {+ data: PipedreamOverlayResponse[];+ status: 200;+};++export type listPipedreamMcpOverlaysResponse401 = {+ data: string;+ status: 401;+};++export type listPipedreamMcpOverlaysResponse500 = {+ data: ErrorResponse;+ status: 500;+};++export type listPipedreamMcpOverlaysResponseSuccess =+ listPipedreamMcpOverlaysResponse200 & {+ headers: Headers;+ };+export type listPipedreamMcpOverlaysResponseError = (+ | listPipedreamMcpOverlaysResponse401+ | listPipedreamMcpOverlaysResponse500+) & {+ headers: Headers;+};++export type listPipedreamMcpOverlaysResponse =+ | listPipedreamMcpOverlaysResponseSuccess+ | listPipedreamMcpOverlaysResponseError;++export const getListPipedreamMcpOverlaysUrl = () => {+ return `/pipedream/mcp/overlays`;+};++export const listPipedreamMcpOverlays = async (+ options?: RequestInit+): Promise<listPipedreamMcpOverlaysResponse> => {+ const res = await fetch(getListPipedreamMcpOverlaysUrl(), {+ ...options,+ method: 'GET',+ });++ const body = [204, 205, 304].includes(res.status) ? null : await res.text();++ const data: listPipedreamMcpOverlaysResponse['data'] = body+ ? JSON.parse(body)+ : {};+ return {+ data,+ status: res.status,+ headers: res.headers,+ } as listPipedreamMcpOverlaysResponse;+};+/*** Called after the Connect UI closes without a success event. Answers 404when Pipedream has no new account for this user and app.+An overlaid app is refused with 409, as in [`complete_connection`].* @summary Register an account a Connect flow created but the Connect UI neverreported.*/@@ -2640,6 +2708,11 @@ export type recoverPipedreamMcpConnectionResponse404 = {status: 404;};+export type recoverPipedreamMcpConnectionResponse409 = {+ data: ErrorResponse;+ status: 409;+};+export type recoverPipedreamMcpConnectionResponse500 = {data: ErrorResponse;status: 500;@@ -2657,6 +2730,7 @@ export type recoverPipedreamMcpConnectionResponseSuccess =export type recoverPipedreamMcpConnectionResponseError = (| recoverPipedreamMcpConnectionResponse401| recoverPipedreamMcpConnectionResponse404+ | recoverPipedreamMcpConnectionResponse409| recoverPipedreamMcpConnectionResponse500| recoverPipedreamMcpConnectionResponse501) & {diff --git a/apps/web/src/lib/service-clients/service-cognition/generated/schemas/index.ts b/apps/web/src/lib/service-clients/service-cognition/generated/schemas/index.tsindex cf0a2e687a..45ba016057 100644--- a/apps/web/src/lib/service-clients/service-cognition/generated/schemas/index.ts+++ b/apps/web/src/lib/service-clients/service-cognition/generated/schemas/index.ts@@ -218,6 +218,7 @@ export * from './pipedreamCatalogResponseNextCursor';export * from './pipedreamCompleteRequest';export * from './pipedreamCompleteRequestServerName';export * from './pipedreamConnectionResponse';+export * from './pipedreamOverlayResponse';export * from './pipedreamRecoverRequest';export * from './pipedreamRecoverRequestServerName';export * from './pipedreamTokenResponse';diff --git a/apps/web/src/lib/service-clients/service-cognition/generated/schemas/pipedreamOverlayResponse.ts b/apps/web/src/lib/service-clients/service-cognition/generated/schemas/pipedreamOverlayResponse.tsnew file mode 100644index 0000000000..7be9a398a5--- /dev/null+++ b/apps/web/src/lib/service-clients/service-cognition/generated/schemas/pipedreamOverlayResponse.ts@@ -0,0 +1,17 @@+/**+ * Generated by orval v7.21.0 🍺+ * Do not edit manually.+ * Document Cognition Service+ * OpenAPI spec version: 1.0.0+ */++/**+ * A catalog app that connects through its own MCP server instead of+Pipedream.+ */+export interface PipedreamOverlayResponse {+ /** Pipedream app name slug, as it appears in the catalog. */+ app_slug: string;+ /** The MCP server to authorize with the native MCP OAuth flow. */+ server_url: string;+}diff --git a/apps/web/src/lib/service-clients/service-cognition/generated/tools/types.ts b/apps/web/src/lib/service-clients/service-cognition/generated/tools/types.tsindex 98a4432184..f094a74eae 100644--- a/apps/web/src/lib/service-clients/service-cognition/generated/tools/types.ts+++ b/apps/web/src/lib/service-clients/service-cognition/generated/tools/types.ts@@ -1153,7 +1153,9 @@ export type DiscoveryResult =| {app: DiscoveredApp;/**- * Whether this caller has an enabled connection.+ * Whether this caller has an enabled connection. For an app that+ * connects through its own MCP server, that connection is checked+ * there, not in Pipedream.*/connected: boolean;/**diff --git a/apps/web/src/lib/service-clients/service-cognition/openapi.json b/apps/web/src/lib/service-clients/service-cognition/openapi.jsonindex 129a56af06..c3073698b8 100644--- a/apps/web/src/lib/service-clients/service-cognition/openapi.json+++ b/apps/web/src/lib/service-clients/service-cognition/openapi.json@@ -1885,7 +1885,7 @@"post": {"tags": ["pipedream-mcp"],"summary": "Register a connected account reported by the Pipedream Connect UI.",- "description": "Verifies with Pipedream that the account exists and was connected for\nthe authenticated user before persisting anything.",+ "description": "Verifies with Pipedream that the account exists and was connected for\nthe authenticated user before persisting anything. An overlaid app is\nrefused with 409: it connects through its own MCP server instead.","operationId": "complete_pipedream_mcp_connection","requestBody": {"content": {@@ -1928,6 +1928,16 @@}}},+ "409": {+ "description": "",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/ErrorResponse"+ }+ }+ }+ },"500": {"description": "","content": {@@ -2091,11 +2101,54 @@}}},+ "/pipedream/mcp/overlays": {+ "get": {+ "tags": ["pipedream-mcp"],+ "summary": "List the catalog apps that connect through their own MCP server.",+ "description": "Clients connect these with the native MCP OAuth flow against\n`server_url`; Pipedream refuses to complete a connection for them.",+ "operationId": "list_pipedream_mcp_overlays",+ "responses": {+ "200": {+ "description": "",+ "content": {+ "application/json": {+ "schema": {+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/PipedreamOverlayResponse"+ }+ }+ }+ }+ },+ "401": {+ "description": "",+ "content": {+ "text/plain": {+ "schema": {+ "type": "string"+ }+ }+ }+ },+ "500": {+ "description": "",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/ErrorResponse"+ }+ }+ }+ }+ }+ }+ },"/pipedream/mcp/recover": {"post": {"tags": ["pipedream-mcp"],"summary": "Register an account a Connect flow created but the Connect UI never\nreported.",- "description": "Called after the Connect UI closes without a success event. Answers 404\nwhen Pipedream has no new account for this user and app.",+ "description": "Called after the Connect UI closes without a success event. Answers 404\nwhen Pipedream has no new account for this user and app.\nAn overlaid app is refused with 409, as in [`complete_connection`].","operationId": "recover_pipedream_mcp_connection","requestBody": {"content": {@@ -2138,6 +2191,16 @@}}},+ "409": {+ "description": "",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/ErrorResponse"+ }+ }+ }+ },"500": {"description": "","content": {@@ -4987,6 +5050,21 @@}}},+ "PipedreamOverlayResponse": {+ "type": "object",+ "description": "A catalog app that connects through its own MCP server instead of\nPipedream.",+ "required": ["app_slug", "server_url"],+ "properties": {+ "app_slug": {+ "type": "string",+ "description": "Pipedream app name slug, as it appears in the catalog."+ },+ "server_url": {+ "type": "string",+ "description": "The MCP server to authorize with the native MCP OAuth flow."+ }+ }+ },"PipedreamRecoverRequest": {"type": "object","description": "Request body for recovering a connect flow whose result the Connect UI\nnever reported.",diff --git a/crates/agent_code_mode/src/domain/operations.json b/crates/agent_code_mode/src/domain/operations.jsonindex 0b187fdb10..37d61aff5c 100644--- a/crates/agent_code_mode/src/domain/operations.json+++ b/crates/agent_code_mode/src/domain/operations.json@@ -218,6 +218,7 @@"cognition.deletePipedreamMcpConnection": "Delete Pipedream Mcp Connection","cognition.listPipedreamMcpConnections": "List Pipedream Mcp Connections","cognition.updatePipedreamMcpConnection": "Update Pipedream Mcp Connection",+ "cognition.listPipedreamMcpOverlays": "List Pipedream Mcp Overlays","cognition.recoverPipedreamMcpConnection": "Recover Pipedream Mcp Connection","cognition.createPipedreamMcpToken": "Create Pipedream Mcp Token","cognition.getBatchPreview": "Get Batch Preview",diff --git a/crates/agent_harness/AGENTS.md b/crates/agent_harness/AGENTS.mdindex 5587e564ba..a9bb165e50 100644--- a/crates/agent_harness/AGENTS.md+++ b/crates/agent_harness/AGENTS.md@@ -46,6 +46,9 @@ between the sandbox and the rest of the product.External runtimes receive the session's configured MCP selection when binding,including enabled owner connections and custom servers under `OwnerConnections`.+Under `Selected`, an overlaid app (`pipedream_mcp` `mcp_overlays`) the owner+authorized natively is advertised as that custom server instead of its slug;+an app connected that way also satisfies the `app.connected` resume check.Use `external_mcp_servers` to preserve the host-reachable egress URL override.External chat replies use `domain/service/external_replies.rs` and thediff --git a/crates/agent_harness/src/outbound/connected_apps.rs b/crates/agent_harness/src/outbound/connected_apps.rsindex 8834151520..6b95d38698 100644--- a/crates/agent_harness/src/outbound/connected_apps.rs+++ b/crates/agent_harness/src/outbound/connected_apps.rs@@ -1,30 +1,44 @@-//! The apps a user has connected, read from their Pipedream connections.+//! The apps a user has connected: their Pipedream connections, or the native+//! MCP connection for an app that is overlaid onto its own server.use std::sync::Arc;use macro_user_id::user_id::MacroUserIdStr;-use pipedream_mcp::domain::ports::ConnectionStore;+use pipedream_mcp::domain::ports::{ConnectionStore, ConnectorOverlays, OverlayConnections};use crate::domain::app_connections::ConnectedApps;+#[cfg(test)]+mod test;+/// The connection store could not be read.#[derive(Debug, thiserror::Error)]-#[error("could not read the Pipedream connection: {0}")]+#[error("could not read the app connection: {0}")]pub struct ConnectionLookupError(String);-/// [`ConnectedApps`] over the Pipedream connection store.-pub struct PipedreamConnectedApps<Connections> {+/// [`ConnectedApps`] over the Pipedream connection store, answering overlaid+/// apps from the native MCP stack.+pub struct PipedreamConnectedApps<Connections, Overlays> {connections: Arc<Connections>,+ overlay_connections: Arc<Overlays>,}-impl<Connections> PipedreamConnectedApps<Connections> {- /// Read connections from `connections`.- pub fn new(connections: Arc<Connections>) -> Self {- Self { connections }+impl<Connections, Overlays> PipedreamConnectedApps<Connections, Overlays> {+ /// Read Pipedream connections and overlays from `connections`, and+ /// overlaid apps' connections from `overlay_connections`.+ pub fn new(connections: Arc<Connections>, overlay_connections: Arc<Overlays>) -> Self {+ Self {+ connections,+ overlay_connections,+ }}}-impl<Connections: ConnectionStore> ConnectedApps for PipedreamConnectedApps<Connections> {+impl<Connections, Overlays> ConnectedApps for PipedreamConnectedApps<Connections, Overlays>+where+ Connections: ConnectionStore + ConnectorOverlays,+ Overlays: OverlayConnections,+{type Err = ConnectionLookupError;async fn connected_app_name(@@ -32,11 +46,24 @@ impl<Connections: ConnectionStore> ConnectedApps for PipedreamConnectedApps<Connuser: &MacroUserIdStr<'static>,app_slug: &str,) -> Result<Option<String>, ConnectionLookupError> {+ let lookup = |error: &dyn std::fmt::Debug| ConnectionLookupError(format!("{error:?}"));+ if let Some(overlay) = self+ .connections+ .overlay(app_slug)+ .await+ .map_err(|error| lookup(&error))?+ {+ return self+ .overlay_connections+ .connected_name(user, &overlay)+ .await+ .map_err(|error| lookup(&error));+ }let connection = self.connections.load(user, app_slug).await- .map_err(|error| ConnectionLookupError(format!("{error:?}")))?;+ .map_err(|error| lookup(&error))?;Ok(connection.filter(|connection| connection.enabled).map(|connection| connection.server_name))diff --git a/crates/agent_harness/src/outbound/connected_apps/test.rs b/crates/agent_harness/src/outbound/connected_apps/test.rsnew file mode 100644index 0000000000..178d632ba7--- /dev/null+++ b/crates/agent_harness/src/outbound/connected_apps/test.rs@@ -0,0 +1,101 @@+use super::*;+use pipedream_mcp::domain::models::{ConnectorOverlay, PipedreamConnection};++/// One user's Pipedream rows, with `sentry` overlaid.+struct Connections(Vec<PipedreamConnection>);++impl ConnectionStore for Connections {+ type Err = String;+ async fn save(&self, _: &PipedreamConnection) -> Result<(), String> {+ unreachable!()+ }+ async fn load(+ &self,+ _: &MacroUserIdStr<'static>,+ app_slug: &str,+ ) -> Result<Option<PipedreamConnection>, String> {+ Ok(self.0.iter().find(|c| c.app_slug == app_slug).cloned())+ }+ async fn delete(&self, _: &MacroUserIdStr<'static>, _: &str) -> Result<(), String> {+ unreachable!()+ }+ async fn list(&self, _: &MacroUserIdStr<'static>) -> Result<Vec<PipedreamConnection>, String> {+ unreachable!()+ }+}++impl ConnectorOverlays for Connections {+ async fn overlays(&self) -> anyhow::Result<Vec<ConnectorOverlay>> {+ unreachable!()+ }+ async fn overlay(&self, app_slug: &str) -> anyhow::Result<Option<ConnectorOverlay>> {+ Ok((app_slug == "sentry").then(|| ConnectorOverlay {+ app_slug: "sentry".into(),+ server_url: "https://mcp.sentry.dev/mcp".into(),+ }))+ }+}++/// The user's native connection to the overlay server, by display name.+struct Native(Option<&'static str>);++impl OverlayConnections for Native {+ async fn connected_name(+ &self,+ _: &MacroUserIdStr<'static>,+ overlay: &ConnectorOverlay,+ ) -> anyhow::Result<Option<String>> {+ assert_eq!(overlay.server_url, "https://mcp.sentry.dev/mcp");+ Ok(self.0.map(str::to_owned))+ }+}++fn user() -> MacroUserIdStr<'static> {+ MacroUserIdStr::try_from_email("[email protected]").unwrap()+}++fn pipedream(app_slug: &str, enabled: bool) -> PipedreamConnection {+ PipedreamConnection {+ user_id: user(),+ app_slug: app_slug.into(),+ server_name: format!("{app_slug} (Pipedream)"),+ account_id: "apn_1".into(),+ enabled,+ }+}++#[tokio::test]+async fn overlaid_apps_are_connected_through_their_native_server_only() {+ let apps = PipedreamConnectedApps::new(+ Arc::new(Connections(vec![+ pipedream("sentry", true),+ pipedream("stripe", true),+ pipedream("asana", false),+ ])),+ Arc::new(Native(Some("Sentry"))),+ );+ assert_eq!(+ apps.connected_app_name(&user(), "sentry").await.unwrap(),+ Some("Sentry".into())+ );+ assert_eq!(+ apps.connected_app_name(&user(), "stripe").await.unwrap(),+ Some("stripe (Pipedream)".into())+ );+ assert_eq!(+ apps.connected_app_name(&user(), "asana").await.unwrap(),+ None+ );++ let unconnected = PipedreamConnectedApps::new(+ Arc::new(Connections(vec![pipedream("sentry", true)])),+ Arc::new(Native(None)),+ );+ assert_eq!(+ unconnected+ .connected_app_name(&user(), "sentry")+ .await+ .unwrap(),+ None+ );+}diff --git a/crates/agent_harness/src/outbound/egress.rs b/crates/agent_harness/src/outbound/egress.rsindex 3ab71e0a99..45e2f561b3 100644--- a/crates/agent_harness/src/outbound/egress.rs+++ b/crates/agent_harness/src/outbound/egress.rs@@ -15,7 +15,7 @@ use agent_egress::domain::model::{};use macro_user_id::user_id::MacroUserIdStr;use mcp_client::domain::ports::McpServerStore;-use pipedream_mcp::domain::ports::ConnectionStore;+use pipedream_mcp::domain::ports::{ConnectionStore, ConnectorOverlays};use std::sync::Arc;use crate::domain::error::{HarnessError, Result};@@ -36,7 +36,7 @@ pub struct EgressProvisioner<Connections, Servers> {impl<Connections, Servers> EgressProvisioner<Connections, Servers>where- Connections: ConnectionStore,+ Connections: ConnectionStore + ConnectorOverlays,Servers: McpServerStore,{/// Build the provisioner over the Pipedream connection store, the custom@@ -67,22 +67,36 @@ whereowner: &MacroUserIdStr<'static>,selection: &AgentMcpServers,) -> Result<(Vec<McpServerSlug>, Vec<CustomMcpServerListing>)> {- // Selected-agent permissions are unchanged: advertise the author's- // explicit list and never add the owner's private servers to it.- if let AgentMcpServers::Selected { servers } = selection {- return Ok((- servers- .iter()- .filter_map(|server| McpServerSlug::parse(&server.app_slug))- .collect(),- Vec::new(),- ));- }let native = self.custom_servers.list(owner).await.map_err(|error| {HarnessError::Egress(rootcause::report!("could not list custom MCP servers: {error:?}"))})?;+ // Selected-agent permissions are unchanged: advertise the author's+ // explicit list and never add the owner's other private servers to+ // it. An overlaid app the owner connected natively is advertised as+ // that server; unconnected, its slug stays so a call asks to connect.+ if let AgentMcpServers::Selected { servers } = selection {+ let overlays = self.connections.overlays().await.map_err(|error| {+ HarnessError::Egress(rootcause::report!("could not list MCP overlays: {error:?}"))+ })?;+ let mut slugs = Vec::new();+ let mut custom = Vec::new();+ for server in servers {+ let connected = overlays+ .iter()+ .find(|overlay| overlay.app_slug == server.app_slug)+ .and_then(|overlay| mcp_select::overlay_connection(&native, overlay));+ match connected {+ Some(record) => custom.push(CustomMcpServerListing {+ key: CustomMcpServerKey::for_url(&record.url),+ name: record.server_name.clone(),+ }),+ None => slugs.extend(McpServerSlug::parse(&server.app_slug)),+ }+ }+ return Ok((slugs, custom));+ }let pipedream = self.connections.list(owner).await.map_err(|error| {HarnessError::Egress(rootcause::report!("could not list Pipedream connections: {error:?}"@@ -107,7 +121,7 @@ whereimpl<Connections, Servers> SandboxEgressProvisioner for EgressProvisioner<Connections, Servers>where- Connections: ConnectionStore,+ Connections: ConnectionStore + ConnectorOverlays,Servers: McpServerStore,{fn external_mcp_servers(diff --git a/crates/agent_harness/src/outbound/egress/test.rs b/crates/agent_harness/src/outbound/egress/test.rsindex 3216138805..c3244d2020 100644--- a/crates/agent_harness/src/outbound/egress/test.rs+++ b/crates/agent_harness/src/outbound/egress/test.rs@@ -42,6 +42,25 @@ impl ConnectionStore for FixedConnections {}}+/// `sentry` is the only overlaid app.+impl ConnectorOverlays for FixedConnections {+ async fn overlays(+ &self,+ ) -> anyhow::Result<Vec<pipedream_mcp::domain::models::ConnectorOverlay>> {+ Ok(vec![pipedream_mcp::domain::models::ConnectorOverlay {+ app_slug: "sentry".to_owned(),+ server_url: "https://mcp.sentry.dev/mcp".to_owned(),+ }])+ }++ async fn overlay(+ &self,+ _app_slug: &str,+ ) -> anyhow::Result<Option<pipedream_mcp::domain::models::ConnectorOverlay>> {+ unreachable!("provisioning lists overlays once")+ }+}+struct FixedServers(Vec<McpServerRecord>);impl McpServerStore for FixedServers {@@ -556,3 +575,54 @@ async fn native_provider_wins_without_hiding_other_hosted_apps() {assert_eq!(provisioned.sandbox.custom_servers.len(), 1);assert_eq!(provisioned.sandbox.custom_servers[0].name, "Linear");}++/// A selected overlaid app the owner authorized natively is advertised as+/// that server, not its Pipedream slug; unauthorized, the slug stays so a+/// call answers with a connect prompt.+#[tokio::test]+async fn a_selected_overlaid_app_is_advertised_as_its_native_server_once_connected() {+ let mut authorized = custom_server("https://mcp.sentry.dev/mcp", "Sentry", true);+ authorized.credentials = Some(+ serde_json::from_value(serde_json::json!({"client_id":"test", "token_response":null}))+ .expect("credentials"),+ );+ let owner = MacroUserIdStr::try_from_email("[email protected]").expect("a valid user id");++ for (servers, expected_slugs, expected_custom) in [+ (vec![authorized.clone()], vec!["notion"], vec!["Sentry"]),+ (+ vec![custom_server("https://mcp.sentry.dev/mcp", "Sentry", true)],+ vec!["sentry", "notion"],+ vec![],+ ),+ ] {+ let provisioner = EgressProvisioner::new(+ Arc::new(FixedConnections(vec![connection("sentry", true)])),+ Arc::new(FixedServers(servers)),+ "https://egress.macro.com",+ );+ let provisioned = provisioner+ .provision(+ AgentSessionId::new(),+ &owner,+ &selected(&["sentry", "notion"]),+ )+ .await+ .expect("provisioned");++ let slugs: Vec<String> = provisioned+ .sandbox+ .mcp_servers+ .iter()+ .map(ToString::to_string)+ .collect();+ assert_eq!(slugs, expected_slugs);+ let custom: Vec<&str> = provisioned+ .sandbox+ .custom_servers+ .iter()+ .map(|server| server.name.as_str())+ .collect();+ assert_eq!(custom, expected_custom);+ }+}diff --git a/crates/ai_tools/src/build_context.rs b/crates/ai_tools/src/build_context.rsindex 5118ff8f76..d487d56018 100644--- a/crates/ai_tools/src/build_context.rs+++ b/crates/ai_tools/src/build_context.rs@@ -561,26 +561,34 @@ pub async fn build_tool_service_context_from_env(let admission =ai_billing::composition::pg_admission_service(pool.clone(), enforcement, pricing);let pipedream_client = crate::mcp_app_catalog::pipedream_client_from_env()?;- let import_tool_context = if let Some(secret_name) = maybe_env+ let native_servers = match maybe_env.mcp_credentials_key_secret_name.as_ref().and_then(|key| key.value()){- let mcp_credentials_key = secretsmanager_client- .get_maybe_secret_value(environment, secret_name)- .await- .context("failed to load MCP credentials encryption key")?;- let mcp_encryption_key =- mcp_client::domain::models::AesKey::try_from(mcp_credentials_key.as_ref())- .context("invalid MCP credentials encryption key")?;+ Some(secret_name) => {+ let mcp_credentials_key = secretsmanager_client+ .get_maybe_secret_value(environment, secret_name)+ .await+ .context("failed to load MCP credentials encryption key")?;+ let mcp_encryption_key =+ mcp_client::domain::models::AesKey::try_from(mcp_credentials_key.as_ref())+ .context("invalid MCP credentials encryption key")?;+ Some(Arc::new(+ mcp_client::outbound::pg_server_repo::PgServerRepo::new(+ pool.clone(),+ mcp_encryption_key,+ ),+ ))+ }+ None => None,+ };+ let import_tool_context = if let Some(native_servers) = &native_servers {let pipedream_connections = Arc::new(pipedream_mcp::outbound::pg_connection_repo::PgConnectionRepo::new(pool.clone()),);let mcp_selector = Arc::new(mcp_select::McpToolSelector::new(- Arc::new(mcp_client::outbound::pg_server_repo::PgServerRepo::new(- pool.clone(),- mcp_encryption_key,- )),+ native_servers.clone(),pipedream_connections.clone(),Arc::new(pipedream_client.clone()),));@@ -646,6 +654,7 @@ pub async fn build_tool_service_context_from_env(connector_tool_context: crate::tool_context::build_connector_tool_context(pool.clone(),pipedream_client.clone(),+ native_servers,),search_service_client: search_client.clone(),email_service_client: email_ext_client,diff --git a/crates/ai_tools/src/tool_context.rs b/crates/ai_tools/src/tool_context.rsindex 63161f57b6..87a286af5e 100644--- a/crates/ai_tools/src/tool_context.rs+++ b/crates/ai_tools/src/tool_context.rs@@ -2038,18 +2038,24 @@ pub struct ToolServiceContext {pub type ToolConnectorToolContext = pipedream_mcp::inbound::toolset::ConnectorToolContext<pipedream_mcp::outbound::api::PipedreamClient,pipedream_mcp::outbound::pg_connection_repo::PgConnectionRepo,+ mcp_select::NativeOverlayConnections<mcp_client::outbound::pg_server_repo::PgServerRepo>,>;/// Wire connector discovery at the composition boundary.+///+/// `native_servers` answers for overlaid apps, which connect through the+/// native MCP stack; `None` where that stack has no encryption key.pub fn build_connector_tool_context(pool: sqlx::PgPool,client: Option<Arc<pipedream_mcp::outbound::api::PipedreamClient>>,+ native_servers: Option<Arc<mcp_client::outbound::pg_server_repo::PgServerRepo>>,) -> ToolConnectorToolContext {pipedream_mcp::inbound::toolset::ConnectorToolContext {service: Arc::new(pipedream_mcp::domain::service::discovery::ConnectorDiscovery::new(client,Arc::new(pipedream_mcp::outbound::pg_connection_repo::PgConnectionRepo::new(pool)),+ Arc::new(mcp_select::NativeOverlayConnections::new(native_servers)),),),}diff --git a/crates/code_execution/src/outbound/deno/sdk.mjs b/crates/code_execution/src/outbound/deno/sdk.mjsindex ac45bc9e4c..ba42292460 100644--- a/crates/code_execution/src/outbound/deno/sdk.mjs+++ b/crates/code_execution/src/outbound/deno/sdk.mjs@@ -19,7 +19,7 @@ async function cO($,O,j){if(!Number.isInteger(O)||O<1)throw RangeError(`concurre`);U=y.pop()??"";for(let a of y){let i=a.split(``),F=[],v;for(let R of i)if(R.startsWith("data:"))F.push(R.replace(/^data:\s*/,""));else if(R.startsWith("event:"))v=R.replace(/^event:\s*/,"");else if(R.startsWith("id:"))J=R.replace(/^id:\s*/,"");else if(R.startsWith("retry:")){let m=Number.parseInt(R.replace(/^retry:\s*/,""),10);if(!Number.isNaN(m))V=m}let M,h=!1;if(F.length){let R=F.join(`-`);try{M=JSON.parse(R),h=!0}catch{M=R}}if(h){if(S)await S(M);if(x)M=await x(M)}if(j?.({data:M,event:v,id:J,retry:V}),F.length)yield M}}}finally{T.removeEventListener("abort",g),H.releaseLock()}break}catch(D){if(O?.(D),Z!==void 0&&B>=Z)break;let _=Math.min(V*2**(B-1),X??30000);await I(_)}}}()}}var l7=($)=>{switch($){case"label":return".";case"matrix":return";";case"simple":return",";default:return"&"}},r7=($)=>{switch($){case"form":return",";case"pipeDelimited":return"|";case"spaceDelimited":return"%20";default:return","}},p7=($)=>{switch($){case"label":return".";case"matrix":return";";case"simple":return",";default:return"&"}},pj=({allowReserved:$,explode:O,name:j,style:x,value:S})=>{if(!O){let X=($?S:S.map((K)=>encodeURIComponent(K))).join(r7(x));switch(x){case"label":return`.${X}`;case"matrix":return`;${j}=${X}`;case"simple":return X;default:return`${j}=${X}`}}let G=l7(x),Z=S.map((X)=>{if(x==="label"||x==="simple")return $?X:encodeURIComponent(X);return EO({allowReserved:$,name:j,value:X})}).join(G);return x==="label"||x==="matrix"?G+Z:Z},EO=({allowReserved:$,name:O,value:j})=>{if(j===void 0||j===null)return"";if(typeof j==="object")throw Error("Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these.");return`${O}=${$?j:encodeURIComponent(j)}`},aj=({allowReserved:$,explode:O,name:j,style:x,value:S,valueOnly:G})=>{if(S instanceof Date)return G?S.toISOString():`${j}=${S.toISOString()}`;if(x!=="deepObject"&&!O){let K=[];Object.entries(S).forEach(([Q,J])=>{K=[...K,Q,$?J:encodeURIComponent(J)]});let L=K.join(",");switch(x){case"form":return`${j}=${L}`;case"label":return`.${L}`;case"matrix":return`;${j}=${L}`;default:return L}}let Z=p7(x),X=Object.entries(S).map(([K,L])=>EO({allowReserved:$,name:x==="deepObject"?`${j}[${K}]`:K,value:L})).join(Z);return x==="label"||x==="matrix"?Z+X:X};var a7=/\{[^{}]+\}/g,i7=({path:$,url:O})=>{let j=O,x=O.match(a7);if(x)for(let S of x){let G=!1,Z=S.substring(1,S.length-1),X="simple";if(Z.endsWith("*"))G=!0,Z=Z.substring(0,Z.length-1);if(Z.startsWith("."))Z=Z.substring(1),X="label";else if(Z.startsWith(";"))Z=Z.substring(1),X="matrix";let K=$[Z];if(K===void 0||K===null)continue;if(Array.isArray(K)){j=j.replace(S,pj({explode:G,name:Z,style:X,value:K}));continue}if(typeof K==="object"){j=j.replace(S,aj({explode:G,name:Z,style:X,value:K,valueOnly:!0}));continue}if(X==="matrix"){j=j.replace(S,`;${EO({name:Z,value:K})}`);continue}let L=encodeURIComponent(X==="label"?`.${K}`:K);j=j.replace(S,L)}return j},f2=({baseUrl:$,path:O,query:j,querySerializer:x,url:S})=>{let G=S.startsWith("/")?S:`/${S}`,Z=($??"")+G;if(O)Z=i7({path:O,url:Z});let X=j?x(j):"";if(X.startsWith("?"))X=X.substring(1);if(X)Z+=`?${X}`;return Z};function tx($){let O=$.body!==void 0;if(O&&$.bodySerializer){if("serializedBody"in $)return $.serializedBody!==void 0&&$.serializedBody!==""?$.serializedBody:null;return $.body!==""?$.body:null}if(O)return $.body;return}var b2=async($,O)=>{let j=typeof O==="function"?await O($):O;if(!j)return;if($.scheme==="bearer")return`Bearer ${j}`;if($.scheme==="basic")return`Basic ${btoa(j)}`;return j};var k2={bodySerializer:($)=>JSON.stringify($,(O,j)=>typeof j==="bigint"?j.toString():j)};var g2=({parameters:$={},...O}={})=>{return(x)=>{let S=[];if(x&&typeof x==="object")for(let G in x){let Z=x[G];if(Z===void 0||Z===null)continue;let X=$[G]||O;if(Array.isArray(Z)){let K=pj({allowReserved:X.allowReserved,explode:!0,name:G,style:"form",value:Z,...X.array});if(K)S.push(K)}else if(typeof Z==="object"){let K=aj({allowReserved:X.allowReserved,explode:!0,name:G,style:"deepObject",value:Z,...X.object});if(K)S.push(K)}else{let K=EO({allowReserved:X.allowReserved,name:G,value:Z});if(K)S.push(K)}}return S.join("&")}},y2=($)=>{if(!$)return"stream";let O=$.split(";")[0]?.trim();if(!O)return;if(O.startsWith("application/json")||O.endsWith("+json"))return"json";if(O==="multipart/form-data")return"formData";if(["application/","audio/","image/","video/"].some((j)=>O.startsWith(j)))return"blob";if(O.startsWith("text/"))return"text";return},n7=($,O)=>{if(!O)return!1;if($.headers.has(O)||$.query?.[O]||$.headers.get("Cookie")?.includes(`${O}=`))return!0;return!1};async function v2($){for(let O of $.security??[]){if(n7($,O.name))continue;let j=await b2(O,$.auth);if(!j)continue;let x=O.name??"Authorization";switch(O.in){case"query":if(!$.query)$.query={};$.query[x]=j;break;case"cookie":$.headers.append("Cookie",`${x}=${j}`);break;case"header":default:$.headers.set(x,j);break}}}var ex=($)=>f2({baseUrl:$.baseUrl,path:$.path,query:$.query,querySerializer:typeof $.querySerializer==="function"?$.querySerializer:g2($.querySerializer),url:$.url}),ox=($,O)=>{let j={...$,...O};if(j.baseUrl?.endsWith("/"))j.baseUrl=j.baseUrl.substring(0,j.baseUrl.length-1);return j.headers=nj($.headers,O.headers),j},s7=($)=>{let O=[];return $.forEach((j,x)=>{O.push([x,j])}),O},nj=(...$)=>{let O=new Headers;for(let j of $){if(!j)continue;let x=j instanceof Headers?s7(j):Object.entries(j);for(let[S,G]of x)if(G===null)O.delete(S);else if(Array.isArray(G))for(let Z of G)O.append(S,Z);else if(G!==void 0)O.set(S,typeof G==="object"?JSON.stringify(G):G)}return O};class ij{fns=[];clear(){this.fns=[]}eject($){let O=this.getInterceptorIndex($);if(this.fns[O])this.fns[O]=null}exists($){let O=this.getInterceptorIndex($);return Boolean(this.fns[O])}getInterceptorIndex($){if(typeof $==="number")return this.fns[$]?$:-1;return this.fns.indexOf($)}update($,O){let j=this.getInterceptorIndex($);if(this.fns[j])return this.fns[j]=O,$;return!1}use($){return this.fns.push($),this.fns.length-1}}var h2=()=>({error:new ij,request:new ij,response:new ij}),t7=g2({allowReserved:!1,array:{explode:!0,style:"form"},object:{explode:!0,style:"deepObject"}}),e7={"Content-Type":"application/json"},Sj=($={})=>({...k2,headers:e7,parseAs:"auto",querySerializer:t7,...$});var $1=($={})=>{let O=ox(Sj(),$),j=()=>({...O}),x=(Q)=>{return O=ox(O,Q),j()},S=h2(),G=async(Q)=>{let J={...O,...Q,fetch:Q.fetch??O.fetch??globalThis.fetch,headers:nj(O.headers,Q.headers),serializedBody:void 0};if(J.security)await v2(J);if(J.requestValidator)await J.requestValidator(J);if(J.body!==void 0&&J.bodySerializer)J.serializedBody=J.bodySerializer(J.body);if(J.body===void 0||J.serializedBody==="")J.headers.delete("Content-Type");let I=J,z=ex(I);return{opts:I,url:z}},Z=async(Q)=>{let J=Q.throwOnError??O.throwOnError,I=Q.responseStyle??O.responseStyle,z,W;try{let{opts:V,url:B}=await G(Q),T={redirect:"follow",...V,body:tx(V)};z=new Request(B,T);for(let N of S.request.fns)if(N)z=await N(z,V);let C=V.fetch;W=await C(z);for(let N of S.response.fns)if(N)W=await N(W,z,V);let D={request:z,response:W};if(W.ok){let N=(V.parseAs==="auto"?y2(W.headers.get("Content-Type")):V.parseAs)??"json";if(W.status===204||W.headers.get("Content-Length")==="0"){let U;switch(N){case"arrayBuffer":case"blob":case"text":U=await W[N]();break;case"formData":U=new FormData;break;case"stream":U=W.body;break;case"json":default:U={};break}return V.responseStyle==="data"?U:{data:U,...D}}let H;switch(N){case"arrayBuffer":case"blob":case"formData":case"text":H=await W[N]();break;case"json":{let U=await W.text();H=U?JSON.parse(U):{};break}case"stream":return V.responseStyle==="data"?W.body:{data:W.body,...D}}if(N==="json"){if(V.responseValidator)await V.responseValidator(H);if(V.responseTransformer)H=await V.responseTransformer(H)}return V.responseStyle==="data"?H:{data:H,...D}}let _=await W.text(),w;try{w=JSON.parse(_)}catch{}throw w??_}catch(V){let B=V;for(let T of S.error.fns)if(T)B=await T(B,W,z,Q);if(B=B||{},J)throw B;return I==="data"?void 0:{error:B,request:z,response:W}}},X=(Q)=>(J)=>Z({...J,method:Q}),K=(Q)=>async(J)=>{let{opts:I,url:z}=await G(J);return q2({...I,body:I.body,method:Q,onRequest:async(W,V)=>{let B=new Request(W,V);for(let T of S.request.fns)if(T)B=await T(B,I);return B},serializedBody:tx(I),url:z})};return{buildUrl:(Q)=>ex({...O,...Q}),connect:X("CONNECT"),delete:X("DELETE"),get:X("GET"),getConfig:j,head:X("HEAD"),interceptors:S,options:X("OPTIONS"),patch:X("PATCH"),post:X("POST"),put:X("PUT"),request:Z,setConfig:x,sse:{connect:K("CONNECT"),delete:K("DELETE"),get:K("GET"),head:K("HEAD"),options:K("OPTIONS"),patch:K("PATCH"),post:K("POST"),put:K("PUT"),trace:K("TRACE")},trace:X("TRACE")}};var m2=$1(Sj());class u2{client;constructor($){this.client=$?.client??m2}}class c2{defaultKey="default";instances=new Map;get($){let O=this.instances.get($??this.defaultKey);if(!O)throw Error('No SDK client found. Create one with "new Sdk()" to fix this error.');return O}set($,O){this.instances.set(O??this.defaultKey,$)}}class sj extends u2{static __registry=new c2;constructor($){super($);sj.__registry.set(this,$?.key)}setPricingHandler($){return($.client??this.client).post({url:"/ai-cost/pricing",...$,headers:{"Content-Type":"application/json",...$.headers}})}getUsageHandler($){return($.client??this.client).post({url:"/ai-cost/usage",...$,headers:{"Content-Type":"application/json",...$.headers}})}upsertAiProjection($){return($.client??this.client).post({url:"/ai-projections",...$,headers:{"Content-Type":"application/json",...$.headers}})}getChatsForAttachmentHandler($){return($.client??this.client).get({url:"/attachments/{attachment_id}/chats",...$})}deleteChat($){return($.client??this.client).delete({url:"/chat/{chat_id}",...$})}patchChat($){return($.client??this.client).patch({url:"/chat/{chat_id}",...$,headers:{"Content-Type":"application/json",...$.headers}})}permanentlyDeleteChat($){return($.client??this.client).delete({url:"/chat/{chat_id}/permanent",...$})}createChat($){return($.client??this.client).post({url:"/chats",...$,headers:{"Content-Type":"application/json",...$.headers}})}getChatHistoryHandler($){return($.client??this.client).get({url:"/chats/history/{chat_id}",...$})}getChatHistoryBatchMessagesHandler($){return($.client??this.client).post({url:"/chats/history_batch_messages",...$,headers:{"Content-Type":"application/json",...$.headers}})}getChat($){return($.client??this.client).get({url:"/chats/{chat_id}",...$})}copyChat($){return($.client??this.client).post({url:"/chats/{chat_id}/copy",...$})}getChatPermissions($){return($.client??this.client).get({url:"/chats/{chat_id}/permissions",...$})}revertDeleteChat($){return($.client??this.client).put({url:"/chats/{chat_id}/revert_delete",...$})}callTool($){return($.client??this.client).post({url:"/chats/{chat_id}/tool/call",...$,headers:{"Content-Type":"application/json",...$.headers}})}rejectToolCall($){return($.client??this.client).post({url:"/chats/{chat_id}/tool/reject",...$,headers:{"Content-Type":"application/json",...$.headers}})}updateToolResponse($){return($.client??this.client).post({url:"/chats/{chat_id}/tool/response/update",...$,headers:{"Content-Type":"application/json",...$.headers}})}updateToolCall($){return($.client??this.client).post({url:"/chats/{chat_id}/tool/update",...$,headers:{"Content-Type":"application/json",...$.headers}})}getCitationHandler($){return($.client??this.client).get({url:"/citations/{id}",...$})}decisions($){return($.client??this.client).post({url:"/decisions",...$,headers:{"Content-Type":"application/json",...$.headers}})}healthHandler($){return($?.client??this.client).get({url:"/health",...$})}notionReportHandler($){return($?.client??this.client).get({url:"/import/notion",...$})}cancelNotionHandler($){return($?.client??this.client).post({url:"/import/notion/cancel",...$})}runImportHandler($){return($.client??this.client).post({url:"/import/run",...$,headers:{"Content-Type":"application/json",...$.headers}})}discoverHandler($){return($.client??this.client).post({url:"/import/runs/{source}/discover",...$})}getStateHandler($){return($?.client??this.client).get({url:"/import/state",...$})}workspaceReportHandler($){return($.client??this.client).get({url:"/import/workspaces/{source}",...$})}cancelWorkspaceHandler($){return($.client??this.client).post({url:"/import/workspaces/{source}/cancel",...$})}deleteMcpServer($){return($.client??this.client).delete({url:"/mcp/servers",...$})}listMcpServers($){return($?.client??this.client).get({url:"/mcp/servers",...$})}addMcpServer($){return($.client??this.client).post({url:"/mcp/servers",...$,headers:{"Content-Type":"application/json",...$.headers}})}updateMcpServer($){return($.client??this.client).put({url:"/mcp/servers",...$,headers:{"Content-Type":"application/json",...$.headers}})}mcpAuthCallback($){return($?.client??this.client).get({url:"/mcp/servers/auth/callback",...$})}mcpOauthClientMetadata($){return($?.client??this.client).get({url:"/mcp/servers/auth/client-metadata",...$})}startMcpAuth($){return($.client??this.client).post({url:"/mcp/servers/auth/start",...$,headers:{"Content-Type":"application/json",...$.headers}})}getMemoryHandler($){return($?.client??this.client).get({url:"/memory",...$})}getStateHandler2($){return($?.client??this.client).get({url:"/onboarding",...$})}completeHandler($){return($.client??this.client).post({url:"/onboarding/complete",...$,headers:{"Content-Type":"application/json",...$.headers}})}dismissedPromptsHandler($){return($?.client??this.client).get({url:"/onboarding/prompts",...$})}dismissPromptHandler($){return($.client??this.client).post({url:"/onboarding/prompts/{prompt_id}/dismiss",...$})}browsePipedreamMcpCatalog($){return($?.client??this.client).get({url:"/pipedream/mcp/catalog",...$})}completePipedreamMcpConnection($){return($.client??this.client).post({url:"/pipedream/mcp/complete",...$,headers:{"Content-Type":"application/json",...$.headers}})}deletePipedreamMcpConnection($){return($.client??this.client).delete({url:"/pipedream/mcp/connections",...$})}listPipedreamMcpConnections($){return($?.client??this.client).get({url:"/pipedream/mcp/connections",...$})}updatePipedreamMcpConnection($){return($.client??this.client).put({url:"/pipedream/mcp/connections",...$,headers:{"Content-Type":"application/json",...$.headers}})}recoverPipedreamMcpConnection($){return($.client??this.client).post({url:"/pipedream/mcp/recover",...$,headers:{"Content-Type":"application/json",...$.headers}})}createPipedreamMcpToken($){return($?.client??this.client).post({url:"/pipedream/mcp/token",...$})}getBatchPreview($){return($.client??this.client).post({url:"/preview",...$,headers:{"Content-Type":"application/json",...$.headers}})}sendChatMessage($){return($.client??this.client).post({url:"/stream/chat/message",...$,headers:{"Content-Type":"application/json",...$.headers}})}stopChatStream($){return($.client??this.client).post({url:"/stream/chat/message/stop",...$,headers:{"Content-Type":"application/json",...$.headers}})}structuredCompletion($){return($.client??this.client).post({url:"/structured-completion",...$,headers:{"Content-Type":"application/json",...$.headers}})}}function d2({onRequest:$,onSseError:O,onSseEvent:j,responseTransformer:x,responseValidator:S,sseDefaultRetryDelay:G,sseMaxRetryAttempts:Z,sseMaxRetryDelay:X,sseSleepFn:K,url:L,...Q}){let J,I=K??((V)=>new Promise((B)=>setTimeout(B,V)));return{stream:async function*(){let V=G??3000,B=0,T=Q.signal??new AbortController().signal;while(!0){if(T.aborted)break;B++;let C=Q.headers instanceof Headers?Q.headers:new Headers(Q.headers);if(J!==void 0)C.set("Last-Event-ID",J);try{let D={redirect:"follow",...Q,body:Q.serializedBody,headers:C,signal:T},_=new Request(L,D);if($)_=await $(L,D);let N=await(Q.fetch??globalThis.fetch)(_);if(!N.ok)throw Error(`SSE failed: ${N.status} ${N.statusText}`);if(!N.body)throw Error("No body in SSE response");let H=N.body.pipeThrough(new TextDecoderStream).getReader(),U="",g=()=>{try{H.cancel()}catch{}};T.addEventListener("abort",g);try{while(!0){let{done:r,value:p}=await H.read();if(r)break;U+=p,U=U.replace(/\r\n?/g,`+`);try{M=JSON.parse(R),h=!0}catch{M=R}}if(h){if(S)await S(M);if(x)M=await x(M)}if(j?.({data:M,event:v,id:J,retry:V}),F.length)yield M}}}finally{T.removeEventListener("abort",g),H.releaseLock()}break}catch(D){if(O?.(D),Z!==void 0&&B>=Z)break;let _=Math.min(V*2**(B-1),X??30000);await I(_)}}}()}}var l7=($)=>{switch($){case"label":return".";case"matrix":return";";case"simple":return",";default:return"&"}},r7=($)=>{switch($){case"form":return",";case"pipeDelimited":return"|";case"spaceDelimited":return"%20";default:return","}},p7=($)=>{switch($){case"label":return".";case"matrix":return";";case"simple":return",";default:return"&"}},pj=({allowReserved:$,explode:O,name:j,style:x,value:S})=>{if(!O){let X=($?S:S.map((K)=>encodeURIComponent(K))).join(r7(x));switch(x){case"label":return`.${X}`;case"matrix":return`;${j}=${X}`;case"simple":return X;default:return`${j}=${X}`}}let G=l7(x),Z=S.map((X)=>{if(x==="label"||x==="simple")return $?X:encodeURIComponent(X);return EO({allowReserved:$,name:j,value:X})}).join(G);return x==="label"||x==="matrix"?G+Z:Z},EO=({allowReserved:$,name:O,value:j})=>{if(j===void 0||j===null)return"";if(typeof j==="object")throw Error("Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these.");return`${O}=${$?j:encodeURIComponent(j)}`},aj=({allowReserved:$,explode:O,name:j,style:x,value:S,valueOnly:G})=>{if(S instanceof Date)return G?S.toISOString():`${j}=${S.toISOString()}`;if(x!=="deepObject"&&!O){let K=[];Object.entries(S).forEach(([Q,J])=>{K=[...K,Q,$?J:encodeURIComponent(J)]});let L=K.join(",");switch(x){case"form":return`${j}=${L}`;case"label":return`.${L}`;case"matrix":return`;${j}=${L}`;default:return L}}let Z=p7(x),X=Object.entries(S).map(([K,L])=>EO({allowReserved:$,name:x==="deepObject"?`${j}[${K}]`:K,value:L})).join(Z);return x==="label"||x==="matrix"?Z+X:X};var a7=/\{[^{}]+\}/g,i7=({path:$,url:O})=>{let j=O,x=O.match(a7);if(x)for(let S of x){let G=!1,Z=S.substring(1,S.length-1),X="simple";if(Z.endsWith("*"))G=!0,Z=Z.substring(0,Z.length-1);if(Z.startsWith("."))Z=Z.substring(1),X="label";else if(Z.startsWith(";"))Z=Z.substring(1),X="matrix";let K=$[Z];if(K===void 0||K===null)continue;if(Array.isArray(K)){j=j.replace(S,pj({explode:G,name:Z,style:X,value:K}));continue}if(typeof K==="object"){j=j.replace(S,aj({explode:G,name:Z,style:X,value:K,valueOnly:!0}));continue}if(X==="matrix"){j=j.replace(S,`;${EO({name:Z,value:K})}`);continue}let L=encodeURIComponent(X==="label"?`.${K}`:K);j=j.replace(S,L)}return j},f2=({baseUrl:$,path:O,query:j,querySerializer:x,url:S})=>{let G=S.startsWith("/")?S:`/${S}`,Z=($??"")+G;if(O)Z=i7({path:O,url:Z});let X=j?x(j):"";if(X.startsWith("?"))X=X.substring(1);if(X)Z+=`?${X}`;return Z};function tx($){let O=$.body!==void 0;if(O&&$.bodySerializer){if("serializedBody"in $)return $.serializedBody!==void 0&&$.serializedBody!==""?$.serializedBody:null;return $.body!==""?$.body:null}if(O)return $.body;return}var b2=async($,O)=>{let j=typeof O==="function"?await O($):O;if(!j)return;if($.scheme==="bearer")return`Bearer ${j}`;if($.scheme==="basic")return`Basic ${btoa(j)}`;return j};var k2={bodySerializer:($)=>JSON.stringify($,(O,j)=>typeof j==="bigint"?j.toString():j)};var g2=({parameters:$={},...O}={})=>{return(x)=>{let S=[];if(x&&typeof x==="object")for(let G in x){let Z=x[G];if(Z===void 0||Z===null)continue;let X=$[G]||O;if(Array.isArray(Z)){let K=pj({allowReserved:X.allowReserved,explode:!0,name:G,style:"form",value:Z,...X.array});if(K)S.push(K)}else if(typeof Z==="object"){let K=aj({allowReserved:X.allowReserved,explode:!0,name:G,style:"deepObject",value:Z,...X.object});if(K)S.push(K)}else{let K=EO({allowReserved:X.allowReserved,name:G,value:Z});if(K)S.push(K)}}return S.join("&")}},y2=($)=>{if(!$)return"stream";let O=$.split(";")[0]?.trim();if(!O)return;if(O.startsWith("application/json")||O.endsWith("+json"))return"json";if(O==="multipart/form-data")return"formData";if(["application/","audio/","image/","video/"].some((j)=>O.startsWith(j)))return"blob";if(O.startsWith("text/"))return"text";return},n7=($,O)=>{if(!O)return!1;if($.headers.has(O)||$.query?.[O]||$.headers.get("Cookie")?.includes(`${O}=`))return!0;return!1};async function v2($){for(let O of $.security??[]){if(n7($,O.name))continue;let j=await b2(O,$.auth);if(!j)continue;let x=O.name??"Authorization";switch(O.in){case"query":if(!$.query)$.query={};$.query[x]=j;break;case"cookie":$.headers.append("Cookie",`${x}=${j}`);break;case"header":default:$.headers.set(x,j);break}}}var ex=($)=>f2({baseUrl:$.baseUrl,path:$.path,query:$.query,querySerializer:typeof $.querySerializer==="function"?$.querySerializer:g2($.querySerializer),url:$.url}),ox=($,O)=>{let j={...$,...O};if(j.baseUrl?.endsWith("/"))j.baseUrl=j.baseUrl.substring(0,j.baseUrl.length-1);return j.headers=nj($.headers,O.headers),j},s7=($)=>{let O=[];return $.forEach((j,x)=>{O.push([x,j])}),O},nj=(...$)=>{let O=new Headers;for(let j of $){if(!j)continue;let x=j instanceof Headers?s7(j):Object.entries(j);for(let[S,G]of x)if(G===null)O.delete(S);else if(Array.isArray(G))for(let Z of G)O.append(S,Z);else if(G!==void 0)O.set(S,typeof G==="object"?JSON.stringify(G):G)}return O};class ij{fns=[];clear(){this.fns=[]}eject($){let O=this.getInterceptorIndex($);if(this.fns[O])this.fns[O]=null}exists($){let O=this.getInterceptorIndex($);return Boolean(this.fns[O])}getInterceptorIndex($){if(typeof $==="number")return this.fns[$]?$:-1;return this.fns.indexOf($)}update($,O){let j=this.getInterceptorIndex($);if(this.fns[j])return this.fns[j]=O,$;return!1}use($){return this.fns.push($),this.fns.length-1}}var h2=()=>({error:new ij,request:new ij,response:new ij}),t7=g2({allowReserved:!1,array:{explode:!0,style:"form"},object:{explode:!0,style:"deepObject"}}),e7={"Content-Type":"application/json"},Sj=($={})=>({...k2,headers:e7,parseAs:"auto",querySerializer:t7,...$});var $1=($={})=>{let O=ox(Sj(),$),j=()=>({...O}),x=(Q)=>{return O=ox(O,Q),j()},S=h2(),G=async(Q)=>{let J={...O,...Q,fetch:Q.fetch??O.fetch??globalThis.fetch,headers:nj(O.headers,Q.headers),serializedBody:void 0};if(J.security)await v2(J);if(J.requestValidator)await J.requestValidator(J);if(J.body!==void 0&&J.bodySerializer)J.serializedBody=J.bodySerializer(J.body);if(J.body===void 0||J.serializedBody==="")J.headers.delete("Content-Type");let I=J,z=ex(I);return{opts:I,url:z}},Z=async(Q)=>{let J=Q.throwOnError??O.throwOnError,I=Q.responseStyle??O.responseStyle,z,W;try{let{opts:V,url:B}=await G(Q),T={redirect:"follow",...V,body:tx(V)};z=new Request(B,T);for(let N of S.request.fns)if(N)z=await N(z,V);let C=V.fetch;W=await C(z);for(let N of S.response.fns)if(N)W=await N(W,z,V);let D={request:z,response:W};if(W.ok){let N=(V.parseAs==="auto"?y2(W.headers.get("Content-Type")):V.parseAs)??"json";if(W.status===204||W.headers.get("Content-Length")==="0"){let U;switch(N){case"arrayBuffer":case"blob":case"text":U=await W[N]();break;case"formData":U=new FormData;break;case"stream":U=W.body;break;case"json":default:U={};break}return V.responseStyle==="data"?U:{data:U,...D}}let H;switch(N){case"arrayBuffer":case"blob":case"formData":case"text":H=await W[N]();break;case"json":{let U=await W.text();H=U?JSON.parse(U):{};break}case"stream":return V.responseStyle==="data"?W.body:{data:W.body,...D}}if(N==="json"){if(V.responseValidator)await V.responseValidator(H);if(V.responseTransformer)H=await V.responseTransformer(H)}return V.responseStyle==="data"?H:{data:H,...D}}let _=await W.text(),w;try{w=JSON.parse(_)}catch{}throw w??_}catch(V){let B=V;for(let T of S.error.fns)if(T)B=await T(B,W,z,Q);if(B=B||{},J)throw B;return I==="data"?void 0:{error:B,request:z,response:W}}},X=(Q)=>(J)=>Z({...J,method:Q}),K=(Q)=>async(J)=>{let{opts:I,url:z}=await G(J);return q2({...I,body:I.body,method:Q,onRequest:async(W,V)=>{let B=new Request(W,V);for(let T of S.request.fns)if(T)B=await T(B,I);return B},serializedBody:tx(I),url:z})};return{buildUrl:(Q)=>ex({...O,...Q}),connect:X("CONNECT"),delete:X("DELETE"),get:X("GET"),getConfig:j,head:X("HEAD"),interceptors:S,options:X("OPTIONS"),patch:X("PATCH"),post:X("POST"),put:X("PUT"),request:Z,setConfig:x,sse:{connect:K("CONNECT"),delete:K("DELETE"),get:K("GET"),head:K("HEAD"),options:K("OPTIONS"),patch:K("PATCH"),post:K("POST"),put:K("PUT"),trace:K("TRACE")},trace:X("TRACE")}};var m2=$1(Sj());class u2{client;constructor($){this.client=$?.client??m2}}class c2{defaultKey="default";instances=new Map;get($){let O=this.instances.get($??this.defaultKey);if(!O)throw Error('No SDK client found. Create one with "new Sdk()" to fix this error.');return O}set($,O){this.instances.set(O??this.defaultKey,$)}}class sj extends u2{static __registry=new c2;constructor($){super($);sj.__registry.set(this,$?.key)}setPricingHandler($){return($.client??this.client).post({url:"/ai-cost/pricing",...$,headers:{"Content-Type":"application/json",...$.headers}})}getUsageHandler($){return($.client??this.client).post({url:"/ai-cost/usage",...$,headers:{"Content-Type":"application/json",...$.headers}})}upsertAiProjection($){return($.client??this.client).post({url:"/ai-projections",...$,headers:{"Content-Type":"application/json",...$.headers}})}getChatsForAttachmentHandler($){return($.client??this.client).get({url:"/attachments/{attachment_id}/chats",...$})}deleteChat($){return($.client??this.client).delete({url:"/chat/{chat_id}",...$})}patchChat($){return($.client??this.client).patch({url:"/chat/{chat_id}",...$,headers:{"Content-Type":"application/json",...$.headers}})}permanentlyDeleteChat($){return($.client??this.client).delete({url:"/chat/{chat_id}/permanent",...$})}createChat($){return($.client??this.client).post({url:"/chats",...$,headers:{"Content-Type":"application/json",...$.headers}})}getChatHistoryHandler($){return($.client??this.client).get({url:"/chats/history/{chat_id}",...$})}getChatHistoryBatchMessagesHandler($){return($.client??this.client).post({url:"/chats/history_batch_messages",...$,headers:{"Content-Type":"application/json",...$.headers}})}getChat($){return($.client??this.client).get({url:"/chats/{chat_id}",...$})}copyChat($){return($.client??this.client).post({url:"/chats/{chat_id}/copy",...$})}getChatPermissions($){return($.client??this.client).get({url:"/chats/{chat_id}/permissions",...$})}revertDeleteChat($){return($.client??this.client).put({url:"/chats/{chat_id}/revert_delete",...$})}callTool($){return($.client??this.client).post({url:"/chats/{chat_id}/tool/call",...$,headers:{"Content-Type":"application/json",...$.headers}})}rejectToolCall($){return($.client??this.client).post({url:"/chats/{chat_id}/tool/reject",...$,headers:{"Content-Type":"application/json",...$.headers}})}updateToolResponse($){return($.client??this.client).post({url:"/chats/{chat_id}/tool/response/update",...$,headers:{"Content-Type":"application/json",...$.headers}})}updateToolCall($){return($.client??this.client).post({url:"/chats/{chat_id}/tool/update",...$,headers:{"Content-Type":"application/json",...$.headers}})}getCitationHandler($){return($.client??this.client).get({url:"/citations/{id}",...$})}decisions($){return($.client??this.client).post({url:"/decisions",...$,headers:{"Content-Type":"application/json",...$.headers}})}healthHandler($){return($?.client??this.client).get({url:"/health",...$})}notionReportHandler($){return($?.client??this.client).get({url:"/import/notion",...$})}cancelNotionHandler($){return($?.client??this.client).post({url:"/import/notion/cancel",...$})}runImportHandler($){return($.client??this.client).post({url:"/import/run",...$,headers:{"Content-Type":"application/json",...$.headers}})}discoverHandler($){return($.client??this.client).post({url:"/import/runs/{source}/discover",...$})}getStateHandler($){return($?.client??this.client).get({url:"/import/state",...$})}workspaceReportHandler($){return($.client??this.client).get({url:"/import/workspaces/{source}",...$})}cancelWorkspaceHandler($){return($.client??this.client).post({url:"/import/workspaces/{source}/cancel",...$})}deleteMcpServer($){return($.client??this.client).delete({url:"/mcp/servers",...$})}listMcpServers($){return($?.client??this.client).get({url:"/mcp/servers",...$})}addMcpServer($){return($.client??this.client).post({url:"/mcp/servers",...$,headers:{"Content-Type":"application/json",...$.headers}})}updateMcpServer($){return($.client??this.client).put({url:"/mcp/servers",...$,headers:{"Content-Type":"application/json",...$.headers}})}mcpAuthCallback($){return($?.client??this.client).get({url:"/mcp/servers/auth/callback",...$})}mcpOauthClientMetadata($){return($?.client??this.client).get({url:"/mcp/servers/auth/client-metadata",...$})}startMcpAuth($){return($.client??this.client).post({url:"/mcp/servers/auth/start",...$,headers:{"Content-Type":"application/json",...$.headers}})}getMemoryHandler($){return($?.client??this.client).get({url:"/memory",...$})}getStateHandler2($){return($?.client??this.client).get({url:"/onboarding",...$})}completeHandler($){return($.client??this.client).post({url:"/onboarding/complete",...$,headers:{"Content-Type":"application/json",...$.headers}})}dismissedPromptsHandler($){return($?.client??this.client).get({url:"/onboarding/prompts",...$})}dismissPromptHandler($){return($.client??this.client).post({url:"/onboarding/prompts/{prompt_id}/dismiss",...$})}browsePipedreamMcpCatalog($){return($?.client??this.client).get({url:"/pipedream/mcp/catalog",...$})}completePipedreamMcpConnection($){return($.client??this.client).post({url:"/pipedream/mcp/complete",...$,headers:{"Content-Type":"application/json",...$.headers}})}deletePipedreamMcpConnection($){return($.client??this.client).delete({url:"/pipedream/mcp/connections",...$})}listPipedreamMcpConnections($){return($?.client??this.client).get({url:"/pipedream/mcp/connections",...$})}updatePipedreamMcpConnection($){return($.client??this.client).put({url:"/pipedream/mcp/connections",...$,headers:{"Content-Type":"application/json",...$.headers}})}listPipedreamMcpOverlays($){return($?.client??this.client).get({url:"/pipedream/mcp/overlays",...$})}recoverPipedreamMcpConnection($){return($.client??this.client).post({url:"/pipedream/mcp/recover",...$,headers:{"Content-Type":"application/json",...$.headers}})}createPipedreamMcpToken($){return($?.client??this.client).post({url:"/pipedream/mcp/token",...$})}getBatchPreview($){return($.client??this.client).post({url:"/preview",...$,headers:{"Content-Type":"application/json",...$.headers}})}sendChatMessage($){return($.client??this.client).post({url:"/stream/chat/message",...$,headers:{"Content-Type":"application/json",...$.headers}})}stopChatStream($){return($.client??this.client).post({url:"/stream/chat/message/stop",...$,headers:{"Content-Type":"application/json",...$.headers}})}structuredCompletion($){return($.client??this.client).post({url:"/structured-completion",...$,headers:{"Content-Type":"application/json",...$.headers}})}}function d2({onRequest:$,onSseError:O,onSseEvent:j,responseTransformer:x,responseValidator:S,sseDefaultRetryDelay:G,sseMaxRetryAttempts:Z,sseMaxRetryDelay:X,sseSleepFn:K,url:L,...Q}){let J,I=K??((V)=>new Promise((B)=>setTimeout(B,V)));return{stream:async function*(){let V=G??3000,B=0,T=Q.signal??new AbortController().signal;while(!0){if(T.aborted)break;B++;let C=Q.headers instanceof Headers?Q.headers:new Headers(Q.headers);if(J!==void 0)C.set("Last-Event-ID",J);try{let D={redirect:"follow",...Q,body:Q.serializedBody,headers:C,signal:T},_=new Request(L,D);if($)_=await $(L,D);let N=await(Q.fetch??globalThis.fetch)(_);if(!N.ok)throw Error(`SSE failed: ${N.status} ${N.statusText}`);if(!N.body)throw Error("No body in SSE response");let H=N.body.pipeThrough(new TextDecoderStream).getReader(),U="",g=()=>{try{H.cancel()}catch{}};T.addEventListener("abort",g);try{while(!0){let{done:r,value:p}=await H.read();if(r)break;U+=p,U=U.replace(/\r\n?/g,``);let y=U.split(``);U=y.pop()??"";for(let a of y){let i=a.split(`diff --git a/crates/macro_db_client/migrations/20261025185037_create_mcp_overlays.sql b/crates/macro_db_client/migrations/20261025185037_create_mcp_overlays.sqlnew file mode 100644index 0000000000..897316173c--- /dev/null+++ b/crates/macro_db_client/migrations/20261025185037_create_mcp_overlays.sql@@ -0,0 +1,507 @@+-- Pipedream catalog apps that connect through the native MCP stack+-- (mcp_servers, our own OAuth client via dynamic or metadata-document+-- registration) instead of Pipedream. The app keeps its place in the catalog+-- under its Pipedream slug; connecting it authorizes server_url directly.+-- Pipedream connection reads ignore rows for these slugs, and completing a+-- Pipedream connection for one is refused.+--+-- Reference data with no foreign keys: deleting a row hands the app back to+-- Pipedream. Do not overlay an app whose Pipedream grant backs a non-MCP+-- reader (Linear, Jira and Notion imports, Granola sync) until that reader+-- has a native path.+CREATE TABLE mcp_overlays (+ app_slug TEXT PRIMARY KEY CHECK (app_slug ~ '^[a-z0-9_-]+$'),+ server_url TEXT NOT NULL CHECK (server_url LIKE 'https://%'),+ created_at TIMESTAMPTZ NOT NULL DEFAULT NOW()+);++-- Seed: Pipedream apps whose vendor hosts an MCP server that answered an+-- unauthenticated initialize with 401 and advertised dynamic client+-- registration or a client metadata document, probed 2026-10-26.+INSERT INTO mcp_overlays (app_slug, server_url) VALUES+ ('adhook', 'https://mcp.adhook.io/mcp'),+ ('affinda', 'https://mcp.affinda.com/mcp'),+ ('affinity', 'https://mcp.affinity.co/mcp'),+ ('ahrefs', 'https://api.ahrefs.com/mcp/mcp'),+ ('ai_ml_api', 'https://mcp.aimlapi.com/mcp'),+ ('aimtell', 'https://mcp.aimtell.com/mcp'),+ ('aircall', 'https://mcp.aircall.io/mcp'),+ ('air', 'https://mcp.air.inc/mcp'),+ ('airops', 'https://app.airops.com/mcp'),+ ('airparser', 'https://mcp.airparser.com/mcp'),+ ('airtable_oauth', 'https://mcp.airtable.com/mcp'),+ ('airweave', 'https://mcp.airweave.ai/mcp'),+ ('alchemy', 'https://mcp.alchemy.com/mcp'),+ ('alegra', 'https://mcp.alegra.com'),+ ('algolia', 'https://mcp.algolia.com/mcp'),+ ('algomo', 'https://mcp.algomo.com/mcp'),+ ('alpha_vantage', 'https://mcp.alphavantage.co/mcp'),+ ('altoviz', 'https://mcp.altoviz.com/mcp'),+ ('alttext_ai', 'https://mcp.alttext.ai/mcp'),+ ('amplitude', 'https://mcp.amplitude.com/mcp'),+ ('anchor_browser', 'https://api.anchorbrowser.io/v1/mcp'),+ ('announcekit', 'https://mcp.announcekit.app/mcp'),+ ('anydb', 'https://mcp.anydb.com'),+ ('apaleo', 'https://mcp.apaleo.com/mcp'),+ ('apex_27', 'https://mcp.apex27.co.uk/mcp'),+ ('apify', 'https://mcp.apify.com'),+ ('apify_oauth', 'https://mcp.apify.com'),+ ('apimage', 'https://mcp.apimage.org/mcp'),+ ('apiverve', 'https://api.apiverve.com/v1/mcp'),+ ('apollo_io', 'https://mcp.apollo.io/mcp'),+ ('apollo_io_oauth', 'https://mcp.apollo.io/mcp'),+ ('appcues', 'https://mcp.appcues.com/mcp'),+ ('appsflyer', 'https://mcp.appsflyer.com/auth/mcp'),+ ('appwrite', 'https://mcp.appwrite.io/mcp'),+ ('are_na', 'https://mcp.are.na/mcp'),+ ('asana', 'https://mcp.asana.com/mcp'),+ ('attio', 'https://mcp.attio.com/mcp'),+ ('autobound', 'https://mcp.autobound.ai/mcp'),+ ('autom', 'https://mcp.autom.dev'),+ ('avaza', 'https://mcp.avaza.com/mcp'),+ ('aweber', 'https://mcp.aweber.com/mcp'),+ ('axonaut', 'https://mcp.axonaut.com/mcp'),+ ('badger_maps', 'https://mcp.badgermapping.com/mcp'),+ ('bannerbear', 'https://mcp.bannerbear.com'),+ ('basecamp', 'https://mcp.basecamp.com/mcp'),+ ('beehiiv', 'https://mcp.beehiiv.com/mcp'),+ ('benzinga', 'https://mcp.benzinga.com/mcp'),+ ('better_stack', 'https://mcp.betterstack.com'),+ ('bitly', 'https://api-ssl.bitly.com/v4/mcp'),+ ('bitquery', 'https://mcp.bitquery.io/mcp'),+ ('blotato', 'https://mcp.blotato.com/mcp'),+ ('braze', 'https://mcp.braze.com/mcp'),+ ('breeze', 'https://mcp.breeze.pm/mcp'),+ ('breezy_hr', 'https://mcp.breezy.hr/mcp'),+ ('bright_data', 'https://mcp.brightdata.com/mcp'),+ ('browse_ai', 'https://mcp.browse.ai/mcp'),+ ('browserless', 'https://mcp.browserless.io/mcp'),+ ('browser_use', 'https://mcp.browser-use.com/mcp'),+ ('bubble', 'https://mcp.bubble.io/mcp'),+ ('buddy', 'https://mcp.buddy.works/mcp'),+ ('bugbug', 'https://mcp.bugbug.io/mcp'),+ ('bugherd', 'https://mcp.bugherd.com/mcp'),+ ('buildkite', 'https://mcp.buildkite.com/mcp'),+ ('cal_com', 'https://mcp.cal.com/mcp'),+ ('calendly_v2', 'https://mcp.calendly.com'),+ ('callerapi', 'https://mcp.callerapi.com/mcp'),+ ('callrail', 'https://mcp.callrail.com/mcp'),+ ('campaignhq', 'https://mcp.campaignhq.co'),+ ('canva_enterprise', 'https://mcp.canva.com/mcp'),+ ('canva', 'https://mcp.canva.com/mcp'),+ ('capturekit', 'https://mcp.capturekit.dev'),+ ('carbone', 'https://mcp.carbone.io'),+ ('caspio', 'https://mcp.caspio.com/mcp'),+ ('cflow', 'https://mcp.cflowapps.com/mcp'),+ ('checkout_com', 'https://mcp.checkout.com/mcp'),+ ('cheddar', 'https://mcp.getcheddar.com/mcp'),+ ('circleci', 'https://mcp.circleci.com/v1/mcp'),+ ('clappia', 'https://mcp.clappia.com/mcp'),+ ('clearout', 'https://mcp.clearout.io/mcp'),+ ('clerk', 'https://mcp.clerk.com/mcp'),+ ('clevertap', 'https://mcp.clevertap.com/mcp'),+ ('clickup', 'https://mcp.clickup.com/mcp'),+ ('clientify', 'https://mcp.clientify.com/mcp'),+ ('clockodo', 'https://mcp.clockodo.com/mcp'),+ ('clockwork_recruiting', 'https://mcp.clockworkrecruiting.com'),+ ('close', 'https://mcp.close.com/mcp'),+ ('cloud_convert', 'https://mcp.cloudconvert.com'),+ ('cloudflare_api_key', 'https://mcp.cloudflare.com/mcp'),+ ('cloudlayer', 'https://mcp.cloudlayer.io/mcp'),+ ('cloudtalk', 'https://mcp.cloudtalk.io/mcp'),+ ('coda', 'https://coda.io/apis/mcp'),+ ('codat', 'https://mcp.codat.io'),+ ('codeqr', 'https://mcp.codeqr.io/mcp'),+ ('coinbase', 'https://agents.coinbase.com/mcp'),+ ('coinmarketcap', 'https://mcp.coinmarketcap.com/mcp'),+ ('commonninja', 'https://mcp.commoninja.com/mcp'),+ ('contacts', 'https://mcp.contactsplus.com/mcp'),+ ('contentdrips', 'https://mcp.contentdrips.com/mcp'),+ ('contentful', 'https://mcp.contentful.com/mcp'),+ ('conversion_tools', 'https://mcp.conversiontools.io/mcp'),+ ('convertkit', 'https://app.kit.com/mcp'),+ ('conveyor', 'https://mcp.conveyor.com/mcp'),+ ('copperx', 'https://mcp.copperx.io/mcp'),+ ('corporate_merch', 'https://mcp.corporatemerch.com/mcp'),+ ('crossmint', 'https://mcp.crossmint.com/mcp'),+ ('crove_app', 'https://mcp.crove.app/mcp'),+ ('crowdin', 'https://mcp.crowdin.com/mcp'),+ ('crowdstrike_falcon', 'https://mcp.crowdstrike.com/v1/mcp'),+ ('crunchbase', 'https://mcp.crunchbase.com/mcp'),+ ('crustdata', 'https://mcp.crustdata.com/mcp'),+ ('customer_io', 'https://mcp.customer.io/mcp'),+ ('data247', 'https://mcp.data247.com/mcp'),+ ('databox', 'https://mcp.databox.com/mcp'),+ ('datadog', 'https://mcp.datadoghq.com/v1/mcp'),+ ('dataforb2b', 'https://mcp.dataforb2b.ai/mcp'),+ ('dataforseo', 'https://mcp.dataforseo.com/mcp'),+ ('decodo', 'https://mcp.decodo.com/mcp'),+ ('deepl', 'https://mcp.deepl.com/v1/mcp'),+ ('deepsource', 'https://mcp.deepsource.com/mcp'),+ ('deutschlandgpt', 'https://mcp.deutschlandgpt.de/mcp'),+ ('devcycle', 'https://mcp.devcycle.com/mcp'),+ ('devin', 'https://mcp.devin.ai/mcp'),+ ('devolens', 'https://mcp.devolens.com/mcp'),+ ('dialpad', 'https://mcp.dialpad.com/mcp'),+ ('diffbot', 'https://mcp.diffbot.com/mcp'),+ ('digital_ocean', 'https://mcp.digitalocean.com/mcp'),+ ('dispatch', 'https://mcp.dispatchit.com/mcp'),+ ('docsautomator', 'https://mcp.docsautomator.co/mcp'),+ ('docsbot_ai', 'https://mcp.docsbot.ai/mcp'),+ ('domo', 'https://mcp.domo.com/mcp'),+ ('dreamdata', 'https://mcp.dreamdata.io/mcp'),+ ('dropbox', 'https://mcp.dropbox.com/mcp'),+ ('dropcontact', 'https://mcp.dropcontact.com/mcp'),+ ('easyship', 'https://mcp.easyship.com/mcp'),+ ('echtpost_postcards', 'https://mcp.echtpost.de'),+ ('edusign', 'https://mcp.edusign.com/mcp'),+ ('elastic_email', 'https://mcp.elasticemail.com/mcp'),+ ('emelia', 'https://mcp.emelia.io/mcp'),+ ('encharge', 'https://mcp.encharge.io/mcp'),+ ('engagebay', 'https://mcp.engagebay.com/mcp'),+ ('enigma', 'https://mcp.enigma.com/mcp'),+ ('enormail', 'https://mcp.enormail.eu/mcp'),+ ('enrich_layer', 'https://mcp.enrichlayer.com/mcp'),+ ('enrichley', 'https://mcp.enrichley.io/mcp'),+ ('enrow', 'https://mcp.enrow.io/mcp'),+ ('envoy', 'https://mcp.envoy.com/mcp'),+ ('esputnik', 'https://mcp.esputnik.com'),+ ('evernote', 'https://mcp.evernote.com/mcp'),+ ('ezeep_blue', 'https://mcp.ezeep.com/mcp'),+ ('ez_texting', 'https://mcp.eztexting.com/mcp'),+ ('f15five', 'https://mcp.15five.com/mcp'),+ ('factorial_api_keys', 'https://mcp.factorialhr.com'),+ ('facturadirecta', 'https://mcp.facturadirecta.com/mcp'),+ ('fal_ai', 'https://mcp.fal.ai/mcp'),+ ('faraday', 'https://mcp.faraday.ai/mcp'),+ ('fibery', 'https://mcp.fibery.io/mcp'),+ ('figma', 'https://mcp.figma.com/mcp'),+ ('fillout', 'https://mcp.fillout.com/mcp'),+ ('findymail', 'https://mcp.findymail.com/mcp'),+ ('finlight_me', 'https://mcp.finlight.me'),+ ('fireflies', 'https://mcp.fireflies.ai/mcp'),+ ('float', 'https://mcp.float.com/mcp'),+ ('flodesk', 'https://mcp.flodesk.com/mcp'),+ ('flowla', 'https://mcp.flowla.com/mcp'),+ ('fly_io', 'https://mcp.fly.io'),+ ('formaloo', 'https://mcp.formaloo.com/mcp'),+ ('formcarry', 'https://mcp.formcarry.com/mcp'),+ ('foxy', 'https://mcp.foxy.io/mcp'),+ ('frame', 'https://mcp.frame.io/mcp'),+ ('freedcamp', 'https://mcp.freedcamp.com/mcp'),+ ('freelancer', 'https://mcp.freelancer.com/mcp'),+ ('freshservice', 'https://mcp.freshservice.com/mcp'),+ ('gamma', 'https://mcp.gamma.app/mcp'),+ ('gatherup', 'https://mcp.gatherup.com/mcp'),+ ('gem', 'https://mcp.gem.com/mcp'),+ ('genpage', 'https://mcp.genpage.ai/mcp'),+ ('getaccept', 'https://mcp.getaccept.com/mcp'),+ ('getresponse', 'https://mcp.getresponse.com'),+ ('gitlab', 'https://gitlab.com/api/v4/mcp'),+ ('givebutter', 'https://mcp.givebutter.com/mcp'),+ ('gleap', 'https://mcp.gleap.io/mcp'),+ ('gong', 'https://mcp.gong.io/mcp'),+ ('grafana', 'https://mcp.grafana.com/mcp'),+ ('greenhouse', 'https://mcp.greenhouse.io/mcp'),+ ('growsurf', 'https://mcp.growsurf.com/mcp'),+ ('habitify', 'https://mcp.habitify.me/mcp'),+ ('handelsregister_ai', 'https://mcp.handelsregister.ai/mcp'),+ ('hashnode', 'https://mcp.hashnode.com/mcp'),+ ('heroku', 'https://mcp.heroku.com/mcp'),+ ('holded', 'https://mcp.holded.com/mcp'),+ ('honeybadger', 'https://mcp.honeybadger.io/mcp'),+ ('hospitable', 'https://mcp.hospitable.com/mcp'),+ ('https_airbyte_com', 'https://mcp.airbyte.com/mcp'),+ ('hubstaff', 'https://mcp.hubstaff.com/mcp'),+ ('humaans', 'https://mcp.humaans.io/mcp'),+ ('humantic_ai', 'https://mcp.humantic.ai/mcp'),+ ('hunter', 'https://mcp.hunter.io/mcp'),+ ('hygraph', 'https://mcp.hygraph.com/mcp'),+ ('hypeauditor', 'https://mcp.hypeauditor.com/mcp'),+ ('hyros', 'https://mcp.hyros.com/mcp'),+ ('iauditor_by_safetyculture', 'https://mcp.safetyculture.com/mcp'),+ ('icypeas', 'https://mcp.icypeas.com/mcp'),+ ('ilovepdf', 'https://mcp.ilovepdf.com/mcp'),+ ('implisense_api', 'https://mcp.implisense.com'),+ ('insightly', 'https://mcp.insightly.com/mcp'),+ ('instant', 'https://mcp.instantdb.com/mcp'),+ ('instantly', 'https://mcp.instantly.ai/mcp'),+ ('instasent', 'https://mcp.instasent.com/mcp'),+ ('intercom', 'https://mcp.intercom.com/mcp'),+ ('intervals_icu', 'https://mcp.intervals.icu/mcp'),+ ('ipinfo_io', 'https://mcp.ipinfo.io'),+ ('jibble', 'https://mcp.jibble.io/v1/mcp'),+ ('jotform', 'https://mcp.jotform.com/mcp'),+ ('jumpseller', 'https://mcp.jumpseller.com'),+ ('kadoa', 'https://mcp.kadoa.com/mcp'),+ ('karbon', 'https://mcp.karbonhq.com/mcp'),+ ('keboola', 'https://mcp.keboola.com/mcp'),+ ('kiyoh', 'https://mcp.kiyoh.com/mcp'),+ ('klaviyo', 'https://mcp.klaviyo.com/mcp'),+ ('klaviyo_oauth', 'https://mcp.klaviyo.com/mcp'),+ ('knack', 'https://mcp.knack.com/mcp'),+ ('knocommerce', 'https://mcp.knocommerce.com/mcp'),+ ('lagrowthmachine', 'https://mcp.lagrowthmachine.com/mcp'),+ ('landbot', 'https://mcp.landbot.io/mcp'),+ ('launchnotes', 'https://mcp.launchnotes.com/mcp'),+ ('leadboxer', 'https://mcp.leadboxer.com/mcp'),+ ('leadfeeder', 'https://mcp.leadfeeder.com/mcp'),+ ('leadiq', 'https://mcp.leadiq.com/mcp'),+ ('letzai', 'https://mcp.letz.ai/mcp'),+ ('linearb', 'https://mcp.linearb.io/mcp'),+ ('linkupapi', 'https://mcp.linkupapi.com/mcp'),+ ('livespace', 'https://mcp.livespace.io/mcp'),+ ('livestorm', 'https://mcp.livestorm.co/mcp'),+ ('llamaindex', 'https://mcp.llamaindex.ai/mcp'),+ ('logo_dev', 'https://mcp.logo.dev/mcp'),+ ('lokalise', 'https://mcp.lokalise.com/mcp'),+ ('loops_so', 'https://mcp.loops.so'),+ ('luma', 'https://mcp.luma.com'),+ ('lumin_pdf', 'https://mcp.luminpdf.com/mcp'),+ ('lusha', 'https://mcp.lusha.com/mcp'),+ ('mailbox_power', 'https://mcp.mailboxpower.com/mcp'),+ ('mailercloud', 'https://mcp.mailercloud.com/mcp'),+ ('mailerlite', 'https://mcp.mailerlite.com/mcp'),+ ('mailersend', 'https://mcp.mailersend.com/mcp'),+ ('manifestly_checklists', 'https://mcp.manifest.ly/mcp'),+ ('mapbox', 'https://mcp.mapbox.com/mcp'),+ ('mapulus', 'https://mcp.mapulus.com/mcp'),+ ('meetgeek', 'https://mcp.meetgeek.ai/mcp'),+ ('meetstream_ai', 'https://mcp.meetstream.ai/mcp'),+ ('meetup', 'https://mcp.meetup.com/mcp'),+ ('mem', 'https://mcp.mem.ai/mcp'),+ ('message_bird', 'https://mcp.bird.com/mcp'),+ ('middesk', 'https://mcp.middesk.com/mcp'),+ ('mintlify', 'https://mcp.mintlify.com/mcp'),+ ('miro_custom_app', 'https://mcp.miro.com/mcp'),+ ('missive', 'https://mcp.missiveapp.com'),+ ('mixmax', 'https://mcp.mixmax.com/mcp'),+ ('mixpanel', 'https://mcp.mixpanel.com/mcp'),+ ('mixpanel_service_account', 'https://mcp.mixpanel.com/mcp'),+ ('mobile_text_alerts', 'https://mcp.mobile-text-alerts.com/mcp'),+ ('mobygames', 'https://mcp.mobygames.com/mcp'),+ ('mollie', 'https://mcp.mollie.com/mcp'),+ ('monday', 'https://mcp.monday.com/mcp'),+ ('mongodb', 'https://mcp.mongodb.com/mcp'),+ ('morgen', 'https://mcp.morgen.so/mcp'),+ ('mux', 'https://mcp.mux.com/mcp'),+ ('mx_toolbox', 'https://mcp.mxtoolbox.com'),+ ('namecheap', 'https://mcp.namecheap.com/mcp'),+ ('nango', 'https://mcp.nango.dev/mcp'),+ ('nano_nets', 'https://mcp.nanonets.com/mcp'),+ ('navan', 'https://mcp.navan.com/mcp'),+ ('nectar_crm', 'https://mcp.nectarcrm.com.br/mcp'),+ ('neon_api_keys', 'https://mcp.neon.tech/mcp'),+ ('neon_postgres', 'https://mcp.neon.tech/mcp'),+ ('netlify', 'https://mcp.netlify.com/mcp'),+ ('new_relic', 'https://mcp.newrelic.com/mcp'),+ ('nexudus', 'https://mcp.nexudus.com'),+ ('ngrok', 'https://mcp.ngrok.com/mcp'),+ ('nordigen', 'https://mcp.gocardless.com/mcp'),+ ('nusii_proposals', 'https://mcp.nusii.com/mcp'),+ ('nvoip', 'https://mcp.nvoip.com.br/mcp'),+ ('octagon', 'https://mcp.octagonai.co/mcp'),+ ('octave', 'https://mcp.octavehq.com/mcp'),+ ('octoparse', 'https://mcp.octoparse.com'),+ ('olostep', 'https://mcp.olostep.com/mcp'),+ ('omnisend', 'https://mcp.omnisend.com/mcp'),+ ('onfleet', 'https://mcp.onfleet.com/mcp'),+ ('onlyoffice_docspace', 'https://mcp.onlyoffice.com/mcp'),+ ('ontraport', 'https://mcp.ontraport.com'),+ ('opengraph_io', 'https://mcp.opengraph.io/mcp'),+ ('openphone', 'https://mcp.quo.com/mcp'),+ ('openrouter', 'https://mcp.openrouter.ai/mcp'),+ ('operating', 'https://mcp.operating.app/mcp'),+ ('orca_scan', 'https://mcp.orcascan.com'),+ ('originality_ai', 'https://mcp.originality.ai/mcp'),+ ('orshot', 'https://mcp.orshot.com/mcp'),+ ('oto', 'https://mcp.tryoto.com/mcp'),+ ('outline', 'https://mcp.getoutline.com/mcp'),+ ('outseta', 'https://mcp.outseta.com'),+ ('paddle', 'https://mcp.paddle.com/mcp'),+ ('pandadoc', 'https://mcp.pandadoc.com/v1/mcp'),+ ('partnerize', 'https://mcp.partnerize.com/mcp'),+ ('partnerstack', 'https://mcp.partnerstack.com/mcp'),+ ('passcreator', 'https://mcp.passcreator.com/mcp'),+ ('paypal', 'https://mcp.paypal.com/mcp'),+ ('pdf4me', 'https://mcp.pdf4me.com/mcp'),+ ('peerdom', 'https://mcp.peerdom.org/mcp'),+ ('peliqan', 'https://mcp.peliqan.io/mcp'),+ ('pennylane', 'https://mcp.pennylane.com/mcp'),+ ('piloterr', 'https://mcp.piloterr.com'),+ ('pipefy', 'https://mcp.pipefy.com/mcp'),+ ('pixelbin', 'https://mcp.pixelbin.io/mcp'),+ ('plaid', 'https://mcp.plaid.com/mcp'),+ ('plain', 'https://mcp.plain.com/mcp'),+ ('podio', 'https://mcp.podio.com/mcp'),+ ('polly', 'https://mcp.polly.ai/mcp'),+ ('poper', 'https://mcp.poper.ai/mcp'),+ ('postgrid', 'https://mcp.postgrid.com/mcp'),+ ('posthog', 'https://mcp.posthog.com/mcp'),+ ('postnitro', 'https://mcp.postnitro.ai/mcp'),+ ('predictleads', 'https://mcp.predictleads.com'),+ ('predis_ai', 'https://mcp.predis.ai/mcp'),+ ('prepr_graphql', 'https://mcp.prepr.io/mcp'),+ ('printify', 'https://mcp.printify.com/mcp'),+ ('prisma_management_api', 'https://mcp.prisma.io/mcp'),+ ('prismic', 'https://mcp.prismic.io/mcp'),+ ('process_street', 'https://mcp.process.st'),+ ('productboard', 'https://mcp.productboard.com/mcp'),+ ('product_hunt', 'https://mcp.producthunt.com/mcp'),+ ('productive_io', 'https://mcp.productive.io/mcp'),+ ('proposify', 'https://mcp.proposify.com/mcp'),+ ('prospeo', 'https://mcp.prospeo.io'),+ ('pumble', 'https://mcp.pumble.com/mcp'),+ ('qase', 'https://mcp.qase.io/mcp'),+ ('quentn', 'https://mcp.quentn.com/mcp'),+ ('questionpro', 'https://mcp.questionpro.com/mcp'),+ ('qwilr', 'https://mcp.qwilr.com/mcp'),+ ('radar', 'https://mcp.radar.com/mcp'),+ ('railway', 'https://mcp.railway.com/mcp'),+ ('raisely', 'https://mcp.raisely.com/mcp'),+ ('ramp', 'https://mcp.ramp.com/mcp'),+ ('razorpay', 'https://mcp.razorpay.com/mcp'),+ ('rebrandly', 'https://mcp.rebrandly.com/v1/mcp'),+ ('recurly', 'https://mcp.recurly.com/mcp'),+ ('relevance_ai', 'https://mcp.relevanceai.com'),+ ('remote', 'https://mcp.remote.com/mcp'),+ ('replicate', 'https://mcp.replicate.com/mcp'),+ ('reply_io', 'https://mcp.reply.io'),+ ('resend', 'https://mcp.resend.com/mcp'),+ ('resource_guru', 'https://mcp.resourceguruapp.com/mcp'),+ ('respond_io', 'https://mcp.respond.io/mcp'),+ ('retently', 'https://mcp.retently.com/mcp'),+ ('retool', 'https://mcp.retool.com/mcp'),+ ('returnless', 'https://mcp.returnless.com'),+ ('richpanel', 'https://mcp.richpanel.com/mcp'),+ ('ringg_ai', 'https://mcp.ringg.ai/mcp'),+ ('rize', 'https://mcp.rize.io/mcp'),+ ('roamresearch', 'https://mcp.roamresearch.com/mcp'),+ ('roboflow', 'https://mcp.roboflow.com/mcp'),+ ('rocketreach', 'https://mcp.rocketreach.co/mcp'),+ ('rootly', 'https://mcp.rootly.com/mcp'),+ ('rudderstack', 'https://mcp.rudderstack.com/mcp'),+ ('runpod', 'https://mcp.runpod.io/mcp'),+ ('runware', 'https://mcp.runware.ai'),+ ('runway', 'https://mcp.runwayml.com/mcp'),+ ('rydoo', 'https://mcp.rydoo.com/mcp'),+ ('salesflare', 'https://mcp.salesflare.com/mcp'),+ ('salesloft', 'https://mcp.salesloft.com/mcp'),+ ('salesmsg', 'https://mcp.salesmessage.com'),+ ('samcart', 'https://mcp.samcart.com'),+ ('sanity', 'https://mcp.sanity.io/mcp'),+ ('sapling_ai', 'https://mcp.sapling.ai/mcp'),+ ('saucelabs', 'https://mcp.saucelabs.com/mcp'),+ ('scoro', 'https://mcp.scoro.com/mcp'),+ ('scrapeops', 'https://mcp.scrapeops.io/mcp'),+ ('scrapingbot', 'https://mcp.scraping-bot.io/mcp'),+ ('screenshotone', 'https://mcp.screenshotone.com'),+ ('selzy', 'https://mcp.selzy.com/mcp'),+ ('semrush', 'https://mcp.semrush.com/v1/mcp'),+ ('sendcloud', 'https://mcp.sendcloud.com/mcp'),+ ('sender', 'https://mcp.sender.net/mcp'),+ ('sendpulse', 'https://mcp.sendpulse.com/mcp'),+ ('sentry', 'https://mcp.sentry.dev/mcp'),+ ('seqera', 'https://mcp.seqera.io/mcp'),+ ('seven', 'https://mcp.seven.io/mcp'),+ ('shiphero', 'https://mcp.shiphero.com/mcp'),+ ('shipstation', 'https://mcp.shipstation.com/mcp'),+ ('shortcut', 'https://mcp.shortcut.com/mcp'),+ ('shotstack', 'https://mcp.shotstack.io'),+ ('signatureapi', 'https://mcp.signatureapi.com/mcp'),+ ('signaturit', 'https://mcp.signaturit.com/mcp'),+ ('sign_plus', 'https://mcp.sign.plus/mcp'),+ ('siit', 'https://mcp.siit.io/mcp'),+ ('similarweb_digitalrank_api', 'https://mcp.similarweb.com/mcp'),+ ('simplero', 'https://mcp.simplero.com/mcp'),+ ('siteglide', 'https://mcp.siteglide.com/mcp'),+ ('skyciv', 'https://mcp.skyciv.com/mcp'),+ ('slab', 'https://mcp.slab.com/v1/mcp'),+ ('smartlead', 'https://mcp.smartlead.ai/mcp'),+ ('smstools', 'https://mcp.smstools.com/mcp'),+ ('snov', 'https://mcp.snov.io/mcp'),+ ('softr', 'https://mcp.softr.io/mcp'),+ ('solve_crm', 'https://mcp.solve360.com/mcp'),+ ('sparkpost', 'https://mcp.sparkpost.com/mcp'),+ ('spider', 'https://mcp.spider.cloud/mcp'),+ ('spike', 'https://mcp.spike.sh/mcp'),+ ('square', 'https://mcp.squareup.com/mcp'),+ ('stammer_ai', 'https://mcp.stammer.ai/mcp'),+ ('streamtime', 'https://mcp.streamtime.net/mcp'),+ ('stripe', 'https://mcp.stripe.com'),+ ('stripo', 'https://mcp.stripo.email/mcp'),+ ('sumo_logic', 'https://mcp.sumologic.com/mcp'),+ ('supabase_management_api', 'https://mcp.supabase.com/mcp'),+ ('supercast', 'https://mcp.supercast.com'),+ ('survey_monkey', 'https://mcp.surveymonkey.com/mcp'),+ ('survicate', 'https://mcp.survicate.com/mcp'),+ ('tableau', 'https://mcp.tableau.com'),+ ('tapfiliate', 'https://mcp.tapfiliate.com/mcp'),+ ('tavily', 'https://mcp.tavily.com/mcp'),+ ('templated', 'https://mcp.templated.io/mcp'),+ ('textmagic', 'https://mcp.textmagic.com'),+ ('thanks_io', 'https://mcp.thanks.io/mcp'),+ ('themarketer', 'https://mcp.themarketer.com/mcp'),+ ('thinkific', 'https://mcp.thinkific.com'),+ ('thrivecart', 'https://mcp.thrivecart.com/mcp'),+ ('ticktick', 'https://mcp.ticktick.com'),+ ('timecamp', 'https://mcp.timecamp.com/mcp'),+ ('time_tracker_by_ebillity', 'https://mcp.ebillity.com/mcp'),+ ('todoist', 'https://ai.todoist.net/mcp'),+ ('tomba', 'https://mcp.tomba.io/mcp'),+ ('trackingtime', 'https://mcp.trackingtime.co/mcp'),+ ('trackvia', 'https://mcp.trackvia.com/mcp'),+ ('trainual', 'https://mcp.trainual.com/mcp'),+ ('transistor_fm', 'https://mcp.transistor.fm'),+ ('travel_code', 'https://mcp.travel-code.com/mcp'),+ ('trello', 'https://mcp.trello.com/v1'),+ ('trengo', 'https://mcp.trengo.com/mcp'),+ ('trint', 'https://mcp.trint.com/mcp'),+ ('twelve_data', 'https://mcp.twelvedata.com/mcp'),+ ('twenty', 'https://mcp.twenty.com/mcp'),+ ('typeform', 'https://api.typeform.com/mcp'),+ ('typefully', 'https://mcp.typefully.com/mcp'),+ ('unbounce', 'https://mcp.unbounce.com/mcp'),+ ('unisender', 'https://mcp.unisender.com/mcp'),+ ('unsplash', 'https://mcp.unsplash.com/mcp'),+ ('upsales', 'https://mcp.upsales.com/mcp'),+ ('upstash_redis', 'https://mcp.upstash.com/mcp'),+ ('uptimerobot', 'https://mcp.uptimerobot.com/mcp'),+ ('userlist', 'https://mcp.userlist.com'),+ ('uspacy', 'https://mcp.uspacy.com/mcp'),+ ('vercel_token_auth', 'https://mcp.vercel.com/v1/mcp'),+ ('vero', 'https://mcp.getvero.com/mcp'),+ ('vestaboard', 'https://mcp.vestaboard.com/mcp'),+ ('vimeo', 'https://mcp.vimeo.com/mcp'),+ ('voice', 'https://mcp.voiceflow.com/mcp'),+ ('voice_monkey', 'https://mcp.voicemonkey.io/mcp'),+ ('voluum', 'https://mcp.voluum.com/mcp'),+ ('voluum_session_auth', 'https://mcp.voluum.com/mcp'),+ ('vosfactures', 'https://mcp.vosfactures.fr/mcp'),+ ('walletap', 'https://mcp.walletap.io/mcp'),+ ('wappalyzer', 'https://mcp.wappalyzer.com/mcp'),+ ('wati', 'https://mcp.wati.io/mcp'),+ ('wbiztool', 'https://mcp.wbiztool.com/mcp'),+ ('webcrawler_api', 'https://mcp.webcrawlerapi.com/mcp'),+ ('webflow', 'https://mcp.webflow.com/mcp'),+ ('webscraping_ai', 'https://mcp.webscraping.ai/mcp'),+ ('weglot', 'https://mcp.weglot.com/mcp'),+ ('whimsical', 'https://mcp.whimsical.com/mcp'),+ ('whop', 'https://mcp.whop.com/mcp'),+ ('wise', 'https://mcp.wise.com/mcp'),+ ('wisepops', 'https://mcp.wisepops.com'),+ ('withings', 'https://mcp.withings.com/mcp'),+ ('wix_api_key', 'https://mcp.wix.com/mcp'),+ ('wiza', 'https://mcp.wiza.co/mcp'),+ ('wordpress_com', 'https://public-api.wordpress.com/wpcom/v2/mcp/v1'),+ ('workast', 'https://mcp.workast.com/mcp'),+ ('workbooks_crm', 'https://mcp.workbooks.com/mcp'),+ ('workiom', 'https://mcp.workiom.com/mcp'),+ ('writesonic', 'https://mcp.writesonic.com/mcp'),+ ('xano_metadata_api', 'https://mcp.xano.com'),+ ('ybug', 'https://mcp.ybug.io/mcp'),+ ('yespo', 'https://mcp.yespo.io'),+ ('zendesk', 'https://mcp.zendesk.com/mcp'),+ ('zonka_feedback', 'https://mcp.zonkafeedback.com'),+ ('zyte_api', 'https://mcp.zyte.com/v1/mcp')+ON CONFLICT (app_slug) DO NOTHING;diff --git a/crates/mcp_select/src/lib.rs b/crates/mcp_select/src/lib.rsindex c2f2c95bd5..67467ec8d9 100644--- a/crates/mcp_select/src/lib.rs+++ b/crates/mcp_select/src/lib.rs@@ -16,7 +16,9 @@ use pipedream_mcp::domain::service::PipedreamToolSet;use std::collections::HashSet;use std::pin::Pin;+mod overlay;mod selection;+pub use overlay::{NativeOverlayConnections, overlay_connection};use selection::native_matches;pub use selection::select_connections;use std::sync::Arc;diff --git a/crates/mcp_select/src/overlay.rs b/crates/mcp_select/src/overlay.rsnew file mode 100644index 0000000000..3b67b9115c--- /dev/null+++ b/crates/mcp_select/src/overlay.rs@@ -0,0 +1,56 @@+//! Overlaid catalog apps, answered from the native MCP stack.++use crate::selection::same_endpoint;+use macro_user_id::user_id::MacroUserIdStr;+use mcp_client::domain::models::McpServerRecord;+use mcp_client::domain::ports::McpServerStore;+use pipedream_mcp::domain::models::ConnectorOverlay;+use pipedream_mcp::domain::ports::OverlayConnections;+use std::sync::Arc;++#[cfg(test)]+mod test;++/// The user's native connection to `overlay`'s server: enabled and+/// authorized, matched by endpoint.+pub fn overlay_connection<'a>(+ native: &'a [McpServerRecord],+ overlay: &ConnectorOverlay,+) -> Option<&'a McpServerRecord> {+ native.iter().find(|record| {+ record.enabled+ && record.credentials.is_some()+ && same_endpoint(&record.url, &overlay.server_url)+ })+}++/// [`OverlayConnections`] over the native server store. `None` is a+/// deployment without the native stack, where nothing is ever connected.+pub struct NativeOverlayConnections<N> {+ native_store: Option<Arc<N>>,+}++impl<N> NativeOverlayConnections<N> {+ /// Read connections from `native_store`.+ pub fn new(native_store: Option<Arc<N>>) -> Self {+ Self { native_store }+ }+}++impl<N: McpServerStore> OverlayConnections for NativeOverlayConnections<N> {+ #[tracing::instrument(skip(self, user), err)]+ async fn connected_name(+ &self,+ user: &MacroUserIdStr<'static>,+ overlay: &ConnectorOverlay,+ ) -> anyhow::Result<Option<String>> {+ let Some(store) = &self.native_store else {+ return Ok(None);+ };+ let native = store+ .list(user)+ .await+ .map_err(|e| anyhow::anyhow!("mcp store: {e:?}"))?;+ Ok(overlay_connection(&native, overlay).map(|record| record.server_name.clone()))+ }+}diff --git a/crates/mcp_select/src/overlay/test.rs b/crates/mcp_select/src/overlay/test.rsnew file mode 100644index 0000000000..15aff9fa47--- /dev/null+++ b/crates/mcp_select/src/overlay/test.rs@@ -0,0 +1,37 @@+use super::*;++fn native(url: &str, enabled: bool, authenticated: bool) -> McpServerRecord {+ McpServerRecord {+ user_id: MacroUserIdStr::parse_from_str("macro|[email protected]").unwrap(),+ url: url.to_owned(),+ server_name: "Sentry (work)".into(),+ enabled,+ credentials: authenticated.then(|| {+ serde_json::from_value(serde_json::json!({"client_id":"test", "token_response":null}))+ .unwrap()+ }),+ }+}++fn sentry() -> ConnectorOverlay {+ ConnectorOverlay {+ app_slug: "sentry".into(),+ server_url: "https://mcp.sentry.dev/mcp".into(),+ }+}++#[test]+fn only_an_enabled_authorized_row_for_the_overlay_endpoint_counts() {+ let rows = [+ native("https://mcp.sentry.dev/mcp", false, true),+ native("https://mcp.sentry.dev/mcp", true, false),+ native("https://mcp.linear.app/mcp", true, true),+ ];+ assert!(overlay_connection(&rows, &sentry()).is_none());++ let rows = [native("https://mcp.sentry.dev/mcp/", true, true)];+ assert_eq!(+ overlay_connection(&rows, &sentry()).map(|r| r.server_name.as_str()),+ Some("Sentry (work)")+ );+}diff --git a/crates/mcp_select/src/selection.rs b/crates/mcp_select/src/selection.rsindex 7051348b78..8309c2efc6 100644--- a/crates/mcp_select/src/selection.rs+++ b/crates/mcp_select/src/selection.rs@@ -28,7 +28,7 @@ const PROVIDERS: &[ConnectorRef<'static>] = &[},ConnectorRef {pipedream_app_slugs: &["datadog"],- native_server_url: "https://mcp.datadoghq.com/mcp",+ native_server_url: "https://mcp.datadoghq.com/v1/mcp",},ConnectorRef {pipedream_app_slugs: &["grafana"],@@ -36,7 +36,7 @@ const PROVIDERS: &[ConnectorRef<'static>] = &[},];-fn same_endpoint(a: &str, b: &str) -> bool {+pub(crate) fn same_endpoint(a: &str, b: &str) -> bool {a.trim_end_matches('/') == b.trim_end_matches('/')}diff --git a/crates/pipedream_mcp/AGENTS.md b/crates/pipedream_mcp/AGENTS.mdindex 540d46942a..e6a8e4002a 100644--- a/crates/pipedream_mcp/AGENTS.md+++ b/crates/pipedream_mcp/AGENTS.md@@ -15,12 +15,18 @@ AI loop calls their tools through Pipedream's remote MCP server.Connect API proxy (`ConnectedAppProxy`) that calls an app's own REST APIwith the account's credentials; catalog entries preserve Pipedream categorylabels for clients to group without a local taxonomy.-- `src/outbound/pg_connection_repo.rs`: the `pipedream_mcp_connections` table.+- `src/outbound/pg_connection_repo.rs`: the `pipedream_mcp_connections` table,+ and the `mcp_overlays` table (`ConnectorOverlays`): catalog apps that connect+ through their own MCP server on the native stack instead of Pipedream.+ Connection reads skip overlaid slugs, and `complete_pipedream_connection`+ (also reached through `recover_pipedream_connection`)+ refuses them (409) and deletes the new Pipedream account.- `src/inbound/toolset.rs`: how connected apps surface as agent tools.## Scope- Owns: Pipedream connect-flow state, the `pipedream_mcp_connections` table,+ the `mcp_overlays` table,and loading a user's Pipedream tools into the agent toolset.- Not here: deciding whether a user's tools come from Pipedream or the nativeMCP stack → `mcp_select`.@@ -33,6 +39,16 @@ AI loop calls their tools through Pipedream's remote MCP server.`import_jira`, `agent_egress`, `agent_harness`,`granola_sync`, `mcp_select`, `services/agent_harness_service`.+## Gotchas++- Overlaying an app hides its Pipedream grant from every reader, including+ imports (Linear, Jira, Notion) and Granola sync, which use the Pipedream+ proxy. Keep those slugs out of `mcp_overlays` until their readers have a+ native path.+- Discovery answers an overlaid app's connection status through+ `OverlayConnections` (implemented in `mcp_select` over the native store); its+ advertised tools still come from Pipedream's listing for the slug.+## Checks- `cargo test -p pipedream_mcp` (`SQLX_OFFLINE` unset; requires local MacroDB).diff --git a/crates/pipedream_mcp/Cargo.toml b/crates/pipedream_mcp/Cargo.tomlindex 74b37b2809..6c92ded9cb 100644--- a/crates/pipedream_mcp/Cargo.toml+++ b/crates/pipedream_mcp/Cargo.toml@@ -33,6 +33,7 @@ utoipa.workspace = trueworkspace-hack = { version = "0.1", path = "../workspace-hack" }[dev-dependencies]+macro_db_migrator = { path = "../macro_db_migrator" }tokio.workspace = truetower = { workspace = true }wiremock = { workspace = true }diff --git a/crates/pipedream_mcp/src/domain/models.rs b/crates/pipedream_mcp/src/domain/models.rsindex 24e7fe4f7a..2247d6b311 100644--- a/crates/pipedream_mcp/src/domain/models.rs+++ b/crates/pipedream_mcp/src/domain/models.rs@@ -20,6 +20,20 @@ pub struct PipedreamConnection {pub enabled: bool,}+/// A catalog app that connects through the native MCP stack instead of+/// Pipedream: the vendor's own MCP server, authorized with our OAuth client+/// (dynamic or metadata-document registration).+///+/// The app still appears in the catalog under its Pipedream slug, but+/// Pipedream never holds a grant for it.+#[derive(Clone, Debug, PartialEq, Eq)]+pub struct ConnectorOverlay {+ /// Pipedream app name slug, e.g. `sentry`.+ pub app_slug: String,+ /// The vendor's MCP server URL, e.g. `https://mcp.sentry.dev/mcp`.+ pub server_url: String,+}+/// A short-lived token for opening Pipedream's hosted Connect UI.#[derive(Clone, Debug)]pub struct ConnectToken {diff --git a/crates/pipedream_mcp/src/domain/ports.rs b/crates/pipedream_mcp/src/domain/ports.rsindex ba6f3bdbd9..7cb2f92e97 100644--- a/crates/pipedream_mcp/src/domain/ports.rs+++ b/crates/pipedream_mcp/src/domain/ports.rs@@ -1,8 +1,33 @@use super::models::{- CatalogEntry, CatalogPage, ConnectToken, MacroUserIdStr, McpServer, PipedreamAccount,- PipedreamConnection,+ CatalogEntry, CatalogPage, ConnectToken, ConnectorOverlay, MacroUserIdStr, McpServer,+ PipedreamAccount, PipedreamConnection,};+/// The catalog apps that connect through the native MCP stack instead of+/// Pipedream.+pub trait ConnectorOverlays: Send + Sync + 'static {+ /// Every overlaid app.+ fn overlays(&self) -> impl Future<Output = anyhow::Result<Vec<ConnectorOverlay>>> + Send;++ /// The overlay for `app_slug`, if the app is overlaid.+ fn overlay(+ &self,+ app_slug: &str,+ ) -> impl Future<Output = anyhow::Result<Option<ConnectorOverlay>>> + Send;+}++/// A user's connections to overlaid apps, which live on the native MCP stack+/// rather than in Pipedream.+pub trait OverlayConnections: Send + Sync + 'static {+ /// The display name of `user`'s enabled, authorized connection to+ /// `overlay`'s MCP server, if they hold one.+ fn connected_name(+ &self,+ user: &MacroUserIdStr<'static>,+ overlay: &ConnectorOverlay,+ ) -> impl Future<Output = anyhow::Result<Option<String>>> + Send;+}+/// Cross-user lookup for background integrations that follow a connected app.pub trait AppConnections: Send + Sync + 'static {/// Every user's enabled connection to `app_slug`.@@ -13,6 +38,10 @@ pub trait AppConnections: Send + Sync + 'static {}/// Port for persisting Pipedream-connected apps, keyed by user and app slug.+///+/// Reads never return a connection to an overlaid app (see+/// [`ConnectorOverlays`]): once an app is overlaid, a Pipedream grant for it+/// stops reaching tools, imports, and sandboxes everywhere at once.pub trait ConnectionStore: Send + Sync + 'static {/// Error type for store operations.type Err: Send + std::fmt::Debug;diff --git a/crates/pipedream_mcp/src/domain/service/connect.rs b/crates/pipedream_mcp/src/domain/service/connect.rsindex 130fb8e84f..c8ca21510f 100644--- a/crates/pipedream_mcp/src/domain/service/connect.rs+++ b/crates/pipedream_mcp/src/domain/service/connect.rs@@ -7,7 +7,7 @@//! any local record is written.use crate::domain::models::{MacroUserIdStr, PipedreamConnection};-use crate::domain::ports::{ConnectionStore, PipedreamConnect};+use crate::domain::ports::{ConnectionStore, ConnectorOverlays, PipedreamConnect};#[cfg(test)]mod test;@@ -18,6 +18,15 @@ pub enum PipedreamConnectError {/// The account doesn't exist, or wasn't connected for this user.#[error("connected account not found for this user")]NotFound,+ /// The app is overlaid: it connects through the native MCP stack at+ /// `server_url`, never through Pipedream.+ #[error("{app_slug} connects through its own MCP server, not Pipedream")]+ Overlaid {+ /// The overlaid app.+ app_slug: String,+ /// The MCP server to connect instead.+ server_url: String,+ },/// Anything else.#[error(transparent)]Internal(#[from] anyhow::Error),@@ -29,9 +38,13 @@ pub enum PipedreamConnectError {/// (accounts are minted for our user IDs via the Connect token), then/// upserts the app record. Reconnecting an app the user already has simply/// points its record at the new account.-#[tracing::instrument(skip(store, pipedream), err)]-pub async fn complete_pipedream_connection<S, P>(+///+/// An overlaid app is refused and its new Pipedream account deleted, so no+/// Pipedream grant for it outlives the attempt.+#[tracing::instrument(skip(store, overlays, pipedream), err)]+pub async fn complete_pipedream_connection<S, O, P>(store: &S,+ overlays: &O,pipedream: &P,user_id: &MacroUserIdStr<'static>,account_id: &str,@@ -39,6 +52,7 @@ pub async fn complete_pipedream_connection<S, P>() -> Result<PipedreamConnection, PipedreamConnectError>whereS: ConnectionStore,+ O: ConnectorOverlays,P: PipedreamConnect,anyhow::Error: From<S::Err>,{@@ -54,6 +68,16 @@ wherereturn Err(PipedreamConnectError::NotFound);}+ if let Some(overlay) = overlays.overlay(&account.app_slug).await? {+ if let Err(error) = pipedream.delete_account(&account.id).await {+ tracing::warn!(error = ?error, account_id = %account.id, "failed to delete Pipedream account for an overlaid app");+ }+ return Err(PipedreamConnectError::Overlaid {+ app_slug: overlay.app_slug,+ server_url: overlay.server_url,+ });+ }+let existing = store.load(user_id, &account.app_slug).await@@ -88,9 +112,10 @@ pub const RECOVERY_WINDOW: chrono::TimeDelta = chrono::TimeDelta::minutes(15);/// of `now` is verified and stored exactly as a reported one would be./// Returns `None` when there is no such account, or when it is already the/// stored one.-#[tracing::instrument(skip(store, pipedream), err)]-pub async fn recover_pipedream_connection<S, P>(+#[tracing::instrument(skip(store, overlays, pipedream), err)]+pub async fn recover_pipedream_connection<S, O, P>(store: &S,+ overlays: &O,pipedream: &P,user_id: &MacroUserIdStr<'static>,app_slug: &str,@@ -99,6 +124,7 @@ pub async fn recover_pipedream_connection<S, P>() -> Result<Option<PipedreamConnection>, PipedreamConnectError>whereS: ConnectionStore,+ O: ConnectorOverlays,P: PipedreamConnect,anyhow::Error: From<S::Err>,{@@ -130,7 +156,7 @@ where}tracing::info!(found = true, account_id = %newest.id, "recovering unreported Pipedream account");- complete_pipedream_connection(store, pipedream, user_id, &newest.id, server_name)+ complete_pipedream_connection(store, overlays, pipedream, user_id, &newest.id, server_name).await.map(Some)}diff --git a/crates/pipedream_mcp/src/domain/service/connect/test.rs b/crates/pipedream_mcp/src/domain/service/connect/test.rsindex 4783f45f94..74f6c7698f 100644--- a/crates/pipedream_mcp/src/domain/service/connect/test.rs+++ b/crates/pipedream_mcp/src/domain/service/connect/test.rs@@ -1,5 +1,5 @@use super::*;-use crate::domain::models::{ConnectToken, PipedreamAccount};+use crate::domain::models::{ConnectToken, ConnectorOverlay, PipedreamAccount};use macro_user_id::cowlike::CowLike;use std::collections::HashMap;use std::sync::Mutex;@@ -104,6 +104,37 @@ impl PipedreamConnect for FakePipedream {}}+struct NoOverlays;++impl ConnectorOverlays for NoOverlays {+ async fn overlays(&self) -> anyhow::Result<Vec<ConnectorOverlay>> {+ Ok(Vec::new())+ }++ async fn overlay(&self, _app_slug: &str) -> anyhow::Result<Option<ConnectorOverlay>> {+ Ok(None)+ }+}++struct SentryOverlay;++impl ConnectorOverlays for SentryOverlay {+ async fn overlays(&self) -> anyhow::Result<Vec<ConnectorOverlay>> {+ Ok(vec![sentry_overlay()])+ }++ async fn overlay(&self, app_slug: &str) -> anyhow::Result<Option<ConnectorOverlay>> {+ Ok((app_slug == "sentry").then(sentry_overlay))+ }+}++fn sentry_overlay() -> ConnectorOverlay {+ ConnectorOverlay {+ app_slug: "sentry".to_owned(),+ server_url: "https://mcp.sentry.dev/mcp".to_owned(),+ }+}+fn account(id: &str, external_user_id: Option<&str>, app_slug: &str) -> PipedreamAccount {PipedreamAccount {id: id.to_owned(),@@ -137,6 +168,7 @@ async fn completing_verifies_and_stores_the_connected_app() {let record = complete_pipedream_connection(&store,+ &NoOverlays,&pd,&user("macro|[email protected]"),"apn_1",@@ -169,6 +201,7 @@ async fn completing_rejects_accounts_owned_by_someone_else() {let err = complete_pipedream_connection(&store,+ &NoOverlays,&pd,&user("macro|[email protected]"),"apn_1",@@ -188,6 +221,7 @@ async fn completing_rejects_unknown_accounts() {let err = complete_pipedream_connection(&store,+ &NoOverlays,&pd,&user("macro|[email protected]"),"apn_missing",@@ -221,6 +255,7 @@ async fn reconnecting_keeps_name_and_enabled_state_but_swaps_the_account() {let record = complete_pipedream_connection(&store,+ &NoOverlays,&pd,&user("macro|[email protected]"),"apn_new",@@ -245,6 +280,7 @@ async fn explicit_server_name_wins() {let record = complete_pipedream_connection(&store,+ &NoOverlays,&pd,&user("macro|[email protected]"),"apn_1",@@ -296,6 +332,41 @@ async fn disconnect_of_unknown_app_is_a_quiet_noop() {assert!(pd.deleted.lock().unwrap().is_empty());}+#[tokio::test]+async fn completing_an_overlaid_app_is_refused_and_its_account_deleted() {+ let store = FakeStore::default();+ let mut pd = FakePipedream::default();+ pd.accounts.insert(+ "apn_1".into(),+ account("apn_1", Some("macro|[email protected]"), "sentry"),+ );++ let err = complete_pipedream_connection(+ &store,+ &SentryOverlay,+ &pd,+ &user("macro|[email protected]"),+ "apn_1",+ None,+ )+ .await+ .unwrap_err();++ assert!(matches!(+ err,+ PipedreamConnectError::Overlaid { ref server_url, .. }+ if server_url == "https://mcp.sentry.dev/mcp"+ ));+ assert_eq!(*pd.deleted.lock().unwrap(), vec!["apn_1".to_owned()]);+ assert!(+ store+ .list(&user("macro|[email protected]"))+ .await+ .unwrap()+ .is_empty()+ );+}+#[tokio::test]async fn recovery_stores_the_newest_recent_account_the_ui_never_reported() {let store = FakeStore::default();@@ -309,6 +380,7 @@ async fn recovery_stores_the_newest_recent_account_the_ui_never_reported() {let record = recover_pipedream_connection(&store,+ &NoOverlays,&pd,&user("macro|[email protected]"),"linear",@@ -342,6 +414,7 @@ async fn recovery_ignores_accounts_outside_the_window_and_other_users() {let recovered = recover_pipedream_connection(&store,+ &NoOverlays,&pd,&user("macro|[email protected]"),"linear",@@ -376,6 +449,7 @@ async fn recovery_does_not_report_the_already_stored_account_as_new() {let recovered = recover_pipedream_connection(&store,+ &NoOverlays,&pd,&user("macro|[email protected]"),"linear",@@ -387,3 +461,32 @@ async fn recovery_does_not_report_the_already_stored_account_as_new() {assert!(recovered.is_none());}++#[tokio::test]+async fn recovering_an_overlaid_app_is_refused_and_its_account_deleted() {+ let store = FakeStore::default();+ let mut pd = FakePipedream::default();+ pd.accounts.insert(+ "apn_1".into(),+ PipedreamAccount {+ app_slug: "sentry".into(),+ ..created("apn_1", "macro|[email protected]", 1)+ },+ );++ let err = recover_pipedream_connection(+ &store,+ &SentryOverlay,+ &pd,+ &user("macro|[email protected]"),+ "sentry",+ None,+ now(),+ )+ .await+ .unwrap_err();++ assert!(matches!(err, PipedreamConnectError::Overlaid { .. }));+ assert_eq!(*pd.deleted.lock().unwrap(), vec!["apn_1".to_owned()]);+ assert!(store.records.lock().unwrap().is_empty(), "nothing stored");+}diff --git a/crates/pipedream_mcp/src/domain/service/discovery.rs b/crates/pipedream_mcp/src/domain/service/discovery.rsindex c2f07549e3..21d2053e1d 100644--- a/crates/pipedream_mcp/src/domain/service/discovery.rs+++ b/crates/pipedream_mcp/src/domain/service/discovery.rs@@ -2,7 +2,10 @@use crate::domain::{models::MacroUserIdStr,- ports::{ConnectionStore, ConnectorCapabilities, ConnectorDirectory},+ ports::{+ ConnectionStore, ConnectorCapabilities, ConnectorDirectory, ConnectorOverlays,+ OverlayConnections,+ },};use schemars::JsonSchema;use serde::{Deserialize, Serialize};@@ -64,7 +67,9 @@ pub enum DiscoveryResult {Inspect {/// App from the directory.app: DiscoveredApp,- /// Whether this caller has an enabled connection.+ /// Whether this caller has an enabled connection. For an app that+ /// connects through its own MCP server, that connection is checked+ /// there, not in Pipedream.connected: bool,/// Advertised tools. Use SearchTools after connecting to load them.tools: Vec<ConnectorTool>,@@ -74,17 +79,28 @@ pub enum DiscoveryResult {}/// Orchestrates discovery through directory, capability, and connection ports.-pub struct ConnectorDiscovery<D, S> {+pub struct ConnectorDiscovery<D, S, N> {directory: Option<Arc<D>>,connections: Arc<S>,+ overlay_connections: Arc<N>,}-impl<D: ConnectorDirectory + ConnectorCapabilities, S: ConnectionStore> ConnectorDiscovery<D, S> {+impl<D, S, N> ConnectorDiscovery<D, S, N>+where+ D: ConnectorDirectory + ConnectorCapabilities,+ S: ConnectionStore + ConnectorOverlays,+ N: OverlayConnections,+{/// An absent directory makes unconfigured deployments fail explicitly.- pub fn new(directory: Option<Arc<D>>, connections: Arc<S>) -> Self {+ pub fn new(+ directory: Option<Arc<D>>,+ connections: Arc<S>,+ overlay_connections: Arc<N>,+ ) -> Self {Self {directory,connections,+ overlay_connections,}}@@ -116,14 +132,7 @@ impl<D: ConnectorDirectory + ConnectorCapabilities, S: ConnectionStore> Connectolet Some(app) = directory.retrieve(app_slug).await? else {anyhow::bail!("No connectable app has that slug; search the catalog first");};- let connected = self- .connections- .load(user_id, &app.app_slug)- .await- .map_err(|error| {- anyhow::anyhow!("Could not check connector status: {error:?}")- })?- .is_some_and(|connection| connection.enabled);+ let connected = self.connected(user_id, &app.app_slug).await?;let mut tools = directory.tools(user_id, &app.app_slug).await?;let tools_truncated = tools.len() > MAX_TOOLS;tools.truncate(MAX_TOOLS);@@ -136,6 +145,26 @@ impl<D: ConnectorDirectory + ConnectorCapabilities, S: ConnectionStore> Connecto}}}++ async fn connected(+ &self,+ user_id: &MacroUserIdStr<'static>,+ app_slug: &str,+ ) -> anyhow::Result<bool> {+ if let Some(overlay) = self.connections.overlay(app_slug).await? {+ return Ok(self+ .overlay_connections+ .connected_name(user_id, &overlay)+ .await?+ .is_some());+ }+ Ok(self+ .connections+ .load(user_id, app_slug)+ .await+ .map_err(|error| anyhow::anyhow!("Could not check connector status: {error:?}"))?+ .is_some_and(|connection| connection.enabled))+ }}impl From<crate::domain::models::CatalogEntry> for DiscoveredApp {diff --git a/crates/pipedream_mcp/src/domain/service/discovery/test.rs b/crates/pipedream_mcp/src/domain/service/discovery/test.rsindex 58bdcb34a2..8da8c09215 100644--- a/crates/pipedream_mcp/src/domain/service/discovery/test.rs+++ b/crates/pipedream_mcp/src/domain/service/discovery/test.rs@@ -1,5 +1,5 @@use super::*;-use crate::domain::models::{CatalogEntry, CatalogPage, PipedreamConnection};+use crate::domain::models::{CatalogEntry, CatalogPage, ConnectorOverlay, PipedreamConnection};use std::sync::Mutex;struct Directory {@@ -59,8 +59,39 @@ impl ConnectorCapabilities for Directory {struct Store {enabled: Option<bool>,+ overlaid: bool,seen: Mutex<Vec<String>>,}++fn linear_overlay() -> ConnectorOverlay {+ ConnectorOverlay {+ app_slug: "linear".into(),+ server_url: "https://mcp.linear.app/mcp".into(),+ }+}++impl ConnectorOverlays for Store {+ async fn overlays(&self) -> anyhow::Result<Vec<ConnectorOverlay>> {+ panic!("inspect only the requested app")+ }+ async fn overlay(&self, slug: &str) -> anyhow::Result<Option<ConnectorOverlay>> {+ Ok((self.overlaid && slug == "linear").then(linear_overlay))+ }+}++/// The caller's native connection to an overlaid app, by display name.+struct Native(Option<String>);++impl OverlayConnections for Native {+ async fn connected_name(+ &self,+ _: &MacroUserIdStr<'static>,+ overlay: &ConnectorOverlay,+ ) -> anyhow::Result<Option<String>> {+ assert_eq!(*overlay, linear_overlay());+ Ok(self.0.clone())+ }+}impl ConnectionStore for Store {type Err = String;async fn save(&self, _: &PipedreamConnection) -> Result<(), String> {@@ -92,7 +123,7 @@ fn service(enabled: Option<bool>,fail_tools: bool,tool_count: usize,-) -> ConnectorDiscovery<Directory, Store> {+) -> ConnectorDiscovery<Directory, Store, Native> {ConnectorDiscovery::new(Some(Arc::new(Directory {fail_tools,@@ -101,8 +132,10 @@ fn service(})),Arc::new(Store {enabled,+ overlaid: false,seen: Mutex::default(),}),+ Arc::new(Native(Some("Linear".into()))),)}fn user() -> MacroUserIdStr<'static> {@@ -220,3 +253,29 @@ async fn unconfigured_deployments_and_empty_searches_fail_explicitly() {svc.directory = None;assert!(svc.discover(&user(), &inspect("linear")).await.is_err());}++#[tokio::test]+async fn overlaid_apps_report_their_native_connection_not_pipedream() {+ for native in [None, Some("Linear".to_owned())] {+ let svc = ConnectorDiscovery::new(+ Some(Arc::new(Directory {+ fail_tools: false,+ tool_count: 1,+ seen: Mutex::default(),+ })),+ Arc::new(Store {+ enabled: Some(true),+ overlaid: true,+ seen: Mutex::default(),+ }),+ Arc::new(Native(native.clone())),+ );+ let DiscoveryResult::Inspect { connected, .. } =+ svc.discover(&user(), &inspect("linear")).await.unwrap()+ else {+ panic!("inspection expected")+ };+ assert_eq!(connected, native.is_some());+ assert!(svc.connections.seen.lock().unwrap().is_empty());+ }+}diff --git a/crates/pipedream_mcp/src/inbound/axum_router.rs b/crates/pipedream_mcp/src/inbound/axum_router.rsindex 946d899695..bdd5a1b9b1 100644--- a/crates/pipedream_mcp/src/inbound/axum_router.rs+++ b/crates/pipedream_mcp/src/inbound/axum_router.rs@@ -1,6 +1,6 @@use crate::domain::{- models::{CatalogEntry, PipedreamConnection},- ports::{ConnectionStore, ConnectorDirectory, PipedreamConnect},+ models::{CatalogEntry, ConnectorOverlay, PipedreamConnection},+ ports::{ConnectionStore, ConnectorDirectory, ConnectorOverlays, PipedreamConnect},service::{catalog::browse_catalog,connect::{@@ -124,7 +124,7 @@ pub fn pipedream_mcp_router<S, P, Auth, Global>(state: PipedreamRouterState<S, P, Auth>,) -> Router<Global>where- S: ConnectionStore,+ S: ConnectionStore + ConnectorOverlays,P: PipedreamConnect + ConnectorDirectory,Auth: MacroAuthorizationService,anyhow::Error: From<S::Err>,@@ -159,6 +159,7 @@ where"/pipedream/mcp/catalog",get(browse_catalog_handler::<S, P, Auth>),)+ .route("/pipedream/mcp/overlays", get(list_overlays::<S, P, Auth>)).with_state(state)}@@ -376,6 +377,25 @@ pub struct PipedreamCatalogResponse {next_cursor: Option<String>,}+/// A catalog app that connects through its own MCP server instead of+/// Pipedream.+#[derive(Debug, Serialize, ToSchema)]+pub struct PipedreamOverlayResponse {+ /// Pipedream app name slug, as it appears in the catalog.+ app_slug: String,+ /// The MCP server to authorize with the native MCP OAuth flow.+ server_url: String,+}++impl From<ConnectorOverlay> for PipedreamOverlayResponse {+ fn from(overlay: ConnectorOverlay) -> Self {+ Self {+ app_slug: overlay.app_slug,+ server_url: overlay.server_url,+ }+ }+}+// -- error --------------------------------------------------------------------/// Error type for MCP HTTP handlers.@@ -387,6 +407,9 @@ pub enum PipedreamHandlerErr {/// Pipedream is not configured for this deployment.#[error("Pipedream is not configured")]PipedreamNotConfigured,+ /// The app connects through its own MCP server, never Pipedream.+ #[error("{0}")]+ Overlaid(String),/// An internal error occurred.#[error("{0}")]Internal(#[from] anyhow::Error),@@ -396,6 +419,9 @@ impl From<PipedreamConnectError> for PipedreamHandlerErr {fn from(err: PipedreamConnectError) -> Self {match err {PipedreamConnectError::NotFound => PipedreamHandlerErr::NotFound,+ err @ PipedreamConnectError::Overlaid { .. } => {+ PipedreamHandlerErr::Overlaid(err.to_string())+ }PipedreamConnectError::Internal(e) => PipedreamHandlerErr::Internal(e),}}@@ -406,6 +432,7 @@ impl IntoResponse for PipedreamHandlerErr {let status = match &self {PipedreamHandlerErr::NotFound => StatusCode::NOT_FOUND,PipedreamHandlerErr::PipedreamNotConfigured => StatusCode::NOT_IMPLEMENTED,+ PipedreamHandlerErr::Overlaid(_) => StatusCode::CONFLICT,PipedreamHandlerErr::Internal(_) => StatusCode::INTERNAL_SERVER_ERROR,};(@@ -599,6 +626,7 @@ where(status = 200, body = PipedreamConnectionResponse),(status = 401, body = String),(status = 404, body = ErrorResponse),+ (status = 409, body = ErrorResponse),(status = 501, body = ErrorResponse),(status = 500, body = ErrorResponse),)@@ -606,7 +634,8 @@ where/// Register a connected account reported by the Pipedream Connect UI.////// Verifies with Pipedream that the account exists and was connected for-/// the authenticated user before persisting anything.+/// the authenticated user before persisting anything. An overlaid app is+/// refused with 409: it connects through its own MCP server instead.#[tracing::instrument(skip_all, err)]pub async fn complete_connection<S, P, Auth>(State(state): State<PipedreamRouterState<S, P, Auth>>,@@ -614,13 +643,14 @@ pub async fn complete_connection<S, P, Auth>(Json(body): Json<PipedreamCompleteRequest>,) -> Result<Json<PipedreamConnectionResponse>, PipedreamHandlerErr>where- S: ConnectionStore,+ S: ConnectionStore + ConnectorOverlays,P: PipedreamConnect + ConnectorDirectory,Auth: MacroAuthorizationService,anyhow::Error: From<S::Err>,{let user = &authorization.authorization.user;let record = complete_pipedream_connection(+ state.store.as_ref(),state.store.as_ref(),state.pipedream()?.as_ref(),&user.macro_user_id,@@ -646,6 +676,7 @@ where(status = 200, body = PipedreamConnectionResponse),(status = 401, body = String),(status = 404, body = ErrorResponse),+ (status = 409, body = ErrorResponse),(status = 501, body = ErrorResponse),(status = 500, body = ErrorResponse),)@@ -655,6 +686,7 @@ where////// Called after the Connect UI closes without a success event. Answers 404/// when Pipedream has no new account for this user and app.+/// An overlaid app is refused with 409, as in [`complete_connection`].#[tracing::instrument(skip_all, err, fields(connector.app_slug = %body.app_slug))]pub async fn recover_connection<S, P, Auth>(State(state): State<PipedreamRouterState<S, P, Auth>>,@@ -662,13 +694,14 @@ pub async fn recover_connection<S, P, Auth>(Json(body): Json<PipedreamRecoverRequest>,) -> Result<Json<PipedreamConnectionResponse>, PipedreamHandlerErr>where- S: ConnectionStore,+ S: ConnectionStore + ConnectorOverlays,P: PipedreamConnect + ConnectorDirectory,Auth: MacroAuthorizationService,anyhow::Error: From<S::Err>,{let user = &authorization.authorization.user;let record = recover_pipedream_connection(+ state.store.as_ref(),state.store.as_ref(),state.pipedream()?.as_ref(),&user.macro_user_id,@@ -726,3 +759,32 @@ wherenext_cursor: page.next_cursor,}))}++#[utoipa::path(+ get,+ path = "/pipedream/mcp/overlays",+ tag = "pipedream-mcp",+ operation_id = "list_pipedream_mcp_overlays",+ responses(+ (status = 200, body = Vec<PipedreamOverlayResponse>),+ (status = 401, body = String),+ (status = 500, body = ErrorResponse),+ )+)]+/// List the catalog apps that connect through their own MCP server.+///+/// Clients connect these with the native MCP OAuth flow against+/// `server_url`; Pipedream refuses to complete a connection for them.+#[tracing::instrument(skip_all, err)]+pub async fn list_overlays<S, P, Auth>(+ State(state): State<PipedreamRouterState<S, P, Auth>>,+ _authorization: MacroAuthorizationExtractor<Auth, UserOrInternal>,+) -> Result<Json<Vec<PipedreamOverlayResponse>>, PipedreamHandlerErr>+where+ S: ConnectionStore + ConnectorOverlays,+ P: PipedreamConnect + ConnectorDirectory,+ Auth: MacroAuthorizationService,+{+ let overlays = state.store.overlays().await?;+ Ok(Json(overlays.into_iter().map(Into::into).collect()))+}diff --git a/crates/pipedream_mcp/src/inbound/toolset.rs b/crates/pipedream_mcp/src/inbound/toolset.rsindex ff8ec56292..663c000fe9 100644--- a/crates/pipedream_mcp/src/inbound/toolset.rs+++ b/crates/pipedream_mcp/src/inbound/toolset.rs@@ -1,7 +1,10 @@//! Thin AI adapter for connector discovery.use crate::domain::{- ports::{ConnectionStore, ConnectorCapabilities, ConnectorDirectory},+ ports::{+ ConnectionStore, ConnectorCapabilities, ConnectorDirectory, ConnectorOverlays,+ OverlayConnections,+ },service::discovery::{ConnectorDiscovery, DiscoveryRequest, DiscoveryResult},};use ai_toolset::{@@ -14,12 +17,12 @@ use serde::{Deserialize, Serialize};use std::sync::Arc;/// Dependencies for the discovery tool.-pub struct ConnectorToolContext<D, S> {+pub struct ConnectorToolContext<D, S, N> {/// Domain service, constructed by the host.- pub service: Arc<ConnectorDiscovery<D, S>>,+ pub service: Arc<ConnectorDiscovery<D, S, N>>,}-impl<D, S> Clone for ConnectorToolContext<D, S> {+impl<D, S, N> Clone for ConnectorToolContext<D, S, N> {fn clone(&self) -> Self {Self {service: self.service.clone(),@@ -52,15 +55,18 @@ impl ToolAnnotated for DiscoverConnectors {}#[async_trait]-impl<D: ConnectorDirectory + ConnectorCapabilities, S: ConnectionStore>- AsyncTool<ConnectorToolContext<D, S>> for DiscoverConnectors+impl<D, S, N> AsyncTool<ConnectorToolContext<D, S, N>> for DiscoverConnectors+where+ D: ConnectorDirectory + ConnectorCapabilities,+ S: ConnectionStore + ConnectorOverlays,+ N: OverlayConnections,{type Output = DiscoverConnectorsResponse;#[tracing::instrument(skip_all, err)]async fn call(&self,- context: ServiceContext<ConnectorToolContext<D, S>>,+ context: ServiceContext<ConnectorToolContext<D, S, N>>,request: RequestContext,) -> ToolResult<Self::Output> {let result = contextdiff --git a/crates/pipedream_mcp/src/outbound/pg_connection_repo.rs b/crates/pipedream_mcp/src/outbound/pg_connection_repo.rsindex c43de399b7..748b2fe728 100644--- a/crates/pipedream_mcp/src/outbound/pg_connection_repo.rs+++ b/crates/pipedream_mcp/src/outbound/pg_connection_repo.rs@@ -1,9 +1,10 @@-use crate::domain::models::{MacroUserIdStr, PipedreamConnection};-use crate::domain::ports::{AppConnections, ConnectionStore};+use crate::domain::models::{ConnectorOverlay, MacroUserIdStr, PipedreamConnection};+use crate::domain::ports::{AppConnections, ConnectionStore, ConnectorOverlays};use macro_user_id::cowlike::CowLike;use sqlx::PgPool;-/// Postgres-backed [`ConnectionStore`] over the `pipedream_mcp_connections` table.+/// Postgres-backed [`ConnectionStore`] over the `pipedream_mcp_connections` table,+/// and [`ConnectorOverlays`] over `mcp_overlays`.////// Rows hold no secrets: Pipedream owns the OAuth grants, we persist only/// the app, its display name, and the Pipedream account ID.@@ -56,6 +57,7 @@ impl ConnectionStore for PgConnectionRepo {SELECT user_id, app_slug, server_name, account_id, enabledFROM pipedream_mcp_connectionsWHERE user_id = $1 AND app_slug = $2+ AND NOT EXISTS (SELECT 1 FROM mcp_overlays o WHERE o.app_slug = $2)"#,user_id.as_ref(),app_slug,@@ -99,8 +101,9 @@ impl ConnectionStore for PgConnectionRepo {let rows = sqlx::query!(r#"SELECT user_id, app_slug, server_name, account_id, enabled- FROM pipedream_mcp_connections+ FROM pipedream_mcp_connections cWHERE user_id = $1+ AND NOT EXISTS (SELECT 1 FROM mcp_overlays o WHERE o.app_slug = c.app_slug)ORDER BY server_name"#,user_id.as_ref(),@@ -133,6 +136,7 @@ impl AppConnections for PgConnectionRepo {SELECT user_id, app_slug, server_name, account_id, enabledFROM pipedream_mcp_connectionsWHERE app_slug = $1 AND enabled+ AND NOT EXISTS (SELECT 1 FROM mcp_overlays o WHERE o.app_slug = $1)"#,app_slug,)@@ -153,6 +157,29 @@ impl AppConnections for PgConnectionRepo {}}+impl ConnectorOverlays for PgConnectionRepo {+ #[tracing::instrument(skip(self), err)]+ async fn overlays(&self) -> anyhow::Result<Vec<ConnectorOverlay>> {+ Ok(sqlx::query_as!(+ ConnectorOverlay,+ "SELECT app_slug, server_url FROM mcp_overlays ORDER BY app_slug"+ )+ .fetch_all(&self.pool)+ .await?)+ }++ #[tracing::instrument(skip(self), err)]+ async fn overlay(&self, app_slug: &str) -> anyhow::Result<Option<ConnectorOverlay>> {+ Ok(sqlx::query_as!(+ ConnectorOverlay,+ "SELECT app_slug, server_url FROM mcp_overlays WHERE app_slug = $1",+ app_slug,+ )+ .fetch_optional(&self.pool)+ .await?)+ }+}+fn to_record(user_id: String,app_slug: String,@@ -169,3 +196,6 @@ fn to_record(enabled,})}++#[cfg(test)]+mod test;diff --git a/crates/pipedream_mcp/src/outbound/pg_connection_repo/test.rs b/crates/pipedream_mcp/src/outbound/pg_connection_repo/test.rsnew file mode 100644index 0000000000..4a78c74629--- /dev/null+++ b/crates/pipedream_mcp/src/outbound/pg_connection_repo/test.rs@@ -0,0 +1,55 @@+use super::*;+use macro_db_migrator::MACRO_DB_MIGRATIONS;++fn connection(app_slug: &str) -> PipedreamConnection {+ PipedreamConnection {+ user_id: MacroUserIdStr::parse_from_str("macro|[email protected]")+ .unwrap()+ .into_owned(),+ app_slug: app_slug.to_owned(),+ server_name: app_slug.to_owned(),+ account_id: format!("apn_{app_slug}"),+ enabled: true,+ }+}++/// `sentry` is overlaid by the seed and `google_sheets` is not: a Pipedream+/// row for an overlaid app is invisible to every read, so no consumer can+/// reach the app through Pipedream.+#[sqlx::test(migrator = "MACRO_DB_MIGRATIONS")]+async fn reads_never_return_connections_to_overlaid_apps(pool: PgPool) {+ let repo = PgConnectionRepo::new(pool);+ let user = connection("sentry").user_id;+ repo.save(&connection("sentry")).await.unwrap();+ repo.save(&connection("google_sheets")).await.unwrap();++ let listed: Vec<String> = repo+ .list(&user)+ .await+ .unwrap()+ .into_iter()+ .map(|c| c.app_slug)+ .collect();+ assert_eq!(listed, ["google_sheets"]);+ assert!(repo.load(&user, "sentry").await.unwrap().is_none());+ assert!(repo.load(&user, "google_sheets").await.unwrap().is_some());+ assert!(+ repo.list_enabled_for_app("sentry")+ .await+ .unwrap()+ .is_empty()+ );++ assert_eq!(+ repo.overlay("sentry").await.unwrap().map(|o| o.server_url),+ Some("https://mcp.sentry.dev/mcp".to_owned())+ );+ assert!(repo.overlay("google_sheets").await.unwrap().is_none());+ assert!(+ repo.overlays()+ .await+ .unwrap()+ .iter()+ .any(|o| o.app_slug == "sentry")+ );+}diff --git a/docs/agent-guide/ai-chat.md b/docs/agent-guide/ai-chat.mdindex 30e8d42380..1727e37650 100644--- a/docs/agent-guide/ai-chat.md+++ b/docs/agent-guide/ai-chat.md@@ -22,7 +22,11 @@ tool list. Expand the discovery row to see the results. An app name alone doesnot establish that the requested action is supported.For a suitable unconnected app, the assistant offers **Connect <app>**. Clicking-it opens the hosted authorization flow over the agent transcript on web. In+it opens the hosted authorization flow over the agent transcript on web. For an+overlaid app (one with its own MCP server, see Settings → Integrations) it+opens that server's OAuth consent in a new tab instead, and the session+continues once the server is authorized; the agent then reaches the app+through that server rather than Pipedream. Innative apps, consent opens in the system browser, which returns to Macro on itsown after authorization (**Return to Macro** is the fallback link). The waitingdialog's **Done** checks Pipedream for an account the flow created, and callbacksdiff --git a/docs/agent-guide/settings.md b/docs/agent-guide/settings.mdindex 6b9d0b8b40..e9b4e00bf8 100644--- a/docs/agent-guide/settings.md+++ b/docs/agent-guide/settings.md@@ -586,6 +586,13 @@ page automatically and preserves category groups. A failed next page keeps loadeapps visible and offers Retry. Use the category picker belowAll apps to show one group; changing the search returns to all categories. Groupcounts reflect the currently loaded results.+Overlaid catalog apps (the `mcp_overlays` table, served at+`GET /pipedream/mcp/overlays`) look the same in the catalog but never open+Pipedream: their plus action opens the vendor's own MCP OAuth consent in a new+tab (system browser on native) and the card turns connected once that server is+authorized, after which the app appears with the custom MCP servers under+Installed. Verify with an overlaid app such as Sentry or Asana; completing a+Pipedream connection for one answers 409.Featured and catalog cards use two columns on wide screens and one on narrowscreens, with a plus action for available apps. Featured cards show app nameswithout descriptions, and catalog descriptionsdiff --git a/packages/sdk-docs/reference/generated/cognition/types.gen/README.md b/packages/sdk-docs/reference/generated/cognition/types.gen/README.mdindex 1c2e3462d4..306db7e30e 100644--- a/packages/sdk-docs/reference/generated/cognition/types.gen/README.md+++ b/packages/sdk-docs/reference/generated/cognition/types.gen/README.md@@ -207,6 +207,11 @@- [ListPipedreamMcpConnectionsErrors](type-aliases/ListPipedreamMcpConnectionsErrors.md)- [ListPipedreamMcpConnectionsResponse](type-aliases/ListPipedreamMcpConnectionsResponse.md)- [ListPipedreamMcpConnectionsResponses](type-aliases/ListPipedreamMcpConnectionsResponses.md)+- [ListPipedreamMcpOverlaysData](type-aliases/ListPipedreamMcpOverlaysData.md)+- [ListPipedreamMcpOverlaysError](type-aliases/ListPipedreamMcpOverlaysError.md)+- [ListPipedreamMcpOverlaysErrors](type-aliases/ListPipedreamMcpOverlaysErrors.md)+- [ListPipedreamMcpOverlaysResponse](type-aliases/ListPipedreamMcpOverlaysResponse.md)+- [ListPipedreamMcpOverlaysResponses](type-aliases/ListPipedreamMcpOverlaysResponses.md)- [MacroUserIdStr](type-aliases/MacroUserIdStr.md)- [McpAuthCallbackData](type-aliases/McpAuthCallbackData.md)- [McpAuthCallbackError](type-aliases/McpAuthCallbackError.md)@@ -249,6 +254,7 @@- [PipedreamCatalogResponse](type-aliases/PipedreamCatalogResponse.md)- [PipedreamCompleteRequest](type-aliases/PipedreamCompleteRequest.md)- [PipedreamConnectionResponse](type-aliases/PipedreamConnectionResponse.md)+- [PipedreamOverlayResponse](type-aliases/PipedreamOverlayResponse.md)- [PipedreamRecoverRequest](type-aliases/PipedreamRecoverRequest.md)- [PipedreamTokenResponse](type-aliases/PipedreamTokenResponse.md)- [PipedreamUpdateRequest](type-aliases/PipedreamUpdateRequest.md)diff --git a/packages/sdk-docs/reference/generated/cognition/types.gen/type-aliases/CompletePipedreamMcpConnectionErrors.md b/packages/sdk-docs/reference/generated/cognition/types.gen/type-aliases/CompletePipedreamMcpConnectionErrors.mdindex ac656fbc91..5b41efd124 100644--- a/packages/sdk-docs/reference/generated/cognition/types.gen/type-aliases/CompletePipedreamMcpConnectionErrors.md+++ b/packages/sdk-docs/reference/generated/cognition/types.gen/type-aliases/CompletePipedreamMcpConnectionErrors.md@@ -1,6 +1,6 @@# Type Alias: CompletePipedreamMcpConnectionErrors-> **CompletePipedreamMcpConnectionErrors** = \{ `401`: `string`; `404`: [`ErrorResponse`](ErrorResponse.md); `500`: [`ErrorResponse`](ErrorResponse.md); `501`: [`ErrorResponse`](ErrorResponse.md); \}+> **CompletePipedreamMcpConnectionErrors** = \{ `401`: `string`; `404`: [`ErrorResponse`](ErrorResponse.md); `409`: [`ErrorResponse`](ErrorResponse.md); `500`: [`ErrorResponse`](ErrorResponse.md); `501`: [`ErrorResponse`](ErrorResponse.md); \}## Properties@@ -8,5 +8,6 @@| ------ | ------ || <a id="property-401"></a> `401` | `string` || <a id="property-404"></a> `404` | [`ErrorResponse`](ErrorResponse.md) |+| <a id="property-409"></a> `409` | [`ErrorResponse`](ErrorResponse.md) || <a id="property-500"></a> `500` | [`ErrorResponse`](ErrorResponse.md) || <a id="property-501"></a> `501` | [`ErrorResponse`](ErrorResponse.md) |diff --git a/packages/sdk-docs/reference/generated/cognition/types.gen/type-aliases/ListPipedreamMcpOverlaysData.md b/packages/sdk-docs/reference/generated/cognition/types.gen/type-aliases/ListPipedreamMcpOverlaysData.mdnew file mode 100644index 0000000000..ab0fbb34db--- /dev/null+++ b/packages/sdk-docs/reference/generated/cognition/types.gen/type-aliases/ListPipedreamMcpOverlaysData.md@@ -0,0 +1,12 @@+# Type Alias: ListPipedreamMcpOverlaysData++> **ListPipedreamMcpOverlaysData** = \{ `body?`: `never`; `path?`: `never`; `query?`: `never`; `url`: `"/pipedream/mcp/overlays"`; \}++## Properties++| Property | Type |+| ------ | ------ |+| <a id="property-body"></a> `body?` | `never` |+| <a id="property-path"></a> `path?` | `never` |+| <a id="property-query"></a> `query?` | `never` |+| <a id="property-url"></a> `url` | `"/pipedream/mcp/overlays"` |diff --git a/packages/sdk-docs/reference/generated/cognition/types.gen/type-aliases/ListPipedreamMcpOverlaysError.md b/packages/sdk-docs/reference/generated/cognition/types.gen/type-aliases/ListPipedreamMcpOverlaysError.mdnew file mode 100644index 0000000000..253c922bc3--- /dev/null+++ b/packages/sdk-docs/reference/generated/cognition/types.gen/type-aliases/ListPipedreamMcpOverlaysError.md@@ -0,0 +1,3 @@+# Type Alias: ListPipedreamMcpOverlaysError++> **ListPipedreamMcpOverlaysError** = [`ListPipedreamMcpOverlaysErrors`](ListPipedreamMcpOverlaysErrors.md)\[keyof [`ListPipedreamMcpOverlaysErrors`](ListPipedreamMcpOverlaysErrors.md)\]diff --git a/packages/sdk-docs/reference/generated/cognition/types.gen/type-aliases/ListPipedreamMcpOverlaysErrors.md b/packages/sdk-docs/reference/generated/cognition/types.gen/type-aliases/ListPipedreamMcpOverlaysErrors.mdnew file mode 100644index 0000000000..feb4b83120--- /dev/null+++ b/packages/sdk-docs/reference/generated/cognition/types.gen/type-aliases/ListPipedreamMcpOverlaysErrors.md@@ -0,0 +1,10 @@+# Type Alias: ListPipedreamMcpOverlaysErrors++> **ListPipedreamMcpOverlaysErrors** = \{ `401`: `string`; `500`: [`ErrorResponse`](ErrorResponse.md); \}++## Properties++| Property | Type |+| ------ | ------ |+| <a id="property-401"></a> `401` | `string` |+| <a id="property-500"></a> `500` | [`ErrorResponse`](ErrorResponse.md) |diff --git a/packages/sdk-docs/reference/generated/cognition/types.gen/type-aliases/ListPipedreamMcpOverlaysResponse.md b/packages/sdk-docs/reference/generated/cognition/types.gen/type-aliases/ListPipedreamMcpOverlaysResponse.mdnew file mode 100644index 0000000000..0610446802--- /dev/null+++ b/packages/sdk-docs/reference/generated/cognition/types.gen/type-aliases/ListPipedreamMcpOverlaysResponse.md@@ -0,0 +1,3 @@+# Type Alias: ListPipedreamMcpOverlaysResponse++> **ListPipedreamMcpOverlaysResponse** = [`ListPipedreamMcpOverlaysResponses`](ListPipedreamMcpOverlaysResponses.md)\[keyof [`ListPipedreamMcpOverlaysResponses`](ListPipedreamMcpOverlaysResponses.md)\]diff --git a/packages/sdk-docs/reference/generated/cognition/types.gen/type-aliases/ListPipedreamMcpOverlaysResponses.md b/packages/sdk-docs/reference/generated/cognition/types.gen/type-aliases/ListPipedreamMcpOverlaysResponses.mdnew file mode 100644index 0000000000..275bc229ee--- /dev/null+++ b/packages/sdk-docs/reference/generated/cognition/types.gen/type-aliases/ListPipedreamMcpOverlaysResponses.md@@ -0,0 +1,9 @@+# Type Alias: ListPipedreamMcpOverlaysResponses++> **ListPipedreamMcpOverlaysResponses** = \{ `200`: [`PipedreamOverlayResponse`](PipedreamOverlayResponse.md)[]; \}++## Properties++| Property | Type |+| ------ | ------ |+| <a id="property-200"></a> `200` | [`PipedreamOverlayResponse`](PipedreamOverlayResponse.md)[] |diff --git a/packages/sdk-docs/reference/generated/cognition/types.gen/type-aliases/PipedreamOverlayResponse.md b/packages/sdk-docs/reference/generated/cognition/types.gen/type-aliases/PipedreamOverlayResponse.mdnew file mode 100644index 0000000000..86c5172a7a--- /dev/null+++ b/packages/sdk-docs/reference/generated/cognition/types.gen/type-aliases/PipedreamOverlayResponse.md@@ -0,0 +1,13 @@+# Type Alias: PipedreamOverlayResponse++> **PipedreamOverlayResponse** = \{ `app_slug`: `string`; `server_url`: `string`; \}++A catalog app that connects through its own MCP server instead of+Pipedream.++## Properties++| Property | Type | Description |+| ------ | ------ | ------ |+| <a id="property-app_slug"></a> `app_slug` | `string` | Pipedream app name slug, as it appears in the catalog. |+| <a id="property-server_url"></a> `server_url` | `string` | The MCP server to authorize with the native MCP OAuth flow. |diff --git a/packages/sdk-docs/reference/generated/cognition/types.gen/type-aliases/RecoverPipedreamMcpConnectionErrors.md b/packages/sdk-docs/reference/generated/cognition/types.gen/type-aliases/RecoverPipedreamMcpConnectionErrors.mdindex a3cd30957c..2b6d971584 100644--- a/packages/sdk-docs/reference/generated/cognition/types.gen/type-aliases/RecoverPipedreamMcpConnectionErrors.md+++ b/packages/sdk-docs/reference/generated/cognition/types.gen/type-aliases/RecoverPipedreamMcpConnectionErrors.md@@ -1,6 +1,6 @@# Type Alias: RecoverPipedreamMcpConnectionErrors-> **RecoverPipedreamMcpConnectionErrors** = \{ `401`: `string`; `404`: [`ErrorResponse`](ErrorResponse.md); `500`: [`ErrorResponse`](ErrorResponse.md); `501`: [`ErrorResponse`](ErrorResponse.md); \}+> **RecoverPipedreamMcpConnectionErrors** = \{ `401`: `string`; `404`: [`ErrorResponse`](ErrorResponse.md); `409`: [`ErrorResponse`](ErrorResponse.md); `500`: [`ErrorResponse`](ErrorResponse.md); `501`: [`ErrorResponse`](ErrorResponse.md); \}## Properties@@ -8,5 +8,6 @@| ------ | ------ || <a id="property-401"></a> `401` | `string` || <a id="property-404"></a> `404` | [`ErrorResponse`](ErrorResponse.md) |+| <a id="property-409"></a> `409` | [`ErrorResponse`](ErrorResponse.md) || <a id="property-500"></a> `500` | [`ErrorResponse`](ErrorResponse.md) || <a id="property-501"></a> `501` | [`ErrorResponse`](ErrorResponse.md) |diff --git a/packages/sdk/generated/cognition/index.ts b/packages/sdk/generated/cognition/index.tsindex c9be5a8d83..ce007fc125 100644--- a/packages/sdk/generated/cognition/index.ts+++ b/packages/sdk/generated/cognition/index.ts@@ -1,4 +1,4 @@// This file is auto-generated by @hey-api/openapi-tsexport { type Options, Sdk } from './sdk.gen';-export type { AccessLevel, AddMcpServerData, AddMcpServerError, AddMcpServerErrors, AddMcpServerResponse, AddMcpServerResponses, AddServerRequest, AiFeature, AssistantMessagePart, AttachmentMetadata, AttachmentType, BrowsePipedreamMcpCatalogData, BrowsePipedreamMcpCatalogError, BrowsePipedreamMcpCatalogErrors, BrowsePipedreamMcpCatalogResponse, BrowsePipedreamMcpCatalogResponses, CallToolData, CallToolError, CallToolErrors, CallToolRequest, CallToolResponse, CallToolResponse2, CallToolResponses, CancelNotionHandlerData, CancelNotionHandlerErrors, CancelNotionHandlerResponse, CancelNotionHandlerResponses, CancelWorkspaceHandlerData, CancelWorkspaceHandlerResponse, CancelWorkspaceHandlerResponses, ChannelSharePermission, ChannelType, Chat, ChatAttachment, ChatHistory, ChatHistoryBatchMessagesRequest, ChatMessage, ChatMessageContent, ChatMessageError, ChatMessageWithAttachments, ChatPreview, ChatPreviewData, ChatResponse, ChatStream, ClientOptions, CompleteHandlerData, CompleteHandlerErrors, CompleteHandlerResponse, CompleteHandlerResponses, CompleteOnboardingRequest, CompletePipedreamMcpConnectionData, CompletePipedreamMcpConnectionError, CompletePipedreamMcpConnectionErrors, CompletePipedreamMcpConnectionResponse, CompletePipedreamMcpConnectionResponses, CompletionUsage, ConnectedServer, ConversationRecord, CopyChatData, CopyChatError, CopyChatErrors, CopyChatResponse, CopyChatResponses, CreateChatData, CreateChatError, CreateChatErrors, CreateChatRequest, CreateChatResponse, CreateChatResponses, CreatePipedreamMcpTokenData, CreatePipedreamMcpTokenError, CreatePipedreamMcpTokenErrors, CreatePipedreamMcpTokenResponse, CreatePipedreamMcpTokenResponses, DatabaseChange, DecisionErrorBody, DecisionRequest, DecisionResponse, DecisionsData, DecisionsError, DecisionsErrors, DecisionsResponse, DecisionsResponses, DeleteChatData, DeleteChatError, DeleteChatErrors, DeleteChatResponses, DeleteMcpServerData, DeleteMcpServerError, DeleteMcpServerErrors, DeleteMcpServerResponse, DeleteMcpServerResponses, DeletePipedreamMcpConnectionData, DeletePipedreamMcpConnectionError, DeletePipedreamMcpConnectionErrors, DeletePipedreamMcpConnectionResponse, DeletePipedreamMcpConnectionResponses, DiscoverHandlerData, DiscoverHandlerErrors, DiscoverHandlerResponse, DiscoverHandlerResponses, DismissedPrompts, DismissedPromptsHandlerData, DismissedPromptsHandlerErrors, DismissedPromptsHandlerResponse, DismissedPromptsHandlerResponses, DismissPromptHandlerData, DismissPromptHandlerErrors, DismissPromptHandlerResponse, DismissPromptHandlerResponses, DocumentCognitionServiceApiVersion, DocumentReference, DocumentTextPart, DynamicSchema, Entity, EntityType, ErrorBody, ErrorResponse, Expiry, FeatureUsage, FileType, FreeTierModel, GenericErrorResponse, GetBatchPreviewData, GetBatchPreviewError, GetBatchPreviewErrors, GetBatchPreviewRequest, GetBatchPreviewResponse, GetBatchPreviewResponse2, GetBatchPreviewResponses, GetChatData, GetChatError, GetChatErrors, GetChatHistoryBatchMessagesHandlerData, GetChatHistoryBatchMessagesHandlerError, GetChatHistoryBatchMessagesHandlerErrors, GetChatHistoryBatchMessagesHandlerResponse, GetChatHistoryBatchMessagesHandlerResponses, GetChatHistoryHandlerData, GetChatHistoryHandlerError, GetChatHistoryHandlerErrors, GetChatHistoryHandlerResponse, GetChatHistoryHandlerResponses, GetChatPermissionsData, GetChatPermissionsError, GetChatPermissionsErrors, GetChatPermissionsResponse, GetChatPermissionsResponse2, GetChatPermissionsResponses, GetChatResponse, GetChatResponse2, GetChatResponses, GetChatsForAttachmentHandlerData, GetChatsForAttachmentHandlerError, GetChatsForAttachmentHandlerErrors, GetChatsForAttachmentHandlerResponse, GetChatsForAttachmentHandlerResponses, GetChatsForAttachmentResponse, GetCitationHandlerData, GetCitationHandlerError, GetCitationHandlerErrors, GetCitationHandlerResponse, GetCitationHandlerResponses, GetMemoryHandlerData, GetMemoryHandlerError, GetMemoryHandlerErrors, GetMemoryHandlerResponse, GetMemoryHandlerResponses, GetStateHandler2Data, GetStateHandler2Errors, GetStateHandler2Response, GetStateHandler2Responses, GetStateHandlerData, GetStateHandlerErrors, GetStateHandlerResponse, GetStateHandlerResponses, GetUsageHandlerData, GetUsageHandlerError, GetUsageHandlerErrors, GetUsageHandlerResponse, GetUsageHandlerResponses, HealthHandlerData, HealthHandlerResponse, HealthHandlerResponses, HttpSendChatMessageRequest, ImportEntity, ImportKind, ImportRun, ImportSource, ImportState, ImportStatus, Initiator, JwtPayload, LinearIssueMeta, LinkShare, ListMcpServersData, ListMcpServersError, ListMcpServersErrors, ListMcpServersResponse, ListMcpServersResponses, ListPipedreamMcpConnectionsData, ListPipedreamMcpConnectionsError, ListPipedreamMcpConnectionsErrors, ListPipedreamMcpConnectionsResponse, ListPipedreamMcpConnectionsResponses, MacroUserIdStr, McpAuthCallbackData, McpAuthCallbackError, McpAuthCallbackErrors, McpAuthCallbackResponses, McpOauthClientMetadataData, McpOauthClientMetadataResponses, MemoryErrorBody, MemoryResponse, MessageWithAttachments, ModelSpeed, NewAttachment, NewChatMessage, NewMessageAttachment, NotionAlreadyImported, NotionDecision, NotionDocMeta, NotionImporter, NotionImportReport, NotionPlanItem, NotionReportHandlerData, NotionReportHandlerErrors, NotionReportHandlerResponse, NotionReportHandlerResponses, NotionReportItem, NotionTaskFields, OnboardingRow, OnboardingState, OnboardingStatus, PatchChatData, PatchChatError, PatchChatErrors, PatchChatRequest, PatchChatResponses, PermanentlyDeleteChatData, PermanentlyDeleteChatError, PermanentlyDeleteChatErrors, PermanentlyDeleteChatResponses, PipedreamCatalogEntryResponse, PipedreamCatalogResponse, PipedreamCompleteRequest, PipedreamConnectionResponse, PipedreamRecoverRequest, PipedreamTokenResponse, PipedreamUpdateRequest, Price, ProjectionStateResponse, ProjectionStatus, RecoverPipedreamMcpConnectionData, RecoverPipedreamMcpConnectionError, RecoverPipedreamMcpConnectionErrors, RecoverPipedreamMcpConnectionResponse, RecoverPipedreamMcpConnectionResponses, RefreshCadence, RejectToolCallData, RejectToolCallError, RejectToolCallErrors, RejectToolCallRequest, RejectToolCallResponses, RevertDeleteChatData, RevertDeleteChatError, RevertDeleteChatErrors, RevertDeleteChatResponses, Role, RunImportHandlerData, RunImportHandlerErrors, RunImportHandlerResponse, RunImportHandlerResponses, RunImportOutcome, RunImportRequest, RunStatus, ScanCounts, SendChatMessageData, SendChatMessageError, SendChatMessageErrors, SendChatMessagePayload, SendChatMessageResponse, SendChatMessageResponse2, SendChatMessageResponses, ServerResponse, SetPricingHandlerData, SetPricingHandlerError, SetPricingHandlerErrors, SetPricingHandlerResponses, SetPricingRequest, SharePermissionV2, SlackChannelMeta, SlackParticipant, StartAuthRequest, StartAuthResponse, StartMcpAuthData, StartMcpAuthError, StartMcpAuthErrors, StartMcpAuthResponse, StartMcpAuthResponses, StopChatStreamData, StopChatStreamError, StopChatStreamError2, StopChatStreamErrors, StopChatStreamRequest, StopChatStreamResponse, StopChatStreamResponse2, StopChatStreamResponses, StreamError, StringIdResponse, StructuredCompletionData, StructuredCompletionError, StructuredCompletionError2, StructuredCompletionErrors, StructuredCompletionOutcome, StructuredCompletionRequest, StructuredCompletionResponse, StructuredCompletionResponse2, StructuredCompletionResponses, StructuredToolActivity, TargetType, ToolOutcome, ToolSet, UpdateChannelSharePermission, UpdateMcpServerData, UpdateMcpServerError, UpdateMcpServerErrors, UpdateMcpServerResponse, UpdateMcpServerResponses, UpdateOperation, UpdatePipedreamMcpConnectionData, UpdatePipedreamMcpConnectionError, UpdatePipedreamMcpConnectionErrors, UpdatePipedreamMcpConnectionResponse, UpdatePipedreamMcpConnectionResponses, UpdateServerRequest, UpdateSharePermissionRequestV2, UpdateToolCallData, UpdateToolCallError, UpdateToolCallErrors, UpdateToolCallRequest, UpdateToolCallResponses, UpdateToolResponseData, UpdateToolResponseError, UpdateToolResponseErrors, UpdateToolResponseRequest, UpdateToolResponseResponses, UpsertAiProjectionData, UpsertAiProjectionError, UpsertAiProjectionErrors, UpsertAiProjectionResponse, UpsertAiProjectionResponses, UpsertProjectionRequest, Usage, UsageRequest, UsageSummary, UserPdfRect, UserToolResponseValue, WebCitation, WithChatId, WorkspaceReportHandlerData, WorkspaceReportHandlerResponse, WorkspaceReportHandlerResponses } from './types.gen';+export type { AccessLevel, AddMcpServerData, AddMcpServerError, AddMcpServerErrors, AddMcpServerResponse, AddMcpServerResponses, AddServerRequest, AiFeature, AssistantMessagePart, AttachmentMetadata, AttachmentType, BrowsePipedreamMcpCatalogData, BrowsePipedreamMcpCatalogError, BrowsePipedreamMcpCatalogErrors, BrowsePipedreamMcpCatalogResponse, BrowsePipedreamMcpCatalogResponses, CallToolData, CallToolError, CallToolErrors, CallToolRequest, CallToolResponse, CallToolResponse2, CallToolResponses, CancelNotionHandlerData, CancelNotionHandlerErrors, CancelNotionHandlerResponse, CancelNotionHandlerResponses, CancelWorkspaceHandlerData, CancelWorkspaceHandlerResponse, CancelWorkspaceHandlerResponses, ChannelSharePermission, ChannelType, Chat, ChatAttachment, ChatHistory, ChatHistoryBatchMessagesRequest, ChatMessage, ChatMessageContent, ChatMessageError, ChatMessageWithAttachments, ChatPreview, ChatPreviewData, ChatResponse, ChatStream, ClientOptions, CompleteHandlerData, CompleteHandlerErrors, CompleteHandlerResponse, CompleteHandlerResponses, CompleteOnboardingRequest, CompletePipedreamMcpConnectionData, CompletePipedreamMcpConnectionError, CompletePipedreamMcpConnectionErrors, CompletePipedreamMcpConnectionResponse, CompletePipedreamMcpConnectionResponses, CompletionUsage, ConnectedServer, ConversationRecord, CopyChatData, CopyChatError, CopyChatErrors, CopyChatResponse, CopyChatResponses, CreateChatData, CreateChatError, CreateChatErrors, CreateChatRequest, CreateChatResponse, CreateChatResponses, CreatePipedreamMcpTokenData, CreatePipedreamMcpTokenError, CreatePipedreamMcpTokenErrors, CreatePipedreamMcpTokenResponse, CreatePipedreamMcpTokenResponses, DatabaseChange, DecisionErrorBody, DecisionRequest, DecisionResponse, DecisionsData, DecisionsError, DecisionsErrors, DecisionsResponse, DecisionsResponses, DeleteChatData, DeleteChatError, DeleteChatErrors, DeleteChatResponses, DeleteMcpServerData, DeleteMcpServerError, DeleteMcpServerErrors, DeleteMcpServerResponse, DeleteMcpServerResponses, DeletePipedreamMcpConnectionData, DeletePipedreamMcpConnectionError, DeletePipedreamMcpConnectionErrors, DeletePipedreamMcpConnectionResponse, DeletePipedreamMcpConnectionResponses, DiscoverHandlerData, DiscoverHandlerErrors, DiscoverHandlerResponse, DiscoverHandlerResponses, DismissedPrompts, DismissedPromptsHandlerData, DismissedPromptsHandlerErrors, DismissedPromptsHandlerResponse, DismissedPromptsHandlerResponses, DismissPromptHandlerData, DismissPromptHandlerErrors, DismissPromptHandlerResponse, DismissPromptHandlerResponses, DocumentCognitionServiceApiVersion, DocumentReference, DocumentTextPart, DynamicSchema, Entity, EntityType, ErrorBody, ErrorResponse, Expiry, FeatureUsage, FileType, FreeTierModel, GenericErrorResponse, GetBatchPreviewData, GetBatchPreviewError, GetBatchPreviewErrors, GetBatchPreviewRequest, GetBatchPreviewResponse, GetBatchPreviewResponse2, GetBatchPreviewResponses, GetChatData, GetChatError, GetChatErrors, GetChatHistoryBatchMessagesHandlerData, GetChatHistoryBatchMessagesHandlerError, GetChatHistoryBatchMessagesHandlerErrors, GetChatHistoryBatchMessagesHandlerResponse, GetChatHistoryBatchMessagesHandlerResponses, GetChatHistoryHandlerData, GetChatHistoryHandlerError, GetChatHistoryHandlerErrors, GetChatHistoryHandlerResponse, GetChatHistoryHandlerResponses, GetChatPermissionsData, GetChatPermissionsError, GetChatPermissionsErrors, GetChatPermissionsResponse, GetChatPermissionsResponse2, GetChatPermissionsResponses, GetChatResponse, GetChatResponse2, GetChatResponses, GetChatsForAttachmentHandlerData, GetChatsForAttachmentHandlerError, GetChatsForAttachmentHandlerErrors, GetChatsForAttachmentHandlerResponse, GetChatsForAttachmentHandlerResponses, GetChatsForAttachmentResponse, GetCitationHandlerData, GetCitationHandlerError, GetCitationHandlerErrors, GetCitationHandlerResponse, GetCitationHandlerResponses, GetMemoryHandlerData, GetMemoryHandlerError, GetMemoryHandlerErrors, GetMemoryHandlerResponse, GetMemoryHandlerResponses, GetStateHandler2Data, GetStateHandler2Errors, GetStateHandler2Response, GetStateHandler2Responses, GetStateHandlerData, GetStateHandlerErrors, GetStateHandlerResponse, GetStateHandlerResponses, GetUsageHandlerData, GetUsageHandlerError, GetUsageHandlerErrors, GetUsageHandlerResponse, GetUsageHandlerResponses, HealthHandlerData, HealthHandlerResponse, HealthHandlerResponses, HttpSendChatMessageRequest, ImportEntity, ImportKind, ImportRun, ImportSource, ImportState, ImportStatus, Initiator, JwtPayload, LinearIssueMeta, LinkShare, ListMcpServersData, ListMcpServersError, ListMcpServersErrors, ListMcpServersResponse, ListMcpServersResponses, ListPipedreamMcpConnectionsData, ListPipedreamMcpConnectionsError, ListPipedreamMcpConnectionsErrors, ListPipedreamMcpConnectionsResponse, ListPipedreamMcpConnectionsResponses, ListPipedreamMcpOverlaysData, ListPipedreamMcpOverlaysError, ListPipedreamMcpOverlaysErrors, ListPipedreamMcpOverlaysResponse, ListPipedreamMcpOverlaysResponses, MacroUserIdStr, McpAuthCallbackData, McpAuthCallbackError, McpAuthCallbackErrors, McpAuthCallbackResponses, McpOauthClientMetadataData, McpOauthClientMetadataResponses, MemoryErrorBody, MemoryResponse, MessageWithAttachments, ModelSpeed, NewAttachment, NewChatMessage, NewMessageAttachment, NotionAlreadyImported, NotionDecision, NotionDocMeta, NotionImporter, NotionImportReport, NotionPlanItem, NotionReportHandlerData, NotionReportHandlerErrors, NotionReportHandlerResponse, NotionReportHandlerResponses, NotionReportItem, NotionTaskFields, OnboardingRow, OnboardingState, OnboardingStatus, PatchChatData, PatchChatError, PatchChatErrors, PatchChatRequest, PatchChatResponses, PermanentlyDeleteChatData, PermanentlyDeleteChatError, PermanentlyDeleteChatErrors, PermanentlyDeleteChatResponses, PipedreamCatalogEntryResponse, PipedreamCatalogResponse, PipedreamCompleteRequest, PipedreamConnectionResponse, PipedreamOverlayResponse, PipedreamRecoverRequest, PipedreamTokenResponse, PipedreamUpdateRequest, Price, ProjectionStateResponse, ProjectionStatus, RecoverPipedreamMcpConnectionData, RecoverPipedreamMcpConnectionError, RecoverPipedreamMcpConnectionErrors, RecoverPipedreamMcpConnectionResponse, RecoverPipedreamMcpConnectionResponses, RefreshCadence, RejectToolCallData, RejectToolCallError, RejectToolCallErrors, RejectToolCallRequest, RejectToolCallResponses, RevertDeleteChatData, RevertDeleteChatError, RevertDeleteChatErrors, RevertDeleteChatResponses, Role, RunImportHandlerData, RunImportHandlerErrors, RunImportHandlerResponse, RunImportHandlerResponses, RunImportOutcome, RunImportRequest, RunStatus, ScanCounts, SendChatMessageData, SendChatMessageError, SendChatMessageErrors, SendChatMessagePayload, SendChatMessageResponse, SendChatMessageResponse2, SendChatMessageResponses, ServerResponse, SetPricingHandlerData, SetPricingHandlerError, SetPricingHandlerErrors, SetPricingHandlerResponses, SetPricingRequest, SharePermissionV2, SlackChannelMeta, SlackParticipant, StartAuthRequest, StartAuthResponse, StartMcpAuthData, StartMcpAuthError, StartMcpAuthErrors, StartMcpAuthResponse, StartMcpAuthResponses, StopChatStreamData, StopChatStreamError, StopChatStreamError2, StopChatStreamErrors, StopChatStreamRequest, StopChatStreamResponse, StopChatStreamResponse2, StopChatStreamResponses, StreamError, StringIdResponse, StructuredCompletionData, StructuredCompletionError, StructuredCompletionError2, StructuredCompletionErrors, StructuredCompletionOutcome, StructuredCompletionRequest, StructuredCompletionResponse, StructuredCompletionResponse2, StructuredCompletionResponses, StructuredToolActivity, TargetType, ToolOutcome, ToolSet, UpdateChannelSharePermission, UpdateMcpServerData, UpdateMcpServerError, UpdateMcpServerErrors, UpdateMcpServerResponse, UpdateMcpServerResponses, UpdateOperation, UpdatePipedreamMcpConnectionData, UpdatePipedreamMcpConnectionError, UpdatePipedreamMcpConnectionErrors, UpdatePipedreamMcpConnectionResponse, UpdatePipedreamMcpConnectionResponses, UpdateServerRequest, UpdateSharePermissionRequestV2, UpdateToolCallData, UpdateToolCallError, UpdateToolCallErrors, UpdateToolCallRequest, UpdateToolCallResponses, UpdateToolResponseData, UpdateToolResponseError, UpdateToolResponseErrors, UpdateToolResponseRequest, UpdateToolResponseResponses, UpsertAiProjectionData, UpsertAiProjectionError, UpsertAiProjectionErrors, UpsertAiProjectionResponse, UpsertAiProjectionResponses, UpsertProjectionRequest, Usage, UsageRequest, UsageSummary, UserPdfRect, UserToolResponseValue, WebCitation, WithChatId, WorkspaceReportHandlerData, WorkspaceReportHandlerResponse, WorkspaceReportHandlerResponses } from './types.gen';diff --git a/packages/sdk/generated/cognition/sdk.gen.ts b/packages/sdk/generated/cognition/sdk.gen.tsindex da5d812f20..57855fa67b 100644--- a/packages/sdk/generated/cognition/sdk.gen.ts+++ b/packages/sdk/generated/cognition/sdk.gen.ts@@ -2,7 +2,7 @@import type { Client, ClientMeta, Options as Options2, RequestResult, TDataShape } from './client';import { client } from './client.gen';-import type { AddMcpServerData, AddMcpServerErrors, AddMcpServerResponses, BrowsePipedreamMcpCatalogData, BrowsePipedreamMcpCatalogErrors, BrowsePipedreamMcpCatalogResponses, CallToolData, CallToolErrors, CallToolResponses, CancelNotionHandlerData, CancelNotionHandlerErrors, CancelNotionHandlerResponses, CancelWorkspaceHandlerData, CancelWorkspaceHandlerResponses, CompleteHandlerData, CompleteHandlerErrors, CompleteHandlerResponses, CompletePipedreamMcpConnectionData, CompletePipedreamMcpConnectionErrors, CompletePipedreamMcpConnectionResponses, CopyChatData, CopyChatErrors, CopyChatResponses, CreateChatData, CreateChatErrors, CreateChatResponses, CreatePipedreamMcpTokenData, CreatePipedreamMcpTokenErrors, CreatePipedreamMcpTokenResponses, DecisionsData, DecisionsErrors, DecisionsResponses, DeleteChatData, DeleteChatErrors, DeleteChatResponses, DeleteMcpServerData, DeleteMcpServerErrors, DeleteMcpServerResponses, DeletePipedreamMcpConnectionData, DeletePipedreamMcpConnectionErrors, DeletePipedreamMcpConnectionResponses, DiscoverHandlerData, DiscoverHandlerErrors, DiscoverHandlerResponses, DismissedPromptsHandlerData, DismissedPromptsHandlerErrors, DismissedPromptsHandlerResponses, DismissPromptHandlerData, DismissPromptHandlerErrors, DismissPromptHandlerResponses, GetBatchPreviewData, GetBatchPreviewErrors, GetBatchPreviewResponses, GetChatData, GetChatErrors, GetChatHistoryBatchMessagesHandlerData, GetChatHistoryBatchMessagesHandlerErrors, GetChatHistoryBatchMessagesHandlerResponses, GetChatHistoryHandlerData, GetChatHistoryHandlerErrors, GetChatHistoryHandlerResponses, GetChatPermissionsData, GetChatPermissionsErrors, GetChatPermissionsResponses, GetChatResponses, GetChatsForAttachmentHandlerData, GetChatsForAttachmentHandlerErrors, GetChatsForAttachmentHandlerResponses, GetCitationHandlerData, GetCitationHandlerErrors, GetCitationHandlerResponses, GetMemoryHandlerData, GetMemoryHandlerErrors, GetMemoryHandlerResponses, GetStateHandler2Data, GetStateHandler2Errors, GetStateHandler2Responses, GetStateHandlerData, GetStateHandlerErrors, GetStateHandlerResponses, GetUsageHandlerData, GetUsageHandlerErrors, GetUsageHandlerResponses, HealthHandlerData, HealthHandlerResponses, ListMcpServersData, ListMcpServersErrors, ListMcpServersResponses, ListPipedreamMcpConnectionsData, ListPipedreamMcpConnectionsErrors, ListPipedreamMcpConnectionsResponses, McpAuthCallbackData, McpAuthCallbackErrors, McpAuthCallbackResponses, McpOauthClientMetadataData, McpOauthClientMetadataResponses, NotionReportHandlerData, NotionReportHandlerErrors, NotionReportHandlerResponses, PatchChatData, PatchChatErrors, PatchChatResponses, PermanentlyDeleteChatData, PermanentlyDeleteChatErrors, PermanentlyDeleteChatResponses, RecoverPipedreamMcpConnectionData, RecoverPipedreamMcpConnectionErrors, RecoverPipedreamMcpConnectionResponses, RejectToolCallData, RejectToolCallErrors, RejectToolCallResponses, RevertDeleteChatData, RevertDeleteChatErrors, RevertDeleteChatResponses, RunImportHandlerData, RunImportHandlerErrors, RunImportHandlerResponses, SendChatMessageData, SendChatMessageErrors, SendChatMessageResponses, SetPricingHandlerData, SetPricingHandlerErrors, SetPricingHandlerResponses, StartMcpAuthData, StartMcpAuthErrors, StartMcpAuthResponses, StopChatStreamData, StopChatStreamErrors, StopChatStreamResponses, StructuredCompletionData, StructuredCompletionErrors, StructuredCompletionResponses, UpdateMcpServerData, UpdateMcpServerErrors, UpdateMcpServerResponses, UpdatePipedreamMcpConnectionData, UpdatePipedreamMcpConnectionErrors, UpdatePipedreamMcpConnectionResponses, UpdateToolCallData, UpdateToolCallErrors, UpdateToolCallResponses, UpdateToolResponseData, UpdateToolResponseErrors, UpdateToolResponseResponses, UpsertAiProjectionData, UpsertAiProjectionErrors, UpsertAiProjectionResponses, WorkspaceReportHandlerData, WorkspaceReportHandlerResponses } from './types.gen';+import type { AddMcpServerData, AddMcpServerErrors, AddMcpServerResponses, BrowsePipedreamMcpCatalogData, BrowsePipedreamMcpCatalogErrors, BrowsePipedreamMcpCatalogResponses, CallToolData, CallToolErrors, CallToolResponses, CancelNotionHandlerData, CancelNotionHandlerErrors, CancelNotionHandlerResponses, CancelWorkspaceHandlerData, CancelWorkspaceHandlerResponses, CompleteHandlerData, CompleteHandlerErrors, CompleteHandlerResponses, CompletePipedreamMcpConnectionData, CompletePipedreamMcpConnectionErrors, CompletePipedreamMcpConnectionResponses, CopyChatData, CopyChatErrors, CopyChatResponses, CreateChatData, CreateChatErrors, CreateChatResponses, CreatePipedreamMcpTokenData, CreatePipedreamMcpTokenErrors, CreatePipedreamMcpTokenResponses, DecisionsData, DecisionsErrors, DecisionsResponses, DeleteChatData, DeleteChatErrors, DeleteChatResponses, DeleteMcpServerData, DeleteMcpServerErrors, DeleteMcpServerResponses, DeletePipedreamMcpConnectionData, DeletePipedreamMcpConnectionErrors, DeletePipedreamMcpConnectionResponses, DiscoverHandlerData, DiscoverHandlerErrors, DiscoverHandlerResponses, DismissedPromptsHandlerData, DismissedPromptsHandlerErrors, DismissedPromptsHandlerResponses, DismissPromptHandlerData, DismissPromptHandlerErrors, DismissPromptHandlerResponses, GetBatchPreviewData, GetBatchPreviewErrors, GetBatchPreviewResponses, GetChatData, GetChatErrors, GetChatHistoryBatchMessagesHandlerData, GetChatHistoryBatchMessagesHandlerErrors, GetChatHistoryBatchMessagesHandlerResponses, GetChatHistoryHandlerData, GetChatHistoryHandlerErrors, GetChatHistoryHandlerResponses, GetChatPermissionsData, GetChatPermissionsErrors, GetChatPermissionsResponses, GetChatResponses, GetChatsForAttachmentHandlerData, GetChatsForAttachmentHandlerErrors, GetChatsForAttachmentHandlerResponses, GetCitationHandlerData, GetCitationHandlerErrors, GetCitationHandlerResponses, GetMemoryHandlerData, GetMemoryHandlerErrors, GetMemoryHandlerResponses, GetStateHandler2Data, GetStateHandler2Errors, GetStateHandler2Responses, GetStateHandlerData, GetStateHandlerErrors, GetStateHandlerResponses, GetUsageHandlerData, GetUsageHandlerErrors, GetUsageHandlerResponses, HealthHandlerData, HealthHandlerResponses, ListMcpServersData, ListMcpServersErrors, ListMcpServersResponses, ListPipedreamMcpConnectionsData, ListPipedreamMcpConnectionsErrors, ListPipedreamMcpConnectionsResponses, ListPipedreamMcpOverlaysData, ListPipedreamMcpOverlaysErrors, ListPipedreamMcpOverlaysResponses, McpAuthCallbackData, McpAuthCallbackErrors, McpAuthCallbackResponses, McpOauthClientMetadataData, McpOauthClientMetadataResponses, NotionReportHandlerData, NotionReportHandlerErrors, NotionReportHandlerResponses, PatchChatData, PatchChatErrors, PatchChatResponses, PermanentlyDeleteChatData, PermanentlyDeleteChatErrors, PermanentlyDeleteChatResponses, RecoverPipedreamMcpConnectionData, RecoverPipedreamMcpConnectionErrors, RecoverPipedreamMcpConnectionResponses, RejectToolCallData, RejectToolCallErrors, RejectToolCallResponses, RevertDeleteChatData, RevertDeleteChatErrors, RevertDeleteChatResponses, RunImportHandlerData, RunImportHandlerErrors, RunImportHandlerResponses, SendChatMessageData, SendChatMessageErrors, SendChatMessageResponses, SetPricingHandlerData, SetPricingHandlerErrors, SetPricingHandlerResponses, StartMcpAuthData, StartMcpAuthErrors, StartMcpAuthResponses, StopChatStreamData, StopChatStreamErrors, StopChatStreamResponses, StructuredCompletionData, StructuredCompletionErrors, StructuredCompletionResponses, UpdateMcpServerData, UpdateMcpServerErrors, UpdateMcpServerResponses, UpdatePipedreamMcpConnectionData, UpdatePipedreamMcpConnectionErrors, UpdatePipedreamMcpConnectionResponses, UpdateToolCallData, UpdateToolCallErrors, UpdateToolCallResponses, UpdateToolResponseData, UpdateToolResponseErrors, UpdateToolResponseResponses, UpsertAiProjectionData, UpsertAiProjectionErrors, UpsertAiProjectionResponses, WorkspaceReportHandlerData, WorkspaceReportHandlerResponses } from './types.gen';export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean, TResponse = unknown> = Options2<TData, ThrowOnError, TResponse> & {/**@@ -463,7 +463,8 @@ export class Sdk extends HeyApiClient {* Register a connected account reported by the Pipedream Connect UI.** Verifies with Pipedream that the account exists and was connected for- * the authenticated user before persisting anything.+ * the authenticated user before persisting anything. An overlaid app is+ * refused with 409: it connects through its own MCP server instead.*/public completePipedreamMcpConnection<ThrowOnError extends boolean = false>(options: Options<CompletePipedreamMcpConnectionData, ThrowOnError>): RequestResult<CompletePipedreamMcpConnectionResponses, CompletePipedreamMcpConnectionErrors, ThrowOnError> {return (options.client ?? this.client).post<CompletePipedreamMcpConnectionResponses, CompletePipedreamMcpConnectionErrors, ThrowOnError>({@@ -504,12 +505,23 @@ export class Sdk extends HeyApiClient {});}+ /**+ * List the catalog apps that connect through their own MCP server.+ *+ * Clients connect these with the native MCP OAuth flow against+ * `server_url`; Pipedream refuses to complete a connection for them.+ */+ public listPipedreamMcpOverlays<ThrowOnError extends boolean = false>(options?: Options<ListPipedreamMcpOverlaysData, ThrowOnError>): RequestResult<ListPipedreamMcpOverlaysResponses, ListPipedreamMcpOverlaysErrors, ThrowOnError> {+ return (options?.client ?? this.client).get<ListPipedreamMcpOverlaysResponses, ListPipedreamMcpOverlaysErrors, ThrowOnError>({ url: '/pipedream/mcp/overlays', ...options });+ }+/*** Register an account a Connect flow created but the Connect UI never* reported.** Called after the Connect UI closes without a success event. Answers 404* when Pipedream has no new account for this user and app.+ * An overlaid app is refused with 409, as in [`complete_connection`].*/public recoverPipedreamMcpConnection<ThrowOnError extends boolean = false>(options: Options<RecoverPipedreamMcpConnectionData, ThrowOnError>): RequestResult<RecoverPipedreamMcpConnectionResponses, RecoverPipedreamMcpConnectionErrors, ThrowOnError> {return (options.client ?? this.client).post<RecoverPipedreamMcpConnectionResponses, RecoverPipedreamMcpConnectionErrors, ThrowOnError>({diff --git a/packages/sdk/generated/cognition/types.gen.ts b/packages/sdk/generated/cognition/types.gen.tsindex 351cd602a5..c958a3c0c9 100644--- a/packages/sdk/generated/cognition/types.gen.ts+++ b/packages/sdk/generated/cognition/types.gen.ts@@ -1390,6 +1390,21 @@ export type PipedreamConnectionResponse = {server_name: string;};+/**+ * A catalog app that connects through its own MCP server instead of+ * Pipedream.+ */+export type PipedreamOverlayResponse = {+ /**+ * Pipedream app name slug, as it appears in the catalog.+ */+ app_slug: string;+ /**+ * The MCP server to authorize with the native MCP OAuth flow.+ */+ server_url: string;+};+/*** Request body for recovering a connect flow whose result the Connect UI* never reported.@@ -3207,6 +3222,7 @@ export type CompletePipedreamMcpConnectionData = {export type CompletePipedreamMcpConnectionErrors = {401: string;404: ErrorResponse;+ 409: ErrorResponse;500: ErrorResponse;501: ErrorResponse;};@@ -3285,6 +3301,26 @@ export type UpdatePipedreamMcpConnectionResponses = {export type UpdatePipedreamMcpConnectionResponse = UpdatePipedreamMcpConnectionResponses[keyof UpdatePipedreamMcpConnectionResponses];+export type ListPipedreamMcpOverlaysData = {+ body?: never;+ path?: never;+ query?: never;+ url: '/pipedream/mcp/overlays';+};++export type ListPipedreamMcpOverlaysErrors = {+ 401: string;+ 500: ErrorResponse;+};++export type ListPipedreamMcpOverlaysError = ListPipedreamMcpOverlaysErrors[keyof ListPipedreamMcpOverlaysErrors];++export type ListPipedreamMcpOverlaysResponses = {+ 200: Array<PipedreamOverlayResponse>;+};++export type ListPipedreamMcpOverlaysResponse = ListPipedreamMcpOverlaysResponses[keyof ListPipedreamMcpOverlaysResponses];+export type RecoverPipedreamMcpConnectionData = {body: PipedreamRecoverRequest;path?: never;@@ -3295,6 +3331,7 @@ export type RecoverPipedreamMcpConnectionData = {export type RecoverPipedreamMcpConnectionErrors = {401: string;404: ErrorResponse;+ 409: ErrorResponse;500: ErrorResponse;501: ErrorResponse;};diff --git a/packages/sdk/specs/cognition.json b/packages/sdk/specs/cognition.jsonindex 129a56af06..c3073698b8 100644--- a/packages/sdk/specs/cognition.json+++ b/packages/sdk/specs/cognition.json@@ -1885,7 +1885,7 @@"post": {"tags": ["pipedream-mcp"],"summary": "Register a connected account reported by the Pipedream Connect UI.",- "description": "Verifies with Pipedream that the account exists and was connected for\nthe authenticated user before persisting anything.",+ "description": "Verifies with Pipedream that the account exists and was connected for\nthe authenticated user before persisting anything. An overlaid app is\nrefused with 409: it connects through its own MCP server instead.","operationId": "complete_pipedream_mcp_connection","requestBody": {"content": {@@ -1928,6 +1928,16 @@}}},+ "409": {+ "description": "",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/ErrorResponse"+ }+ }+ }+ },"500": {"description": "","content": {@@ -2091,11 +2101,54 @@}}},+ "/pipedream/mcp/overlays": {+ "get": {+ "tags": ["pipedream-mcp"],+ "summary": "List the catalog apps that connect through their own MCP server.",+ "description": "Clients connect these with the native MCP OAuth flow against\n`server_url`; Pipedream refuses to complete a connection for them.",+ "operationId": "list_pipedream_mcp_overlays",+ "responses": {+ "200": {+ "description": "",+ "content": {+ "application/json": {+ "schema": {+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/PipedreamOverlayResponse"+ }+ }+ }+ }+ },+ "401": {+ "description": "",+ "content": {+ "text/plain": {+ "schema": {+ "type": "string"+ }+ }+ }+ },+ "500": {+ "description": "",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/ErrorResponse"+ }+ }+ }+ }+ }+ }+ },"/pipedream/mcp/recover": {"post": {"tags": ["pipedream-mcp"],"summary": "Register an account a Connect flow created but the Connect UI never\nreported.",- "description": "Called after the Connect UI closes without a success event. Answers 404\nwhen Pipedream has no new account for this user and app.",+ "description": "Called after the Connect UI closes without a success event. Answers 404\nwhen Pipedream has no new account for this user and app.\nAn overlaid app is refused with 409, as in [`complete_connection`].","operationId": "recover_pipedream_mcp_connection","requestBody": {"content": {@@ -2138,6 +2191,16 @@}}},+ "409": {+ "description": "",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/ErrorResponse"+ }+ }+ }+ },"500": {"description": "","content": {@@ -4987,6 +5050,21 @@}}},+ "PipedreamOverlayResponse": {+ "type": "object",+ "description": "A catalog app that connects through its own MCP server instead of\nPipedream.",+ "required": ["app_slug", "server_url"],+ "properties": {+ "app_slug": {+ "type": "string",+ "description": "Pipedream app name slug, as it appears in the catalog."+ },+ "server_url": {+ "type": "string",+ "description": "The MCP server to authorize with the native MCP OAuth flow."+ }+ }+ },"PipedreamRecoverRequest": {"type": "object","description": "Request body for recovering a connect flow whose result the Connect UI\nnever reported.",diff --git a/packages/sdk/src/coverage/skipped.ts b/packages/sdk/src/coverage/skipped.tsindex 307f17b5ff..c2245403f3 100644--- a/packages/sdk/src/coverage/skipped.ts+++ b/packages/sdk/src/coverage/skipped.ts@@ -176,6 +176,7 @@ export const cognitionExcluded = ['healthHandler','listMcpServers','listPipedreamMcpConnections',+ 'listPipedreamMcpOverlays','mcpAuthCallback','mcpOauthClientMetadata','recoverPipedreamMcpConnection',diff --git a/services/agent_harness_service/src/cognition/api/context/test.rs b/services/agent_harness_service/src/cognition/api/context/test.rsindex be6a2e4a4d..da9bfc5b3a 100644--- a/services/agent_harness_service/src/cognition/api/context/test.rs+++ b/services/agent_harness_service/src/cognition/api/context/test.rs@@ -500,7 +500,7 @@ pub async fn test_api_context(pool: sqlx::Pool<sqlx::Postgres>) -> std::sync::Arlet tool_service_context = ai_tools::ToolServiceContext {cognition_tool_context: Default::default(),- connector_tool_context: ai_tools::build_connector_tool_context(pool.clone(), None),+ connector_tool_context: ai_tools::build_connector_tool_context(pool.clone(), None, None),search_service_client: search_service_client.clone(),email_service_client: email_service_client_external.clone(),soup_service: soup_service.clone(),diff --git a/services/agent_harness_service/src/cognition/api/swagger.rs b/services/agent_harness_service/src/cognition/api/swagger.rsindex 5d311248eb..762654c88e 100644--- a/services/agent_harness_service/src/cognition/api/swagger.rs+++ b/services/agent_harness_service/src/cognition/api/swagger.rs@@ -31,8 +31,8 @@ use memory::inbound::axum_router::{self as memory_api, MemoryErrorBody, MemoryReuse onboarding::inbound::axum_router::{self as onboarding_api, CompleteOnboardingRequest};use pipedream_mcp::inbound::axum_router::{self as pipedream_api, PipedreamCatalogEntryResponse, PipedreamCatalogResponse,- PipedreamCompleteRequest, PipedreamConnectionResponse, PipedreamRecoverRequest,- PipedreamTokenResponse, PipedreamUpdateRequest,+ PipedreamCompleteRequest, PipedreamConnectionResponse, PipedreamOverlayResponse,+ PipedreamRecoverRequest, PipedreamTokenResponse, PipedreamUpdateRequest,};use crate::cognition::api::preview::get_batch_preview::{@@ -121,7 +121,8 @@ use utoipa::OpenApi;pipedream_api::create_connect_token,pipedream_api::complete_connection,pipedream_api::recover_connection,- pipedream_api::browse_catalog_handler+ pipedream_api::browse_catalog_handler,+ pipedream_api::list_overlays),components(schemas(@@ -269,6 +270,7 @@ use utoipa::OpenApi;PipedreamRecoverRequest,PipedreamCatalogResponse,PipedreamCatalogEntryResponse,+ PipedreamOverlayResponse,model_error_response::ErrorResponse,),),diff --git a/services/agent_harness_service/src/cognition/server.rs b/services/agent_harness_service/src/cognition/server.rsindex db12a8c75d..287b329858 100644--- a/services/agent_harness_service/src/cognition/server.rs+++ b/services/agent_harness_service/src/cognition/server.rs@@ -830,7 +830,7 @@ pub async fn build(let tool_service_context = ai_tools::ToolServiceContext {cognition_tool_context: ai_tools::build_cognition_tool_context()?,- connector_tool_context: ai_tools::build_connector_tool_context(db.clone(), None),+ connector_tool_context: ai_tools::build_connector_tool_context(db.clone(), None, None),search_service_client: search_service_client.clone(),email_service_client: email_service_client_external.clone(),soup_service: soup_service.clone(),diff --git a/services/agent_harness_service/src/main.rs b/services/agent_harness_service/src/main.rsindex f4f3c9130a..62c78b25c0 100644--- a/services/agent_harness_service/src/main.rs+++ b/services/agent_harness_service/src/main.rs@@ -1591,6 +1591,9 @@ async fn run() -> anyhow::Result<()> {Arc::new(agent_harness::outbound::connected_apps::PipedreamConnectedApps::new(Arc::clone(&mcp_connections),+ Arc::new(mcp_select::NativeOverlayConnections::new(Some(Arc::clone(+ &mcp_servers,+ )))),),),Arc::clone(¬ification_service),